Skip to content
Nick Whitelegg edited this page May 3, 2020 · 9 revisions

Tiles for Kothic JS can be generated from osm2pgsql PostGIS database by a script like json_getter.py

See json_getter-setup for an setup howto.

An example set of tiles is hosted on http://osmosnimki.ru/vtile/ - please don't use it heavily-loaded projects for now.

Tile names follow OSM scheme: tile /0/0/0.js contains whole world, tile /1/0/0.js contains left-upper corner of tile /0/0/0.js and so on (more info: Slippy map tilenames)

As of May 2020 (post-Leaflet 1.x compatibility), tiles are GeoJSON-like (but without a 'geometry' property, and using Spherical Mercator as described below) and should follow this scheme: {"features":[ features list ], "bbox":[ EPSG:4326 bounding box ], "granularity": granularity }

All coordinates of features should be Spherical Mercator integers. To save bandwidth and disk space, they are calculated to be relative to tile boundaries: [0,0] represents lower right corner, and [granularity, granularity] represents upper right.

Features list contains features as JSON objects one by one, and are alike usual GeoJSON.

{"reprpoint":[5388,5976],"type":"Polygon","properties":{"landuse":"residential","name":"гостинный двор"},"coordinates":[5380,5975],[5383,5985],[5397,5979],[5391,5968],[5380,5975]}

Polygons have additional field "reprpoint", which stores coordinates of "representative point" that lies inside the source polygon - a point where an icon or text should be drawn. That point can be even outside of the tile.

If a polygon or a line crosses a tile boundary, it should be cropped to only contain points that lie inside or on boundary of a tile, but Kothic JS will automatically hide edges of polygon which lie on tile boundaries.

Clone this wiki locally