SpaTools: Import ESRI Shapefile into AutoCAD






Shapefile is one of the data format developed by ESRI to store geographic information. Because of the simplicity of shapefiles, it is very popular in GIS and Geospatial industry to transfer geographic information along with attributes.

The SpaTools toolbar has a dedicated panel for tools to import different file formats in AutoCAD directly. These tools import Lidar LAS/LAZ files, GPX files, KML files and CSV (Comma Delimited) point data text files. A new tool to import ESRI shapefiles into AutoCAD directly is added now.




Shapefile is not a single file rather it consists of several supporting files. There are three major and mandatory files.

1. Main file

The extension of the main file is SHP. This file contains the feature geometry. The data is stored in the form of records having variable length because each feature may have variable number of vertices. Each record describes a shape with a list of its vertices.

2. Index file
The extension of the index file is SHX. This file contains the positional index of the feature geometry which is used to seek the forwards and backwards quickly. The index file contains a 100-byte header followed by 8-byte, fixed-length records.

3. dBASE file
The extension of the dBASE file is dbf. All the attributes are stored in dbf file. It has one-to-one relationship with shp file i-e the number of the rows in dbf file must be equal to the number of features in main (shp) file with the same order.

All the other files such as PRJ, SBX, SBN, CPG, SHP.XML are optional. PRJ file is optional but it has vital importance as it stores the projection and coordinate system information. The file is plain text file having extension of PRJ. It begins with a name for the projected coordinate system.  Then it describes the geographic coordinate system.  Then it defines the projection and all the parameters needed for the projection.  It then defines the linear units used in the projection.


If any shapefile having no PRJ file associated, it will be treated by GIS software as geographic data with  Unknown or Undefined coordinate system.

All the files (shp, shx, dbf, prj) must have the same file name. If the file name of shp or shx files differs from dbf file, it will not be read or rendered by any GIS software. 

Download the updated SpaTools.DLL from the link at the bottom of this blog and load it using NETLOAD command.  


Try different shapefiles to import in AutoCAD. 




All the geometric features (Points, Polylines and Polygons) will be plotted based on the coordinate system defined in the PRJ file associated with the shapefile. This version does not attach the attribute information with the geometric features but I will extend it to:
  • Plot the Point features with labels from any field in the form of points as well as pre-defined/user-defined blocks
  • Plot the polylines with the labels at a defined interval with user specified layer, color or linetype.
  • Plot the polygons with labels at the centroid location of the polygon. 

Your feedback as comments is always appreciated.



The updated SpaTools DLL can be downloaded from Cadomation.


Comments

Popular posts from this blog

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

How to Clip objects in AutoCAD

SpaTools: Extract Topographic Profile From Contours In AutoCAD

Creating Contour Maps in ArcGIS and Conversion to AutoCAD drawing

Why GIS users should learn AutoCAD?

SpaTools: Toolbar with all tools