1

I'm working on something that converts DXF file to GeoJSON. I'm using ogr2ogr to do the conversion.

I noticed that after the conversion there are sometimes 3 coordinates in elements of the coordinate array (in a Feature)

What I expected:

"coordinates": [[0.086584573923531, 0.422008395338774],
                [0.581375326175266, 0.422008399304735],
                [0.581375245258107, 0.290774751470432]]

What I see:

"coordinates": [[0.360170914188475, 0.116629842293151, -351.3902692287678],
                [0.359721756546415, 0.116629842293151, -351.3902692287678],
                [0.359721756546415, 0.118890761146294, -351.3902692287678],
                [0.360170914188475, 0.118890761146294, -351.3902692287678],
                [0.360170914188475, 0.116629842293151, -351.3902692287678]]

The 3rd entry is always the same for the same feature. I would like to know what that 3rd coordinate mean.

EDIT :

I'm inputting a DXF file to be converted into GeoJSON.

This is the command I use for the conversion.

/Library/Frameworks/GDAL.framework/Versions/2.1/Programs/ogr2ogr -f 'GeoJSON' -s_srs 'epsg:3395' -t_srs 'epsg:4326' 'out.geo.json' '/Users/user1/Documents/input.dxf

I also found this snipped by using ogrinfo

OGRFeature(entities):1780
  Layer (String) = polygon_spaces
  SubClasses (String) = AcDbEntity:AcDbPolyline
  ExtendedEntity (String) = (null)
  Linetype (String) = (null)
  EntityHandle (String) = 10C1
  Text (String) = (null)
  Style = PEN(c:#00ff00)
  LINESTRING Z (56537.2955015298 20183.5740248058 -56.5253146704201,58517.2955206032 20183.5740248058 -56.5253146704201,58517.2955206032 18075.118670286 -56.5253146704201,56537.2955015298 18075.118670286 -56.5253146704201,56537.2955015298 20183.5740248058 -56.5253146704201)

Looks like it's embedded in the DXF file.

Dug inside the .dxf file and found an interesting snippet.

AcDbPolyline
 90
        4
 70
     1
 43
0.0
 38
-56.52531467042009
 10
57100.83897876152
 20
18414.61964684861
 10
57188.07870200788
 20
19383.83994322875
 10
57914.0123201251
 20
19383.83994322875
 10
58001.25204337141
 20
18414.61964684861

It looks like the marker 38 contains the 3rd coordinate.

  • it's probably the Z or elevation – Ian Turton Feb 19 at 10:40
  • @IanTurton Is there a way to be sure? What other information would be required from my end? – Thihara Feb 19 at 10:52
  • what does the metadata for the input dataset say – Ian Turton Feb 19 at 10:53
  • @IanTurton I'm not sure how to get the metadata you are referring to. But I used ogrinfo -al and noticed that the third coordinate is present in the ogrinfo output as well. I posted the details in a question update. – Thihara Feb 19 at 11:37
  • whoever built the dxf file should be able to tell you what the 3rd coordinate is - it should be documented – Ian Turton Feb 19 at 11:39
1

Ok so I figured it out while looking up metadata for @Ian Turton (Comments section). He was right, it's the elevation.

Number 38 in the dxf specification refers to the elevation.

Extract:

38 DXF: entity's elevation if nonzero

Source : https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf

|improve this answer|||||

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