2

I need to display huge GeoJSON file using OpenLayers. So I decided to use VectorTiles. Library geojson-vt.js works perfectly for me, but unfortunately it requires my GeoJSON file to be preloaded on client. As it is about 120MB, it's not possible. So I started to look for a way, how to serve the data from my web server. I can see 2 options:

  1. Serve it on fly like geojson-vt.js does. Is there a PHP library capable doing this? I haven't been able to find any.
  2. Create vector tiles pyramid and serve the tiles per request. I was able to find only 1 way, how to split my GeoJSON to vector tiles - using GDAL - ogr2ogr. Is there another way? I installed GDAL on my Centos 7 box and on my Windows 10 PC. Running command

    ogr2ogr -f MVT -dsco FORMAT=MBTILES -dsco MAXZOOM=18 previews.mbtiles previews.geojson
    

finishes with error "Unable to find driver `MVT'" on both of them. gdal-config --formats command gives me this result:

 gxf gtiff hfa aigrid aaigrid ceos ceos2 iso8211 xpm sdts raw dted mem jdem envisat elas fit vrt usgsdem l1b nitf bmp airsar rs2 ilwis rmf leveller sgi srtmhgt idrisi gsg ingr ers jaxapalsar dimap gff cosar pds adrg coasp tsx terragen blx msgn til r northwood saga xyz hf2 kmlsuperoverlay ctg e00grid zmap ngsgeoid iris map cals safe sentinel2 derived prf mrf grib bsb gif jpeg png pcraster zlib pcidsk rik ozi pdf postgisraster arg

I found a suggestion, that "./configure --with-spatialite --with-sqlite" should help on CentOS, but it didn't. Any idea how I can move forward? I don't care whether with ogr2ogr or other tool. I just need to serve my GeoJSON from my web server (without using special GIS server) as vector tiles.

  • did you add any other options with --with-spatialite ...? – Ian Turton Jul 3 at 16:31
  • What is your GDAL version gdalinfo -- version? – user30184 Jul 3 at 17:38
  • user30184 - the version is "GDAL 2.2.3, released 2017/11/20" – user3523426 Jul 7 at 12:21
  • Ian - I used "./configure --with-libkml" during installation and, when I got the MVT error, I used "./configure --with-spatialite --with-sqlite". – user3523426 Jul 7 at 12:25
  • Did you try geojson2mvt: github.com/NYCPlanning/labs-geojson2mvt? – TomazicM Jul 8 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.