pyrosm.OSM.get_boundaries

pyrosm.OSM.get_boundaries#

OSM.get_boundaries(boundary_type='administrative', name=None, custom_filter=None, extra_attributes=None, timestamp=None, tags_to_keep=None)#

Parses boundaries from OSM.

Parameters:
  • boundary_type (str) –

    The type of boundaries to parse. Possible values:
    • ”administrative” (default)

    • ”national_park”

    • ”political”

    • ”postal_code”

    • ”protected_area”

    • ”aboriginal_lands”

    • ”maritime”

    • ”lot”

    • ”parcel”

    • ”tract”

    • ”marker”

    • ”all”

  • name (str (optional)) – Name of the administrative area that will be searched for.

  • custom_filter (dict (optional)) – Additional filter for what kind of boundary to parse.

  • extra_attributes (list (optional)) – Additional OSM tag keys that will be converted into columns in the resulting GeoDataFrame.

  • tags_to_keep (list (optional)) – When given, only these OSM tag keys are kept as columns, replacing the default set of tag columns (reduces memory). Structural columns and filtering are unaffected; extra_attributes still apply.

  • timestamp (str | datetime | int) –

    If provided, the data from given moment of time will be returned. The time should be provided in UTC. Note: This functionality only works with OSH.PBF files that can be downloaded manually e.g. from Geofabrik (requires login with OSM account).

    The logic: the closest version of each element up to given timestamp will be selected to the result. This means that elements can be older than the given timestamp (the most up-to-date version is selected), but not newer (records having exactly the selected timestamp will be kept). In case only a date is given, the time will represent midnight of the given day, such as “2021-01-01 00:00:00”.

See also

Take a look at OSM documentation for further details about the data:

https://wiki.openstreetmap.org/wiki/Key:boundary