-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add house numbers layer #336
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.protomaps.basemap.layers; | ||
|
||
import com.onthegomap.planetiler.FeatureCollector; | ||
import com.onthegomap.planetiler.ForwardingProfile; | ||
import com.onthegomap.planetiler.VectorTile; | ||
import com.onthegomap.planetiler.geo.GeometryException; | ||
import com.onthegomap.planetiler.reader.SourceFeature; | ||
import com.protomaps.basemap.feature.FeatureId; | ||
|
||
import java.util.List; | ||
|
||
public class Housenumbers implements ForwardingProfile.LayerPostProcesser { | ||
public void processOsm(SourceFeature sf, FeatureCollector features) { | ||
if (sf.hasTag("addr:housenumber")) { | ||
if (sf.isPoint()) { | ||
features.point(this.name()) | ||
.setId(FeatureId.create(sf)) | ||
.setAttr("housenumber", sf.getString("addr:housenumber")) | ||
.setZoomRange(10, 17); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should limit the house numbers to exist only in the zoom 15 tiles, in order to not bloat the tile size. A visual reference we use for deciding what data goes in what zoom is http://tangrams.github.io/bubble-wrap - house numbers only appear above zoom ~18 which means we can put them in our tileset at 15 and define the style to appear > 18, etc. Is that zoom level good enough for your use case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think so :) |
||
} | ||
} | ||
} | ||
|
||
@Override | ||
public List<VectorTile.Feature> postProcess(int zoom, List<VectorTile.Feature> items) throws GeometryException { | ||
return items; | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return "housenumbers"; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a lot of ways in osm have a house number: https://taginfo.openstreetmap.org/keys/addr%3Ahousenumber#overview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I agree. As I mentioned in PR description I wanted to handle them as well, but wanted to first agree on the general approach. Do you think such implementation does have a chance to be eventually merged? 😀 Ofc after handling all the cases, adding tests etc...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is a good idea to add house numbers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then I'll continue working on that PR :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a great start! We should align the layer name and properties to conform with the Tilezen docs: https://tilezen.readthedocs.io/en/latest/layers/#buildings-and-addresses
so it should be points included in the
buildings
layer with a property calledaddr_housenumber