Solved

DXF to KML conversion problem

  • 20 December 2017
  • 7 replies
  • 29 views

Hi,

 

 

I am trying to do a simple conversion of my DXF file to KML. I do the following steps:

1. I launch Start > Generate Workspace.

2. Select format "Autodesk AutoCAD DWG/DXF" in Reader and give path to my DXF file, and add some coordinate system.

3. Select Google KML format in Writer and give output file path.

4. Click Ok. and it shows some input and output boxes directly connected to each other.

5. I click RUN. In the terminal I see Success in the end and the file is created.

6. I open the KML in Google Earth.

In Google Earth I see whole earth covered with KML lines.

Can you guys help me with this please? I am using FME workbench 2017.1

icon

Best answer by geosander 21 December 2017, 16:42

View original

7 replies

Badge

I'd say your workflow is okay, but you will have to attach some test data if you want us to help you properly.

Without it, I'd say the problem lies with step 2, where you state that you "add some coordinate system". Which coordinate system? Typically, DXF's don't have one, and the coordinates are arbitrary XYZ values.

Badge +3

I'd say your workflow is okay, but you will have to attach some test data if you want us to help you properly.

Without it, I'd say the problem lies with step 2, where you state that you "add some coordinate system". Which coordinate system? Typically, DXF's don't have one, and the coordinates are arbitrary XYZ values.

And then use the CsMapReprojector transformer to get it into the LL84 coordinate system that KML uses.

 

I'd say your workflow is okay, but you will have to attach some test data if you want us to help you properly.

Without it, I'd say the problem lies with step 2, where you state that you "add some coordinate system". Which coordinate system? Typically, DXF's don't have one, and the coordinates are arbitrary XYZ values.

 

Ok. You are probably right. I dont know much about coordinate systems. I want to place the KML somewhere in Australia (-16.431495, 136.095543). So I just searched "Australia" and chose one system. I have used other converters (AutoCAD) that only ask me to map a DXF point on a XYZ coordinate. Please help me with coordinate system. I'll try to get some test data.

 

Badge
Hi @usmankhansaab,

 

Provided that your DXF only contains line geometry in local coordinates (so at or around 0,0,0), you could simply use a LocalCoordinateSystemSetter and write to Google KML. FME will take care of the reprojection automatically, since KML placemarks always have an LL-WGS84 projection, so it knows into which coordinate system it should reproject.

 

 

In the example above, I've set the transformer according to your needs, assuming you are using metric units. But you can change this of course.

 

 

Note that writing to Google KML is not that straightforward. You will have to write your geometries as Placemark features for instance (which are stored in Folder features that live in a Document feature). You also need to style your lines yourself, if you don't like the default colors. You could base them on the ones the DXF has, of course.

 

For more information on the KML Writer, see:

 

https://blog.safe.com/2015/04/how-to-convert-style-kml

 

https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/WKBkml/ogckml.htm

 

https://cdn.safe.com/training/tutorials/KML-Pathway-Tutorial.pdf (rather old though)

 

https://knowledge.safe.com/articles/1081/basic-kml-example-kmlstyler-tab-to-kml.html

 

Badge

I'd say your workflow is okay, but you will have to attach some test data if you want us to help you properly.

Without it, I'd say the problem lies with step 2, where you state that you "add some coordinate system". Which coordinate system? Typically, DXF's don't have one, and the coordinates are arbitrary XYZ values.

Hi @usmankhansaab,

 

Provided that your DXF only contains line geometry in local coordinates (so at or around 0,0,0), you could simply use a LocalCoordinateSystemSetter and write to Google KML. FME will take care of the reprojection automatically, since KML placemarks always have an LL-WGS84 projection, so it knows into which coordinate system it should reproject.

 

 

In the example above, I've set the transformer according to your needs, assuming you are using metric units. But you can change this of course.

 

 

Note that writing to Google KML is not that straightforward. You will have to write your geometries as Placemark features for instance (which are stored in Folder features that live in a Document feature). You also need to style your lines yourself, if you don't like the default colors. You could base them on the ones the DXF has, of course.

 

For more information on the KML Writer, see:

 

https://blog.safe.com/2015/04/how-to-convert-style-kml

 

https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/WKBkml/ogckml.htm

 

https://cdn.safe.com/training/tutorials/KML-Pathway-Tutorial.pdf (rather old though)

 

https://knowledge.safe.com/articles/1081/basic-kml-example-kmlstyler-tab-to-kml.html

 

I'd say your workflow is okay, but you will have to attach some test data if you want us to help you properly.

Without it, I'd say the problem lies with step 2, where you state that you "add some coordinate system". Which coordinate system? Typically, DXF's don't have one, and the coordinates are arbitrary XYZ values.

Awesome! thanks @sander the "LocalCoordinateSystemSetter" worked ! :)

 

Badge
Awesome! thanks @sander the "LocalCoordinateSystemSetter" worked ! :)

 

Great to hear that, @usmankhansaab!

 

I have converted my comment into an answer. Could you mark it as the answer to your question? Then others can see it's solved and easily find the solution. Thanks! :)

 

Reply