mirror of
https://github.com/cfpwastaken/planetiler-openmaptiles.git
synced 2026-02-04 20:41:09 +00:00
Set feature IDs in boundary and agg_stop features. (#148)
This commit is contained in:
@@ -269,6 +269,7 @@ public class Boundary implements
|
||||
// save for later
|
||||
try {
|
||||
CountryBoundaryComponent component = new CountryBoundaryComponent(
|
||||
feature.id(),
|
||||
minAdminLevel,
|
||||
disputed,
|
||||
maritime,
|
||||
@@ -323,7 +324,7 @@ public class Boundary implements
|
||||
if (merged instanceof LineString lineString) {
|
||||
BorderingRegions borderingRegions = getBorderingRegions(countryBoundaries, key.regions, lineString);
|
||||
|
||||
var features = featureCollectors.get(SimpleFeature.fromWorldGeometry(lineString));
|
||||
var features = featureCollectors.get(SimpleFeature.fromWorldGeometry(lineString, key.id));
|
||||
var newFeature = features.line(LAYER_NAME).setBufferPixels(BUFFER_SIZE)
|
||||
.setAttr(Fields.ADMIN_LEVEL, key.adminLevel)
|
||||
.setAttr(Fields.DISPUTED, key.disputed ? 1 : 0)
|
||||
@@ -471,6 +472,7 @@ public class Boundary implements
|
||||
* Information to hold onto from processing a way in a boundary relation to determine the left/right region ID later.
|
||||
*/
|
||||
private record CountryBoundaryComponent(
|
||||
long id,
|
||||
int adminLevel,
|
||||
boolean disputed,
|
||||
boolean maritime,
|
||||
@@ -482,7 +484,7 @@ public class Boundary implements
|
||||
) {
|
||||
|
||||
CountryBoundaryComponent groupingKey() {
|
||||
return new CountryBoundaryComponent(adminLevel, disputed, maritime, minzoom, null, regions, claimedBy, name);
|
||||
return new CountryBoundaryComponent(id, adminLevel, disputed, maritime, minzoom, null, regions, claimedBy, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,8 @@ public class Poi implements
|
||||
private void processAggStop(Tables.OsmPoiPoint element, FeatureCollector.Factory featureCollectors,
|
||||
Consumer<FeatureCollector.Feature> emit, Integer aggStop) {
|
||||
try {
|
||||
var features = featureCollectors.get(SimpleFeature.fromWorldGeometry(element.source().worldGeometry()));
|
||||
var features =
|
||||
featureCollectors.get(SimpleFeature.fromWorldGeometry(element.source().worldGeometry(), element.source().id()));
|
||||
setupPoiFeature(element, features.point(LAYER_NAME), aggStop);
|
||||
for (var feature : features) {
|
||||
emit.accept(feature);
|
||||
@@ -209,7 +210,6 @@ public class Poi implements
|
||||
processAggStop(aggStopSet.getFirst(), featureCollectors, emit, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
Tables.OsmPoiPoint nearest = null;
|
||||
try {
|
||||
// find most important stops based on subclass
|
||||
@@ -228,7 +228,8 @@ public class Poi implements
|
||||
double minDistance = Double.MAX_VALUE;
|
||||
for (var aggStop : topAggStops) {
|
||||
double distance = aggStopCentroid.distance(aggStop.source().worldGeometry());
|
||||
if (distance < minDistance) {
|
||||
if (distance < minDistance || nearest == null ||
|
||||
(distance == minDistance && aggStop.source().id() < nearest.source().id())) {
|
||||
minDistance = distance;
|
||||
nearest = aggStop;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user