Support for ESRI shapefiles

SQL Anywhere supports the Environmental System Research Institute, Inc. (ESRI) shapefile format. ESRI shapefiles are used to store geometry data and attribute information for the spatial features in a data set.

An ESRI shapefile includes three different files: .shp, .shx, and .dbf. The suffix for the main file is .shp, the suffix for the index file is .shx, and the suffix for the attribute columns is .dbf. All files share the same base name and are frequently combined in a single compressed file. SQL Anywhere can read all ESRI shapefiles with all shape types except MultiPatch. This includes shape types that include Z and M data.

The data in an ESRI shapefile usually contains multiple rows and columns. For example, the spatial tutorial loads a shapefile that contains zip code regions for Massachusetts. The shapefile contains one row for each zip code region, including the polygon information for the region. It also contains additional attributes (columns) for each zip code region, including the zip code name (for example, the string '02633') and other attributes.

To determine the types of the columns stored in a shapefile, use the sa_describe_shapefile system procedure. From the information returned by sa_describe_shapefile, you can create a table with the appropriate column names and types for the shapefile, or you can determine the rowset-schema to use with an OPENSTRING clause. You can then use LOAD TABLE USING FILE FORMAT SHAPEFILE to load the shapefile into a table, or use ... FROM OPENSTRING( FILE ) WITH( rowset-schema ) OPTION( FORMAT SHAPEFILE ) to retrieve the result set.

 See also

For more information about ESRI shapefiles, see [external link] http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf.