0

I'm new to GIS and (ESRI) shapefile. I would like to extract GPS-Coordinates or longitude and latitude from every object in a shapefile, mainly from polygons.

Here is a picture with one of these objects: enter image description here

My plan is to create a GPS-System App where the user can search for that object and my app leading them to the desired object. Is this even possible?

There are somewhere GPS-Coordinates in the Shapefile, because Google Maps can find my shapefile on the map, see here:

enter image description here

So now I would like to know GPS-Coordinates from every Object in that Shapefile, so every colorful object you can see in that picture above.

  • 4
    Welcome to GIS.SE. Some more information would be helpful, e.g. the software you're working with, and what you tried so far. – Erik Jan 17 at 14:25
  • Shapefile always makes me think ESRI software, but I concur we need to know more, especially the software. Also what part of the polygon are you looking to identify the coordinates of, the centroid, each vertex, it's min/max binding coordinates. – Pete Jan 17 at 14:31
  • 3
    See for example: gis.stackexchange.com/questions/32414/… – cokrzys Jan 17 at 14:57
  • 1
    While it is possible to extract the lat/long of the vertices of the polygons in Google Earth Pro, extacting the centroids is not a straight-forward option. If you have access to ArcGIS Desktop/Pro (requires a license) or QGIS (open source), these tasks can be completed fairly quickly. See @RutgerH's comment above. – smiller Jan 17 at 15:21
  • 1
    Coordinates do not generally exist in the dBase attribute table. Slightly more often with points, but exceedingly rare with polygons. Computing a centroid which is within the figure is more difficult than a center of mass point. – Vince Jan 17 at 16:29
0

To my knowledge, Google Earth Pro does not directly have a way to provide you with the lat/long of the centroids of the polygons in your shapefile. It is possible to export out the coordinates (may not be lat/long) of the vertices of the polygons, as described in this video: https://www.youtube.com/watch?v=dlWhGSIXm1U. However, this will be a cleaner process if you work directly with the shapefile in a GIS application such as QGIS.

The following assumes you want one lat/long pair for each polygon centroid as a CSV file.

First, you want to be sure of what coordinate system the shapefile is using. Per https://opensourceforu.com/2015/03/assigning-map-projections-in-qgis :

Right click on the layer under the Layers window on the left side of the QGIS window. Next, under the Properties window, click on the Metadata tab. The CRS assigned to the layer can be seen under the label Layer Spatial Reference System

If you do not have a geographic coordinate system assigned such as WGS84, your data will be in meters or feet rather than degrees. Coordinate systems are a deeper topic that you can explore elsewhere on the site or in tutorials. Todd Vachon's article gives a brief overview.

Basically, there’s a whole slew of methods of translating spherical map data (the earth) onto a flat surface (a paper map or your screen). The different methods are called coordinate reference systems (CRS). To translate x and y coordinate data you may have into latitude and longitude data, you’ll need to figure out what CRS you’re starting from and ‘project’ it to another one.

Once you have the data in WGS84, which has degrees as its unit and the coordinates are in lat/long, you can extract and export the centroids of each polgyon. The post linked by @FSimardGIS can help. You can create a centroid layer and add the coordinates directly to that layer as described by @Curlew, or you can simply create the centroids and save the layer to CSV format as described in Vachon's article:

Once your data is in the WGS 84 / World Mercator projection it will have latitude and longitude data. Here’s how to get it back out of QGIS (v1.8): Right-click on your data layer and choose ‘Save As…’ [...] Click the Browse button and choose a name and location to save the file to. The CRS field should show ‘WGS 84′(ESPG: 4326). In the’Layers’ text box, type ‘GEOMETRY=AS_XY’**. You should now have a file that contains your original data and the new latitude and longitude coordinates.

  • Thank you very much, that's exactly what I asked for. Now I have a Centroid with lat/long in every polygon in my Shapefile. – R. Kut Jan 21 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.