1

I working on an ASP MVC web app that calls a web service to get the polygons (as GeoJSON files) to display on the client side in OpenLayers. These polygons contain in total 47191 points !! Which makes roughly 5Mb of data...

Are there any strategies to transfer big amounts of GIS data through a web service without the size overhead ?

I've tried GZipping the requests but it didn't help much.

Is it possible to transform the GeoJSON files to some binary format to be downloaded and read by OpenLayers ?

  • For display of GIS data whether input data is raster or vector, the best option would be WMS or WMTS, which deliver images. Querying of the data at any point location is also supported. – nmtoken Nov 14 '17 at 12:38
2

Are you talking about raster or vector tiles?

If you can style them server side you just could serve it as WMS raster tiles so amount of points doesn't matter. QGIS server could do that.

The most efficient format for vector tiles so is MVT, which is a binary format based on Google Protobufs. You could use tippecanoe to convert GeoJSON to MVT or serve them directly from PostGIS using ST_AsMVT. Here is an example of how to use them with Openlayers.

If you really have to work with the original GeoJSON file you could give geojson-vt a try:

A highly efficient JavaScript library for slicing GeoJSON data into vector tiles on the fly, primarily designed to enable rendering and interacting with large geospatial datasets on the browser side (without a server).

Here is an example of integration with Openlayers.

  • This is the best way. You need a simple web service to get map from the mbtiles as online tiles. As readymade software I would suggest geoserver, this can show any size data as either raster or also vector tiles, and setup is relatevily simple – JaakL Nov 14 '17 at 6:52
1

There is one format you can try: geobuf

  1. in server convert data from geojson to geobuf - there are node geobuf, python and java ready tools for that. Not sure about .net
  2. In client JS side decode geobuf to geojson and add as geojson layer to whatever client you use.

Sample code:

// decode
var geojson = geobuf.decode(new Pbf(data));

// Leaflet:
var layer = L.geoJson(geojson).addTo(map);

// OpenLayers:
var vectorSource = new ol.source.Vector({
   features: (new ol.format.GeoJSON()).readFeatures(geojson)
});

It may work for small-medium size datasets; I'd say <10MB is worth trying, but it depends on details. For bigger datasets vector tiles is usually the best viable option.

0

I am not sure of the exact details of the scenario you are talking about, but a strategy could be to use a Cron job or scheduler that fires off a python script on some sort of regular schedule. The script could pull the data from the service and store it locally. The data could be stored in a local database SQL or NoSQL. The applications that you are creating or are using that consume the spatial data could then use the local version and hopefully run a little faster.

  • I have to download the geojson from the server and display it to the client in real time, and that takes a lot of time to download. Cron jobs are not relevant to my case. – Mehdiway Nov 10 '17 at 1:06

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.