Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to extract lattitude/longitude values for the streets in this shapefile: http://gispub02.sfgov.org/website/sfshare/catalog/stclines_streets.html

I've seen it reommended in many places that I use this command to do so:

ogr2ogr -f CSV output.csv STCLINES_STREETS.shp -lco GEMOETRY=AS_XYZ

However, when I do so, I get a CSV containing a lot of useful information about the streets -- names, neighborhoods, etc -- but no actual lat/long values.

What am I doing wrong? I'm a GDAL noob so am sure I'm missing something obvious.

share|improve this question
I am able to extract coordinates if I output to GML instead of CSV. This isn't ideal, and it isn't what's described in the GDAL documentation, but it will suffice for me for now... – TimWJones May 28 '11 at 1:42
You have done some conversion? Because your coordinate with the original SHP are not in lat, long but x, y coordinates in NAD_1983_StatePlane_California_III_FIPS_0403_Feet meters (epsg code 2227). Use ogr2ogr -t_srs EPSG:4326 STCLINES_STREETS_WGS84.shp STCLINES_STREETS.shp to get true lat, long – ThomasG77 May 29 '11 at 0:59

1 Answer

It's very likely that AS_XYZ only works for point layers. If you are trying to extract a single XYZ for lines, what XYZ would that be? The start point? mid point? end point?

Trying GEOMETRY=AS_WKT instead will give you the component points of the line. See http://www.gdal.org/ogr/drv_csv.html

share|improve this answer
That makes sense. I think I was hoping for a startpoint and endpoint, though in retrospect I suppose it's likely that many streets aren't simple straight lines. – TimWJones May 28 '11 at 1:24
Unfortunately, AS_WKT is producing a CSV identical to AS_XYZ. Neither flag is successfully extracting GPS coords. – TimWJones May 28 '11 at 1:25
1  
make sure you spell GEOMETRY correctly! (you have GEMOETRY in your original post... does that fix it?) – RandomEtc May 28 '11 at 1:48
ah. yes that fixed it. facepalm – TimWJones May 28 '11 at 1:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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