Akylas / tyler

Python webservice for tiling static maps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tyler

Python webservice for tiling static maps.

Build Status Badge Code Health Badge Version Badge Downloads Badge Wheel Status Badge License Badge

Demo

A demo can be found at https://tyler-demo.herokuapp.com - the Heroku project code is at https://github.com/benbacardi/tyler-heroku

Usage example

Installation

Tyler is designed to be deployed in your own Django environment.

  • Add cacheback and tyler to your INSTALLED_APPS setting.
  • Add tyler.urls to your urls.py:
urlpatterns = patterns('',
    url(r'^', include('tyler.urls')),
)
  • Optionally, set TYLER_CACHE_DURATION to cache . It defaults to one week.

Usage

To use the service, call the URL with optional parameters to return the image in a .png format:

GET /?lat=51.5008198&lon=-0.1427437&width=800&height=600

The available parameters are:

  • lat: The latitude to center the map on.
  • lon: The longitude to center the map on.
  • zoom: The zoom level (0 to 19). Defaults to 17.
  • width: The pixel width of the resulting image. Defaults to 800.
  • height: The pixel height of the resulting image. Defaults to 600.
  • greyscale: Whether to render the image in greyscale. Defaults to False.
  • tile_url: The URL of the tiling service. Defaults to OpenStreetMap's: http://[abc].tile.openstreetmap.org/{zoom}/{x}/{y}.png. Requires the following parameters in the URL:
    • {zoom}: Where the zoom level is defined.
    • {x}: The x-tile coordinate.
    • {y}: The y-tile coordinate.
    • [???]: Available content sharding domains. For example, OpenStreetMap uses [abc]. MapQuest uses [1234].

Caching

To control the caching of the resultant image, set TYLER_CACHE_DURATION in settings.py to the number of seconds to cache for. This defaults to one week.

To control the caching of the individual tiles used to create the image, set TYLER_TILE_CACHE_DURATION in settings.py to the number of settings to cache for. This also defaults to one week.

About

Python webservice for tiling static maps

License:GNU General Public License v3.0


Languages

Language:Python 100.0%