ThinkGeo.com    |     Documentation    |     Premium Support

Large GeoJSON data issue

Hi,

We are using the ThinkGEO library in our web services (WebAPI) to convert Shape Files into GeoJSON data format. The issue is when I convert a large Shape File (100MB) into GeoJSON data it is fine, but when I load the GeoJSON data to OpenLayers v3 it just crashes and not able to see any layer on the map.

Please provide any suggestion for loading large GeoJSON data to OpenLayers v3. Thanks.

Regards,
Jay

This is our use case:

  1. We have a few large Shape Files, approx. 60-100MB each
  2. We use ThinkGEO library to convert these shape files into GeoJSON through our web services (WebAPI v2)
  3. Then we got 80-120MB of each GeoJSON data after the conversion (so the GeoJSON data is slightly larger than the original Shape Files)
  4. We tried to load each of the GeoJSON data into the OpenLayers v3 using HTML5 technology
  5. Problem: We are unable to see any layer on OpenLayers v3 map and the browser just crashed out.

Seeking for advise on how to load large GeoJSON data into OpenLayers v3 map.

Hi Kerry,

I want to double check about the “crash out” here, it means not response or browser is closed?

I am not sure whether browser have enough memory to load the big shape file, but I think to load a 100mb file into browser via internet need takes so long time, and it’s not a good solution.

We should render the shape file in server side, then pass the tile image back to browser, that’s how we handle that in our web edition also.

Regards,

Don

Hi Don,

We are using PhoneGap/Cordova, which is using HTML5 technology to download the 100mb of GeoJSON data via the web service, so the file is stored locally on the device. The problem is when I load the local GeoJSON data into OpenLayers the mobile app crashes without any error, I think this would be the out of memory issue.

We’d like to provide offline solutions to our customers, so all the GeoJSON data (100mb - 200mb) needs to be stored on the device, and render them locally without talking to a web service, so the user can interact with the map, e.g. be able to select/highlight a feature, delete a feature, add a marker, draw and save shapes, etc. If we pass the tile image back to the app, user cannot interact with the map.

Is there a way to handle large GeoJSON data with OpenLayers v3? Or is there any solution for it?

Thanks,
Jay

Hi Jay,

Thanks for your detail description, I understand your scenario now.

But we don’t have related project experience, and we hadn’t ever tried to load big GeoJSON data by Openlayers, so maybe I cannot give you some suggestion about how to handle this problem.

But I think you’re right, that should because the memory limitation. Because I remembered the localstorage can only saved 10mb or smaller data in browser, but I think you can try to look into indexdb, which maybe helpful.

Regards,

Don

We had a similar problem (using leaflet.js, but I think it’s comparable)
Rendering 100-150 MB GeoJSON works with a good rendering speed, but the memory requirements on the client is huge (> 600 MB). Too much for a mobile device, even a modern iPhone. In our tests the mobile browser simply crashed.

Only solution seems to be shape simplification (quite hard thing).

Hi Andreas,

Yes the mobile browser set strict limitation, it’s system level problem so we cannot handle that.

I think you maybe want to split your data into smaller size and load them when you need it.

Regards,

Don