GithubHelp home page GithubHelp logo

allrod5 / motionless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ryancox/motionless

0.0 1.0 0.0 100 KB

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

License: Other

Python 100.00%

motionless's Introduction

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.6, 2.7, 3.4, and 3.5.

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.

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, 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)
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 geojson feed. See examples/earthquakes.py

Earthquakes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.