Reversed Latitude/Longitude US Tiger/Line Shape File to MySQL w/ OGR2OGRP

Posted by Dave LeJeune on Stack Overflow See other posts from Stack Overflow or by Dave LeJeune
Published on 2010-12-27T15:51:57Z Indexed on 2010/12/27 15:53 UTC
Read the original article Hit count: 330

Filed under:
|

Hi -

I've downloaded the latest set (2010) of TIGER edge shape files (ESRI shapefile format) from the US Census website and am loading them into MySQL using the GDAL ogr2ogr utility. A new table (geotest) does get created with a SHAPE column that has the geometry defined as a LINESTRING. However, I am seeing reversed latitude and longitude values that get reversed when running the following command:

ogr2ogr -f "MySQL" MySQL:"geo,user=lejeuned,host=localhost,password=cnickl234" -nln geotest -nlt LINESTRING -append -a_srs "EPSG:4326" -lco engine=MYISAM tl_2010_01021_edges.shp

Mapping the latitude/longitude (after reversing them of course) they appear to be spot on so I suspect there is just something I am doing wrong or flag I am missing which is causing the latitude and longitudes to be transposed.

When I select the SHAPE column using astext() I get the following result:

LINESTRING(-86.69863 32.973164,-86.69853 32.97302,-86.69856 32.97287,-86.698613 32.972825,-86.6988 32.972825,-86.6989 32.972892,-86.6989 32.973002,-86.69874 32.97316,-86.69864 32.97318,-86.69863 32.973164)

Any ideas what I am doing wrong?

© Stack Overflow or respective owner

Related posts about geospatial

Related posts about esri