diff --git a/src/osm/jp/postgis/PostgisItems.java b/src/osm/jp/postgis/PostgisItems.java
index c8579b2..ee0e46a 100644
--- a/src/osm/jp/postgis/PostgisItems.java
+++ b/src/osm/jp/postgis/PostgisItems.java
@@ -16,6 +16,7 @@
double lon = 0.0D;
public static void main() {
+ @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
PostgisItems items = new PostgisItems();
items.add(new PostgisItem("gmlid", "gmlid"));
items.add(new PostgisItem("idref", "idref"));
@@ -94,7 +95,8 @@
sb.append(item.localName);
sb.append(",");
}
- sb.append("lat,lon FROM "+ tableName);
+ sb.append("lat,lon FROM ");
+ sb.append(tableName);
return sb.toString();
}
@@ -163,7 +165,8 @@
break;
}
}
- sb.append(" FROM t_"+ tableName);
+ sb.append(" FROM t_");
+ sb.append(tableName);
sb.append(" ORDER BY area, gmlid");
return sb.toString();
}
diff --git a/src/osm/jp/postgis/UnMapped.java b/src/osm/jp/postgis/UnMapped.java
new file mode 100644
index 0000000..93aadcc
--- /dev/null
+++ b/src/osm/jp/postgis/UnMapped.java
@@ -0,0 +1,354 @@
+package osm.jp.postgis;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.StringReader;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonNumber;
+import javax.json.JsonObject;
+import javax.json.JsonReader;
+import javax.json.JsonValue;
+import javax.xml.parsers.ParserConfigurationException;
+import jp.co.areaweb.tools.database.DatabaseTool;
+import org.apache.commons.compress.archivers.ArchiveException;
+import org.xml.sax.SAXException;
+import osm.jp.api.Coverage;
+import osm.jp.api.Japan;
+import tools.Compless;
+
+public class UnMapped {
+ ToPostgis type;
+ String dbname;
+
+ @SuppressWarnings({"UseSpecificCatch", "CallToPrintStackTrace"})
+ public static void main(String[] args) {
+ try {
+ File kmz = (new UnMapped("busstop"))
+ .getKmz(35.4341254D,139.408969D, 3.0D);
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * コンストラクタ
+ * @param dbname
+ * @throws java.lang.ClassNotFoundException
+ * @throws java.sql.SQLException
+ * @throws java.io.IOException
+ */
+ public UnMapped(String dbname) throws ClassNotFoundException, SQLException, IOException {
+ this.type = null;
+ this.dbname = dbname;
+ if (dbname.equals(osm.jp.coverage.busstop.DbBusstop.TABLE_NAME)) {
+ this.type = new osm.jp.coverage.busstop.ToPostgis();
+ }
+ else if (dbname.equals(osm.jp.coverage.fuel.DbFuel.TABLE_NAME)) {
+ this.type = new osm.jp.coverage.fuel.ToPostgis();
+ }
+ else if (dbname.equals(osm.jp.coverage.police.DbPolice.TABLE_NAME)) {
+ this.type = new osm.jp.coverage.police.ToPostgis();
+ }
+ else if (dbname.equals(osm.jp.coverage.postoffice.DbPostoffice.TABLE_NAME)) {
+ this.type = new osm.jp.coverage.postoffice.ToPostgis();
+ }
+ }
+
+ /**
+ *
+ * @param lat0 緯度
+ * @param lon0 経度
+ * @param km 半径(km)
+ * @return KMZファイル
+ * @throws java.lang.ClassNotFoundException
+ * @throws java.sql.SQLException
+ * @throws java.io.IOException
+ * @throws java.io.FileNotFoundException
+ * @throws javax.xml.parsers.ParserConfigurationException
+ * @throws org.xml.sax.SAXException
+ * @throws org.apache.commons.compress.archivers.ArchiveException
+ */
+ public File getKmz(double lat0, double lon0, double km) throws ClassNotFoundException, SQLException, IOException, FileNotFoundException, ParserConfigurationException, SAXException, ArchiveException {
+ File kml = new File(dbname +".kml");
+ File kmz = new File(dbname +".kmz");
+ toKml(kml, "'"+ this.dbname +"' - UnMapped OpenSteetMap", 35.4341254D,139.408969D,3.0D);
+ toKmz(kml, kmz);
+ kml.delete();
+ return kmz;
+ }
+
+ public UnMapped toKmz(File kml, File kmz) throws ArchiveException, IOException {
+ Compless.toZip(kml, kmz);
+ return this;
+ }
+
+ /**
+ *
+ * @param kmlFile
+ * @param name
+ * @param lat0
+ * @param lon0
+ * @param km
+ * @return
+ * @throws FileNotFoundException
+ * @throws ClassNotFoundException
+ * @throws SQLException
+ * @throws IOException
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ */
+ public UnMapped toKml (File kmlFile, String name, double lat0, double lon0, double km)
+ throws FileNotFoundException, ClassNotFoundException, SQLException, IOException, ParserConfigurationException, SAXException
+ {
+ try (Connection conPost = DatabaseTool.openDb(Coverage.DB_PORP_GISDB);
+ BufferedWriter ow = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(kmlFile), "UTF-8")))
+ {
+ ow.write("");
+ ow.newLine();
+ ow.write("");
+ ow.newLine();
+ ow.write("");
+ ow.newLine();
+ {
+ ow.write(getStringStyle());
+ ow.newLine();
+
+ ow.write(""+ name +"");
+ ow.newLine();
+ ow.write("1");
+ ow.newLine();
+ ow.write(getStringExtendedData(name));
+ ow.newLine();
+
+ String sql = "SELECT area,gmlid,fixed,ST_AsGeoJSON(ST_Transform(t_%s.geom,4326))::json As geometry FROM t_%s";
+ sql = String.format(sql, type.tableName, type.tableName);
+ try (PreparedStatement ps8 = conPost.prepareStatement(sql)) {
+ try (ResultSet rset8 = ps8.executeQuery()) {
+ while (rset8.next()) {
+ String gmlid = rset8.getString("gmlid");
+ int area = rset8.getInt("area");
+ int fixed = rset8.getInt("fixed");
+
+ // geom: {"type":"Point","coordinates":[143.3147749,42.2984888]}
+ String geom = rset8.getString("geometry");
+ String lonStr = null;
+ String latStr = null;
+ try (JsonReader reader = Json.createReader(new StringReader(geom))) {
+ JsonObject geojson = reader.readObject();
+ JsonArray coordinates = geojson.getJsonArray("coordinates");
+ for (JsonValue v1 : coordinates) {
+ if (v1.getValueType() == JsonValue.ValueType.NUMBER) {
+ JsonNumber num = (JsonNumber)v1;
+ if (lonStr == null) {
+ lonStr = num.toString();
+ }
+ else {
+ latStr = num.toString();
+ }
+ }
+ }
+ }
+ if ((lonStr != null) && (latStr != null)) {
+ double lat = Double.parseDouble(latStr);
+ double lon = Double.parseDouble(lonStr);
+ double dd = Japan.distanceKm(lat0,lon0,lat,lon);
+ if (dd < km) {
+ String poiname = String.format("%02d - %s", area, gmlid);
+ String color = decideColor(fixed);
+ ow.write(getStringPlacemark(poiname, latStr, lonStr, color));
+ ow.newLine();
+ }
+ }
+ }
+ }
+ }
+ }
+ ow.write("");
+ ow.write("");
+ ow.flush();
+ }
+ return this;
+ }
+
+ String decideColor(int fixed) {
+ if (this.type instanceof osm.jp.coverage.busstop.ToPostgis) {
+ if (fixed == 0) {
+ return "red";
+ }
+ else if (fixed < 100) {
+ return "orange";
+ }
+ else {
+ return "green";
+ }
+ }
+ else if (this.type instanceof osm.jp.coverage.fuel.ToPostgis) {
+ if (fixed == 0) {
+ return "red";
+ }
+ else if (fixed < 50) {
+ return "orange";
+ }
+ else {
+ return "green";
+ }
+ }
+ else if (this.type instanceof osm.jp.coverage.police.ToPostgis) {
+ if (fixed == 0) {
+ return "red";
+ }
+ else {
+ return "green";
+ }
+ }
+ else if (this.type instanceof osm.jp.coverage.postoffice.ToPostgis) {
+ if (fixed == 0) {
+ return "red";
+ }
+ else {
+ return "green";
+ }
+ }
+ return "brown";
+ }
+
+ String getStringStyle() {
+ StringBuilder sbuf = new StringBuilder();
+ sbuf.append(icon("red"));
+ sbuf.append(icon("orange"));
+ sbuf.append(icon("green"));
+ sbuf.append(icon("brown"));
+ return sbuf.toString();
+ }
+
+ /**
+ *
+ * @param color ["red"|"blue"|"purple"|"yellow"|"pink"|"brown"|"green"|"orange"]
+ * @return
+ */
+ String icon(String color) {
+ StringBuilder sbuf = new StringBuilder();
+ sbuf.append(String.format("");
+ return sbuf.toString();
+ }
+
+ /**
+ *
+
+
+ poi
+
+
+
+ 2018-12-23T01:50:40Z
+ Local
+
+ *
+ *
+ */
+ String getStringExtendedData(String name) {
+ StringBuilder sbuf = new StringBuilder();
+ sbuf.append("");
+ sbuf.append("");
+ sbuf.append(name);
+ sbuf.append("");
+ sbuf.append("");
+ sbuf.append("");
+
+ sbuf.append("");
+ sbuf.append((new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")).format(new Date()));
+ sbuf.append("");
+
+ sbuf.append("Local");
+ sbuf.append("");
+ return sbuf.toString();
+ }
+
+ /**
+ *
+
+ 新日本海フェリー 苫小牧東港ターミナル
+ 2017-12-28T11:15:56Z
+ #placemark-blue
+ 141.81955,42.610008
+
+
+ 新日本海フェリー 苫小牧東港ターミナル
+
+
+
+
+ 新日本海フェリー 苫小牧東港ターミナル
+
+ 13
+
+
+ *
+ */
+ String getStringPlacemark(String name, String latStr, String lonStr, String color) {
+ StringBuilder sbuf = new StringBuilder();
+ sbuf.append("");
+ sbuf.append("");
+ sbuf.append(name);
+ sbuf.append("");
+ sbuf.append("");
+ sbuf.append((new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")).format(new Date()));
+ sbuf.append("");
+ sbuf.append(String.format("#placemark-%s", color));
+ sbuf.append("");
+ sbuf.append(String.format("%s,%s", lonStr, latStr));
+ sbuf.append("");
+ sbuf.append(getStringPlacemarkExtendedData(name));
+ sbuf.append("");
+ return sbuf.toString();
+ }
+
+ /**
+ *
+
+
+ 新日本海フェリー 苫小牧東港ターミナル
+
+
+
+
+ 新日本海フェリー 苫小牧東港ターミナル
+
+ 13
+
+ *
+ */
+ String getStringPlacemarkExtendedData(String name) {
+ StringBuilder sbuf = new StringBuilder();
+ sbuf.append("");
+ sbuf.append("");
+ sbuf.append(name);
+ sbuf.append("");
+ sbuf.append("");
+ sbuf.append("");
+ sbuf.append(name);
+ sbuf.append("");
+ sbuf.append("13");
+ sbuf.append("");
+ return sbuf.toString();
+ }
+
+}
diff --git a/src/tools/Compless.java b/src/tools/Compless.java
new file mode 100644
index 0000000..c3f09c2
--- /dev/null
+++ b/src/tools/Compless.java
@@ -0,0 +1,77 @@
+package tools;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.zip.GZIPInputStream;
+import org.apache.commons.compress.archivers.ArchiveException;
+import org.apache.commons.compress.archivers.ArchiveOutputStream;
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
+import org.apache.commons.compress.utils.IOUtils;
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+
+public class Compless {
+
+ /**
+ * `.tar.gz`形式のファイルを指定のディレクトリにuncompless
+ *
+ * @param outDir
+ * @param gzipFile
+ * @throws FileNotFoundException
+ * @throws IOException
+ */
+ public static void uncomplessTarGz(File outDir, File gzipFile) throws FileNotFoundException, IOException {
+ try (FileInputStream fis = new FileInputStream(gzipFile)) {
+ try (GZIPInputStream gis = new GZIPInputStream(fis)) {
+ try (TarArchiveInputStream tis = new TarArchiveInputStream(gis)) {
+ for (TarArchiveEntry entry = tis.getNextTarEntry(); entry != null; entry = tis.getNextTarEntry()) {
+ if (entry.isDirectory()) {
+ File newDir = new File(outDir, entry.getName());
+ try {
+ newDir.mkdirs();
+ }
+ catch(Exception e) {
+ throw new IOException("directory '" + newDir.getAbsolutePath() + "' cannot create.");
+ }
+ }
+ else {
+ File newfile = new File(outDir, entry.getName());
+ File parentDir = newfile.getParentFile();
+ try {
+ parentDir.mkdirs();
+ }
+ catch(Exception e) {
+ throw new IOException("directory '" + parentDir.getAbsolutePath() + "' cannot create.");
+ }
+ try (FileOutputStream fos = new FileOutputStream(newfile)) {
+ IOUtils.copy(tis, fos); // Apache common-io
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @param sourceFile
+ * @param zipFile
+ * @throws FileNotFoundException
+ * @throws org.apache.commons.compress.archivers.ArchiveException
+ */
+ public static void toZip(File sourceFile, File zipFile) throws FileNotFoundException, IOException, ArchiveException {
+ final OutputStream out = new BufferedOutputStream(new FileOutputStream(zipFile));
+ try (ArchiveOutputStream os = new ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.ZIP, out)) {
+ os.putArchiveEntry(new ZipArchiveEntry(sourceFile.getName()));
+ IOUtils.copy(new FileInputStream(sourceFile), os);
+ os.closeArchiveEntry();
+ }
+ }
+}
diff --git a/test/osm/jp/mapped/KML_Samples.kml b/test/osm/jp/mapped/KML_Samples.kml
new file mode 100644
index 0000000..47ae59a
--- /dev/null
+++ b/test/osm/jp/mapped/KML_Samples.kml
@@ -0,0 +1,915 @@
+
+
+
+ KML Samples
+ 1
+ Unleash your creativity with the help of these examples!
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Placemarks
+ These are just some of the different kinds of placemarks with
+ which you can mark your favorite places
+
+ -122.0839597145766
+ 37.42222904525232
+ 0
+ -148.4122922628044
+ 40.5575073395506
+ 500.6566641072245
+
+
+ Simple placemark
+ Attached to the ground. Intelligently places itself at the
+ height of the underlying terrain.
+
+ -122.0822035425683,37.42228990140251,0
+
+
+
+ Floating placemark
+ 0
+ Floats a defined distance above the ground.
+
+ -122.0839597145766
+ 37.42222904525232
+ 0
+ -148.4122922628044
+ 40.5575073395506
+ 500.6566641072245
+
+ #downArrowIcon
+
+ relativeToGround
+ -122.084075,37.4220033612141,50
+
+
+
+ Extruded placemark
+ 0
+ Tethered to the ground by a customizable
+ "tail"
+
+ -122.0845787421525
+ 37.42215078737763
+ 0
+ -148.4126684946234
+ 40.55750733918048
+ 365.2646606980322
+
+ #globeIcon
+
+ 1
+ relativeToGround
+ -122.0857667006183,37.42156927867553,50
+
+
+
+
+ Styles and Markup
+ 0
+ With KML it is easy to create rich, descriptive markup to
+ annotate and enrich your placemarks
+
+ -122.0845787422371
+ 37.42215078726837
+ 0
+ -148.4126777488172
+ 40.55750733930874
+ 365.2646826292919
+
+ #noDrivingDirections
+
+ Highlighted Icon
+ 0
+ Place your mouse over the icon to see it display the new
+ icon
+
+ -122.0856552124024
+ 37.4224281311035
+ 0
+ 0
+ 0
+ 265.8520424250024
+
+
+
+
+
+ normal
+ #normalPlacemark
+
+
+ highlight
+ #highlightPlacemark
+
+
+
+ Roll over this icon
+ 0
+ #exampleStyleMap
+
+ -122.0856545755255,37.42243077405461,0
+
+
+
+
+ Descriptive HTML
+ 0
+
+Placemark descriptions can be enriched by using many standard HTML tags.
+For example:
+
+Styles:
+Italics,
+Bold,
+Underlined,
+Strike Out,
+subscriptsubscript,
+superscriptsuperscript,
+Big,
+Small,
+Typewriter,
+Emphasized,
+Strong,
+Code
+
+Fonts:
+red by name,
+leaf green by hexadecimal RGB
+
+size 1,
+size 2,
+size 3,
+size 4,
+size 5,
+size 6,
+size 7
+
+Times,
+Verdana,
+Arial
+
+Links:
+
+Google Earth!
+
+ or: Check out our website at www.google.com
+
+Alignment:
+left
+center
+right
+
+Ordered Lists:
+- First
- Second
- Third
+- First
- Second
- Third
+- First
- Second
- Third
+
+Unordered Lists:
+
+
+
+
+Definitions:
+
+- Google:
- The best thing since sliced bread
+
+
+Centered:
+Time present and time past
+Are both perhaps present in time future,
+And time future contained in time past.
+If all time is eternally present
+All time is unredeemable.
+
+
+Block Quote:
+
+
+We shall not cease from exploration
+And the end of all our exploring
+Will be to arrive where we started
+And know the place for the first time.
+-- T.S. Eliot
+
+
+
+Headings:
+Header 1
+Header 2
+Header 3
+Header 4
+Header 5
+
+Images:
+Remote image
+
+Scaled image
+
+
+Simple Tables:
+
+
+[Did you notice that double-clicking on the placemark doesn't cause the viewer to take you anywhere? This is because it is possible to directly author a "placeless placemark". If you look at the code for this example, you will see that it has neither a point coordinate nor a LookAt element.]]]>
+
+
+
+ Ground Overlays
+ 0
+ Examples of ground overlays
+
+ Large-scale overlay on terrain
+ 0
+ Overlay shows Mount Etna erupting on July 13th, 2001.
+
+ 15.02468937557116
+ 37.67395167941667
+ 0
+ -16.5581842842829
+ 58.31228652890705
+ 30350.36838438907
+
+
+ http://developers.google.com/kml/documentation/images/etna.jpg
+
+
+ 37.91904192681665
+ 37.46543388598137
+ 15.35832653742206
+ 14.60128369746704
+ -0.1556640799496235
+
+
+
+
+ Screen Overlays
+ 0
+ Screen overlays have to be authored directly in KML. These
+ examples illustrate absolute and dynamic positioning in screen space.
+
+ Simple crosshairs
+ 0
+ This screen overlay uses fractional positioning to put the
+ image in the exact center of the screen
+
+ http://developers.google.com/kml/documentation/images/crosshairs.png
+
+
+
+
+
+
+
+ Absolute Positioning: Top left
+ 0
+
+ http://developers.google.com/kml/documentation/images/top_left.jpg
+
+
+
+
+
+
+
+ Absolute Positioning: Top right
+ 0
+
+ http://developers.google.com/kml/documentation/images/top_right.jpg
+
+
+
+
+
+
+
+ Absolute Positioning: Bottom left
+ 0
+
+ http://developers.google.com/kml/documentation/images/bottom_left.jpg
+
+
+
+
+
+
+
+ Absolute Positioning: Bottom right
+ 0
+
+ http://developers.google.com/kml/documentation/images/bottom_right.jpg
+
+
+
+
+
+
+
+ Dynamic Positioning: Top of screen
+ 0
+
+ http://developers.google.com/kml/documentation/images/dynamic_screenoverlay.jpg
+
+
+
+
+
+
+
+ Dynamic Positioning: Right of screen
+ 0
+
+ http://developers.google.com/kml/documentation/images/dynamic_right.jpg
+
+
+
+
+
+
+
+
+ Paths
+ 0
+ Examples of paths. Note that the tessellate tag is by default
+ set to 0. If you want to create tessellated lines, they must be authored
+ (or edited) directly in KML.
+
+ Tessellated
+ 0
+ tag has a value of 1, the line will contour to the underlying terrain]]>
+
+ -112.0822680013139
+ 36.09825589333556
+ 0
+ 103.8120432044965
+ 62.04855796276328
+ 2889.145007690472
+
+
+ 1
+ -112.0814237830345,36.10677870477137,0
+ -112.0870267752693,36.0905099328766,0
+
+
+
+ Untessellated
+ 0
+ tag has a value of 0, the line follow a simple straight-line path from point to point]]>
+
+ -112.0822680013139
+ 36.09825589333556
+ 0
+ 103.8120432044965
+ 62.04855796276328
+ 2889.145007690472
+
+
+ 0
+ -112.080622229595,36.10673460007995,0
+ -112.085242575315,36.09049598612422,0
+
+
+
+ Absolute
+ 0
+ Transparent purple line
+
+ -112.2719329043177
+ 36.08890633450894
+ 0
+ -106.8161545998597
+ 44.60763714063257
+ 2569.386744398339
+
+ #transPurpleLineGreenPoly
+
+ 1
+ absolute
+ -112.265654928602,36.09447672602546,2357
+ -112.2660384528238,36.09342608838671,2357
+ -112.2668139013453,36.09251058776881,2357
+ -112.2677826834445,36.09189827357996,2357
+ -112.2688557510952,36.0913137941187,2357
+ -112.2694810717219,36.0903677207521,2357
+ -112.2695268555611,36.08932171487285,2357
+ -112.2690144567276,36.08850916060472,2357
+ -112.2681528815339,36.08753813597956,2357
+ -112.2670588176031,36.08682685262568,2357
+ -112.2657374587321,36.08646312301303,2357
+
+
+
+ Absolute Extruded
+ 0
+ Transparent green wall with yellow outlines
+
+ -112.2643334742529
+ 36.08563154742419
+ 0
+ -125.7518698668815
+ 44.61038665812578
+ 4451.842204068102
+
+ #yellowLineGreenPoly
+
+ 1
+ 1
+ absolute
+ -112.2550785337791,36.07954952145647,2357
+ -112.2549277039738,36.08117083492122,2357
+ -112.2552505069063,36.08260761307279,2357
+ -112.2564540158376,36.08395660588506,2357
+ -112.2580238976449,36.08511401044813,2357
+ -112.2595218489022,36.08584355239394,2357
+ -112.2608216347552,36.08612634548589,2357
+ -112.262073428656,36.08626019085147,2357
+ -112.2633204928495,36.08621519860091,2357
+ -112.2644963846444,36.08627897945274,2357
+ -112.2656969554589,36.08649599090644,2357
+
+
+
+ Relative
+ 0
+ Black line (10 pixels wide), height tracks terrain
+
+ -112.2580438551384
+ 36.1072674824385
+ 0
+ 4.947421249553717
+ 44.61324882043339
+ 2927.61105910266
+
+ #thickBlackLine
+
+ 1
+ relativeToGround
+ -112.2532845153347,36.09886943729116,645
+ -112.2540466121145,36.09919570465255,645
+ -112.254734666947,36.09984998366178,645
+ -112.255493345654,36.10051310621746,645
+ -112.2563157098468,36.10108441943419,645
+ -112.2568033076439,36.10159722088088,645
+ -112.257494011321,36.10204323542867,645
+ -112.2584106072308,36.10229131995655,645
+ -112.2596588987972,36.10240001286358,645
+ -112.2610581199487,36.10213176873407,645
+ -112.2626285262793,36.10157011437219,645
+
+
+
+ Relative Extruded
+ 0
+ Opaque blue walls with red outline, height tracks terrain
+
+ -112.2683594333433
+ 36.09884362144909
+ 0
+ -72.24271551768405
+ 44.60855445139561
+ 2184.193522571467
+
+ #redLineBluePoly
+
+ 1
+ 1
+ relativeToGround
+ -112.2656634181359,36.09445214722695,630
+ -112.2652238941097,36.09520916122063,630
+ -112.2645079986395,36.09580763864907,630
+ -112.2638827428817,36.09628572284063,630
+ -112.2635746835406,36.09679275951239,630
+ -112.2635711822407,36.09740038871899,630
+ -112.2640296531825,36.09804913435539,630
+ -112.264327720538,36.09880337400301,630
+ -112.2642436562271,36.09963644790288,630
+ -112.2639148687042,36.10055381117246,630
+ -112.2626894973474,36.10149062823369,630
+
+
+
+
+ Polygons
+ 0
+ Examples of polygon shapes
+
+ Google Campus
+ 0
+ A collection showing how easy it is to create 3-dimensional
+ buildings
+
+ -122.084120030116
+ 37.42174011925477
+ 0
+ -34.82469740081282
+ 53.454348562403
+ 276.7870053764046
+
+
+ Building 40
+ 0
+ #transRedPoly
+
+ 1
+ relativeToGround
+
+
+ -122.0848938459612,37.42257124044786,17
+ -122.0849580979198,37.42211922626856,17
+ -122.0847469573047,37.42207183952619,17
+ -122.0845725380962,37.42209006729676,17
+ -122.0845954886723,37.42215932700895,17
+ -122.0838521118269,37.42227278564371,17
+ -122.083792243335,37.42203539112084,17
+ -122.0835076656616,37.42209006957106,17
+ -122.0834709464152,37.42200987395161,17
+ -122.0831221085748,37.4221046494946,17
+ -122.0829247374572,37.42226503990386,17
+ -122.0829339169385,37.42231242843094,17
+ -122.0833837359737,37.42225046087618,17
+ -122.0833607854248,37.42234159228745,17
+ -122.0834204551642,37.42237075460644,17
+ -122.083659133885,37.42251292011001,17
+ -122.0839758438952,37.42265873093781,17
+ -122.0842374743331,37.42265143972521,17
+ -122.0845036949503,37.4226514386435,17
+ -122.0848020460801,37.42261133916315,17
+ -122.0847882750515,37.42256395055121,17
+ -122.0848938459612,37.42257124044786,17
+
+
+
+
+
+ Building 41
+ 0
+ #transBluePoly
+
+ 1
+ relativeToGround
+
+
+ -122.0857412771483,37.42227033155257,17
+ -122.0858169768481,37.42231408832346,17
+ -122.085852582875,37.42230337469744,17
+ -122.0858799945639,37.42225686138789,17
+ -122.0858860101409,37.4222311076138,17
+ -122.0858069157288,37.42220250173855,17
+ -122.0858379542653,37.42214027058678,17
+ -122.0856732640519,37.42208690214408,17
+ -122.0856022926407,37.42214885429042,17
+ -122.0855902778436,37.422128290487,17
+ -122.0855841672237,37.42208171967246,17
+ -122.0854852065741,37.42210455874995,17
+ -122.0855067264352,37.42214267949824,17
+ -122.0854430712915,37.42212783846172,17
+ -122.0850990714904,37.42251282407603,17
+ -122.0856769818632,37.42281815323651,17
+ -122.0860162273783,37.42244918858722,17
+ -122.0857260327004,37.42229239604253,17
+ -122.0857412771483,37.42227033155257,17
+
+
+
+
+
+ Building 42
+ 0
+ #transGreenPoly
+
+ 1
+ relativeToGround
+
+
+ -122.0857862287242,37.42136208886969,25
+ -122.0857312990603,37.42136935989481,25
+ -122.0857312992918,37.42140934910903,25
+ -122.0856077073679,37.42138390166565,25
+ -122.0855802426516,37.42137299550869,25
+ -122.0852186221971,37.42137299504316,25
+ -122.0852277765639,37.42161656508265,25
+ -122.0852598189347,37.42160565894403,25
+ -122.0852598185499,37.42168200156,25
+ -122.0852369311478,37.42170017860346,25
+ -122.0852643957828,37.42176197982575,25
+ -122.0853239032746,37.42176198013907,25
+ -122.0853559454324,37.421852864452,25
+ -122.0854108752463,37.42188921823734,25
+ -122.0854795379357,37.42189285337048,25
+ -122.0855436229819,37.42188921797546,25
+ -122.0856260178042,37.42186013499926,25
+ -122.085937287963,37.42186013453605,25
+ -122.0859428718666,37.42160898590042,25
+ -122.0859655469861,37.42157992759144,25
+ -122.0858640462341,37.42147115002957,25
+ -122.0858548911215,37.42140571326184,25
+ -122.0858091162768,37.4214057134039,25
+ -122.0857862287242,37.42136208886969,25
+
+
+
+
+
+ Building 43
+ 0
+ #transYellowPoly
+
+ 1
+ relativeToGround
+
+
+ -122.0844371128284,37.42177253003091,19
+ -122.0845118855746,37.42191111542896,19
+ -122.0850470999805,37.42178755121535,19
+ -122.0850719913391,37.42143663023161,19
+ -122.084916406232,37.42137237822116,19
+ -122.0842193868167,37.42137237801626,19
+ -122.08421938659,37.42147617161496,19
+ -122.0838086419991,37.4214613409357,19
+ -122.0837899728564,37.42131306410796,19
+ -122.0832796534698,37.42129328840593,19
+ -122.0832609819207,37.42139213944298,19
+ -122.0829373621737,37.42137236399876,19
+ -122.0829062425667,37.42151569778871,19
+ -122.0828502269665,37.42176282576465,19
+ -122.0829435788635,37.42176776969635,19
+ -122.083217411188,37.42179248552686,19
+ -122.0835970430103,37.4217480074456,19
+ -122.0839455556771,37.42169364237603,19
+ -122.0840077894637,37.42176283815853,19
+ -122.084113587521,37.42174801104392,19
+ -122.0840762473784,37.42171341292375,19
+ -122.0841447047739,37.42167881534569,19
+ -122.084144704223,37.42181720660197,19
+ -122.0842503333074,37.4218170700446,19
+ -122.0844371128284,37.42177253003091,19
+
+
+
+
+
+
+ Extruded Polygon
+ A simple way to model a building
+
+ The Pentagon
+
+ -77.05580139178142
+ 38.870832443487
+ 59.88865561738225
+ 48.09646074797388
+ 742.0552506670548
+
+
+ 1
+ relativeToGround
+
+
+ -77.05788457660967,38.87253259892824,100
+ -77.05465973756702,38.87291016281703,100
+ -77.05315536854791,38.87053267794386,100
+ -77.05552622493516,38.868757801256,100
+ -77.05844056290393,38.86996206506943,100
+ -77.05788457660967,38.87253259892824,100
+
+
+
+
+ -77.05668055019126,38.87154239798456,100
+ -77.05542625960818,38.87167890344077,100
+ -77.05485125901024,38.87076535397792,100
+ -77.05577677433152,38.87008686581446,100
+ -77.05691162017543,38.87054446963351,100
+ -77.05668055019126,38.87154239798456,100
+
+
+
+
+
+
+ Absolute and Relative
+ 0
+ Four structures whose roofs meet exactly. Turn on/off
+ terrain to see the difference between relative and absolute
+ positioning.
+
+ -112.3348969157552
+ 36.14845533214919
+ 0
+ -86.91235037566909
+ 49.30695423894192
+ 990.6761201087104
+
+
+ Absolute
+ 0
+ #transBluePoly
+
+ 1
+ absolute
+
+
+ -112.3372510731295,36.14888505105317,1784
+ -112.3356128688403,36.14781540589019,1784
+ -112.3368169371048,36.14658677734382,1784
+ -112.3384408457543,36.14762778914076,1784
+ -112.3372510731295,36.14888505105317,1784
+
+
+
+
+
+ Absolute Extruded
+ 0
+ #transRedPoly
+
+ 1
+ 1
+ absolute
+
+
+ -112.3396586818843,36.14637618647505,1784
+ -112.3380597654315,36.14531751871353,1784
+ -112.3368254237788,36.14659596244607,1784
+ -112.3384555043203,36.14762621763982,1784
+ -112.3396586818843,36.14637618647505,1784
+
+
+
+
+
+ Relative
+ 0
+
+ -112.3350152490417
+ 36.14943123077423
+ 0
+ -118.9214100848499
+ 37.92486261093203
+ 345.5169113679813
+
+ #transGreenPoly
+
+ 1
+ relativeToGround
+
+
+ -112.3349463145932,36.14988705767721,100
+ -112.3354019540677,36.14941108398372,100
+ -112.3344428289146,36.14878490381308,100
+ -112.3331289492913,36.14780840132443,100
+ -112.3317019516947,36.14680755678357,100
+ -112.331131440106,36.1474173426228,100
+ -112.332616324338,36.14845453364654,100
+ -112.3339876620524,36.14926570522069,100
+ -112.3349463145932,36.14988705767721,100
+
+
+
+
+
+ Relative Extruded
+ 0
+
+ -112.3351587892382
+ 36.14979247129029
+ 0
+ -55.42811560891606
+ 56.10280503739589
+ 401.0997279712519
+
+ #transYellowPoly
+
+ 1
+ 1
+ relativeToGround
+
+
+ -112.3348783983763,36.1514008468736,100
+ -112.3372535345629,36.14888517553886,100
+ -112.3356068927954,36.14781612679284,100
+ -112.3350034807972,36.14846469024177,100
+ -112.3358353861232,36.1489624162954,100
+ -112.3345888301373,36.15026229372507,100
+ -112.3337937856278,36.14978096026463,100
+ -112.3331798208424,36.1504472788618,100
+ -112.3348783983763,36.1514008468736,100
+
+
+
+
+
+
+
+
diff --git "a/test/osm/jp/mapped/MAPS.ME\343\201\256\344\275\215\347\275\256\346\203\205\345\240\261\343\202\267\343\202\247\343\202\242" "b/test/osm/jp/mapped/MAPS.ME\343\201\256\344\275\215\347\275\256\346\203\205\345\240\261\343\202\267\343\202\247\343\202\242"
new file mode 100644
index 0000000..12182e7
--- /dev/null
+++ "b/test/osm/jp/mapped/MAPS.ME\343\201\256\344\275\215\347\275\256\346\203\205\345\240\261\343\202\267\343\202\247\343\202\242"
Binary files differ
diff --git a/test/osm/jp/mapped/UnMapped OpenSteetMap busstop.kml b/test/osm/jp/mapped/UnMapped OpenSteetMap busstop.kml
new file mode 100644
index 0000000..2ec912f
--- /dev/null
+++ b/test/osm/jp/mapped/UnMapped OpenSteetMap busstop.kml
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+
+
+ UnMapped OpenSteetMap busstop
+ 1
+
+
+ UnMapped OpenSteetMap busstop
+
+
+
+
+
+ 2018-12-24T01:07:22Z
+ Local
+
+
+ 14,n4315
+
+ #placemark-blue
+ 139.41338,35.437989
+
+
+ 14,n4315
+
+
+
+
+
+ 14,n4315
+
+ 13
+
+
+
+ 14,n4323
+
+ #placemark-yellow
+ 139.41363,35.428051
+
+
+ 14,n4323
+
+
+
+
+
+ 14,n4323
+
+ 13
+
+
+
+ 14,n4331
+
+ #placemark-green
+ 139.40461,35.432256
+
+
+ 14,n4331
+
+
+
+
+
+ 14,n4331
+
+ 13
+
+
+
+ 14,n4784
+ #placemark-red
+ 139.41085,35.433714
+
+
+ 14,n4784
+
+
+
+
+ 14,n4784
+
+ 13
+
+
+
+
diff --git a/test/osm/jp/mapped/poi.kml b/test/osm/jp/mapped/poi.kml
new file mode 100644
index 0000000..711c066
--- /dev/null
+++ b/test/osm/jp/mapped/poi.kml
@@ -0,0 +1,708 @@
+
+
+
+
+
+
+
+
+
+
+
+ poi
+ 1
+
+
+ poi
+
+
+
+
+
+ 2018-12-23T01:50:40Z
+ Local
+
+
+ 新日本海フェリー 苫小牧東港ターミナル
+ 2017-12-28T11:15:56Z
+ #placemark-blue
+ 141.81955,42.610008
+
+
+ 新日本海フェリー 苫小牧東港ターミナル
+
+
+
+
+ 新日本海フェリー 苫小牧東港ターミナル
+
+ 13
+
+
+
+ 追分町IC
+ 2017-12-28T11:27:42Z
+ #placemark-blue
+ 141.81422,42.892327
+
+
+ 追分町IC
+
+
+
+
+ 追分町IC
+
+ 12
+
+
+
+ disusedつぼ八
+ 2017-12-29T04:21:24Z
+ #placemark-blue
+ 144.32928,43.017075
+
+
+ disusedつぼ八
+
+
+
+
+ disusedつぼ八
+
+ 17
+
+
+
+ アトモス
+ 2017-12-29T05:49:33Z
+ #placemark-blue
+ 144.39003,42.990622
+
+
+ アトモス
+
+
+
+
+ アトモス
+
+ 19
+
+
+
+ 湯の華銭湯瑞祥
+ #placemark-green
+ 137.95544,36.232811
+
+
+ 湯の華銭湯瑞祥
+
+
+
+
+ 湯の華銭湯瑞祥
+
+
+
+
+ 寸又峡公民館
+ 2018-03-10T23:44:27Z
+ #placemark-green
+ 138.12249,35.17452
+
+
+ 寸又峡公民館
+
+
+
+
+ 寸又峡公民館
+
+ 16
+
+
+
+ ENEOS
+ 2018-04-14T07:46:30Z
+ #placemark-blue
+ 139.03082,35.527759
+
+
+ ENEOS
+
+
+
+
+ ENEOS
+
+ 18
+
+
+
+ 不明な場所
+ 2018-08-31T23:35:05Z
+ #placemark-red
+ 139.87107,35.016036
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 14
+
+
+
+ 不明な場所
+ 2018-08-31T23:40:13Z
+ #placemark-red
+ 139.86873,34.930847
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 16
+
+
+
+ 不明な場所
+ 2018-08-31T23:46:01Z
+ #placemark-red
+ 139.92219,35.003703
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 16
+
+
+
+ 不明な場所
+ 2018-08-31T23:47:05Z
+ #placemark-red
+ 139.97595,35.018605
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 16
+
+
+
+ 不明な場所
+ 2018-08-31T23:47:24Z
+ #placemark-red
+ 139.96148,35.022289
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 16
+
+
+
+ 不明な場所
+ 2018-08-31T23:54:15Z
+ #placemark-red
+ 139.89511,35.024525
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 16
+
+
+
+ 不明な場所
+ 2018-08-31T23:54:51Z
+ #placemark-red
+ 139.91444,35.023882
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 17
+
+
+
+ 接続ミス
+ 2018-09-16T07:21:08Z
+ #placemark-blue
+ 139.54846,35.576906
+
+
+ 接続ミス
+
+
+
+
+ highway-primary
+ hwtag-oneway
+ psurface-paved_good
+
+
+ 接続ミス
+
+ 19
+
+
+
+ bus
+ 2018-11-07T03:15:39Z
+ #placemark-red
+ 139.70321,35.53288
+
+
+ bus
+
+
+
+
+ highway-unclassified
+
+
+ bus
+
+ 17
+
+
+
+ 不明な場所
+ 2018-11-07T03:16:25Z
+ #placemark-red
+ 139.70607,35.534591
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 17
+
+
+
+ 不明な場所
+ 2018-11-07T03:17:01Z
+ #placemark-red
+ 139.71024,35.534199
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 18
+
+
+
+ 不明な場所
+ 2018-11-07T03:17:04Z
+ #placemark-red
+ 139.7103,35.534367
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 18
+
+
+
+ 不明な場所
+ 2018-11-07T03:17:21Z
+ #placemark-red
+ 139.7145,35.534143
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 17
+
+
+
+ 不明な場所
+ 2018-11-07T03:17:26Z
+ #placemark-red
+ 139.71434,35.533953
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 17
+
+
+
+ 不明な場所
+ 2018-11-07T03:17:41Z
+ #placemark-red
+ 139.71757,35.532887
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 17
+
+
+
+ 不明な場所
+ 2018-11-07T03:17:45Z
+ #placemark-red
+ 139.71748,35.53269
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 17
+
+
+
+ 不明な場所
+ 2018-11-07T03:18:17Z
+ #placemark-red
+ 139.72029,35.533458
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 18
+
+
+
+ ストリート
+ 2018-11-07T03:18:25Z
+ #placemark-red
+ 139.72032,35.533334
+
+
+ ストリート
+
+
+
+
+ highway-residential
+ psurface-paved_good
+
+ 18
+
+
+
+ 歩道
+ 2018-11-07T03:18:35Z
+ #placemark-red
+ 139.72208,35.534729
+
+
+ 歩道
+
+
+
+
+ highway-footway
+ hwtag-yesbicycle
+ hwtag-yesfoot
+
+ 17
+
+
+
+ 不明な場所
+ 2018-11-07T03:18:39Z
+ #placemark-red
+ 139.7222,35.534542
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 17
+
+
+
+ no
+ 2018-11-07T03:21:23Z
+ #placemark-green
+ 139.70067,35.528938
+
+
+ 不明な場所
+
+
+
+
+ no
+
+ 18
+
+
+
+ no
+ 2018-11-07T03:21:50Z
+ #placemark-green
+ 139.69853,35.527273
+
+
+ 不明な場所
+
+
+
+
+ no
+
+ 18
+
+
+
+ no
+ 2018-11-07T03:22:13Z
+ #placemark-green
+ 139.69689,35.526403
+
+
+ no
+
+
+
+
+ highway-unclassified
+ hwtag-oneway
+
+
+ no
+
+ 17
+
+
+
+ 旧東海道
+ 川28,30
+ 2018-11-07T10:33:04Z
+ #placemark-green
+ 139.69964,35.527764
+
+
+ 旧東海道
+
+
+ 川28,30
+
+
+ highway-tertiary
+ psurface-paved_good
+
+ 19
+
+
+
+ 現在地
+ 2018-11-07T10:43:11Z
+ #placemark-green
+ 139.6962,35.525399
+
+
+ 現在地
+
+
+
+
+ 現在地
+
+ 17
+
+
+
+ 現在地
+ 2018-11-07T10:50:00Z
+ #placemark-green
+ 139.69539,35.525435
+
+
+ 現在地
+
+
+
+
+ 現在地
+
+ 18
+
+
+
+ 不明な場所
+ 2018-11-07T11:04:16Z
+ #placemark-green
+ 139.69153,35.530158
+
+
+ 不明な場所
+
+
+
+
+ 不明な場所
+
+ 18
+
+
+
+ 川61,74
+ 2018-11-07T11:23:36Z
+ #placemark-green
+ 139.69456,35.534861
+
+
+ 中幸町三丁目
+
+
+
+
+ highway-bus_stop
+
+
+ 川61,74
+
+ 19
+
+
+
+ 川61,75
+ 2018-11-07T11:25:29Z
+ #placemark-green
+ 139.69471,35.534792
+
+
+ 中幸町三丁目
+
+
+
+
+ highway-bus_stop
+
+
+ 川61,75
+
+ 19
+
+
+
+
diff --git a/test/osm/jp/mapped/poi.kmz b/test/osm/jp/mapped/poi.kmz
new file mode 100644
index 0000000..3ada650
--- /dev/null
+++ b/test/osm/jp/mapped/poi.kmz
Binary files differ
diff --git a/test/osm/jp/postgis/PostgresqlTest.java b/test/osm/jp/postgis/PostgresqlTest.java
new file mode 100644
index 0000000..ca5f2c7
--- /dev/null
+++ b/test/osm/jp/postgis/PostgresqlTest.java
@@ -0,0 +1,51 @@
+package osm.jp.postgis;
+
+import java.sql.Connection;
+import jp.co.areaweb.tools.database.DatabaseTool;
+import org.junit.After;
+import org.junit.AfterClass;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * database connect test.
+ * `database.properties` hsqldb
+ */
+public class PostgresqlTest {
+
+ @BeforeClass
+ public static void setUpClass() {
+ }
+
+ @AfterClass
+ public static void tearDownClass() {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * postgresql `gisdb.properties`
+ * postgresql - PostGIS : gisdb
+ */
+ @Test
+ public void connectTest_postgis() {
+ connect("gisdb");
+ }
+ void connect(String dbname) {
+ try (Connection postgresql = DatabaseTool.openDb(dbname)) {
+ assertNotNull(postgresql);
+ }
+ catch (Exception ex) {
+ fail(ex.toString());
+ }
+ }
+}
diff --git a/test/osm/jp/postgis/UnMappedTest.java b/test/osm/jp/postgis/UnMappedTest.java
new file mode 100644
index 0000000..08caca5
--- /dev/null
+++ b/test/osm/jp/postgis/UnMappedTest.java
@@ -0,0 +1,146 @@
+package osm.jp.postgis;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.helpers.DefaultHandler;
+import jp.co.areaweb.tools.database.DatabaseTool;
+import static org.hamcrest.CoreMatchers.is;
+import org.junit.After;
+import org.junit.AfterClass;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.xml.sax.Attributes;
+import osm.jp.api.Coverage;
+import osm.jp.coverage.busstop.DbBusstop;
+
+/**
+ * database connect test.
+ * `gisdb.properties` Postgresql:PostGIS
+ */
+public class UnMappedTest {
+ static Connection conPost = null;
+
+ @BeforeClass
+ public static void setUpClass() throws ClassNotFoundException, SQLException, IOException {
+ // postgresql `gisdb.properties`
+ // postgresql - PostGIS : gisdb
+ conPost = DatabaseTool.openDb("gisdb");
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws SQLException {
+ conPost.close();
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ @Test
+ public void testDbPropertiesName() {
+ assertThat(Coverage.DB_PORP_GISDB, is("gisdb"));
+ }
+
+ @Test
+ public void getBusstopTable() {
+ String tableName = DbBusstop.TABLE_NAME;
+ assertThat(tableName, is("busstop"));
+
+ osm.jp.coverage.busstop.ToPostgis model = new osm.jp.coverage.busstop.ToPostgis();
+ String sql = model.items.getPostSqlStr(tableName);
+ assertThat(sql, is("SELECT gmlid,area,fixed FROM t_busstop ORDER BY area, gmlid"));
+
+ try (PreparedStatement ps8 = conPost.prepareStatement(sql)) {
+ try (ResultSet rset8 = ps8.executeQuery()) {
+ while (rset8.next()) {
+ model.items.setPostResuit(rset8);
+ String osm_node = model.items.getValue();
+ System.out.println(osm_node);
+ }
+ }
+ }
+ catch(Exception e) {
+ fail(e.toString());
+ }
+ }
+
+ @Test
+ public void unMappedBusstop() {
+ check("busstop");
+ }
+
+ @Test
+ public void unMappedFuel() {
+ check("FUEL");
+ }
+
+ @Test
+ public void unMappedPolice() {
+ check("POLICE");
+ }
+
+ @Test
+ public void unMappedPostoffice() {
+ check("POSTOFFICE");
+ }
+
+ @SuppressWarnings("UseSpecificCatch")
+ void check(String dbname) {
+ File kmz = null;
+ try {
+ kmz = (new UnMapped(dbname))
+ .getKmz(35.4341254D,139.408969D, 5.0D);
+ }
+ catch(Exception e) {
+ fail(e.toString());
+ }
+
+ // 出力結果のチェック
+ assertNotNull(kmz);
+ assertThat(kmz.exists(), is(true));
+ assertThat(kmz.isFile(), is(true));
+ assertThat(kmz.getName(), is(dbname+".kmz"));
+ }
+
+ class KmlSaxSimpleReader extends DefaultHandler {
+
+ @Override
+ public void startDocument() {
+ //System.out.println("[11] ドキュメント開始");
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attributes) {
+ //System.out.println("[21] 要素開始 = " + qName);
+ }
+
+ @Override
+ public void characters(char[] ch, int offset, int length) {
+ //System.out.println("[31] テキストデータ = " + new String(ch, offset, length));
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ //System.out.println("[41] 要素終了 = " + qName);
+ }
+
+ @Override
+ public void endDocument(){//[50]
+ //System.out.println("[51] ドキュメント終了");
+ }
+ }
+}
diff --git a/test/tools/Compless.java b/test/tools/Compless.java
deleted file mode 100644
index 45ef5eb..0000000
--- a/test/tools/Compless.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package tools;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.zip.GZIPInputStream;
-import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
-import org.apache.commons.compress.utils.IOUtils;
-import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
-
-public class Compless {
-
- /**
- * `.tar.gz`形式のファイルを指定のディレクトリにuncompless
- *
- * @param outDir
- * @param gzipFile
- * @throws FileNotFoundException
- * @throws IOException
- */
- public static void uncomplessTarGz(File outDir, File gzipFile) throws FileNotFoundException, IOException {
- try (FileInputStream fis = new FileInputStream(gzipFile)) {
- try (GZIPInputStream gis = new GZIPInputStream(fis)) {
- try (TarArchiveInputStream tis = new TarArchiveInputStream(gis)) {
- for (TarArchiveEntry entry = tis.getNextTarEntry(); entry != null; entry = tis.getNextTarEntry()) {
- if (entry.isDirectory()) {
- File newDir = new File(outDir, entry.getName());
- try {
- newDir.mkdirs();
- }
- catch(Exception e) {
- throw new IOException("directory '" + newDir.getAbsolutePath() + "' cannot create.");
- }
- }
- else {
- File newfile = new File(outDir, entry.getName());
- File parentDir = newfile.getParentFile();
- try {
- parentDir.mkdirs();
- }
- catch(Exception e) {
- throw new IOException("directory '" + parentDir.getAbsolutePath() + "' cannot create.");
- }
- try (FileOutputStream fos = new FileOutputStream(newfile)) {
- IOUtils.copy(tis, fos); // Apache common-io
- }
- }
- }
- }
- }
- }
- }
-
-
-}