SHP (.shp)

Background & Context

    • ESRI shape file format.
    • Common GIS file format.
    • Used for archiving and exchanging cartographic and geospatial information.
    • Stores the geometry and data of map features.
    • SHP is an acronym derived from the word Shape.
    • An SHP bundle consists of multiple files combined in a file archive or directory.
    • Binary format.


  • Import["dir","SHP"] or Import["dir"] imports an entire SHP directory and returns a combined rendering of all graphics layers.
  • The Wolfram Language can read SHP files from directories or file archive bundles.
  • Import["dir/file.shp"] imports the specified layer from a shape file bundle.
  • Import["dir"] returns a GeoGraphics object.
  • Import["dir","elem"] imports the specified element from an SHP file.
  • Import["dir",{{"elem1","elem2",}}] imports multiple elements.
  • See the following reference pages for full general information:
  • Importimport from a file
    CloudImportimport from a cloud object
    ImportStringimport from a string
    ImportByteArrayimport from a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • Data representation elements:
  • "Graphics"all layers combined into a single graphics object
    "GraphicsList"list of graphics representing the layers of an SHP archive
    "Data"graphics primitives for each layer
  • Import by default uses the "Graphics" element for the SHP format.
  • Import["file","Data"] returns an expression of the form {layer1,layer2,} . Individual layers are given as a list of rules representing the geometry, as well as numerical and textual information associated with the features.
  • Meta-information elements:
  • "LayerNames"all layer names, given as a list of strings
    "LayerTypes"what graphics primitives comprise each layer
    "SpatialRange"range of geographic coordinates, typically given in decimal degrees
  • Elements representing the geodetic datum and reference ellipsoid used in the file:
  • "CoordinateSystem"name of the coordinate system used in the file
    "Datum"geodetic datum
    "SemimajorAxis"semimajor axis of the reference ellipsoid in meters
    "SemiminorAxis"semiminor axis of the reference ellipsoid in meters
    "InverseFlattening"inverse flattening of the ellipsoid
    "LinearUnits"coordinate system units
  • Elements specifying the cartographic projection and its parameters:
  • "Projection"projection name and parameters
    "Centering"latitude and longitude defining the origin of the projection
    "StandardParallels"standard parallels
    "CentralScaleFactor"scale factor at the central meridian or center of projection
    "GridOrigin"grid coordinates {n,e} of the central parallel and meridian
    "ProjectionName"Wolfram Language standard name of the projection used
    "ReferenceModel"which reference sphere or ellipsoid to use
  • Accessing low-level meta-information from the file:
  • "CoordinateSystemInformation"raw parameters of the coordinate system as stored in the file
  • See the reference page for GeoProjectionData for full information on cartographic projections.



Basic Examples  (1)

Import all layers from an SHP bundle:

Import the layer names:

Show a list of all import elements available for this file:

Import the name of the geodetic datum to which the coordinates in the file are referenced:

The coordinates in this file are not projected: