Open DiegoPino opened 3 years ago
@pcambra following your advice I plan on making everything that is "Views" extending a submodule shipped with formatter_strawberryfield
And more info here https://github.com/calvinmetcalf/leaflet-ajax
The fact that you can pass an array of URLs to L.geoJson.ajax
makes things even more promising or you can dynamically (as new things get download) add them to the existing layer.
An example with some cool styling based on custom properties (which we have full control off because its just a twig template!) I love archipelago gosh https://leafletjs.com/examples/choropleth/
Nothing new, but the we can do better and the code is actual discrete
Drupal has many modules that do this. The most common approach is to use a Views Attachment that gathers all features from a GeoField (so DB) and the the actual Style Plugin of a View renders it.
The approach is not very performant and I can see how this will fail for 10,000 or so features.
Leaflet, our favorite library can Stream via Ajax GeoJSON and that is how we do it here for a single ADO with Geographic information using an exposed Metadata Display Entity that produces GeoJSON
https://github.com/esmero/format_strawberryfield/blob/9f0241d7eace4465e18a862ce4ce5d3bd3bbc34f/js/leaflet_strawberry.js#L41-L47
So. To build this custom View Formatter we are going to do something simpler:
This approach can also be used for other libraries that generate large amount of data and inclusive, we can allow each ADO to have not only its own geoJSON producing endpoint as source, but also another JSON key with an external link with geoJSON points. With the issue of course that cross domain (CORS) Ajax access is not an easy peasy task so will probably not be as simple as our local approach.
Another example of how this could work is the 3D formatter applied as a View Formatter (not the same code, just similar) to stream multiple sources of 3D PointClouds to build from many many ADOs a full large scene! Imagine an Archeologic site (or a City) where each ADO provide a small subset of 3D and the View Renders all elements. 3D maps? So much!
@pcambra @patdunlavey @alliomeria @giancarlobi what do you think?