Selectors
To optimize response time and size, by default, the MVT and JSON API return a minimized response. This approach ensures peak performance and reduces tile payload sizes, which is critical for smooth map interactions. By using selectors, you can include the additional data points your application specifically requires.
Where to use
- Station Features Only: Selectors are only applicable to station features (
count: 1). They do not affect the properties of cluster features. - MVT and JSON endpoints only: Selectors can be used in both the MVT and JSON endpoints, but not in the count endpoint.
Available selectors
Any field listed in the station properties for MVT and JSON tiles can be used as a selector in its respective service, with the exception of the mandatory GeoJSON fields returned in JSON endpoint.
Implementation
To request specific properties, append station_properties[] query parameter to the tile request URL.
Selectors / URL Structure
- 01
https://api.chargetrip.io/v2/station/..../?station_properties[]={selector1}&station_properties[]={selector2}&station_properties[]={selector3}..
Behaviour Examples
When selectors are provided, the request returns only the specified fields.
GeoJSON
In the GeoJSON endpoint, the mandatory GeoJSON fields (type and geometry and id ) are always returned regardless of the selectors chosen.
GeoJSON Tile / Example response with selectors
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
.../?station_properties[]=station_maximum_power&station_properties[]=preferred_operator { "type": "FeatureCollection", "features": [ // Station feature { "id": "132313", "type": "Feature", "geometry": { "type": "Point", "coordinates": [6.789, 52.234] }, // 'count' is missing because it wasn't provided as selector "properties": { "station_maximum_power": 350, "preferred_operator": true } }, // Cluster feature // Cluster feature is not modified, as it's not affected by the selectors. { "type": "Feature", "geometry": { "type": "Point", "coordinates": [6.723, 50.000] }, "properties": { "count": 3, "expansion_zoom": 18 } } ]}
MVT
In MVT endpoint, only the parameters explicitly selected are returned as there are no mandatory fields.
Mapbox Vector Tile / Example response with selectors
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
.../?station_properties[]=station_maximum_power&station_properties[]=preferred_operator // Station feature// 'count' is missing because it wasn't provided as a selector.{ "id": "132313", "preferred_operator": false, "station_maximum_power": 350} // Cluster feature// Cluster feature is not modified, as it's not affected by the selectors.{ "count": 3, "expansion_zoom":32}