StationA / tilenol

Scalable, multi-backend geo vector tile server
MIT License
22 stars 6 forks source link

Add request parameter to query extra source fields. #31

Closed ccma14 closed 4 years ago

ccma14 commented 4 years ago

Description

This PR addresses issue #28, by adding support for a matrixed s query parameter when rquesting a tile. -- This allows for additional properties to be added to features, beyond what's specified in the layer defintion.

For example, a request like

http://mytilenolserver.company.com/_all/16/10486/25327.mvt?s=foo:bar&s=name:nested.property

will also add properties named foo and name to each feature on each layer, populating them from ES source fields bar and nested.property, respectively.

RFC

These additional properties are currently applied across all requested layers. -- We could enhance this by making the source field parameter layer specific, such as <layername>:<propertyname>:<elastic_source_field_path>, with _all for <layername> referring to all layers again.

Implementation

The cleanest way to add support for this was to construct a new, temporary ElasticsearchSource instance for the lifetime of a request that has extra source field requests in doGetFeature. -- That temporary ElasticsearchSource contains those extra source fields and is then used for the remainder of the request, hence making the addition of extra fields transparent to the rest of the code.

Testing Done