yourcelf / olwidget

Javascript library to replace textareas that contain WKT data with editable OpenLayers maps, and a django app using it for django forms and admin.
Other
91 stars 43 forks source link

Stamen maps tile set for OpenStreetMap #106

Open turukawa opened 12 years ago

turukawa commented 12 years ago

Stamen has released three tile-sets for use with OpenStreetMap (http://maps.stamen.com/). I would love to use them with OLWidgdet but have no idea how to do so.

It would be great to have either some way of including use of a custom tile-set easily, or somewhere in the documentation which details how to do this.

RobertoMaurizzi commented 11 years ago

According to their example at view-source:http://maps.stamen.com/test/openlayers.html, after you load their tile.stamen.js library, OpenLayers gets a new Layer Object for their map. You should be able to add in your django settings something like:

OLWIDGET_CUSTOM_LAYER_TYPES = {
    'stamen_toner': """OpenLayers.Layer.Stamen("toner")""",
    'stamen_terrain': """OpenLayers.Layer.Stamen("terrain")""",
    'stamen_watercolor': """OpenLayers.Layer.Stamen("watercolor")""",
}

then you'll be able to request maps of layer type "stamen_toner" instead of osm.mapnik or google.hybrid. Please check their docs to see if there are other useful parameters to the OpenLayers.Layer.Stamen function

Roberto P.S. ... didn't notice this was 1 year old... :-(