-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose Filter options for GeoJson #172
Comments
I don't understand the proposal. Could you give an example? |
I have two cases where currently I generate multiple small geojson files instead of one bigger. The first is visualisation of project stages for a trail construction project where we have Stage1, then Stage1 and Stage2 (i.e. Stage 1 is complete and now we do Stage2) so the same data gets repeated in each file. The second is where there are points that need to be as standard markers or as circle markers. These require their own files as the circlemarker can't be applied on a per point basis from the shortcode. I have modded your shortcode code like this.. |
What kind of filters are you thinking? Maybe something like this Then the filter function can be: var filteredProps = filterString.split(',').reduce(function(a, b) {
var parts = b.split(':');
a[parts[0]] = parts[1];
return a;
}, {});
var filter = function (feature) {
for (var key in filteredProps) {
if (feature.properties[key] !== filteredProps[key]) {
return false
}
}
return true
}; |
something like that but I have a list of values for each property i.e. |
So, like |
Yes, that is the idea. Otherwise I think we drop into intepreting code or
passing a javascript expression with all its validation headaches.
|
I think I was going to ask a similar question. Translated with www.DeepL.com/Translator (free version) from Ich glaube ich wollte eine änliche Frage stellen. |
It may be not what you want, but have a look at [geojsonmarker] or [leaflet-featuregroup] from Extensions for Leaflet Map. |
It would be really nice to be able to impose a filter from the geojson shortcode, something like
[leaflet-geojson src="...." filter_json="{property}='..some value..'"]{PopupText}[/leaflet-geojson]. (where the expression in the filter_json is evaluated by the filter: function call from Leaflet GeoJson.)
I have had a wee tinker and with my limited javascript skills can get something to work if I use the feature.properties.Property syntax and this is OK but verbose and think that the curly braces syntax would be better.
The text was updated successfully, but these errors were encountered: