Skip to content

pyportall.api.models

geojson

Feature pydantic-model

GeoJSON feature.

set_geometry(v) classmethod

set geometry from geo interface or input

FeatureCollection pydantic-model

GeoJSON feature collection.

__getitem__(self, index) special

get feature at a given index

__iter__(self) special

iterate over features

__len__(self) special

return features length

GeometryCollection pydantic-model

GeometryCollection Model

__getitem__(self, index) special

get geometry at a given index

__iter__(self) special

iterate over geometries

__len__(self) special

return geometries length

LineString pydantic-model

LineString Model

MultiLineString pydantic-model

MultiLineString Model

MultiPoint pydantic-model

MultiPoint Model

MultiPolygon pydantic-model

MultiPolygon Model

Point pydantic-model

Point Model

Polygon pydantic-model

Polygon Model

check_coordinates(coords) classmethod

Validate that Polygon coordinates pass the GeoJSON spec

parse_geometry_obj(obj)

obj is an object that is supposed to represent a GeoJSON geometry. This method returns the reads the "type" field and returns the correct pydantic Geometry model.

parse_polygon_obj(obj)

obj is an object that is supposed to represent a GeoJSON geometry. This method returns the reads the "type" field and returns the correct pydantic Geometry model.

geopandas

Portall's GeoDataFrame wrappers.

PortallDataFrame

GeoDataFrame with Portall superpowers.

__init__(self, client, name=None, id=None, description=None, *args, **kwargs) special

Class constructor to attach the corresponding API client.

Parameters:

Name Type Description Default
client APIClient

API client object to be used to send requests to the dataframe API.

required
name Optional[str]

Dataframe name in Portall.

None
id Optional[UUID4]

Dataframe ID in Portall.

None
description Optional[str]

Dataframe description in Portall.

None

delete(self)

Delete dataframe in Portall.

Deletes remote PortallDataFrame object in Portall. It will not delete the actual Python object.

from_api(pdf_api, client) staticmethod

Build from a Portall dataframe as returned directly by Portall's API.

Return a PortallDataFrame object out of a Portall dataframe as returned directly by Portall's API.

Parameters:

Name Type Description Default
pdf_api PortallDataFrameAPI

PortallDataFrameAPI object to build the new PortallDataFrame object from.

required
client APIClient

API client object to be used to send requests to the dataframe API.

required

Returns:

Type Description
PortallDataFrame

A new PortallDataFrame object.

from_gdf(gdf, client, name=None, id=None, description=None) staticmethod

Build from GeoDataFrame.

Return a PortallDataFrame object out of a standard GeoPandas' GeoDataFrame.

Parameters:

Name Type Description Default
gdf gpd.GeoDataFrame

GeoDataFrame to build the new PortallDataFrame object from.

required
client APIClient

API client object to be used to send requests to the dataframe API.

required
name Optional[str]

Dataframe name in Portall.

None
id Optional[UUID4]

Dataframe ID in Portall.

None
description Optional[str]

Dataframe description in Portall.

None

Returns:

Type Description
PortallDataFrame

A new PortallDataFrame object.

from_geojson(geojson, client, name=None, id=None, description=None) staticmethod

Build from GeoJSON.

Return a PortallDataFrame object out of a standard GeoPandas' GeoDataFrame.

Parameters:

Name Type Description Default
geojson FeatureCollection

FeatureCollection GeoJSON to build the new PortallDataFrame object from.

required
client APIClient

API client object to be used to send requests to the dataframe API.

required
name Optional[str]

Dataframe name in Portall.

None
id Optional[UUID4]

Dataframe ID in Portall.

None
description Optional[str]

Dataframe description in Portall.

None

Returns:

Type Description
PortallDataFrame

A new PortallDataFrame object.

save(self)

Persist dataframe in Portall.

Creates or updates an equivalent, remote PortallDataFrame object in Portall.

PortallDataFrameAPI pydantic-model

Representation of a Portall dataframe straight from the API.

id: UUID4 pydantic-field

Portall ID of the saved dataframe in question.

indicators

Indicator-related model classes.

DayOfWeek

Day of the week.

Indicator pydantic-model

Defines a measurement to be computed, typically after a location and a moment have been defined.

aggregated: bool pydantic-field

True means a single value is returned for the entire geometry; false means original cells and values are preserved.

code: str pydantic-field required

Indicator code as defined in the metadata database.

normalization: Normalization pydantic-field

Requested geospatial normalization.

percent: bool pydantic-field

Whether the value is required to be a percentage.

Moment pydantic-model

Combination of hour, day of the week, month and year to be used when computing an indicator or requesting an isoline.

day: ConstrainedIntValue pydantic-field

Day of the month.

dow: DayOfWeek pydantic-field

Day of the week.

Month

Month.

Normalization

Geospatial normalization, where total means the actual value for a given area and density means values are normalized by area.

lbs

Models that relate to location-based services.

GeocodingOptions pydantic-model

Options to be used as fallback when the specific addresses do not have their own.

city: str pydantic-field

City or municipality.

country: str pydantic-field

Country in English.

county: str pydantic-field

County or province.

district: str pydantic-field

District or neighborhood.

postal_code: str pydantic-field

Postal code.

state: str pydantic-field

State or region.

IsolineMode

Transportation mode to use when computing an isoline.

IsolineOptions pydantic-model

Options to be used as fallback when the specific isolines do not have their own.

mode: IsolineMode pydantic-field

Means of transport used to calculate the isoline border.

moment: Moment pydantic-field

Moment in time to use when estimating the isoline border.

range_s: int pydantic-field

Number of seconds to be taken into account to calculate the isoline border.

IsovistOptions pydantic-model

Options to be used as fallback when the specific isovists do not have their own.

fov_deg: int pydantic-field

Field of view in degrees, centered in the heading direction.

heading_deg: int pydantic-field

Northing in degrees, to set the direction the eyeballs are looking at.

num_rays: int pydantic-field

Number of angular steps that will define the resolution (-1 means 1 ray per field of view degree).

radius_m: int pydantic-field

Maximum number of meters to be taken into account to calculate the isovist border.

metadata

Indicator metadata-related model classes.

Aggregate

An enumeration.

DataType

An enumeration.

Format

An enumeration.

preflight

Preflight requests related model classes.

Preflight pydantic-model

Credit information for a given request.

detail: int pydantic-field required

Cost in credits of a given request.