Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to extract lattitude/longitude values for the streets in this shapefile:

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

(Below does work! Spelling error fixed.)

ogr2ogr -f CSV output.csv STCLINES_STREETS.shp -lco GEOMETRY=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

closed as off-topic by Paul, BradHards, Fezter, Devdatta Tengshe, MappaGnosis Oct 10 '13 at 10:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Paul, BradHards, Fezter, Devdatta Tengshe, MappaGnosis
If this question can be reworded to fit the rules in the help center, please edit the 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

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

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
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

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