Skip to main content

Official Python SDK for the Georavity Geospatial API — routing, geocoding, and map tiles.

Project description

georavity

Official Python SDK for the Georavity Geospatial API — routing, geocoding, isochrones, and more.

Installation

pip install georavity

Quick Start

from georavity import Georavity

geo = Georavity("gr_your_api_key")

# Route between two points
route = geo.route(
    locations=[
        {"lon": 13.388860, "lat": 52.517037},  # Berlin Hauptbahnhof
        {"lon": 13.397634, "lat": 52.529407},  # Mauerpark
    ],
    costing="auto",
)
print(f"Distance: {route['trip']['summary']['length']} km")
print(f"Duration: {route['trip']['summary']['time']} seconds")

API Reference

Routing

# Standard route
route = geo.route(
    locations=[{"lat": 52.52, "lon": 13.40}, {"lat": 48.85, "lon": 2.35}],
    costing="auto",  # "auto" | "bicycle" | "pedestrian" | "truck"
)

# Optimized route (TSP)
optimized = geo.optimized_route(
    locations=[
        {"lat": 52.52, "lon": 13.40},
        {"lat": 48.85, "lon": 2.35},
        {"lat": 51.50, "lon": -0.12},
    ],
    costing="auto",
)

# Distance/time matrix
matrix = geo.matrix(
    sources=[{"lat": 52.52, "lon": 13.40}],
    targets=[{"lat": 48.85, "lon": 2.35}, {"lat": 51.50, "lon": -0.12}],
    costing="auto",
)

# Isochrone
iso = geo.isochrone(
    locations=[{"lat": 52.52, "lon": 13.40}],
    costing="auto",
    contours=[{"time": 15}, {"time": 30}],
    polygons=True,
)

Geocoding

# Forward geocode
results = geo.geocode("Brandenburg Gate, Berlin")

# With focus point (biases results near the given location)
results = geo.geocode("coffee", focus_lat=52.52, focus_lon=13.40)

# Reverse geocode
place = geo.reverse(lat=52.5163, lon=13.3777)

# Autocomplete
suggestions = geo.autocomplete("Bran", focus_lat=52.52, focus_lon=13.40)

Error Handling

from georavity import Georavity, GeoravityError

try:
    route = geo.route(...)
except GeoravityError as e:
    print(f"API Error [{e.code}]: {e}")
    print(f"HTTP Status: {e.status}")

License

MIT — georavity.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

georavity-1.0.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

georavity-1.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file georavity-1.0.0.tar.gz.

File metadata

  • Download URL: georavity-1.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for georavity-1.0.0.tar.gz
Algorithm Hash digest
SHA256 19dc20a849574245fa42d382ecf10c75828d7668feb73f0f6fae351d79f4f5d6
MD5 a14e3ca8768ceee0d8fbdcfa5e2a8102
BLAKE2b-256 6d4533637182820a18977bc2174661f63e53abbdfc8164b229673563d174fd8e

See more details on using hashes here.

File details

Details for the file georavity-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: georavity-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for georavity-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61728db300364ee94d2d2accb189ca79580da44d6ebe1ea2cff6bc1d02705c2b
MD5 75d36a0385dd348bb231e0e69292d52f
BLAKE2b-256 17aa7c64926d7c57deda8c26db5e738f1d079824feea26d1b539754c43fe08a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page