2021-12-23 10:42:24 +00:00
|
|
|
package com.onthegomap.planetiler.basemap.layers;
|
2021-06-25 11:06:55 +00:00
|
|
|
|
2021-12-23 10:42:24 +00:00
|
|
|
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
|
|
|
import static com.onthegomap.planetiler.basemap.BasemapProfile.NATURAL_EARTH_SOURCE;
|
2021-06-25 11:06:55 +00:00
|
|
|
|
2021-12-23 10:42:24 +00:00
|
|
|
import com.onthegomap.planetiler.geo.GeoUtils;
|
|
|
|
import com.onthegomap.planetiler.reader.SimpleFeature;
|
2021-06-25 11:06:55 +00:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
public class LanduseTest extends AbstractLayerTest {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testNaturalEarthUrbanAreas() {
|
|
|
|
assertFeatures(0, List.of(Map.of(
|
|
|
|
"_layer", "landuse",
|
|
|
|
"class", "residential",
|
|
|
|
"_buffer", 4d
|
2021-09-10 00:46:20 +00:00
|
|
|
)), process(SimpleFeature.create(
|
2021-06-25 11:06:55 +00:00
|
|
|
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
|
|
|
Map.of("scalerank", 1.9),
|
|
|
|
NATURAL_EARTH_SOURCE,
|
|
|
|
"ne_50m_urban_areas",
|
|
|
|
0
|
|
|
|
)));
|
2021-09-10 00:46:20 +00:00
|
|
|
assertFeatures(0, List.of(), process(SimpleFeature.create(
|
2021-06-25 11:06:55 +00:00
|
|
|
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
|
|
|
Map.of("scalerank", 2.1),
|
|
|
|
NATURAL_EARTH_SOURCE,
|
|
|
|
"ne_50m_urban_areas",
|
|
|
|
0
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testOsmLanduse() {
|
2021-07-16 09:58:28 +00:00
|
|
|
assertFeatures(13, List.of(
|
|
|
|
Map.of("_layer", "poi"),
|
|
|
|
Map.of(
|
|
|
|
"_layer", "landuse",
|
|
|
|
"class", "railway",
|
|
|
|
"_minpixelsize", 4d,
|
|
|
|
"_minzoom", 9,
|
|
|
|
"_maxzoom", 14
|
|
|
|
)), process(polygonFeature(Map.of(
|
2021-06-25 11:06:55 +00:00
|
|
|
"landuse", "railway",
|
|
|
|
"amenity", "school"
|
|
|
|
))));
|
2021-07-16 09:58:28 +00:00
|
|
|
assertFeatures(13, List.of(Map.of("_layer", "poi"), Map.of(
|
2021-06-25 11:06:55 +00:00
|
|
|
"_layer", "landuse",
|
|
|
|
"class", "school",
|
|
|
|
"_minpixelsize", 4d,
|
|
|
|
"_minzoom", 9,
|
|
|
|
"_maxzoom", 14
|
|
|
|
)), process(polygonFeature(Map.of(
|
|
|
|
"amenity", "school"
|
|
|
|
))));
|
|
|
|
}
|
|
|
|
|
2022-01-19 10:36:44 +00:00
|
|
|
@Test
|
|
|
|
public void testGraveYardBecomesCemetery() {
|
|
|
|
assertFeatures(14, List.of(
|
|
|
|
Map.of("_layer", "poi"),
|
|
|
|
Map.of(
|
|
|
|
"_layer", "landuse",
|
|
|
|
"class", "cemetery"
|
|
|
|
)), process(polygonFeature(Map.of(
|
|
|
|
"amenity", "grave_yard"
|
|
|
|
))));
|
|
|
|
}
|
|
|
|
|
2021-06-25 11:06:55 +00:00
|
|
|
@Test
|
|
|
|
public void testOsmLanduseLowerZoom() {
|
|
|
|
assertFeatures(6, List.of(Map.of(
|
|
|
|
"_layer", "landuse",
|
|
|
|
"class", "suburb",
|
|
|
|
"_minzoom", 6,
|
|
|
|
"_maxzoom", 14,
|
|
|
|
"_minpixelsize", 1d
|
|
|
|
)), process(polygonFeature(Map.of(
|
|
|
|
"place", "suburb"
|
|
|
|
))));
|
|
|
|
assertFeatures(7, List.of(Map.of(
|
|
|
|
"_layer", "landuse",
|
|
|
|
"class", "residential",
|
|
|
|
"_minzoom", 6,
|
|
|
|
"_maxzoom", 14,
|
|
|
|
"_minpixelsize", 2d
|
|
|
|
)), process(polygonFeature(Map.of(
|
|
|
|
"landuse", "residential"
|
|
|
|
))));
|
|
|
|
}
|
|
|
|
}
|