OSDN Git Service

一括アップロード用
authorYu Hayashi <hayashi.yuu@gmail.com>
Thu, 19 Feb 2015 14:10:05 +0000 (23:10 +0900)
committerYu Hayashi <hayashi.yuu@gmail.com>
Thu, 19 Feb 2015 14:10:05 +0000 (23:10 +0900)
.classpath
.gitignore
ConvBusstop.sh [new file with mode: 0644]
ConvBusstop.zip
dest/ConvBusstop.bat [new file with mode: 0644]
dest/database.properties [new file with mode: 0644]
src/osm/jp/ConvBusstop.java

index 7a553c1..6150f79 100644 (file)
@@ -2,7 +2,7 @@
 <classpath>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-       <classpathentry kind="lib" path="lib/hayashi_0225.jar"/>
-       <classpathentry kind="lib" path="lib/hsqldb_2.2.9.jar"/>
+       <classpathentry kind="lib" path="D:/workspace/hayashi_0225.jar"/>
+       <classpathentry kind="lib" path="D:/workspace/hsqldb_2_2_9.jar"/>
        <classpathentry kind="output" path="classes"/>
 </classpath>
index a4637d5..68bdc7d 100644 (file)
@@ -3,4 +3,5 @@
 *.zip
 bin/
 classes/
-sample/
\ No newline at end of file
+sample/
+P11-10_14_GML/
\ No newline at end of file
diff --git a/ConvBusstop.sh b/ConvBusstop.sh
new file mode 100644 (file)
index 0000000..b977c22
--- /dev/null
@@ -0,0 +1,5 @@
+rm -r database
+java -cp .:ConvBusstop.jar:hayashi_0225.jar:hsqldb_2.2.9.jar osm.jp.ConvBusroute
+
+rm -r database
+java -cp .:ConvBusstop.jar:hayashi_0225.jar:hsqldb_2.2.9.jar osm.jp.ConvBusstop -nocheck
index 77d8328..42aa31c 100644 (file)
Binary files a/ConvBusstop.zip and b/ConvBusstop.zip differ
diff --git a/dest/ConvBusstop.bat b/dest/ConvBusstop.bat
new file mode 100644 (file)
index 0000000..09a806a
--- /dev/null
@@ -0,0 +1,5 @@
+rem java -jar ConvBusstop.jar
+
+java -jar ConvBusstop.jar -nocheck
+
+pause
\ No newline at end of file
diff --git a/dest/database.properties b/dest/database.properties
new file mode 100644 (file)
index 0000000..b8aa951
--- /dev/null
@@ -0,0 +1,4 @@
+db_driver=org.hsqldb.jdbcDriver
+db_url=jdbc:hsqldb:file:./database/db
+db_user=sa
+db_passwd=
index 1613ac5..0086cb4 100644 (file)
@@ -101,6 +101,58 @@ public class ConvBusstop {
                                }
                        }
                        System.out.println("["+ fcounter +"]つのファイルをインポートしました。");
+                       
+                       /**
+                        * インポートしたデータの緯度経度範囲を読み取る
+                        */
+                       double maxLat = -90.0D;
+                       double minLat = 90.0D;
+                       double maxLon = -180.0D;
+                       double minLon = 180.0D;
+                       PreparedStatement ps8 = con.prepareStatement("SELECT lat,lon FROM bus_stop");
+                       ResultSet rset8 = ps8.executeQuery();
+                       while (rset8.next()) {
+                               Double lat = rset8.getDouble("lat");
+                               Double lon = rset8.getDouble("lon");
+
+                               if (lat > maxLat) {
+                                       maxLat = lat;
+                               }
+                               if (lon > maxLon) {
+                                       maxLon = lon;
+                               }
+                               if (lat < minLat) {
+                                       minLat = lat;
+                               }
+                               if (lon < minLon) {
+                                       minLon = lon;
+                               }
+                       }
+                       rset8.close();
+                       System.out.println("<bbox-query s=\"" + (minLat - 0.01D) + "\" n=\"" + (maxLat + 0.01D) + "\" w=\"" + (minLon - 0.01D) + "\" e=\"" + (maxLon + 0.01D) + "\"/>");
+                       
+                       /**
+                        * 既存のOSMバス停を読み込む
+                        */
+                       if (!ConvBusstop.nocheck) {
+                               /*
+<osm-script timeout="900" element-limit="1073741824">
+ <query type="node">
+  <has-kv k="highway" v="bus_stop"/>
+  <bbox-query s="35.13" n="35.66" w="138.99" e="139.79"/>
+ </query>
+ <query type="node">
+  <has-kv k="public_transport" v="platform"/>
+  <has-kv k="bus" v="yes"/>
+  <bbox-query s="35.13" n="35.66" w="138.99" e="139.79"/>
+ </query>
+ <print/>
+</osm-script>
+                                */
+                               
+                       }
+                       
+                       System.out.println("["+ fcounter +"] 変換完了しました。");
                }
                finally {
                        DatabaseTool.closeDb(con);
@@ -325,9 +377,9 @@ public class ConvBusstop {
                        gw.write("<gpx xmlns=\"http://www.topografix.com/GPX/1/1\" version=\"1.1\" creator=\"osmtracker-android\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd \">");
                        gw.newLine();
 
-                       double maxLat = 0.0;
+                       double maxLat = -180.0;
                        double minLat = 180.0;
-                       double maxLon = 0.0;
+                       double maxLon = -180.0;
                        double minLon = 180.0;
 
                        ps9.setInt(1, code);
@@ -823,7 +875,8 @@ public class ConvBusstop {
                                double lon = Double.parseDouble(lonStr);
                                ps6.setDouble(1, lat);
                                ps6.setDouble(2, lon);
-                               ps6.setInt(3, (ConvBusstop.nocheck ? 0 : HttpGET.getMap(lat, lon, NEER)));
+                               // ps6.setInt(3, (ConvBusstop.nocheck ? 0 : HttpGET.getMap(lat, lon, NEER)));
+                               ps6.setInt(3, 0);
                                ps6.setString(4, idStr);
                                System.out.println("UPDATE bus_stop("+ idStr +") lat="+ lat +", lon="+ lon +", fixed="+ (ConvBusstop.nocheck ? 0 : HttpGET.getMap(lat, lon, NEER)));
                                ps6.executeUpdate();
@@ -873,7 +926,8 @@ public class ConvBusstop {
 
                                ps6.setDouble(1, lat);
                                ps6.setDouble(2, lon);
-                               ps6.setInt(3, (ConvBusstop.nocheck ? 0 : HttpGET.getMap(lat, lon, NEER)));
+                               //ps6.setInt(3, (ConvBusstop.nocheck ? 0 : HttpGET.getMap(lat, lon, NEER)));
+                               ps6.setInt(3, 0);
                                ps6.setString(4, idStr);
                                ps6.executeUpdate();
                                ps6.close();