Vector Tile Cache
This application is deprecated and no longer in use. With the exception of data stored in AGOL, all vector tiles and GeoJSON data is served directly from Postgres via pg_tileserv and pg_featureserv
This is done with a script that runs nightly as a scheduled task on the GIS computer (it could run directly on the server as well). It is located at Z:\scans\GIS_Applications\production\geojson-sde-backup-and-vector-tile-cache\index.js
. This script does the following:
This script does not work with MultiPoint geometry. If it fails try setting
create single part instead of multi-part
when uploading to Postgres
- Spins up a simple Node server to serve out GeoJSON endpoints of all data in the Postgres database with user “viewer” select privledges.
- Downloads a layer list.
- Appends the layer list with the timestamp for the last edited date of the layer.
- Compares the timestamp to a cached layer list - saved as a json file in the same folder as the script.
- Downloads any changed files as GeoJSON.
- Compares these files to the GeoJSON files on the 311 server.
- If new, adds a unique ID to the file, creates a centroid label layer if it is a polygon, and overwrites the 311 GeoJSON cache with these files.
- Creates a vector tile cache on the 311 server using a modified version of
geojson2mvt
. - An available layers list is updated on the 311 server as is the layerCacheList.json in the script folder.
Some large files, such as the
env_contours_10ft_simplified
are too large to be cached using this script. The vector tiles for any large files such as these were created by first exposting the geojson from QGIS then using thevtile
script directly on this file, increasing the Node memory limit withnode --max_old_space_size=16384 vtile -f filename -Z 16