Skip to content

mapsam/get-or-tile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

get ... or tile

This is an example tile server that gets a vector tile from a local filesystem if it exists, otherwise generates a new tile from a geojson source and serves it on demand. Once a tile is generated on demand, it is stored in the tile cache for the next request.

Here's an example of the server generating tiles as the user scrolls as well as serving already generated and cached tiles.

How to use it

Firstly, don't use this for huge datasources. It'll clog up the javascript event loop and crash your server. Running it locally takes a few steps.

First, clone the repo

git clone [email protected]:mapsam/get-or-tile.git

Then edit the viz/index.html file to add your Mapbox access token. And finally run the following commands:

cd get-or-tile
npm install

# create (and clear) the local cache
npm run clear-cache

# start the server
npm start

# start a separate server for the web map (open another terminal)
cd get-or-tile/viz
python -m SimpleHTTPServer

Now you can go to http://127.0.0.1:8000 to see the map load tiles from cache or source.

About

Get a vector tile from cache or on demand

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published