cenpy.tiger.ESRILayer.query

ESRILayer.query(self, raw=False, strict=False, **kwargs)[source]

A query function to extract data out of MapServer layers. I’ve exposed every option here

Parameters
where: str, required

sql query string.

out_fields: list or str

fields to pass from the header out (default: ‘*’)

return_geometry: bool

bool describing whether to return geometry or just the dataframe. (default: True)

geometry_precision: str

a number of significant digits to which the output of the query should be truncated (default: None)

out_sr: int or str

ESRI WKID spatial reference into which to reproject the geodata (default: None)

return_ids_only: bool

bool stating to only return ObjectIDs. (default: False)

return_z: bool

whether to return z components of shp-z, (default: False)

return_m: bool

whether to return m components of shp-m, (default: False)

strictbool

whether to throw an error if invalid polygons are provided from the API (True) or just warn that at least one polygon is invalid (default: False)

rawbool

whether to provide the raw geometries from the API (default: False)

Returns
Dataframe or GeoDataFrame containing entries from the geodatabase

Notes

Most of the time, this should be used leaning on the SQL “where” argument:

cxn.query(where=’GEOID LIKE “06*”’)

In most cases, you’ll be querying against layers, not MapServices overall.