motionless

An easy way to generate Google Static Map URLs with Python.


Keywords
google, static, maps, url, api, georss, mapping, gpx, kml, geo, gis
License
Apache-2.0
Install
pip install motionless==1.3.3

Documentation

motionless

fury.io Build Status Coverage Status

motionless is a Python library that takes the pain out of generating Google Static Map URLs. Three map types are supported. Each is illustrated below. For fully worked code see the examples directory for code that parses and visualizes both GeoRSS feeds and GPX files.

motionless is tested with Python versions 2.7, 3.4, 3.5 and 3.6.

Code is licensed under Apache 2.0

For DecoratedMaps, paths are encoded using gpolyencode (shipped with motionless). This is useful for keeping URLs with in the 2048 character limit imposed by the service.

Important

As of October 2018, Google Static Map API no longer supports keyless access. This means that if you want to continue using motionless, you'll need to generate and use a personal API key.

CenterMap

CenterMaps show a map with no markers or paths, centered on a single location.

from motionless import CenterMap
cmap = CenterMap(address='151 third st, san francisco, ca', key=key)
print(cmap.generate_url())

SFMOMA

from motionless import CenterMap
cmap = CenterMap(lat=48.858278, lon=2.294489, maptype='satellite', key=key)
print(cmap.generate_url())

La Tour Eiffel

VisibleMap

VisibleMaps show a map with no markers or paths, automatically sized and zoomed to make the specified locations visible.

from motionless import VisibleMap
vmap = VisibleMap(maptype='terrain', key=key)
vmap.add_address('Sugarbowl, Truckee, CA')
vmap.add_address('Tahoe City, CA')
print(vmap.generate_url())

Sugarbowl and Tahoe City

DecoratedMap

DecoratedMaps contain markers and/or paths. They are automatically sized and zoomed to make the specified elements visible.

from motionless import DecoratedMap, LatLonMarker
dmap = DecoratedMap(maptype='satellite', key=key)
dmap.add_marker(LatLonMarker(27.988056, 86.925278, label='S'))
dmap.add_marker(LatLonMarker(28.007222, 86.859444, label='B'))
print(dmap.generate_url())

Everest Basecamp

You can add a list of style definitions to add custom styling to your map.

from motionless import DecoratedMap, AddressMarker
road_styles = [{
    'feature': 'road.highway',
    'element': 'geomoetry',
    'rules': {
        'visibility': 'simplified',
        'color': '#c280e9'
    }
}, {
    'feature': 'transit.line',
    'rules': {
        'visibility': 'simplified',
        'color': '#bababa'
    }
}]
dmap = DecoratedMap(style=road_styles, key=key)
dmap.add_marker(AddressMarker('1 Infinite Loop, Cupertino, CA',label='A'))
dmap.add_marker(AddressMarker('1600 Amphitheatre Parkway Mountain View, CA',label='G'))
print(dmap.generate_url())

Apple and Google

Further examples

Munich

Produced from parsing GPX file. See examples/munich.py

Earthquakes

Produced from geojson feed. See examples/earthquakes.py