Here are some ideas on how best to debug GeoJSON. This was inspired by Adam’s use of GeoJSON.io, and my laziness with copy and paste!
The workflow is as follows:
testVectorToGeoJsonMilngavie
which generates milngavie.geojson
). The filename must have the suffix .geojson
.gh
gh gist create app/milngavie.geojson
gh gist list
(referred to as XXX_GIST_ID_XXX
in the following examples)gh gist edit XXX_GIST_ID_XXX app/milngavie.geojson
The only limitation of this method is that the gist must smaller than 1MByte. Otherwise, it’s a very quick way of viewing GeoJSON without having to copy or paste any text.
Getting hold of tiles from our server is straightforward e.g.
wget https://d1wzlzgah5gfol.cloudfront.net/protomaps/15/17509/11948.pbf -O 17509x11948.mvt
However, an additional bit of workflow is required when making changes to the map where we want to test it prior to it being uploaded to the server. For this we have to build planetiler
(see the instructions in the mapping doc). Then we need to use that to build a small map to test with. I build the whole of Scotland, though building Monaco is the default and very slightly quicker option e.g.
java -Xmx30g -jar target/planetiler-openmaptiles-3.15.1-SNAPSHOT-with-deps.jar --force --download --area=monaco --fetch-wikidata --output=monaco.pmtiles --nodemap-type=array --storage=mmap --maxzoom=15 --render_maxzoom=15 --simplify-tolerance-at-max-zoom=-1
It will take slightly longer to run the first time as it has to download the various data sources. However, it still takes around 100 seconds to run on my fairly fast linux PC. Once the mapping file has been generated there are various ways to use it:
tileserver-gl-light --file monaco.pmtiles
. This allows viewing of the map both as a graphical UI map or as tile data where points can be queried.git checkout git@github.com:protomaps/go-pmtiles.git
cd go-pmtiles
go build main.go
go install main.go
main tile monaco.pmtiles 15 17509 11948 > 17509x11948.mvt
For larger protomaps files (e.g. Europe, the output tiles are gzipped, and so they need to be unzipped as they come out e.g. main tile monaco.pmtiles 15 17509 11948 | gunzip > 17509x11948.mvt
). The resulting mvt files can then be used from within unit tests etc.