# 19.7. Shapefile Converter¶

The Shapefile converter handles shapefiles. To use the Shapefile converter, specify type = "shp" in your converter definition.

## 19.7.1. Configuration¶

The Shapefile converter does not have any configuration beyond the basic converter defaults. However, since a shapefile is a collection of files, and not a single input, there are a few constraints that must be observed.

Shapefile converters are not usable in distributed converter jobs, as the map/reduce paradigm does not work well with the collection of related files that comprise a shapefile. In addition, when using a Shapefile converter it is important to set the input file path in the evaluation context. This is handled automatically by the GeoMesa CLI tools, but if used programmatically "inputFilePath" must be set in the evaluation context global parameters.

## 19.7.3. Example Usage¶

This example is for the Tiger US States boundary file available from the US Census Bureau.

The shapefile has the following columns:

*the_geom:MultiPolygon,STATEFP:String,STATENS:String,AFFGEOID:String,GEOID:String,STUSPS:String,NAME:String,LSAD:String,ALAND:Long,AWATER:Long


From these, we will only consider a subset, using the following SimpleFeatureType:

geomesa.sfts.cb_2017_us_state_20m = {
attributes = [
{ name = "name",    type = "String"       }
{ name = "usps",    type = "String"       }
{ name = "area",    type = "Long"         }
{ name = "geom",    type = "MultiPolygon" }
]
}


You could ingest with the following converter:

geomesa.converters.cb_2017_us_state_20m = {
type     = "shp"
id-field = "$0" fields = [ { name = "name", transform = "$7" }, // example of lookup by field number
{ name = "usps", transform = "shp('STUSPS')" }, // example of lookup by name
{ name = "area", transform = "add(shp('ALAND'),shp('AWATER'))" },
{ name = "geom", transform = "shp('the_geom')" },
]
}