Skip to content

Add vector tile support #775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2025
Merged

Add vector tile support #775

merged 1 commit into from
Aug 14, 2025

Conversation

tidwall
Copy link
Owner

@tidwall tidwall commented Aug 14, 2025

This commit adds commands for returning objects in a vector tile. Allows for fetching tiles over JSON, RESP, or HTTP.

Using the command "INTERSECT key MVT x y z", Tile38 returns a vector tile containing objects that intersects the tile at (x,y,z). The format is a Mapbox Vector Tile, which can be loaded into mapping tools that support mvt/pbf sources, such as mapbox, maplibre, leaflet.js, etc.

Example using the tile38-cli:

INTERSECTS fleet MVT 50 23 7

Returns json with an "mvt" member as base64.

{"ok":true,"mvt":"Gg0KBnRpbGUzOCiAIHgC","count":1,"cursor":0}

If desired, The raw (non-base64) binary can be returned when the client output is set to 'resp', as with "OUTPUT resp".

The number of items that are included in the mvt binary are limited to 100, which is the default for all Tile38 spatial commands, but can be increased using the LIMIT option.

INTERSECTS fleet LIMIT 10000000 MVT 50 23 7

Direct http access is allowed using the following URL.

http://{ip}:{port}/{collection}/{z}/{x}/{y}.(mvt|pbf)

Such as:

http://127.0.0.1:9851/fleet/7/50/23.mvt

A simple map viewer is provided with Tile38 for viewing and experimenting with vector tiles.

http://127.0.0.1:9851/viewer

All objects are encoded as features in the MVT binary format. Each feature is tagged with an 'id' and 'type' property. These properties can be used for programatically filtering at the source layer. All source layers are named 'tile38'.

View the source code for the web viewer from a web browser to see a working example.

This commit adds commands for returning objects in a vector
tile. Allows for fetching tiles over JSON, RESP, or HTTP.

Using the command "INTERSECT key MVT x y z", Tile38 returns
a vector tile containing objects that intersects the tile at
(x,y,z). The format is a Mapbox Vector Tile, which can be
loaded into mapping tools that support mvt/pbf sources, such
as mapbox, maplibre, leaflet.js, etc.

Example using the tile38-cli:

  INTERSECTS fleet MVT 50 23 7

Returns json with an "mvt" member as base64.

  {"ok":true,"mvt":"Gg0KBnRpbGUzOCiAIHgC","count":1,"cursor":0}

If desired, The raw (non-base64) binary can be returned when
the client output is set to 'resp', as with "OUTPUT resp".

The number of items that are included in the mvt binary are
limited to 100, which is the default for all Tile38 spatial
commands, but can be increased using the LIMIT option.

  INTERSECTS fleet LIMIT 10000000 MVT 50 23 7

Direct http access is allowed using the following URL.

  http://{ip}:{port}/{collection}/{z}/{x}/{y}.(mvt|pbf)

Such as:

  http://127.0.0.1:9851/fleet/7/50/23.mvt

An simple map viewer is provided with Tile38 for viewing and
experimenting with vector tiles.

  http://127.0.0.1:9851/viewer

All objects are encoded as features in the MVT binary format.
Each feature is tagged with an 'id' and 'type' property. These
properties can be used for programatically filtering at the
source layer. All source layers are named 'tile38'.

View the source code for the web viewer from a web browser to
see a working example.
@tidwall tidwall merged commit a2afb21 into master Aug 14, 2025
1 check passed
@tobilg
Copy link
Contributor

tobilg commented Aug 15, 2025

This is crazy useful! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants