-
I would like to do change all I am happy to create an example afterwards for this... |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
` @OverRide
}` Something like this? I am using the post process funtion to add a short name to the poi feature. Right now i am working on only a single langauge so this works fine. but i was thinking of moving this to langauge utils and making it more accesible. |
Beta Was this translation helpful? Give feedback.
-
You could do something like: for (var item : items) {
Object name = item.attrs().get("name");
if (name instanceof String s) { // also filters out nulls
item.attrs().put("name", s.toUpperCase());
}
} or with the new full-tile hook: for (var layer : layers.values()) {
for (var item: layer) {
Object name = item.attrs().get("name");
if (name instanceof String s) {
item.attrs().put("name", s.toUpperCase());
}
}
} There's also a 1-liner for the get/modify/set: item.attrs().computeIfPresent("name", (k, v) -> v instanceof String s ? s.toUpperCase() : v); But you could also do this client-side with maplibre's upcase? ["upcase", ["get", "name"]] |
Beta Was this translation helpful? Give feedback.
-
For the example I would like to do some geometry postprocessing. Say I have 3 rectangles in a GPKG source with a color attribute that can be red, green, or blue. The 3 rectangles look like this: With the following code I can read the info about the rectangles in the post-tile hook: @Override
public Map<String, List<VectorTile.Feature>> postProcessTileFeatures(TileCoord tileCoord, Map<String, List<VectorTile.Feature>> layers)
throws GeometryException {
for (var layer : layers.values()) {
System.out.println(tileCoord);
for (var item: layer) {
System.out.println(item);
}
}
return null;
} The output looks like this:
I would like to create a new layer with the intersections of the polygons. It would be a layer with 7 polygons and each polygon would state which colors it has, for example "red,blue", or "red,green,blue". Can you give me a tip how to create these intersections and emit the new geometries with new attributes? |
Beta Was this translation helpful? Give feedback.
You could do something like:
or with the new full-tile hook:
There's also a 1-liner for the get/modify/set:
But you could also do this client-side with maplibre's upcase?
["upcase", [