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

More poi objects #50

Merged
merged 3 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 vector/src/main/java/lt/lrv/basemap/Basemap.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Basemap() {
new MountainPeak(),
new Park(),
new Place(),
new POI(),
new Poi(),
new Transportation(),
new TransportationName(),
new Water(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,23 @@

import static com.google.common.base.Strings.emptyToNull;

public class POI implements OpenMapTilesSchema.Poi {
public class Poi implements OpenMapTilesSchema.Poi {

@Override
public void processFeature(SourceFeature sf, FeatureCollector features) {
if (sf.getSource().equals(Source.GRPK) &&
sf.getSourceLayer().equals(Layer.GRPK_VIETOV_P) &&
sf.canBePolygon() &&
emptyToNull(sf.getString("VARDAS")) != null
) {
var code = sf.getString("GKODAS");

switch (code) {
case "uur14" -> addFeature(FieldValues.CLASS_PARK, 5, sf, features);
case "uvu11" -> addFeature(FieldValues.CLASS_HARBOR, 1, sf, features);
case "ums0", "uhd6", "uhd10" -> addFeature(null, 15, sf, features);
}
} else if (sf.getSource().equals(Source.GRPK) &&
sf.getSourceLayer().equals(Layer.GRPK_VIETOV_T) &&
sf.isPoint() &&
emptyToNull(sf.getString("VARDAS")) != null &&
Expand All @@ -24,20 +36,27 @@ public void processFeature(SourceFeature sf, FeatureCollector features) {

switch (code) {
case "uur14" -> addFeature(FieldValues.CLASS_PARK, 5, sf, features);
case "uvp1" -> addFeature("cemetery", 10, sf, features);
case "unk0" -> addFeature("unknown", 15, sf, features);
case "uvp1" -> addFeature(FieldValues.CLASS_CEMETERY, 10, sf, features);
case "unk0" -> {
switch (sf.getString("OBJ_TIP")) {
case "SPORT" -> addFeature(FieldValues.CLASS_STADIUM, 10, sf, features);
case "KRAŠT" -> addFeature(FieldValues.CLASS_ATTRACTION, 10, sf, features);
default -> addFeature(null, 15, sf, features);
}
}
}
}
}

void addFeature(String clazz, int rank, SourceFeature sf, FeatureCollector features) {
features.point(this.name())
.setBufferPixels(BUFFER_SIZE)
var feature = sf.isPoint() ? features.point(this.name()) : features.centroidIfConvex(this.name());

feature.setBufferPixels(BUFFER_SIZE)
.putAttrs(LanguageUtils.getNames(sf.tags()))
.setAttr(Fields.CLASS, clazz)
.setAttr(Fields.RANK, rank)
.setAttr(Fields.LEVEL, 0)
.setMinZoom(10)
.setMinZoom(12)
.setPointLabelGridPixelSize(14, 64)
.setSortKey(rank);
}
Expand Down