Skip to content
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

OpenMapTiles 3.15.0 SNAPSHOT #126

Merged
merged 146 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
0bb61f7
version bumped from 3.14.0 to 3.15.0-SNAPSHOT
phanecak-maptiler Jul 5, 2023
d32501e
regenerate-openmaptiles.sh 07f243c5d9efa558fa539d7a31b2ae50507aaa9d (…
phanecak-maptiler Jul 5, 2023
862e50a
SQL -> Java re-implementation of OMT PR 1457
phanecak-maptiler Jul 6, 2023
8998ddd
version bumped from 3.14.0 to 3.15.0-SNAPSHOT
phanecak-maptiler Jul 5, 2023
14c204d
WaterName.areaToMinZoom(): improved handling of rounding and precissi…
phanecak-maptiler Jul 7, 2023
fcfe115
mvn spotless:apply
phanecak-maptiler Jul 7, 2023
91b1842
water label min. zoom calculation simplified
phanecak-maptiler Jul 9, 2023
05b91a7
comment adjusted to be hopefully more useful
phanecak-maptiler Jul 9, 2023
096b1a4
mvn spotless:apply
phanecak-maptiler Jul 10, 2023
fda198f
minzoom for CA_TRANSCANADA and US_INTERSTATE trunk now 4 (to match OM…
phanecak-maptiler Jul 10, 2023
74f655b
minzoom for some other Canada trunks now 4 (to match OMT PR 1446)
phanecak-maptiler Jul 10, 2023
cf92b5e
equals() simplified + clean-up of comments
phanecak-maptiler Jul 10, 2023
be4ac2d
Merge pull request #3 from phanecak-maptiler/zlw-water-area-size
phanecak-maptiler Jul 11, 2023
32c59d1
regenerate-openmaptiles.sh 5f7b2c11b3224759a21133381ca7d959a1f3cf51 (…
phanecak-maptiler Jul 14, 2023
4e3f0fd
GB road relations processing adjusted to match OMT PR 1465, e.g. hand…
phanecak-maptiler Jul 14, 2023
da044ca
regenerate-openmaptiles.sh edb42f2db3c2b0ec37045367720eed84d7bbd71f (…
phanecak-maptiler Jul 14, 2023
436e3b3
IE road relations processing adjusted to match OMT PR 1466, e.g. hand…
phanecak-maptiler Jul 14, 2023
6354264
fixed handling of networkType for secondary GB routes
phanecak-maptiler Jul 14, 2023
984b7f2
clean-up: case statements simplified
phanecak-maptiler Jul 14, 2023
4702e31
Merge branch 'omt3_15-gb_primary_secondary' into omt3_15-routes_of_ir…
phanecak-maptiler Jul 14, 2023
1e1b896
mvn spotless:apply
phanecak-maptiler Jul 14, 2023
8750c78
clazz calculation moved up so that minzoom can be set to 3 for only l…
phanecak-maptiler Jul 14, 2023
7418117
unit tests adjusted + extended to cover 'minzoom=3 fore lakes' change
phanecak-maptiler Jul 14, 2023
bfce42e
fixed minor typo from previous PR
phanecak-maptiler Jul 17, 2023
65f672f
Merge pull request #4 from phanecak-maptiler/omt3_15-trans_canada
phanecak-maptiler Jul 17, 2023
213dd14
render POIs for large universities at low zoom (to match OMT PR 1479)
phanecak-maptiler Jul 17, 2023
77e6aea
Merge pull request #5 from phanecak-maptiler/omt3_15-gb_primary_secon…
phanecak-maptiler Jul 18, 2023
1fa4181
Merge pull request #6 from phanecak-maptiler/omt3_15-routes_of_ireland
phanecak-maptiler Jul 18, 2023
03f2b04
clean-up, to make the diff/PR smaller
phanecak-maptiler Jul 18, 2023
7a718e6
Merge pull request #7 from phanecak-maptiler/omt3_15-big_lake_lake_lines
phanecak-maptiler Jul 19, 2023
a93cc9e
Merge pull request #8 from phanecak-maptiler/large_uni_poi_zoom
phanecak-maptiler Jul 19, 2023
17604dc
Merge branch 'upstream-main' into omt_3_15_0
phanecak-maptiler Aug 4, 2023
f06187a
Merge branch 'upstream-main' into omt_3_15_0
phanecak-maptiler Sep 6, 2023
5b6a46c
Merge branch 'upstream-main' into omt_3_15_0
phanecak-maptiler Sep 13, 2023
e46c44c
regenerate-openmaptiles.sh 5e9b7c475d53a5bd5ea394da361594d3f4ce2d66 (…
phanecak-maptiler Sep 25, 2023
258db80
handle 'grade1' and 'tracktype' as per OMT PR 1485
phanecak-maptiler Sep 25, 2023
62814fe
Merge pull request #9 from phanecak-maptiler/omt3_15-set_paved_attrib…
phanecak-maptiler Sep 26, 2023
d3429c4
added implementation of agg_stop
phanecak-maptiler Sep 26, 2023
7f96e66
Merge branch 'upstream-main' into omt_3_15_0
phanecak-maptiler Sep 26, 2023
137a89a
Merge branch 'omt_3_15_0' into omt3_15-agg_stop_fix
phanecak-maptiler Sep 26, 2023
0672adf
Merge pull request #10 from phanecak-maptiler/omt3_15-agg_stop_fix
phanecak-maptiler Sep 28, 2023
6a099de
clean-up: mvn spotless:apply
phanecak-maptiler Oct 2, 2023
afbd863
Long ferries (as per OMT PR 1486)
phanecak-maptiler Oct 2, 2023
19a75a0
regenerate-openmaptiles.sh b3d67ed5b327c9059aeea0b3304772c6b4c8c7e9 …
phanecak-maptiler Oct 2, 2023
899a0c5
Add aboriginal lands (as per OMT PR 1489)
phanecak-maptiler Oct 2, 2023
7043e8c
handle duplicate route relations (to match OMT PR 1501)
phanecak-maptiler Oct 4, 2023
b597ecf
regenerate-openmaptiles.sh master, to match several OMT PRs which adj…
phanecak-maptiler Oct 6, 2023
604f22b
URLs in comments adjusted to match OMT PR 1560
phanecak-maptiler Oct 9, 2023
ed7e357
Convert separated addresses to dashed addresses
phanecak-maptiler Oct 9, 2023
3470989
add brunnel (and layer) attributes only for certain zoomlevels, depen…
phanecak-maptiler Oct 10, 2023
3876d6b
unit test testInterstateMotorway(): brunnel tag for test line no long…
phanecak-maptiler Oct 10, 2023
bca12e2
unit test testInterstateMotorway() clean-up: Z13 was tested twice
phanecak-maptiler Oct 10, 2023
7a22bc6
Merge pull request #15 from phanecak-maptiler/omt3_15-yml_sync_and_ja…
phanecak-maptiler Oct 10, 2023
cf9e850
Merge pull request #16 from phanecak-maptiler/omt3_15-update_doc
phanecak-maptiler Oct 10, 2023
22029f1
Merge branch 'omt_3_15_0' into omt3_15-aboriginal
phanecak-maptiler Oct 10, 2023
26680da
Merge pull request #13 from phanecak-maptiler/omt3_15-fix-dupe-route
phanecak-maptiler Oct 11, 2023
37c657d
Merge pull request #12 from phanecak-maptiler/omt3_15-aboriginal
phanecak-maptiler Oct 11, 2023
ac6bb21
minor clean-up: fixed unit test naming
phanecak-maptiler Oct 11, 2023
f6c4ace
Merge pull request #17 from phanecak-maptiler/omt3_15-housenumber-col…
phanecak-maptiler Oct 11, 2023
72abc21
partial fix for differences in transportation_name layer
phanecak-maptiler Oct 12, 2023
6125d70
Merge branch 'omt_3_15_0' into omt3_15-long-ferries
phanecak-maptiler Oct 12, 2023
b7e7f4c
further adjustments to better match what is done with ferries in OMT
phanecak-maptiler Oct 17, 2023
00560b3
ferry minLength tweak + clean-up
phanecak-maptiler Oct 17, 2023
5d08720
mvn spotless:apply
phanecak-maptiler Oct 17, 2023
397efef
fixed minor typo
phanecak-maptiler Oct 17, 2023
dca9671
minor reformatting
phanecak-maptiler Oct 17, 2023
8654d86
ferry line length filter replaced with min. zoom calculation
phanecak-maptiler Oct 18, 2023
8e1703b
testFerry() adjusted to match previous commit
phanecak-maptiler Oct 18, 2023
6c05d7d
clea-up of unused stuff + mvn spotless:apply
phanecak-maptiler Oct 18, 2023
b6cda03
mvn spotless:apply
phanecak-maptiler Oct 18, 2023
338329a
Merge branch 'omt3_15-long-ferries' into omt3_15-frag-fix
phanecak-maptiler Oct 18, 2023
9b59981
added TODO node for follow-up pull-request/simplification
phanecak-maptiler Oct 18, 2023
a7bcfa9
clean-up: common getMinZoom() code moved to Utils
phanecak-maptiler Oct 18, 2023
30dab9f
minzoom clipping for brunnel was adjusted do Z9-Z12 -> test adjusted too
phanecak-maptiler Oct 18, 2023
f50e2b7
Merge pull request #11 from phanecak-maptiler/omt3_15-long-ferries
phanecak-maptiler Oct 23, 2023
1ddfb9a
clean-up
phanecak-maptiler Oct 23, 2023
0a2565d
use same tolerance for all transportation items, like OSM does
phanecak-maptiler Oct 23, 2023
59b3078
clean-up, since ferry and non-ferry procesing is now same
phanecak-maptiler Oct 23, 2023
d3434f9
Merge pull request #18 from phanecak-maptiler/omt3_15-frag-fix
phanecak-maptiler Oct 26, 2023
50273b0
Merge branch 'omt_3_15_0' into omt3_15-fix_for_diff_in_transportation…
phanecak-maptiler Oct 27, 2023
124b1dc
Merge branch 'upstream-main' into omt_3_15_0
phanecak-maptiler Oct 30, 2023
93bdca5
Merge pull request #19 from phanecak-maptiler/omt3_15-transportation_…
phanecak-maptiler Nov 2, 2023
8c200bd
Merge branch 'omt_3_15_0' into omt3_15-fix_for_diff_in_transportation…
phanecak-maptiler Nov 2, 2023
c9c5f01
Merge pull request #20 from phanecak-maptiler/omt3_15-fix_for_diff_in…
phanecak-maptiler Nov 2, 2023
43d16a9
we need regenerate to work with master branch for now
phanecak-maptiler Nov 3, 2023
269575b
first sub-class search for agg_stop simplified a little
phanecak-maptiler Nov 3, 2023
e58b60e
Merge branch 'upstream-main' into omt_3_15_0
phanecak-maptiler Nov 6, 2023
45abdbe
contains() used instead of indexOf() for better readability
phanecak-maptiler Nov 16, 2023
124d000
numbers as list, not array, so that getFirst() and getLast() can be used
phanecak-maptiler Nov 16, 2023
91d5e82
better trimming and filtring of housenumbers
phanecak-maptiler Nov 16, 2023
d93ca1f
adjusted handling of large house numbers
phanecak-maptiler Nov 16, 2023
8380e2f
several unit tests collapsed to one with @ParameterizedTest + @CsvSource
phanecak-maptiler Nov 16, 2023
1a9a333
AGG_STOP_SUBCLASS_ORDER simplified from Map to List
phanecak-maptiler Nov 16, 2023
9886cb1
fixed major omission from previous commit
phanecak-maptiler Nov 16, 2023
654e08a
clamp() used to replace min()&max() combo
phanecak-maptiler Nov 16, 2023
1f64f5f
agg_stop now implemented
phanecak-maptiler Nov 16, 2023
0f8487e
fixed typo in the error message
phanecak-maptiler Nov 16, 2023
35442fa
prepare IE and GB boundary geometry outside of synchronized{}
phanecak-maptiler Nov 16, 2023
99704bf
fixed typo in the error message
phanecak-maptiler Nov 16, 2023
eb46f86
mvn spotless:apply
phanecak-maptiler Nov 16, 2023
bfaa676
switch statements for IE and GB route networks simplified
phanecak-maptiler Nov 16, 2023
4374adf
avoid RouteNetwork->String mapping, not needed for anyMatch()
phanecak-maptiler Nov 16, 2023
371206c
fix: attr. brunnel optional based on size on Z4-Z11, attr. layer opti…
phanecak-maptiler Nov 16, 2023
e21c74a
tolerance change in transportation reverted, added note to README as …
phanecak-maptiler Nov 16, 2023
f499467
fix: monzoom for sea&co. is Z0-Z14 based on area, for the rest it is …
phanecak-maptiler Nov 16, 2023
caa41e1
clean-up: avoid doing area->side->area, do just area
phanecak-maptiler Nov 16, 2023
a20d488
Merge pull request #21 from phanecak-maptiler/omt_3_15_0-updates_base…
phanecak-maptiler Nov 16, 2023
b9db64a
regenerate-openmaptiles.sh 6c31841f4674f15e15afde346a060cf7c22e6cdd (…
phanecak-maptiler Nov 16, 2023
9ab8f47
relevant process() functions adjusted to match changes in transportat…
phanecak-maptiler Nov 16, 2023
32982da
regenerate-openmaptiles.sh master, instead of 6c31841f4674f15e15afde3…
phanecak-maptiler Nov 16, 2023
3cbe8c8
Merge pull request #22 from phanecak-maptiler/omt3_15-zlw-oneway-rail
phanecak-maptiler Nov 16, 2023
912538b
introduce duplicate housenumber filtering (matching OMT PR 1391)
phanecak-maptiler Nov 20, 2023
a0569fd
(less related) clean-up: use isEmpty() instead if size check
phanecak-maptiler Nov 20, 2023
5bab4cf
testContainsHousenumber UT adjusted, since duplicate housenumber filt…
phanecak-maptiler Nov 20, 2023
a5eabee
Merge pull request #23 from phanecak-maptiler/omt3_15-housenumber_fil…
phanecak-maptiler Nov 20, 2023
dc8a179
use combination of uic_ref, name, network and operator as key for agg…
phanecak-maptiler Nov 20, 2023
7a09981
Merge pull request #24 from phanecak-maptiler/omt3_15-agg_stop_fix-2
phanecak-maptiler Nov 20, 2023
60ee412
agg_stop comparison made more explicit, since we want to match same e…
phanecak-maptiler Nov 20, 2023
6863915
mvn spotless:apply
phanecak-maptiler Nov 20, 2023
23d9ba7
name now important for agg_stop processing, hence name:es (ab)used fo…
phanecak-maptiler Nov 20, 2023
602036c
Merge pull request #25 from phanecak-maptiler/omt3_15-agg_stop_fix-2
phanecak-maptiler Nov 20, 2023
e11f9c6
agg_stop: simplified processing of nearest station
phanecak-maptiler Nov 21, 2023
f5fe5fe
agg_stop: forther code simplification
phanecak-maptiler Nov 21, 2023
27f57a3
Merge pull request #26 from phanecak-maptiler/omt3_15-agg_stop_cleanup
phanecak-maptiler Nov 21, 2023
ac14a04
Merge branch 'upstream-main' into omt_3_15_0
phanecak-maptiler Nov 21, 2023
f390550
fixed major typo introduced in previous merge
phanecak-maptiler Nov 21, 2023
3b363cb
setMinPixelSize() + setMinZoom() used instead of areaToMinZoom()
phanecak-maptiler Nov 21, 2023
360751e
clean-up: unused stuff removed
phanecak-maptiler Nov 21, 2023
503eee8
mvn spotless:apply
phanecak-maptiler Nov 21, 2023
212c80c
setAttrWithMinSize() used instead of getBrunnelMinzoom()
phanecak-maptiler Nov 21, 2023
28b75a7
getMinZoomForLength() no longer used, hence removed
phanecak-maptiler Nov 21, 2023
6dcd29d
Merge pull request #27 from phanecak-maptiler/omt3_15-area_to_minzoom…
phanecak-maptiler Nov 21, 2023
612f700
clean-up: LOG2 not used, hence removed
phanecak-maptiler Nov 28, 2023
d756038
added BY_TEMP_HAS_NAME comparator to avoid its repeated construction …
phanecak-maptiler Dec 12, 2023
08ee4da
duplicate houcenumber processing simplified further
phanecak-maptiler Dec 12, 2023
c8c4b24
clean-up: get(0) replaced with getFirst()
phanecak-maptiler Dec 12, 2023
57c2547
clean-up: CPU-intensive prepare() moved out of synchronized block
phanecak-maptiler Dec 12, 2023
82bb68a
regenerate-openmaptiles.sh 3cf77e2a542d8a369bb08bf2538cdde0b3effb2b (…
phanecak-maptiler Dec 15, 2023
7eed2ac
unit test adjusted for POI office class changes
phanecak-maptiler Dec 15, 2023
59fa9ac
Merge pull request #29 from phanecak-maptiler/omt3_15-more-office-values
phanecak-maptiler Dec 15, 2023
60be59b
regenerate-openmaptiles.sh master (to match content of OMT PR 1544)
phanecak-maptiler Dec 18, 2023
a0b7443
added charging_station implementation matching OMT PR 1544
phanecak-maptiler Dec 18, 2023
3b0959b
Merge pull request #30 from phanecak-maptiler/omt3_15-charging_station
phanecak-maptiler Dec 18, 2023
69393d0
use setMinPixelSizeBelowZoom() instead of uniAreaToMinZoom()
phanecak-maptiler Dec 19, 2023
bdea325
use setMinPixelSizeBelowZoom() instead of getFerryMinzoom()
phanecak-maptiler Dec 20, 2023
6aa4e88
fixed unit test, to match recent tweaks
phanecak-maptiler Dec 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<groupId>org.openmaptiles</groupId>
<artifactId>planetiler-openmaptiles</artifactId>
<version>3.14.0</version>
<version>3.15.0-SNAPSHOT</version>

<name>OpenMapTiles Vector Tile Schema implementation for Planetiler tool</name>

Expand Down
3 changes: 2 additions & 1 deletion scripts/regenerate-openmaptiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -o errexit
set -o pipefail
set -o nounset

TAG="${1:-"v3.14"}"
# TODO: change to "v3.15" once that is released
TAG="${1:-"master"}"
echo "tag=${TAG}"

BASE_URL="${2:-"https://raw.githubusercontent.com/openmaptiles/openmaptiles/"}"
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/openmaptiles/OpenMapTilesProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ public interface NaturalEarthProcessor {

/**
* Layers should implement this interface to subscribe to elements from
* <a href="https://github.com/lukasmartinelli/osm-lakelines">OSM lake centerlines source</a>.
* <a href="https://github.com/openmaptiles/osm-lakelines">OSM lake centerlines source</a>.
*/
public interface LakeCenterlineProcessor {

/**
* Process an element from the <a href="https://github.com/lukasmartinelli/osm-lakelines">OSM lake centerlines
* Process an element from the <a href="https://github.com/openmaptiles/osm-lakelines">OSM lake centerlines
* source</a>
*
* @see Profile#processFeature(SourceFeature, FeatureCollector)
Expand Down
131 changes: 84 additions & 47 deletions src/main/java/org/openmaptiles/generated/OpenMapTilesSchema.java

Large diffs are not rendered by default.

117 changes: 72 additions & 45 deletions src/main/java/org/openmaptiles/generated/Tables.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE

/**
* OSM element parsers generated from the <a href="https://github.com/omniscale/imposm3">imposm3</a> table definitions
* in the <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.14/openmaptiles.yaml">OpenMapTiles vector tile
* in the <a href="https://github.com/openmaptiles/openmaptiles/blob/master/openmaptiles.yaml">OpenMapTiles vector tile
* schema</a>.
*
* These filter and parse the raw OSM key/value attribute pairs on tags into records with fields that match the columns
Expand Down Expand Up @@ -94,21 +94,23 @@ public record RowHandlerAndClass<T extends Row> (
) {}
/** An OSM element that would appear in the {@code osm_water_polygon} table generated by imposm3. */
public record OsmWaterPolygon(@Override String name, @Override String nameEn, @Override String nameDe,
@Override String natural, @Override String landuse, @Override String waterway, @Override String leisure,
@Override String water, @Override boolean isIntermittent, @Override boolean isTunnel, @Override boolean isBridge,
@Override SourceFeature source) implements Row, WithName, WithNameEn, WithNameDe, WithNatural, WithLanduse,
WithWaterway, WithLeisure, WithWater, WithIsIntermittent, WithIsTunnel, WithIsBridge, WithSource {
@Override String place, @Override String natural, @Override String landuse, @Override String waterway,
@Override String leisure, @Override String water, @Override boolean isIntermittent, @Override boolean isTunnel,
@Override boolean isBridge, @Override SourceFeature source)
implements Row, WithName, WithNameEn, WithNameDe, WithPlace, WithNatural, WithLanduse, WithWaterway, WithLeisure,
WithWater, WithIsIntermittent, WithIsTunnel, WithIsBridge, WithSource {
public OsmWaterPolygon(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString("natural"), source.getString("landuse"), source.getString("waterway"),
source.getString("leisure"), source.getString("water"), source.getBoolean("intermittent"),
source.getBoolean("tunnel"), source.getBoolean("bridge"), source);
source.getString("place"), source.getString("natural"), source.getString("landuse"),
source.getString("waterway"), source.getString("leisure"), source.getString("water"),
source.getBoolean("intermittent"), source.getBoolean("tunnel"), source.getBoolean("bridge"), source);
}

/** Imposm3 "mapping" to filter OSM elements that should appear in this "table". */
public static final Expression MAPPING = and(
or(matchAny("landuse", "reservoir", "basin", "salt_pond"), matchAny("leisure", "swimming_pool"),
matchAny("natural", "water", "bay", "spring"), matchAny("waterway", "dock"), matchAny("water", "river")),
matchAny("natural", "water", "bay", "spring"), matchAny("waterway", "dock"),
matchAny("water", "river", "stream", "canal", "ditch", "drain", "pond", "basin", "wastewater")),
not(matchAny("covered", "yes")), matchType("polygon"));

/**
Expand Down Expand Up @@ -246,9 +248,8 @@ public OsmParkPolygon(SourceFeature source, String mappingKey) {
}

/** Imposm3 "mapping" to filter OSM elements that should appear in this "table". */
public static final Expression MAPPING =
and(or(matchAny("leisure", "nature_reserve"), matchAny("boundary", "national_park", "protected_area")),
matchType("polygon"));
public static final Expression MAPPING = and(or(matchAny("leisure", "nature_reserve"),
matchAny("boundary", "national_park", "protected_area", "aboriginal_lands")), matchType("polygon"));

/**
* Interface for layer implementations to extend to subscribe to OSM elements filtered and parsed as
Expand Down Expand Up @@ -316,25 +317,27 @@ public interface Handler {
}
}
/** An OSM element that would appear in the {@code osm_highway_linestring} table generated by imposm3. */
public record OsmHighwayLinestring(@Override String highway, @Override String construction, @Override String ref,
@Override String network, @Override int zOrder, @Override long layer, @Override long level,
@Override boolean indoor, @Override String name, @Override String nameEn, @Override String nameDe,
@Override String shortName, @Override boolean isTunnel, @Override boolean isBridge, @Override boolean isRamp,
@Override boolean isFord, @Override int isOneway, @Override boolean isArea, @Override String service,
@Override String access, @Override boolean toll, @Override String usage, @Override String publicTransport,
@Override String manMade, @Override String bicycle, @Override String foot, @Override String horse,
@Override String mtbScale, @Override String sacScale, @Override String surface, @Override boolean expressway,
@Override SourceFeature source) implements Row, WithHighway, WithConstruction, WithRef, WithNetwork, WithZOrder,
WithLayer, WithLevel, WithIndoor, WithName, WithNameEn, WithNameDe, WithShortName, WithIsTunnel, WithIsBridge,
WithIsRamp, WithIsFord, WithIsOneway, WithIsArea, WithService, WithAccess, WithToll, WithUsage, WithPublicTransport,
public record OsmHighwayLinestring(@Override String highway, @Override String construction,
@Override String tracktype, @Override String ref, @Override String network, @Override int zOrder,
@Override long layer, @Override long level, @Override boolean indoor, @Override String name,
@Override String nameEn, @Override String nameDe, @Override String shortName, @Override boolean isTunnel,
@Override boolean isBridge, @Override boolean isRamp, @Override boolean isFord, @Override int isOneway,
@Override boolean isArea, @Override String service, @Override String access, @Override boolean toll,
@Override String usage, @Override String publicTransport, @Override String manMade, @Override String bicycle,
@Override String foot, @Override String horse, @Override String mtbScale, @Override String sacScale,
@Override String surface, @Override boolean expressway, @Override SourceFeature source)
implements Row, WithHighway, WithConstruction, WithTracktype, WithRef, WithNetwork, WithZOrder, WithLayer,
WithLevel, WithIndoor, WithName, WithNameEn, WithNameDe, WithShortName, WithIsTunnel, WithIsBridge, WithIsRamp,
WithIsFord, WithIsOneway, WithIsArea, WithService, WithAccess, WithToll, WithUsage, WithPublicTransport,
WithManMade, WithBicycle, WithFoot, WithHorse, WithMtbScale, WithSacScale, WithSurface, WithExpressway, WithSource {
public OsmHighwayLinestring(SourceFeature source, String mappingKey) {
this(source.getString("highway"), source.getString("construction"), source.getString("ref"),
source.getString("network"), source.getWayZorder(), source.getLong("layer"), source.getLong("level"),
source.getBoolean("indoor"), source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString("short_name"), source.getBoolean("tunnel"), source.getBoolean("bridge"),
source.getBoolean("ramp"), source.getBoolean("ford"), source.getDirection("oneway"), source.getBoolean("area"),
source.getString("service"), source.getString("access"), source.getBoolean("toll"), source.getString("usage"),
this(source.getString("highway"), source.getString("construction"), source.getString("tracktype"),
source.getString("ref"), source.getString("network"), source.getWayZorder(), source.getLong("layer"),
source.getLong("level"), source.getBoolean("indoor"), source.getString("name"), source.getString("name:en"),
source.getString("name:de"), source.getString("short_name"), source.getBoolean("tunnel"),
source.getBoolean("bridge"), source.getBoolean("ramp"), source.getBoolean("ford"),
source.getDirection("oneway"), source.getBoolean("area"), source.getString("service"),
source.getString("access"), source.getBoolean("toll"), source.getString("usage"),
source.getString("public_transport"), source.getString("man_made"), source.getString("bicycle"),
source.getString("foot"), source.getString("horse"), source.getString("mtb:scale"),
source.getString("sac_scale"), source.getString("surface"), source.getBoolean("expressway"), source);
Expand Down Expand Up @@ -521,16 +524,19 @@ public interface Handler {
}
/** An OSM element that would appear in the {@code osm_marine_point} table generated by imposm3. */
public record OsmMarinePoint(@Override String name, @Override String nameEn, @Override String nameDe,
@Override String place, @Override long rank, @Override boolean isIntermittent, @Override SourceFeature source)
implements Row, WithName, WithNameEn, WithNameDe, WithPlace, WithRank, WithIsIntermittent, WithSource {
@Override String place, @Override String natural, @Override long rank, @Override boolean isIntermittent,
@Override SourceFeature source)
implements Row, WithName, WithNameEn, WithNameDe, WithPlace, WithNatural, WithRank, WithIsIntermittent, WithSource {
public OsmMarinePoint(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString("place"), source.getLong("rank"), source.getBoolean("intermittent"), source);
source.getString("place"), source.getString("natural"), source.getLong("rank"),
source.getBoolean("intermittent"), source);
}

/** Imposm3 "mapping" to filter OSM elements that should appear in this "table". */
public static final Expression MAPPING =
and(matchAny("place", "ocean", "sea"), matchField("name"), matchType("point"));
and(or(matchAny("place", "ocean", "sea"), matchAny("natural", "bay", "strait")), matchField("name"),
matchType("point"));

/**
* Interface for layer implementations to extend to subscribe to OSM elements filtered and parsed as
Expand Down Expand Up @@ -656,9 +662,8 @@ public OsmCityPoint(SourceFeature source, String mappingKey) {
}

/** Imposm3 "mapping" to filter OSM elements that should appear in this "table". */
public static final Expression MAPPING = and(
matchAny("place", "city", "town", "village", "hamlet", "suburb", "quarter", "neighbourhood", "isolated_dwelling"),
matchField("name"), matchType("point"));
public static final Expression MAPPING = and(matchAny("place", "city", "town", "village", "hamlet", "borough",
"suburb", "quarter", "neighbourhood", "isolated_dwelling"), matchField("name"), matchType("point"));

/**
* Interface for layer implementations to extend to subscribe to OSM elements filtered and parsed as
Expand All @@ -669,10 +674,12 @@ public interface Handler {
}
}
/** An OSM element that would appear in the {@code osm_housenumber_point} table generated by imposm3. */
public record OsmHousenumberPoint(@Override String housenumber, @Override SourceFeature source)
implements Row, WithHousenumber, WithSource {
public record OsmHousenumberPoint(@Override String housenumber, @Override String street, @Override String blockNumber,
@Override String hasName, @Override SourceFeature source)
implements Row, WithHousenumber, WithStreet, WithBlockNumber, WithHasName, WithSource {
public OsmHousenumberPoint(SourceFeature source, String mappingKey) {
this(source.getString("addr:housenumber"), source);
this(source.getString("addr:housenumber"), source.getString("addr:street"), source.getString("addr:block_number"),
source.getString("name"), source);
}

/** Imposm3 "mapping" to filter OSM elements that should appear in this "table". */
Expand Down Expand Up @@ -731,9 +738,9 @@ public OsmPoiPoint(SourceFeature source, String mappingKey) {
"erotic", "fabric", "florist", "frozen_food", "furniture", "garden_centre", "general", "gift", "greengrocer",
"hairdresser", "hardware", "hearing_aids", "hifi", "ice_cream", "interior_decoration", "jewelry", "kiosk",
"lamps", "laundry", "locksmith", "mall", "massage", "mobile_phone", "motorcycle", "music", "musical_instrument",
"newsagent", "optician", "outdoor", "perfume", "perfumery", "pet", "photo", "second_hand", "shoes", "sports",
"stationery", "supermarket", "tailor", "tattoo", "ticket", "tobacco", "toys", "travel_agency", "video",
"video_games", "watches", "weapons", "wholesale", "wine"),
"newsagent", "optician", "outdoor", "paint", "perfume", "perfumery", "pet", "photo", "second_hand", "shoes",
"sports", "stationery", "supermarket", "tailor", "tattoo", "ticket", "tobacco", "toys", "travel_agency",
"video", "video_games", "watches", "weapons", "wholesale", "wine"),
matchAny("sport", "american_football", "archery", "athletics", "australian_football", "badminton", "baseball",
"basketball", "beachvolleyball", "billiards", "bmx", "boules", "bowls", "boxing", "canadian_football", "canoe",
"chess", "climbing", "climbing_adventure", "cricket", "cricket_nets", "croquet", "curling", "cycling",
Expand Down Expand Up @@ -801,9 +808,9 @@ public OsmPoiPolygon(SourceFeature source, String mappingKey) {
"erotic", "fabric", "florist", "frozen_food", "furniture", "garden_centre", "general", "gift", "greengrocer",
"hairdresser", "hardware", "hearing_aids", "hifi", "ice_cream", "interior_decoration", "jewelry", "kiosk",
"lamps", "laundry", "locksmith", "mall", "massage", "mobile_phone", "motorcycle", "music", "musical_instrument",
"newsagent", "optician", "outdoor", "perfume", "perfumery", "pet", "photo", "second_hand", "shoes", "sports",
"stationery", "supermarket", "tailor", "tattoo", "ticket", "tobacco", "toys", "travel_agency", "video",
"video_games", "watches", "weapons", "wholesale", "wine"),
"newsagent", "optician", "outdoor", "paint", "perfume", "perfumery", "pet", "photo", "second_hand", "shoes",
"sports", "stationery", "supermarket", "tailor", "tattoo", "ticket", "tobacco", "toys", "travel_agency",
"video", "video_games", "watches", "weapons", "wholesale", "wine"),
matchAny("sport", "american_football", "archery", "athletics", "australian_football", "badminton", "baseball",
"basketball", "beachvolleyball", "billiards", "bmx", "boules", "bowls", "boxing", "canadian_football", "canoe",
"chess", "climbing", "climbing_adventure", "cricket", "cricket_nets", "croquet", "curling", "cycling",
Expand Down Expand Up @@ -885,6 +892,11 @@ public interface WithBicycle {
String bicycle();
}

/** Rows with a String blockNumber attribute. */
public interface WithBlockNumber {
String blockNumber();
}

/** Rows with a String boundary attribute. */
public interface WithBoundary {
String boundary();
Expand Down Expand Up @@ -965,6 +977,11 @@ public interface WithFunicular {
String funicular();
}

/** Rows with a String hasName attribute. */
public interface WithHasName {
String hasName();
}

/** Rows with a String height attribute. */
public interface WithHeight {
String height();
Expand Down Expand Up @@ -1225,6 +1242,11 @@ public interface WithStation {
String station();
}

/** Rows with a String street attribute. */
public interface WithStreet {
String street();
}

/** Rows with a String subclass attribute. */
public interface WithSubclass {
String subclass();
Expand All @@ -1245,6 +1267,11 @@ public interface WithTourism {
String tourism();
}

/** Rows with a String tracktype attribute. */
public interface WithTracktype {
String tracktype();
}

/** Rows with a String uicRef attribute. */
public interface WithUicRef {
String uicRef();
Expand Down
60 changes: 58 additions & 2 deletions src/main/java/org/openmaptiles/layers/Housenumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
import com.onthegomap.planetiler.geo.GeometryException;
import com.onthegomap.planetiler.stats.Stats;
import com.onthegomap.planetiler.util.Translations;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.openmaptiles.generated.OpenMapTilesSchema;
import org.openmaptiles.generated.Tables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Defines the logic for generating map elements in the {@code housenumber} layer from source features.
Expand All @@ -59,13 +65,63 @@ public class Housenumber implements
Tables.OsmHousenumberPoint.Handler,
ForwardingProfile.FeaturePostProcessor {

public Housenumber(Translations translations, PlanetilerConfig config, Stats stats) {}
private static final Logger LOGGER = LoggerFactory.getLogger(Housenumber.class);
private static final Character OSM_SEPARATOR = ';';
private static final String DISPLAY_SEPARATOR = "–";
private static final Pattern NO_CONVERSION_PATTERN = Pattern.compile("[^0-9;]");
private final Stats stats;

public Housenumber(Translations translations, PlanetilerConfig config, Stats stats) {
this.stats = stats;
}

private static String displayHousenumberNonumeric(String[] numbers) {
return numbers[0]
.concat(DISPLAY_SEPARATOR)
.concat(numbers[numbers.length - 1]);
}

protected static String displayHousenumber(String housenumber) {
if (housenumber.indexOf(OSM_SEPARATOR) < 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: would be a little easier to follow. OSM_SEPARATOR would need to be a string

Suggested change
if (housenumber.indexOf(OSM_SEPARATOR) < 0) {
if (!housenumber.contains(OSM_SEPARATOR)) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted.

return housenumber;
}

String[] numbers = Arrays.stream(housenumber.split(OSM_SEPARATOR.toString()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're using java 21 now, if you make this a list with stream.toList() then later on when you need the first/last values you can use the new methods .getFirst() and .getLast()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted.

.filter(n -> !n.trim().isEmpty())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to trim the output?

Suggested change
.filter(n -> !n.trim().isEmpty())
.map(String::trim)
.filter(n -> !n.isEmpty())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, definitely. Adjusted.

.toArray(String[]::new);
if (numbers.length <= 0) {
// not much to do with strange/invalid entries like "3;" or ";" etc.
return housenumber;
}

Matcher matcher = NO_CONVERSION_PATTERN.matcher(housenumber);
if (matcher.find()) {
return displayHousenumberNonumeric(numbers);
}

// numeric display house number
var statistics = Arrays.stream(numbers)
.collect(Collectors.summarizingInt(Integer::parseUnsignedInt));
return String.valueOf(statistics.getMin())
.concat(DISPLAY_SEPARATOR)
.concat(String.valueOf(statistics.getMax()));
}

@Override
public void process(Tables.OsmHousenumberPoint element, FeatureCollector features) {
String housenumber;
try {
housenumber = displayHousenumber(element.housenumber());
phanecak-maptiler marked this conversation as resolved.
Show resolved Hide resolved
} catch (NumberFormatException e) {
// should not be happening (thanks to NO_CONVERSION_PATTERN) but ...
stats.dataError("housenumber_range");
LOGGER.warn("Failed to convert housenumber range: {}", element.housenumber());
phanecak-maptiler marked this conversation as resolved.
Show resolved Hide resolved
housenumber = element.housenumber();
}

features.centroidIfConvex(LAYER_NAME)
.setBufferPixels(BUFFER_SIZE)
.setAttr(Fields.HOUSENUMBER, element.housenumber())
.setAttr(Fields.HOUSENUMBER, housenumber)
.setMinZoom(14);
}

Expand Down
Loading
Loading