Skip to content

motionless is a Python library that takes the pain out of generating Google Static Map URLs.

License

Notifications You must be signed in to change notification settings

neon-jungle/motionless

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Code is licensed under Apache 2.0

For DecoratedMaps, paths are encoded if gpolyencode is present. This is useful for keeping URLs with in the 2048 character limit imposed by the service.

If you have run into bugs, open a github issue. If you have questions, feel free to email me at ryan.a.cox@gmail.com

-ryan @ryancox www.asciiarmor.com

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')
print cmap.generate_url()

SFMOMA

from motionless import CenterMap
cmap = CenterMap(lat=48.858278,lon=2.294489,maptype='satellite')
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')
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. You can add a list of style definitions to add custom styling to your map.

from motionless import DecoratedMap
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)
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

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

Munich

Produced from GeoRSS feed. See examples/earthquakes.py

Earthquakes

About

motionless is a Python library that takes the pain out of generating Google Static Map URLs.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%