1

I have been using QGIS to extract lat and long vertices from a number of shapefiles. It worked great but for one file. When I create the lat and long for this file, the values are greater than 1,000,000. The real lats and longs should be in the 40 to 90 and -40 to -90 range respectively. I have tried many ideas posted in help groups but no luck. The shapefile is available at "Area-Based Conservation Measures".

If you can get the lats and longs in another software package and send them to me in a CSV file or Excel, it would be a major help. There are 250,955 features in the table.

7
  • 5
    That shapefile is in Canada Albers Equal Area. You will have to convert it to a geographic coordinate system before extracting your coordinates. You can right-click on your layer, and export the features into a new file, specifying the geographic coordinate system you're using (ex. NAD83 would be epsg 4269, WGS84 would be epsg 4326). Then extract your x and y coordinates and it should work. – FSimardGIS Feb 29 '20 at 17:50
  • Are you trying to calculate the longitude and latitude of a polygon centroid or you want to calculate the x_min/x_max and y_min/y_max of the polygons? – Val P Feb 29 '20 at 17:59
  • I want to calculate the endpoints of each line in the polygons – Bill Mar 1 '20 at 14:32
  • 5
    Does this answer your question? Reprojecting vector layer in QGIS? – GISKid Mar 2 '20 at 2:52
  • The shapefile I downloaded contains polygons; are you trying to get the vertices of the polygons? – MyGIS Mar 2 '20 at 11:40
3

If I inspect you data with FME, I can see that the projection is NAD83.

Method 1:

enter image description here

I used FME to read the polygons, retrieve the vertices using the Chopper Transformer, extract the coordinates, convert them into Lat-Long, export as CSV containing the coordinates in WGS84. there are 250955 records.

You can download the csv and shapefile from here (I have removed the link as the data was incorrect)

Below is a screenshot of the workspace. If you could confirm which EPSG we need to use, I could confirm on the accuracy of the data.

enter image description here

Method 2:

I have changed the coordinate systems for the original data as I followed the QGIS information. I Used ESRI:102001 -- > Canada_Albers_Equal_Area_Conic and converted to WGS84 using FME Desktop's ESRI Reprojector then extracted the coordinates. The screenshot below shows how I got the reference.

enter image description here

The new data is available for download from here.

Method 3:

I noticed in the page you provided the link that you could also download the data in KML format.

enter image description here

KML is by default projected in WGS84. I downloaded the KML (KMZ actually) and loaded it into QGIS. I chose WGS84 as the project CRS.

I used then the "Extract Vertices" from the "Geometry Tools" available from the "Vector" menu; and the result was the vertices as points.

enter image description here

enter image description here

I believe this should be the way to go if you have only QGIS.

I hope this helps.

6
  • There are a couple of issues. The longitude range for eastern Canada is between -40 and -75 west. There are none of these X values in the csv file, even though the polygons seem to plot correctly on the map you provided. Also, I could not see the new shapefile. The WGS is EPSG 4326 – Bill Mar 2 '20 at 17:53
  • I meant EPSG for NAD83 – MyGIS Mar 3 '20 at 2:05
  • @Bill I have amended the parameters to the right CRS. Please check the new data. – MyGIS Mar 3 '20 at 3:09
  • Lyes Sorry, I have been away for a while. The data you transformed was correct and much appreciated. I have one other similar file which can be found at open.canada.ca/data/en/dataset/… The projection is similar ESRI:102001 -- > Canada_Albers_Equal_Area_Conic. I tried your process using FME but I failed. I am new to FME and QGIS but learning new software is slower at my advanced age. Any help would be appreciated. Bill – Bill Mar 8 '20 at 14:04
  • Hi Bill, the website is down for maintenance. You can download the FME workspace from here, you just need to set the input file and output file dropbox.com/s/vccaylh1jk8vq20/canadacoordsys.fmw?dl=0 . Also, the easiest way to do this would be to download the kml file which is by default in WGS84. Add it to QGIS then extract the coordinates using the field calculator. – MyGIS Mar 9 '20 at 0:22

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