-
-
Notifications
You must be signed in to change notification settings - Fork 184
-
I wanted to confirm that in order to have the sac_scale and mtb_scale data in the tiles I have to do like BikeRouteOverlay.java ?
The idea is to create a rendering for the outdoors.
hyperknot/openfreemap#31 (comment)
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 5 replies
-
mtb:scale is already available as mtb_scale: https://openmaptiles.org/schema/#mtb_scale
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Here I see that sac_scale is present but how can I be sure that it is in the tiles?
Beta Was this translation helpful? Give feedback.
All reactions
-
oh interesting! Tho when I inspect https://tiles.openfreemap.org/planet I don't see it
I used https://overpass-ultra.us/#run&m=18.22/37.527851/-77.452749&q=BYFxAcGcC4HpZASwDYFNIDoD25UDsAzAJ1VQFsBDcbIgc1nGQr1RCA to check
specifically checking this way: https://www.openstreetmap.org/way/287344575
Beta Was this translation helpful? Give feedback.
All reactions
-
Me neither and so not knowing anything I don't really know where to look.
Beta Was this translation helpful? Give feedback.
All reactions
-
Planetiler-openmaptiles only uses sac_scale to determine min zoom, it doesn't put it onto the features: https://github.com/openmaptiles/planetiler-openmaptiles/blob/1ba1a5464ee732b8328cc35a481eefad91a708d7/src/main/java/org/openmaptiles/layers/Transportation.java#L551
So you could add it in openmaptiles/openmaptiles repo then planetiler-openmaptiles would eventually get it. Or if openfreemap is using a planetiler-openmaptiles fork you could add code to that to copy over sac_scale
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Sorry, I didn't quite understand what to do. Before indicating in the issue what to do, I'll try to do it on my side. I saw that we can make shema.yml but for the moment without success on my side
Beta Was this translation helpful? Give feedback.
All reactions
-
I did this which seems to work. I don't know if it's very good but I have an additional outdoor layer that is added
public class CustomProfile extends OpenMapTilesProfile {
public CustomProfile(Planetiler runner) {
super(runner.translations(), runner.config(), runner.stats());
}
public CustomProfile(Translations translations, PlanetilerConfig config, Stats stats) {
super(translations,config,stats);
}
@Override
public void processFeature(SourceFeature sourceFeature, FeatureCollector features) {
super.processFeature(sourceFeature, features);
// Puis ajoute sac_scale à transportation
if (sourceFeature.canBeLine() && sourceFeature.hasTag("highway") &&
(
sourceFeature.hasTag("sac_scale") ||
sourceFeature.hasTag("surface") ||
sourceFeature.hasTag("trail_visibility") ||
sourceFeature.hasTag("tracktype")
)) {
var line = features.line("outdoor")
.inheritAttrFromSource("highway"); // récupère d'autres attributs utiles
if (sourceFeature.hasTag("tracktype")) {
line.setAttr("tracktype", sourceFeature.getTag("tracktype"));
}
if (sourceFeature.hasTag("sac_scale")) {
line.setAttr("sac_scale", sourceFeature.getTag("sac_scale"));
}
if (sourceFeature.hasTag("surface")) {
line.setAttr("surface", sourceFeature.getTag("surface"));
}
if (sourceFeature.hasTag("trail_visibility")) {
line.setAttr("trail_visibility", sourceFeature.getTag("trail_visibility"));
}
int i = 0;
for (var routeInfo : sourceFeature.relationInfo(RouteRelationInfo.class)) {
// (routeInfo.role() also has the "role" of this relation member if needed)
RouteRelationInfo relation = routeInfo.relation();
line.setAttr("relation_"+i+"_name", relation.name);
line.setAttr("relation_"+i+"_ref", relation.ref);
line.setAttr("relation_"+i+"_route", relation.route);
line.setAttr("relation_"+i+"_network", relation.network);
line.setAttr("relation_"+i+"_symbol", relation.symbol);
line.setAttr("relation_"+i+"_color", relation.color);
i++;
}
}
}
private record RouteRelationInfo(
// OSM ID of the relation (required):
@Override long id,
// Values for tags extracted from the OSM relation:
String name, String ref, String route, String network,String symbol,String color
) implements OsmRelationInfo {}
@Override
public List<OsmRelationInfo> preprocessOsmRelation(OsmElement.Relation relation) {
if (relation.hasTag("type", "route")) {
if (relation.hasTag("route","hiking")) {
return List.of(new RouteRelationInfo(
relation.id(),
relation.getString("name"),
relation.getString("ref"),
relation.getString("route"),
relation.getString("network", ""),
relation.getString("osmc:symbol", ""),
relation.getString("colour", "")
));
}
}
return null;
}
}
Beta Was this translation helpful? Give feedback.