Skip to content

Commit

Permalink
Merge pull request #50 from govlt/more-poi
Browse files Browse the repository at this point in the history
More poi objects
  • Loading branch information
vycius authored Apr 15, 2024
2 parents 96a3cac + bda1930 commit eac7f60
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
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

0 comments on commit eac7f60

Please sign in to comment.