libredwg icon indicating copy to clipboard operation
libredwg copied to clipboard

Any expectation for dwgwrite from GeoJSON

Open jossefaz opened this issue 4 years ago • 13 comments
trafficstars

All is in the title : is there any time expectation for this feature ?

Best Regards

jossefaz avatar Apr 08 '21 13:04 jossefaz

Oh, no idea. Is this needed? Easier would be via DXF, via some script.

rurban avatar Apr 08 '21 13:04 rurban

I successfully convert a GeoJSON to DXF with the GDAL ogr2ogr command line.

But then I tried both dwgwrite and dxf2dwg command and both did not output a valid DWG file.

Here is a link to the DXF output from GDAL. If it could help anyhow.

jossefaz avatar Apr 08 '21 14:04 jossefaz

Great that GDAL handles that already. So we only have to understand the GDAL DXF, which should be easier. Thanks, will fix that

rurban avatar Apr 08 '21 18:04 rurban

I use those features in my new REST API Geofiles-convertor API

I hope to enhance it with this fix. Thank you so much for your help

jossefaz avatar Apr 08 '21 19:04 jossefaz

ogr2ogr converts a POLYLINE to a HATCH? interesting. I would have expected a POLYLINE_2D.

I can repro the dxfimport problems from GDAL with your file. When I convert example_2007.geojson by myself, it imports the lines and hatches fine though. ogr2ogr --version GDAL 3.0.4, released 2020/01/28

rurban avatar Apr 09 '21 07:04 rurban

Well as far as I know there is no Polygon entity natively in AutoCad (I use AutoCad Map btw...it might be a slight difference on what I write here with AutoCAD 3D).

And the input GeoJSON of that conversion had Polygons features. This is why you can see the same XY coordinates at the beginins and at the end of the HATCH. I assume that if my GeoJSON has instead a LineString feature, then it should have been converted to POLYLINE_2D
I'll give this a shot and i'll update here afterward Hope this helps...

jossefaz avatar Apr 11 '21 06:04 jossefaz

But what's your GDAL version? It might be something earlier than 3.0.4, because I can successfully import my 3.0.4 DXF's, but not yours. Or it's some feature I have to find.

Polygons are of course closed POLYLINE_2D entities, but HATCH is also fine. It is just solid filled then.

rurban avatar Apr 11 '21 07:04 rurban

I use the official docker image of Osgeo The version there is ogr2ogr --version GDAL 3.3.0dev-7856bfcd6e516a93d7cb23da70a13c41dc4214c4, released 2021/04/04

jossefaz avatar Apr 11 '21 08:04 jossefaz

I'd need your geojson file also. with my examples cannot reproduce it. Even latest GDAL from git master works fine. GDAL 3.3.0dev-dba3ac7ef0, released 2021/04/11

3.3.0dev-7856bfcd6e516a93d7cb does not compile for me

rurban avatar Apr 12 '21 14:04 rurban