archesproject / arches-docs

official repo for Arches documentation
https://arches.readthedocs.io
9 stars 20 forks source link

Add developer guidance for implementing frontend polygon simplification via turfjs #417

Open whatisgalen opened 3 months ago

whatisgalen commented 3 months ago

describe the issue

Move the commented lines below from map-popup-provider.js:

define([
    'arches',
    'knockout',
    'turf',
    'templates/views/components/map-popup.htm'
], function(arches, ko, turf, popupTemplate) {

...

sendFeatureToMapFilter: function(popupFeatureObject)
        {
            let feature = popupFeatureObject.geometries()[0].geom.features[0];
            // Note that polygons with very high vertex-counts can benefit from simplification.
            // To use turf.js library, uncomment the next 3 lines:
            // const tolerance = 0.1; // Degree of Simplification: Lower numbers are less simplified, preserving more detail
            // const highQuality = true; // Set to true for a slower but higher quality simplification
            // turf.simplify(feature.geometry, {tolerance: tolerance, highQuality: highQuality, mutate: true});
            popupFeatureObject.mapCard.filterByFeatureGeom(feature, popupFeatureObject.resourceinstanceid);
        },

into the documentation in a section ostensibly titled "Simplifying polygons (with high vertex-count) on the frontend" and provide as a code example the above implementation, along with

please add links to existing docs or code (if relevant)
which release does this issue concern?

7.6