AutoCAD Map 3D Forum
Welcome to Autodesk’s AutoCAD Map 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Export MPolygon to "Polygon" in KML (and not export to Polyline)

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
muhammadfareez
3287 Views, 6 Replies

How to Export MPolygon to "Polygon" in KML (and not export to Polyline)

I am trying to generate a map of a mock city.

 

The city layout was drawn in DWG format with the district boundaries drawn as "MPolygons".

I would like to convert the city layout from DWG to KML, while converting the "MPolygons" (in DWG) to  "Polygons" (in KML).

However, every time I export my DWG to KML, the "MPolygons" are converted to "Polylines" instead.

 

Has anyone ever came across this problem and does anyone have a solution?

 

P.S.

The reason why the district boundaries have to be in Polygon is because I am building a choropleth map with Mapbox for data visualisation.

My intention is for the districts to change colour depending on the data tagged to the respective districts.

Mapbox does not recognise polylines as "containers" so the data cannot be tagged to the districts.

It does however, recognise polygons.

6 REPLIES 6
Message 2 of 7

I tried in 2019, and I got a polygon in kml from mpoligon to dwg.

mpoly.png

What is your version?
And how exactly do you export?

 

Apparently, you need to attach an example of your mpoligons in dwg.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 3 of 7

Hi @АлексЮстасу 

 

Thanks for responding.

I am using AutoCAD Civil 3D 2021 Metric.

 

My apologies, it seems, I did not assign a proper coordinate system.

Instead, I plotted the map based on a rough estimate of the lat long converted from the Civil 3D's XYZ (I did this as the local authorities uses a different coordinate system than the standard WGS48).

After assigning the proper coordinate system (WGS48-47N), I successfully exported the MPolygon to Polygon in KML.

 

DWG:

muhammadfareez_3-1608093124918.png

 

KML:

muhammadfareez_0-1608092639747.png

 

However, now I found another problem.

When I loaded the KML file in Google Earth, I noticed that the polygon is somehow "broken".

The coordinates in the polygon does not follow the outline of the district boundary but it "zig-zags" around the interior of the polygon:

muhammadfareez_1-1608092838149.png

 

Have you come across the same problem?

I've attached my files for your reference.

Message 4 of 7
braudpat
in reply to: muhammadfareez

Hello

 

I don't understand why you are using MPolygons ! 

 

You have no Islands / Holes into your MPolygons so why you don't use standard 2D closed PLines ?

 

Please test with my KML ... Is it OK for you ?

 

When I have "unnecessary" MPolygons (no Islands / Holes), I am using a beautiful Lisp routine (from a french developper Bruno) to convert MPolygons to 2D closed Plines keeping ODs (Object Data) if there are ODs present on the MPolygons !? ... Do you need it ??

 

THE HEALTH, Regards, Patrice

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 5 of 7

If you want KML polygons taken from your AutoCAD file, you can export the polygons to shapefile. Be sure you have already assigned an appropriate coordinate system to modelspace before performing MapExport. After the shapefile has been successfully exported, you can bring it into to Google Earth Pro and perform a Save As to KMZ or KML. The new KMZ/KML will be polygonal objects.

Here are the steps:

 

  1. Use MAPEXPORT command. Name and select a folder location to save the shapefile. Be sure to change 'Files of type' to ESRI Shapefile (*shp). Click OK to open the MAPEXPORT window. Image-1.
  2. On the Selection Tab, choose POLYGON for Object type. Next, choose Select manually, Layers or any other method to select your polygons. The number of selected polylines will appear in lower left corner. Image-2.
  3. On the Options Tab check 'Treat closed polylines as polygons.' Click OK to create the shapefile. Image-3.
  4. Open Google Earth Pro. Go to File=>IMPORT=>Browse to and select your shapefile=>OPEN. Image-4.
  5. Scroll to the bottom of the Places Panel. Under Temporary Places Section, check the box next to the imported shapefile. You can now view the shapefile in the Google Earth Pro map area. Image-5.
  6. Right-click the shapefile layer in the Places Panel=>SAVE PLACE AS... Image-6.
  7. Name and Save the shapefile in either KMZ or KML format. Image-7.

 

Image-1.Image-1.

 

 

Image-2.Image-2.

 

 

Image-3.Image-3.

 

 

Image-4.Image-4.

 

 

Image-5.Image-5.

 

 

Image-6.Image-6.

 

 

Image-7.Image-7.

Chicagolooper
Message 6 of 7
braudpat
in reply to: ChicagoLooper

Hello @ChicagoLooper 

 

BRAVO for your very clear Tutorial ! I hope it will help @muhammadfareez !?

 

THE HEALTH, Regards, Patrice

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 7 of 7

Thanks @ChicagoLooper @braudpat !

Both solutions work perfectly.

This is my first time posting in this forum.

I'm glad for the positive feedback from the community 🙂

Kudos to you two legends!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


AutoCAD Beta