21

I'm working with this downloadable shapefile that has X Y coordinates. They are akin to '3672187.92698000, 534175.72095400'.

I would like to convert them to longitude latitude so they are more like '-90.097017, 29.963176'.

I've seen this question tackled using ArcMap however I don't have that software. I was able to download and install QGIS but I am unfortunately perplexed by its complicated interface. Would like to do the conversion with it, if possible.

5
  • ArcGIS seems to be an aside - the numbers could have come from anywhere but it appears you want to know what QGIS can do to import and project them.
    – PolyGeo
    Commented Jun 27, 2013 at 8:00
  • 2
    You say you have it in ESRI format, what do you mean? It's a Shapefile? Or is just a text file with coordinates? Besides, like you saw in the question you linked, you need to know the input Coordinate Reference System (CRS)(in your case a projected one), and the CRS of the Lat, Long you want (Geographic), you probably want the WGG84 (the one used by GPSs). Without that you can't accurately transform any pair of coordinates. Take a look at "Gentle Introductuion to GIS, chapter 7 - Working with projections" Commented Jun 27, 2013 at 9:12
  • The example X, Y and lng/lat I gave should be an exact pair. I mentioned ArcGIS as that is the software linked to by the website from which the dataset came from. I've included a link to the complete dataset in the question. Commented Jun 27, 2013 at 19:02
  • Your dataset link just references another question here. Regardless, the fact that the data originated in ArcGIS is irrelevant. As others have said, you need to know the input (source) coordinate system in order to properly transform to lat/long.
    – user3461
    Commented Jun 27, 2013 at 19:10
  • Copy paste error--fixed dataset link. I'll see if I can figure out source coordinate system. Commented Jun 27, 2013 at 19:49

4 Answers 4

18

The dataset you mention is a shapefile, a format invented by ESRI, but understood by most GIS software, including QGIS.

After extracting the zip, you can add it with Add vector layer and point to the .shp file. The CRS information is stored in the .prj file, and the layer CRS will automatically set right by QGIS. In your case, NAD_1983_StatePlane_Louisiana_South_FIPS_1702_Feet with US feet as units.

With the openlayers plugin, you can add a Openstreetmap or Google background layer. For doing that, you have to set the project CRS to EPSG:3857.

If you want coordinates in lat/lon degrees, just rightclick on the shapefile layer, and Save as ... to a new file under a different name, selecting EPSG:4326 as CRS for that, and check to add that layer to the canvas. Saving may take some time.

For the next step, you better zoom in to see just a couple of points. Open the attribute table, and click on the pencil symbol at the bottom to enter the edit mode, and then the field calculator icon bottom right. Create a new field named degx, type real, precision 6, and select $x from geometry. After saving (which takes some time), do the same for degy and $y. Leave edit mode, then the attribute table.

The new columns in the attribute table give you lat and lon in degrees.

6
  • Worked perfectly! Then I was able to export the layer as a CSV with the newly added attributes and have exactly what I need! Thanks! Commented Jun 28, 2013 at 20:31
  • I followed these steps exactly and my degx and degy are all NULL. Any idea what I did wrong? Commented Sep 21, 2015 at 2:55
  • I figured out my issue. QGis was adding variable as a virtual column. Commented Sep 21, 2015 at 3:36
  • How did you fix it? I am havig the same issue. Commented Feb 2, 2016 at 2:01
  • Just FYI, I found the answer. GIS files can come in lines, points, or polygons (maybe more?). My GIS file was saved as lines, I needed to extract the point info and then I could easily get the coordinate info. Commented Feb 2, 2016 at 4:01
8

You can import the coordinates as a csv, e.g. in a file called coords.csv you would have:

x, y
672187.92698, 534175.72095

1) Import it by Layer -> Add delimited text layer.

The next dialogue should be fairly self explanatory. After clicking OK from this dialogue you will be asked for the coordinate system of your input coordinates. You can work through the list or use the Filter box to help find the right projection.

2) Once it's imported right click on the layer in the Layers panel, and choose "Save as".

3) Save it as a shapefile, and change "Layer CRS" to "Selected CRS", then browse the projections to find WGS84 EPSG:4326. Select to add it to the map and click ok.

4) Once your new shapefile is created, right click on it the layer's dialogue and "Open Attribute Table". Toggle editing (ctrl-E) and open the calculator (ctrl-I). Select "create a new field", call it "Longitude", and make the expression $x. Do the same for a second new attribute called "Latitude" and make the expression $y. You should now have latitude and longitude in your attribute table.

5) If you want it in a spreadsheet a quick solution is to click on the invert selection icon (Ctrl-R) and then copy to clipboard (Ctrl-C). You can then paste it directly into a spreadsheet.

4
  • 2
    You missed the step where he has to give the CRS for the csv layer. This will not be EPSG:4326, but some projected CRS.
    – AndreJ
    Commented Jun 26, 2013 at 18:13
  • 1
    I've added a note along those lines.
    – Nick S
    Commented Jun 26, 2013 at 18:21
  • 1
    I have followed these (excellent written) instructions, however the resulting new field values are the same as the original x, y values (and clearly not longitude/latitude). Not sure if useful information, but the imported layer does look like it should (New Orleans) and the second created layer from "Save As" overlays it perfectly. Commented Jun 27, 2013 at 19:37
  • 1
    You need to first import it in right SRID , then you need to "Save as" in wanted SRID and you need to load your new file into QGIS. Note that if you dont have 'reproject on fly' on , your data will all over places. If you have turned it on then those should overlay perfectly Commented Jun 28, 2013 at 6:40
5

Your question is not ArcGIS/QGIS specific. It has to do with coordinate systems. I interpret your questions as "How do I import X/Y csv data in one spatial coordinate system and export to another coordinate system using QGIS?".

If you do not have your data displaying correctly in QGIS (assuming v1.8), you will need to enable the "Add Delimited Text Layer" plugin using the Plugin Manager, then import the data using Layer -> Add Delimited Layer, then proceed through the wizard selecting the appropriate source, x/y columns, and then the correct coordinate system.

They layer should now be correctly displaying in QGIS in it's native coordinate system. If you want to reproject it on the fly, you will need to go to Settings -> Project Properties -> Select "on the fly reprojection" and the desired display coordinate system.

Now that you have the data properly imported, all you have to do is right click your layer and select "Save As". In this dialog, change to the format you would like (shape, csv, etc), set a save location, and in the CRS section select "Selected CRS", then click Browse and select "WGS 84" or any other desired coordinate system.

2
  • 2
    This seems to just export the same values. My hunch is that I have no idea what "the correct coordinate system" and "desired display coordinate system" is. Commented Jun 27, 2013 at 19:43
  • @Zugwalt: If you do not know the source coordinate system of the data you have, it is spatially unusable. Is this US data? If so it is probably in some state plane or UTM grid. You will need to contact the data provider to find out what coordinate system was used to create the data.
    – BasilV
    Commented Jun 28, 2013 at 17:55
1

You can reproject geometry with a QGIS expression. Here’s an example of how you can convert from one EPSG to another using QGIS expression1:

format_number(x(transform($geometry, layer_property(@layer,'crs'), 'EPSG:4326')),6)
format_number(y(transform($geometry, layer_property(@layer,'crs'), 'EPSG:4326')),6)

In this example, the geometry is being transformed from the layer’s CRS to EPSG:4326. You can change the value of the target EPSG to the one you want to convert to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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