Giter VIP home page Giter VIP logo

acalcutt / tileserver-gl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maptiler/tileserver-gl

5.0 3.0 3.0 12.22 MB

Vector and raster maps with GL styles. Server side rendering by Mapbox GL Native. Map tile server for Mapbox GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.

Home Page: https://tileserver-gl.readthedocs.io/en/latest/

License: Other

JavaScript 83.15% Shell 1.13% CSS 14.03% Dockerfile 1.70%

tileserver-gl's Introduction

MapLibre TileServer GL

GitHub Workflow Status Docker Hub

Vector and raster maps with GL styles. Server-side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.

Download vector tiles from OpenMapTiles.

Getting Started with Node

Make sure you have Node.js version 14.20.0 or above installed. Node 18 is recommended. (running node -v it should output something like v18.x.x). Running without docker requires Native dependencies to be installed first.

Install @acalcutt/tileserver-gl with server-side raster rendering of vector tiles with npm.

npm install -g @acalcutt/tileserver-gl

Once installed, you can use it like the following examples.

using a mbtiles file

wget https://github.com/acalcutt/tileserver-gl/releases/download/test_data/zurich_switzerland.mbtiles
tileserver-gl --mbtiles zurich_switzerland.mbtiles
[in your browser, visit http://[server ip]:8080]

using a config.json + style + mbtiles file

wget https://github.com/acalcutt/tileserver-gl/releases/download/test_data/test_data.zip
unzip test_data.zip
tileserver-gl
[in your browser, visit http://[server ip]:8080]

Alternatively, you can use the @acalcutt/tileserver-gl-light npm package instead, which is pure javascript, does not have any native dependencies, and can run anywhere, but does not contain rasterization on the server side made with Maplibre GL Native.

Getting Started with Docker

An alternative to npm to start the packed software easier is to install Docker on your computer and then run from the tileserver-gl directory

Example using a mbtiles file

wget https://github.com/acalcutt/tileserver-gl/releases/download/test_data/zurich_switzerland.mbtiles
docker run --rm -it -v $(pwd):/data -p 8080:8080 wifidb/tileserver-gl --mbtiles zurich_switzerland.mbtiles
[in your browser, visit http://[server ip]:8080]

Example using a config.json + style + mbtiles file

wget https://github.com/acalcutt/tileserver-gl/releases/download/test_data/test_data.zip
unzip test_data.zip
docker run --rm -it -v $(pwd):/data -p 8080:8080 wifidb/tileserver-gl
[in your browser, visit http://[server ip]:8080]

Example using a different path

docker run --rm -it -v /your/local/config/path:/data -p 8080:8080 wifidb/tileserver-gl

replace '/your/local/config/path' with the path to your config file

Alternatively, you can use the wifidb/tileserver-gl-light docker image instead, which is pure javascript, does not have any native dependencies, and can run anywhere, but does not contain rasterization on the server side made with Maplibre GL Native.

Getting Started with Linux cli

Test from command line

wget -O test_data.zip https://github.com/acalcutt/tileserver-gl/releases/download/test_data/test_data.zip
unzip -q test_data.zip -d test_data
xvfb-run --server-args="-screen 0 1024x768x24" npm test

Run from command line

xvfb-run --server-args="-screen 0 1024x768x24" node .

Documentation

You can read full documentation of this project at https://tileserver-gl.readthedocs.io/en/latest/.

Alternative

Discover MapTiler Server if you need a map server with easy setup and user-friendly interface.

tileserver-gl's People

Contributors

petrsloup avatar acalcutt avatar dependabot[bot] avatar vinayakkulkarni avatar tschaub avatar klokan avatar spatialillusions avatar loicgasser avatar zstadler avatar joakimfors avatar xabbu42 avatar mnutt avatar albanm avatar daliborjanak avatar disarticulate avatar candux avatar lukasmartinelli avatar efi avatar stirringhalo avatar stefslon avatar guenhter avatar nyurik avatar smellman avatar rubenpoppe avatar mloskot avatar leinfeldt avatar 0xflotus avatar mcolmant avatar rastapasta avatar monstrofil avatar

Stargazers

Robin avatar Philipp Gassmann avatar  avatar  avatar Martijn van Laar avatar

Watchers

Martijn van Laar avatar  avatar  avatar

tileserver-gl's Issues

Server crashes with X Error

I've gotten the tileserver running, but I'm running into an issue when I try to load a page. Here's the console output:

13:40:14 ❯ PORT=8005 tileserver-gl --mbtiles zurich_switzerland.mbtiles
Starting @acalcutt/tileserver-gl v4.0.8
[INFO] Automatically creating config file for zurich_switzerland.mbtiles
[INFO] Only a basic preview style will be used.
[INFO] See documentation to learn how to create config.json file.
Run with --verbose to see the config file here.
Starting server
Listening at http://[::]:8005/
Startup complete
GET /index.css 304 17.900 ms - -
GET /images/logo.png 304 26.502 ms - -
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  27 (X_GLXCreatePbuffer)
  Serial number of failed request:  37
  Current serial number in output stream:  40

I get this error when I try to run tileserver-gl on a Debian 11 machine when I try to load the home page.

Interestingly, running the server on my local desktop with Pop!_OS 20.04 (basically a reskin of Ubuntu 20.04) works a bit better, though the server still crashes when I try to load the raster tile map. Here's the console output there:

13:48:29 ❯ PORT=8005 tileserver-gl --mbtiles zurich_switzerland.mbtiles
Starting @acalcutt/tileserver-gl v4.0.8
[INFO] Automatically creating config file for zurich_switzerland.mbtiles
[INFO] Only a basic preview style will be used.
[INFO] See documentation to learn how to create config.json file.
Run with --verbose to see the config file here.
Starting server
Listening at http://[::]:8005/
Startup complete
GET / 200 108.850 ms - 2708
GET /index.css 200 10.189 ms - 3276
GET /images/logo.png 200 6.915 ms - 6407
GET /images/placeholder.png 200 7.988 ms - 2084
GET /images/header-map-1280px.png 200 4.169 ms - 174969
GET /fonts/OpenSans-Regular.ttf 200 4.563 ms - 217360
GET /fonts/OpenSans-Bold.ttf 200 4.503 ms - 224592
GET /styles/basic-preview/11/1072/717.png 200 289.960 ms - 54747
GET /favicon.ico 200 3.246 ms - 5430
GET /styles/basic-preview/?raster 200 22.524 ms - 3205
GET /maplibre-gl.css 200 2.113 ms - 68506
GET /maplibre-gl-inspect.css 200 1.189 ms - 1921
GET /leaflet.css 200 1.749 ms - 14004
GET /leaflet.js 200 1.981 ms - 143908
GET /leaflet-hash.js 200 3.239 ms - 3462
GET /L.TileLayer.NoGap.js 200 3.661 ms - 8137
GET /maplibre-gl.js 200 2.139 ms - 706133
GET /maplibre-gl-inspect.min.js 200 1.935 ms - 23455
GET /styles/basic-preview.json 200 2.960 ms - 479
GET /styles/basic-preview/11/1072/717.png 304 1.535 ms - -
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  27 (X_GLXCreatePbuffer)
  Serial number of failed request:  30
  Current serial number in output stream:  37

Note that when the X error occurs, the service crashes. Any ideas on how to go about solving this?

EDIT: Okay, so I think the error I'm getting on my Debian server is being propagated from my local machine because of X forwarding. If I ssh into the Debian server without X forwarding turned on, I get a different error when I attempt to load a server page.

14:08:30 ❯ PORT=8005 tileserver-gl --mbtiles zurich_switzerland.mbtiles
Starting @acalcutt/tileserver-gl v4.0.8
[INFO] Automatically creating config file for zurich_switzerland.mbtiles
[INFO] Only a basic preview style will be used.
[INFO] See documentation to learn how to create config.json file.
Run with --verbose to see the config file here.
Starting server
Listening at http://[::]:8005/
Startup complete
GET / 304 280.505 ms - -
GET /index.css 304 51.538 ms - -
GET /images/logo.png 304 27.910 ms - -
terminate called after throwing an instance of 'std::runtime_error'
  what():  Failed to open X display.
Aborted

Chinese/Japanese characters not being rendered on raster map

I'm having trouble getting Chinese/Japanese names to show up on my raster map. Oddly enough, I do not have this problem with my vector tiles.

Here's a rendered vector tile from within Tokyo.

image

Here's roughly the same raster tile.

image

When I modify my style.json to render road label class instead of road name, we can see that there are a at least a few road labels within the tile.

image

I think this is probably an issue with my style.json, or maybe my fonts, because I see that other styles successfully render Chinese/Japanese labels. But I'm having trouble figuring out what could be going wrong, since my vector tiles seem fine.

Do you have any advice for debugging this issue?

tileserver-gl version

OS

Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

If it's of any use, you can find the frontend for my tileserver-gl here: http://flan.nettoolkit.com:8005/

Static Image Generation Only Uses one Tile

I just tried to use the static tile generation. However, the resulting tiles seems to be only using one tile.

I can see that there is a warning in the log:

mlgl: {
  class: 'General',
  severity: 'WARNING',
  text: 'Provided camera options returned 4 tiles, only 11/1100/671=>11 is taken in Tile mode.'
}
GET /styles/my-style/static/13.389587,52.515359,12/500x500.png 200 162572 - 63.870 ms

The generated static map looks like this:
500x500

The same with the "old tileserver-gl" looks like this:
500x500 (1)

To me it seems that only one source tile is used, the warning message seem to hint at that as well. Interestingly some text is still used on the empty tiles? This seems to be related to the observations made here: maptiler#542

Some labels appear cutoff in raster tiles

I'm having an issue where some of the labels in raster tiles appear cutoff.

image

When I look at the actual image being generated, I can see that the labels are clearly being cutoff at the image boundaries.

image

This looks very much like this issue in MapLibre GL Native that @acalcutt raised. Reading through that thread, I got the impression that the issue should be fixed on master now, but I'm not totally sure if that's the case.

For reference, here's my npm package versions.

danwoz@flan tegola  master [!?] 
13:43:28 ❯ npm ls -g --depth 1
/home/danwoz/.nvm/versions/node/v16.15.0/lib
├─┬ @acalcutt/[email protected]
│ ├── @acalcutt/[email protected]
│ ├── @mapbox/[email protected]
│ ├── @mapbox/[email protected]
│ ├── @mapbox/[email protected]
│ ├── @mapbox/[email protected]
│ ├── @maplibre/[email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]

Compile and Run Locally

I just tried to run tileserver-gl locally without Docker. Building the Docker image locally also failed.

For the local run, I think I would have to install quite a lot of dependencies, so it would be great if the docker build would work. (MacOS doesn't include X11 by default)

The Docker build failed as well. I think this is because I am on a machine with ARM CPU (Apple Silicon).

npm ERR! code 1
npm ERR! path /usr/src/app/node_modules/canvas
npm ERR! command failed
npm ERR! command sh /tmp/install-6cd65663.sh
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/usr/src/app/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/usr/src/app/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | linux | arm64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v93-linux-glibc-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v93-linux-glibc-arm64.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v93 ABI, glibc) (falling back to source compile with node-gyp) 

I was running the Docker build with:

docker build -f Dockerfile .

Add marker to static images

Thanks a lot for maintaining this fork! I just gave this a try and it seems to work well 🎉. One thing that is currently missing from tileserver-gl is the ability to add markers to static images.

There is an open PR upstream for this: maptiler#427

I am wondering if you would be interested in adding this feature to your fork?

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.