https://github.com/perliedman/openlayers-tilejson
Create map or tile layer from TileJSON, with projection support
https://github.com/perliedman/openlayers-tilejson
Last synced: over 1 year ago
JSON representation
Create map or tile layer from TileJSON, with projection support
- Host: GitHub
- URL: https://github.com/perliedman/openlayers-tilejson
- Owner: perliedman
- License: bsd-2-clause
- Created: 2013-10-25T10:57:42.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-12-13T08:10:03.000Z (over 12 years ago)
- Last Synced: 2025-01-30T13:21:49.484Z (over 1 year ago)
- Language: JavaScript
- Size: 136 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openlayers-tilejson
openlayers-tilejson adds support for the
[TileJSON](https://github.com/mapbox/tilejson-spec) specification
to the [OpenLayers](http://openlayers.org) map client.
For extra fun and possibility of future profit, openlayers-tilejson
also supports an
[extension to the TileJSON specification](https://github.com/perliedman/TileJSON/tree/master/2.0.0),
which allows other projections than spherical-mercator. This
extension requires [Proj4js](http://trac.osgeo.org/proj4js/) as extra dependency.
## Example
```javascript
var osmTileJSON = {
"tilejson": "2.0.0",
"name": "OpenStreetMap",
"description": "A free editable map of the whole world.",
"version": "1.0.0",
"attribution": "© OpenStreetMap contributors, CC-BY-SA",
"scheme": "xyz",
"tiles": [
"http://a.tile.openstreetmap.org/{z}/{x}/{y}.png",
"http://b.tile.openstreetmap.org/{z}/{x}/{y}.png",
"http://c.tile.openstreetmap.org/{z}/{x}/{y}.png"
],
"minzoom": 0,
"maxzoom": 18,
"bounds": [ -180, -85, 180, 85 ],
"center": [ 11.9, 57.7, 8 ]
};
var map = OpenLayers.Layer.TileJSON.createMap('map', osmTileJSON);
```
## Limitations
This is, as everything else, a work in progress. Current known limitations are:
* No support for UTFGrid interaction. Mostly because Leaflet does not currently support UTFGrid.
* Only the first tile URL specified is used.
* Bounds are currently hardcoded.