package osm.jp.coverage.fuel; import java.sql.Connection; import java.util.ArrayList; import jp.co.areaweb.tools.database.DatabaseTool; import org.junit.*; import org.junit.runners.MethodSorters; import osm.jp.api.Feature; import osm.jp.api.Japan; import static osm.jp.api.Osmdb.POINT_FIXME; import static osm.jp.api.Osmdb.POINT_NO; import static osm.jp.api.Osmdb.POINT_NO_BRAND; @FixMethodOrder (MethodSorters.NAME_ASCENDING) public class OsmExistTest { public void init() throws Exception { } @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } @Test public void test02_main() throws Exception { Connection hsqldb = null; try { // DB.tableを作成 hsqldb = DatabaseTool.openDb("database"); ArrayList<Feature> features = new ArrayList<>(); features.add(new Feature(Feature.NODE, "amenity", "fuel", POINT_NO_BRAND | POINT_FIXME)); features.add(new Feature(Feature.NODE, "disused:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.NODE, "abandoned:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.NODE, "demolished:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.NODE, "historic:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.NODE, "was:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.NODE, "removed:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.NODE, "no:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.AREA, "amenity", "fuel", POINT_NO_BRAND | POINT_FIXME)); features.add(new Feature(Feature.AREA, "disused:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.AREA, "abandoned:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.AREA, "demolished:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.AREA, "historic:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.AREA, "was:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.AREA, "removed:amenity", "fuel", POINT_NO)); features.add(new Feature(Feature.AREA, "no:amenity", "fuel", POINT_NO)); /** * 既存のOSMガソリンスタンドを読み込む * OSM OverPassAPI を使って、既存のGSデータを取得して、「HSQLDB.FUEL_EXIST」にSTOREする */ OsmExistFuel osmExistFuel = new OsmExistFuel(hsqldb); osmExistFuel.getJapanCapabilities(features, testBoxes); osmExistFuel.export(); } finally { if (hsqldb != null) { DatabaseTool.closeDb(hsqldb); } } } public static Japan[] testBoxes = new Japan[] { // 神奈川県東部 new Japan(138D, 34D, 2D) }; }