SpaTools: Import KML in AutoCAD














KML, or 'Keyhole Markup Language', is an XML based file format for modeling and storing geographic features such as points, lines, images, polygons, and models for display in Google Earth, Google Maps and other applications. KML uses a tag-based structure with nested elements and attributes and is based on the XML standard. KML files can be created using Google Earth user interface or using any simple text editor by writing XML tags, attributes and values in the form of raw KML. The compressed form of KML files is KMZ archive file having extension of KMZ.
KML/KMZ files are frequently shared over the internet via email to display the location, extent and orientation. Anyone can view the KML/KMZ files using Google Earth application.
It is often required to overlay the KML files in AutoCAD drawings for further cartographic activities.



Every feature in the KML file have a tag with ending tag of Placemark . Under Placemark tag, there are various tags which are used to store some specific properties. The most important tags which define the topology and geometry of the feature are Point, LineString , and Polygon  with respective ending tags.



The spatial information is stored is always contained in tag  Coordinates with an ending tag of Coordinates. The tag is child element of  Point, LineString or Polygon tags. The spherical coordinates (Latitude, Longitude & Height) are in the form of comma delimited 3-tuples delimited with space.

For example, a KML file stores the coordinates of a Polygon as shown below:



The spherical coordinates (Latitude, Longitude and Height) of the geometric features in KML file are based on WGS 84 ellipsoid. It is always required to plot these coordinates on a projected coordinate system.
KMLIN is a tool developed to plot the geometric features (Points, Polylines and Polygons) in AutoCAD. The tool is included into SpaTools.DLL. It takes a KML file as input and plots all the features (points, polylines and polygons) along with names (as text objects) into AutoCAD drawing. It detects the UTM Zone along with hemisphere (Northern / Southern) and transform all the spherical coordinates into projected coordinates.

A KML file depicted below has four point features, four polyline features and five polygons.  


The file can be imported and plotted in AutoCAD by a command KMLIN as shown below:



The DLL can be downloaded from here.

Note: This tool is further extendable to import the information from CDATA tags, customized construction of AutoCAD objects (such as Text heights, Polyline properties, Blocks for points etc)  and transformation to different coordinate systems used all over the world. Your suggestions to improve and enhance this tool will be appreciated. 

Comments

  1. Thanks so much for this. This is an added knowledge to what I have known before.

    ReplyDelete
    Replies
    1. bro pls how did u get urs i cant download it, pls help a brother

      Delete
  2. Waooh!!!! I tested it and it worked as I expected...
    Thanks.

    ReplyDelete
    Replies
    1. i could not download that url saying "This Path Doesn't Exist." how to download please
      can any one suggest

      Delete
  3. Thanks so much for your contribution to knowledge!

    ReplyDelete
  4. While using i am having an issue like "Index was outside the bounds of the array".
    Can you help me out from this...

    Much Thanks....!

    ReplyDelete
    Replies
    1. send the KML file to info@cadomation.com to check why there is issue.

      Delete
    2. Is there any blog that explains how to transform all the spherical coordinates into projected coordinates in AutoCAD.

      Delete
  5. pls sir I can download it is there any way I can get it into my pc?

    ReplyDelete

Post a Comment

Popular posts from this blog

SpaTools: Import Lidar Point Cloud (LAS/LAZ) files into AutoCAD

How to Clip objects in AutoCAD

Creating Contour Maps in ArcGIS and Conversion to AutoCAD drawing

SpaTools: Extract Topographic Profile From Contours In AutoCAD

Gunter Chain / Surveyor's Chain

SpaTools: Toolbar with all tools