pynhd.core
Contents
pynhd.core
#
Base classes for PyNHD functions.
Module Contents#
- class pynhd.core.AGRBase(base_url, layer=None, outfields='*', crs=4326, outformat='json')#
Base class for getting geospatial data from a ArcGISRESTful service.
- Parameters
base_url (
str
, optional) – The ArcGIS RESTful service url. The URL must either include a layer number after the last/
in the url or the target layer must be passed as an argument.layer (
str
, optional) – A valid service layer. To see a list of available layers instantiate the class without passing any argument.outfields (
str
orlist
, optional) – Target field name(s), default to “*” i.e., all the fields.crs (
str
,int
, orpyproj.CRS
, optional) – Target spatial reference, default toEPSG:4326
outformat (
str
, optional) – One of the output formats offered by the selected layer. If not correct a list of available formats is shown, defaults tojson
.
- property service_info: ServiceInfo#
Get the service information.
- bygeom(geom, geo_crs=4326, sql_clause='', distance=None, return_m=False, return_geom=True)#
Get feature within a geometry that can be combined with a SQL where clause.
- Parameters
geom (
Polygon
ortuple
) – A geometry (Polygon) or bounding box (tuple of length 4).geo_crs (
str
) – The spatial reference of the input geometry.sql_clause (
str
, optional) – A valid SQL 92 WHERE clause, defaults to an empty string.distance (
int
, optional) – The buffer distance for the input geometries in meters, default to None.return_m (
bool
, optional) – Whether to activate the Return M (measure) in the request, defaults to False.return_geom (
bool
, optional) – Whether to return the geometry of the feature, defaults toTrue
.
- Returns
geopandas.GeoDataFrame
– The requested features as a GeoDataFrame.
- byids(field, fids, return_m=False, return_geom=True)#
Get features based on a list of field IDs.
- Parameters
- Returns
geopandas.GeoDataFrame
– The requested features as a GeoDataFrame.
- bysql(sql_clause, return_m=False, return_geom=True)#
Get feature IDs using a valid SQL 92 WHERE clause.
Notes
Not all web services support this type of query. For more details look here
- Parameters
- Returns
geopandas.GeoDataFrame
– The requested features as a GeoDataFrame.
- class pynhd.core.GeoConnex(item=None)#
Access to the GeoConnex API.
Notes
The
geometry
field of the query can be a Polygon, MultiPolygon, or tuple/list of length 4 (bbox) inEPSG:4326
CRS. They should be within the extent of the GeoConnex endpoint.- Parameters
item (
str
, optional) – The target endpoint to query, defaults toNone
.
- query(kwds, skip_geometry=False)#
Query the GeoConnex endpoint.