1

I'm attempting to plot a CAD file (.dxf) using GeoPandas then save it as a KML file. When I attempt to do so - the CAD file ends up showing up in the wrong place (in the middle of the ocean - when it should be in Florida). The strange part is this only occurs after opening the .dxf then saving it with Adobe Illustrator (in order to perform cleanup). If I run the same process without opening and saving with Illustrator - the files plot correctly.

I've done a considerable amount of research - but it appears I'm doing everything correctly using GeoPandas (I've reduced my code to the following few lines for simplicity - but the result is the same - once the .dxf has been opened with Illustrator - it ends up in the middle of the ocean when opening the .kml!)

import geopandas as gpd
from geopandas import GeoDataFrame
import os
import fiona
from fiona.crs import from_epsg


# Enable Fiona KML driver
gpd.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw'


# Read (and display) Data from CAD File
plano = gpd.read_file('C:/Users/dev/Desktop/ ... 2000.dxf')

# Add the Coordinate Reference System
plano.crs = {'init':'epsg:3517'}
plano.plot()

# Write KML file 
with fiona.Env():
    plano.to_file('C:/Users/dev/Desktop/ ... /2000.kml', driver='KML')

enter image description here

I have no idea why this is happening - any suggestions are GREATLY appreciated.

user2161499
  • 67
  • 1
  • 10
  • Can you perhaps share one or more geometries (`plano.geometry[0]`) before and after saving it in Illustrator? – Martin Valgur Jul 23 '19 at 19:03
  • Also, how big is the offset? Is it somewhat close, at (0, 0) or at the other side of the world? – Martin Valgur Jul 23 '19 at 19:09
  • it's not too far off: https://imgur.com/a/CJKLDoD – user2161499 Jul 23 '19 at 19:28
  • Can you share coordinates of geometries as @MartinValgur suggested? Illustrator might do some changes. – martinfleis Jul 24 '19 at 10:44
  • I have the coordinates as requested - it appears they are quite different - which is strange because this occurs when simply opening a .dxf file with Illustrator then saving it - no other changes are made. Any suggestions as to how I might be able to resolve this are beyond appreciated. https://pastebin.com/bamY1yU4 – user2161499 Jul 24 '19 at 19:44
  • 1
    It looks like an issue with Illustrator which is hard to fix. AI probably can't handle large numbers in coordinates, so it moves it around 0. You can try to find out how much (as a difference between coords of the same point before and after), and then use `translate` in geopandas to move it back to the proper point. – martinfleis Jul 25 '19 at 14:56

1 Answers1

0

The fix / solution to this issue is to use an Adobe Illustrator plugin which allows for the preservation of GIS / Geo-spatial data. We've decided to use: https://www.avenza.com/mapublisher/

Thank you to everyone who provided input regarding this issue.

user2161499
  • 67
  • 1
  • 10