3

I am confused by the output I'm getting from ogr2ogr when converting a shapefile to WKT. What I'm expecting to see is something in the form below (from Wikipedia):

MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),
((20 35, 45 20, 30 5, 10 10, 10 30, 20 35),
(30 20, 20 25, 20 15, 30 20)))

What I'm getting out of ogr2ogr -f CSV out.wkt source.shp -lco GEOMETRY=AS_WKT, in very abbreviated form, is this:

"MULTIPOLYGON (((-120.6 50.8, ...)", 33.9, 137.1, 2, 1,1,1

I do not understand how to interpret the final six numbers, which are not enclosed in brackets and fall outside the quotation marks. Can someone explain this or point me towards the appropriate documentation?

1
  • 2
    You should have the ogr2ogr command included which produced that output. That's way how people how haven't seen your previous post understands what you have done.
    – LauriK
    Commented Mar 20, 2013 at 17:22

1 Answer 1

6

Ogr2ogr translates vector data sources between different formats. Shape file is one kind of data source format but WKT is not. WKT is just a way to represent geometries in a human understandable way. Data source consists of features/objects that consists of a geometry and attributes.

The ogr2ogr command you specified in your previous question translates that shape file which have some attributes to a csv file. In that csv file you have geometries as a WKT and attributes of features as a comma separeted values.

3
  • In all fairness, LauriK, although you do mention in your previous answer that shapefiles contain attribute information, your subsequent words ("converts now the geometry") suggest that the conversion process only converts the geometric information. Editing your answer there might help avoid such confusion in the future.
    – whuber
    Commented Mar 20, 2013 at 17:37
  • You are right @whuber. That was unclear from me. It's now corrected.
    – LauriK
    Commented Mar 20, 2013 at 17:45
  • Of course, I'm embarassed that I didn't realize that!
    – Gregory
    Commented Mar 20, 2013 at 20:55

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.