Hello i have a map with complex features. each feature has 4 attributes.
Province | Regency | Sub-District | Village
i am using openlayers to display my map. i need to be able to style this map with color based on attributes and filtering each of this features based on the common attributes. which is is the best way to do this? using merge or dissolve? or can i do this with openlayers?
for example
i have options to select the scope of the attributes color to be displayed.
for example when i choose scope village
Province | Regency | Sub-District | Village
A 101 X1 Z1
A 101 X2 Z2
B 102 X3 Z3
B 102 X4 Z4
C 103 X5 Z5
but when i choose scope Regency the result will be
Province | Regency |
A 101
B 102
C 103
and if i use merge does the features after merging disappear?
OpenLayers has some excellent in-built classes that can help you out quite a bit. I think the classes you are looking for are OpenLayers.Strategy.Filter and OpenLayers.StyleMap.
The Filter Strategy allows you to specify a Filter object to a layer that will hide features that do not match the filter.
The StyleMap allows you to define Style objects to the features based on attributes or computed attributes (function output).
For both of these, there are great examples that you can find online (using the Google) to see these classes in action.