CartoDB / mobile-carto-libs

Internal dependencies for CARTO Mobile SDK
BSD 3-Clause "New" or "Revised" License
4 stars 5 forks source link

cant read feature id with `[id]` #22

Closed farfromrefug closed 2 years ago

farfromrefug commented 2 years ago

I am creating an openmaptiles layer with that query

datasource:
    geometry_field: geometry
    key_field: osm_id
    key_field_as_attribute: no
    srid: 900913
    query: (SELECT osm_id, geometry, class, network, name, ref, symbol, textcolor, color, ascent, descent, distance, description, website, extent FROM layer_route(!bbox!, z(!scale_denominator!))) AS t

So the feature id is the osm_id. Now i need to read that id through css style to test for selection. However this does not seem possible. [id] does not return the id. Could we add that?

mtehver commented 2 years ago

Have you tried using [osm_id]? It should work.

farfromrefug commented 2 years ago

@mtehver osm_id is not available. The config i attached says that osm_id is used as the feature id. The issue here is that the feature id does not seem to be available through css. Am i wrong? Same question for VectorTileSearchService and filterExpression

mtehver commented 2 years ago

@farfromrefug Ok, makes sense. I will add support for special 'id' field that will be equal to the internal feature id.

mtehver commented 2 years ago

@farfromrefug I have added the feature now (you need to get the latest commits from 'develop' branch for both mobile-carto-libs and mobile-sdk). You can access the internal id using [mapnik::feature_id]

farfromrefug commented 2 years ago

@mtehver awesome thanks a lot for all this !