Hello GeoTools devs,
I've been working with the MapBox styles module, trying to implement some
of the MapBox Expressions, specifically the FeatureData "properties"
expression (documented here:
Essentially, the "properties" expression is intended to be used to fetch
all of the feature schema columns (attributes, not the values) for a
feature that is to be rendered.
In looking at the code and how existing SLD filters and functions work, it
seems that the feature's Geometry and ID are included at render time, along
with only the attributes explicitly required by the style's Rules. I
understand this is done for performance reasons.
As an example of what I'm talking about, consider the "population" style
that comes with community GeoServer and the US Population layer
(topp:states) which uses that style as it's default. The layer has 22
attributes (not including its ID or its geometry), my goal is to return a
list of the layer attributes’ names for use in the “properties” expression.
The “population” style makes use of a few filters/functions that change the
color of each of the states based on population thresholds, and apply each
state's 2 letter abbreviation as a label. When the OpenLayers preview is
rendered, the filters/functions used in the style are "evaluated" and
passed each feature to be rendered. However, the features that are passed
to these filters/functions are not fully populated as the schemas only
contain the feature Id, the geometry and in this case the population
(PERSONS) and the abbreviation (STATE_ABBR). None of the other attributes
are in the schema at render time as they are not needed. From what I can
tell, this happens when the style is processed in StreamingRenderer, and
the process uses a StyleAttributeExtractor visitor to process the style for
Rules that contain necessary attributes for rendering.
I'm trying to figure out if there is a way to make the
StyleAttributeExtractor "add" all the attributes in this process without
having to specify them all in a Rule(s). I understand that doing so can
impose a huge performance penalty.
Many thanks in advance,
Software Engineer | Boundless
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
GeoTools-Devel mailing list