如何获取谷歌地图中伊朗省级虚线边界的经纬度坐标以生成多边形?
How to Get Iran's Provincial Dashed Border Coordinates from Google Maps for Polygon Generation
Awesome question! I’ve tackled similar geospatial tasks before, so here are a few practical, actionable methods to grab those latitude/longitude coordinates and turn them into usable polygons:
Method 1: Google My Maps (Manual + Tool Combo)
This is the easiest way for single or small batches of provinces:
- Fire up Google My Maps and create a new map project
- Search for your target Iranian province (e.g., "Isfahan Province, Iran")—you’ll see the dashed provincial border pop up. Click it to highlight the boundary
- Use the "Add path" tool and click along the highlighted dashed line to trace the full border. The tool automatically logs every point’s lat/long as you go
- Once you’re done tracing, click the path you created, select "Download KML", and save the file. Open it with a text editor or GIS tool (like QGIS) to extract the raw coordinate arrays, which are ready to use for polygon generation
Method 2: Google Maps Place Details API (Batch-Friendly)
If you need to pull data for multiple provinces at once, the API route works—just keep an eye on Google’s usage rules and quotas:
- Use the Place Details API by passing the province’s name or unique Place ID. The response will include a
geometryfield if the full border data is available - For provinces with polygon boundaries, you’ll get a nested array of lat/long pairs under
geometry.polygon.coordinates(ormultipolygonif the province has enclaves) - Here’s a quick pseudocode example to illustrate the workflow:
Heads up: Not all provinces will return full polygon data via the API—some might only give a center point. Test with your target provinces first!// Replace with your API key and target province's Place ID fetch('https://maps.googleapis.com/maps/api/place/details/json?place_id=YOUR_PROVINCE_PLACE_ID&fields=geometry&key=YOUR_API_KEY') .then(res => res.json()) .then(data => { // Extract polygon coordinates (adjust for multipolygon if needed) const borderCoords = data.result.geometry.polygon.coordinates; console.log('Border coordinates:', borderCoords); });
Method 3: QGIS + Google Maps Basemap (High-Precision)
If you need super accurate boundaries or want to avoid manual tracing, use a GIS tool like QGIS:
- Install QGIS and add the Google Maps vector basemap (use the QuickMapServices plugin to access it easily)
- Create a new vector layer set to "Polygon" type
- Trace over the dashed provincial border on the basemap using QGIS’s digitizing tools. The tool records every coordinate point as you draw
- Once finished, export the layer as GeoJSON or Shapefile—both formats include the full set of lat/long coordinates you need for polygon creation
Quick Notes to Keep in Mind
- Always follow Google Maps’ service terms, especially if you’re using this data for commercial purposes
- Double-check coordinate accuracy—some border lines might have been updated recently
- KML, GeoJSON, and Shapefile outputs work with almost all polygon generation tools, so you won’t need heavy conversion work
内容的提问来源于stack exchange,提问作者Hamed Salimian
相关产品推荐
相关产品推荐

