Question

How to Convert DWG file to KML file


Hi Everyone !

For the purpose of my mission during my internship, i must convert a DWG file to a KML file.

My boss told me using FME was the best choice.

 

I didn't know FME before, I just begin using FME to solve this problem.

I tried to convert the file with FME Quick Translatetor (following the FME Tutorial) using "Autodesk AutoCAD RealDWG DWG/DXF" for the DWG file in input and "Google KML" for the KML file in output.

It failed and return this error :

KML: Feature does not have a coordinate system specified

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Feature Type: `0'

Attribute(16 bit unsigned integer): `autocad_color' has value `7'

Attribute(64 bit real) : `autocad_elevation' has value `0'

Attribute(encoded: utf-16) : `autocad_linetype' has value `ByLayer'

Attribute(string) : `autocad_linetype_scale' has value `1'

Attribute(string) : `autocad_lineweight' has value `-1'

Attribute(64 bit real) : `autocad_thickness' has value `0'

Attribute(64 bit real) : `autocad_width' has value `0'

Attribute(encoded: utf-8) : `kml_id' has value `kml_2689'

Attribute(encoded: utf-8) : `kml_parent' has value `kml_ft_0'

Attribute(string) : `kml_type' has value `kml_area'

Coordinate System: `'

Geometry Type: IFMEPolygon

Boundary:

Geometry Type: IFMELine

Number of Coordinates: 5 -- Coordinate Dimension: 2

(1692982.6297503628,9246414.3255591113)(1693049.1543420772,9246414.3255591113)(1693049.1543420772,9246358.8121544663)(1692982.6297503628,9246358.8121544663)(1692982.6297503628,9246414.3255591113)

I also tried with FME Workbench with the same types used above. I create the Reader with my DWG file and my Writer with a KML file i used for testing. It create 2 entity (a reader and a writer) and i link them eachother and then I click on the "Run" button.

The translation also failed and return this error :

KML: Feature does not have a coordinate system specified

Storing feature(s) to FME feature store file `.\\mapping_log.ffs'

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Feature Type: `0'

Attribute(entangled: 16 bit unsigned integer): `autocad_color' has value `7'

entangled to [autocad_original_color, autocad_true_color]

Attribute(64 bit real) : `autocad_elevation' has value `0'

Attribute(string) : `autocad_entity' has value `autocad_polygon'

Attribute(string) : `autocad_entity_handle' has value `36FFFE'

Attribute(string) : `autocad_entity_visibility' has value `invisible'

Attribute(encoded: utf-16) : `autocad_layer' has value `0'

Attribute(encoded: utf-16) : `autocad_layer_desc' has value `'

Attribute(string) : `autocad_layer_frozen' has value `no'

Attribute(string) : `autocad_layer_hidden' has value `no'

Attribute(string) : `autocad_layer_locked' has value `no'

Attribute(string) : `autocad_layer_on' has value `yes'

Attribute(string) : `autocad_layer_plottable' has value `yes'

Attribute(encoded: utf-16) : `autocad_linetype' has value `ByLayer'

Attribute(32 bit unsigned integer) : `autocad_linetype_generation' has value `0'

Attribute(string) : `autocad_linetype_scale' has value `1'

Attribute(string) : `autocad_lineweight' has value `-1'

Attribute(string) : `autocad_original_color' has value `ByLayer'

Attribute(string) : `autocad_original_entity_type' has value `autocad_lwpolyline'

Attribute(encoded: utf-16) : `autocad_resolved_linetype' has value `Continuous'

Attribute(string) : `autocad_source_filename' has value `C:\\Users\\THE Rémi\\Downloads\\ROUVROY - Grille + n°.dwg'

Attribute(string) : `autocad_space' has value `model_space'

Attribute(boolean) : `autocad_store_bulges_mode' has value `No'

Attribute(64 bit real) : `autocad_thickness' has value `0'

Attribute(boolean) : `autocad_ucs_applied' has value `No'

Attribute(64 bit real) : `autocad_ucs_origin_x' has value `0'

Attribute(64 bit real) : `autocad_ucs_origin_y' has value `0'

Attribute(64 bit real) : `autocad_ucs_origin_z' has value `0'

Attribute(64 bit real) : `autocad_ucs_xdir_x' has value `1'

Attribute(64 bit real) : `autocad_ucs_xdir_y' has value `0'

Attribute(64 bit real) : `autocad_ucs_xdir_z' has value `0'

Attribute(64 bit real) : `autocad_ucs_ydir_x' has value `0'

Attribute(64 bit real) : `autocad_ucs_ydir_y' has value `1'

Attribute(64 bit real) : `autocad_ucs_ydir_z' has value `0'

Attribute(64 bit real) : `autocad_width' has value `0'

Attribute(entangled: string) : `fme_color' has value `0,0,0'

entangled to [autocad_color]

Attribute(string) : `fme_feature_type' has value `0'

Attribute(string) : `fme_geometry' has value `fme_polygon'

Attribute(entangled: string) : `fme_type' has value `fme_area'

entangled to [autocad_entity]

Attribute(encoded: utf-8) : `kml_id' has value `kml_2689'

Attribute(encoded: utf-8) : `kml_parent' has value `kml_ft_0'

Attribute(string) : `kml_type' has value `kml_area'

Attribute(string) : `multi_writer_id' has value `0'

Coordinate System: `'

Geometry Type: IFMEPolygon

Boundary:

Geometry Type: IFMELine

Number of Coordinates: 5 -- Coordinate Dimension: 2

(1692982.6297503628,9246414.3255591113)(1693049.1543420772,9246414.3255591113)(1693049.1543420772,9246358.8121544663)(1692982.6297503628,9246358.8121544663)(1692982.6297503628,9246414.3255591113)

To be clear, I call error the text wrote in red in FME Console/Translation Log during the translation.

I search what was wrong with the type and the value and found that some line like autocad_color attend a "number(31,15)" type and the value is "0". I asume that the type "number(31,15)" is a number between 15 and 31 but i'm not sure. It's an example but it's almost the same kind of disagreaments between the value and the type.

It's not very urgent but if someone have time to help me solve this i would be gratefull.

Thank you !!

PS: I'm a french student, if I was not clear about some points let me know about them.


5 replies

Userlevel 2
Badge +17

Hi @remizolendzewsk, most likely the reason for the error is the features from the source DWG dataset don't have any coordinate system. This message indicates the situation.

"KML: Feature does not have a coordinate system specified"

The KML writer requires that every feature has a proper coordinate system, because KML datasets always have LL84 coordinate system according to the format specification and the KML writer transforms the source coordinate system to LL84 automatically.

Consider setting a proper coordinate system to the Coord. System parameter in the DWG reader.

Badge +16

Or a CoordinateSystemSetter transformer

I did indicate LL84 in Coord. System in both (Reader and Writer) then run the translation and I doesn't have any errors anymore.

I don't know how to configure a transformer but with simple link it works.

Thank you so much for your help. I don't belive i will use FME again but your answer was really quick and usefull.

Thanks again, bye !

Badge +16
Finding out how transformers work is a MUST if you intend to use FME more and more.

 

 

This is how you can configure it to set the desired coordinate system on the features going through it.

 

 

A good place to make a start with transformers is the Knowledge Center, for example:

 

https://knowledge.safe.com/articles/1009/getting-started-with-fme-desktop-adding-transforme.html

 

Hope this helps.

 

 

Badge +16

I did indicate LL84 in Coord. System in both (Reader and Writer) then run the translation and I doesn't have any errors anymore.

I don't know how to configure a transformer but with simple link it works.

Thank you so much for your help. I don't belive i will use FME again but your answer was really quick and usefull.

Thanks again, bye !

Finding out how transformers work is a MUST if you intend to use FME more and more.

 

 

This is how you can configure it to set the desired coordinate system on the features going through it.

 

 

A good place to make a start with transformers is the Knowledge Center, for example:

 

https://knowledge.safe.com/articles/1009/getting-started-with-fme-desktop-adding-transforme.html

 

Hope this helps.

 

 

Reply