pycartociudad package

Submodules

pycartociudad.geocode module

Calls to Cartociudad geocoding API

Geolocation of Spanish addresses via Cartociudad API calls

pycartociudad.geocode.geocode(full_address: str)[source]

This function performs the geocoding of an address. It returns the details of the closest address in Spain.

full_addressstr

Character string providing the full address to be geolocated; e.g., “calle miguel servet 5, zaragoza”. Adding the country may cause problems.

geolocation

A dictionary consisting of location guess * id * province * comunidadAutonoma * muni * type * address * poblacion * geom * lat * lng * portalNumber * stateMsg * state * countryCode

pycartociudad.pycartociudad module

Main module.

pycartociudad.reverse_geocode module

Reverse geocoding of a location using cartociudad API

pycartociudad.reverse_geocode.reverse_geocode(latitude, longitude, cadastral=False)[source]

This function performs reverse geocoding of a location in Spain. It returns the closest address details (or cadastral details if) a cadastral reverse geocode is done.

latitudefloat

Point latitude in geographical coordinates (e.g., 40.473219)

longitude: float

Point longitude in geographical coordinates (e.g., -3.7227241)

cadastral: bool (optional) (default: False)

Set to True if performing cadastral address reverse geocoding

addrs_details : dictionary with the following items ** For non cadastral searches **:

  • id: Ref identifier

  • province: (if applicable) Province to which the

    location belongs.

  • comunidadAutonoma: (if applicable) Autonomous community to

    which the location belongs.

  • muni: Municipality to which the location belongs

  • type: Entity type

  • address: Result name

  • postalCode: Codigo postal (si corresponde)

  • poblacion: Town to which the location belongs

  • geom: GML geometry

  • tip_via: Street (1) or road (2)

  • lat: Latitude

  • lng: Longitude

  • portalNumber: Street/km number

  • stateMsg: Geometry computation result

  • state: Digit indicating the geometry computation

    result:

    · 1: exact result · 2: even street number not found · 3: odd street number not found · 4: km number not found (closest is returned) · 5: street/km number not found · 6: Type does not match query · 10: no results found, higher entity returned

  • priority: Priority (?)

  • countryCode: Country code (default 011 for Spain)

** For cadastral searches **: Same fields but
  • address: Address as registered in Cadastre

  • refCatastral: Cadastral reference

Module contents

Top-level package for pycartociudad.