• R/O
  • HTTP
  • SSH
  • HTTPS

convbusstop: Commit


Commit MetaInfo

Revisionf2ae59ec7c67e0e3ef67c02748291c14ebc1fb2f (tree)
Time2017-01-10 18:20:35
Authoryuuhayashi <hayashi.yuu@gmai...>
Commiteryuuhayashi

Log Message

PostGISへの対応。

Change Summary

Incremental Difference

--- /dev/null
+++ b/src/create_busstop.sql
@@ -0,0 +1,3 @@
1+CREATE TABLE t_busstop (gid SERIAL PRIMARY KEY,name text,fixed integer,area integer,geom GEOMETRY(POINT, 4612));
2+CREATE INDEX ix_busstop_geom ON t_busstop USING GiST (geom);
3+
--- a/src/osm/jp/ConvBusstop.java
+++ b/src/osm/jp/ConvBusstop.java
@@ -33,7 +33,7 @@ public class ConvBusstop {
3333 public static final boolean DB_INIT = false;
3434
3535 // 近くのバス停を探す範囲(バス停を中心としたNEER×2m四方の領域
36- static final int NEER = 150;
36+ static final int NEER = 150; // 150m(0.15km)
3737 static boolean nocheck = false;
3838
3939 public static SimpleDateFormat timeStampFmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
@@ -78,140 +78,155 @@ public class ConvBusstop {
7878
7979 Connection con = DatabaseTool.openDb("database");
8080 ConvBusstop.initDb(con);
81-
81+
8282 try {
8383 /**
84- * バス停データ変換のメイン処理
84+ * 都道府県ごとのGMLディレクトリの処理
8585 */
86+
8687 int fcounter = 0;
8788 File dir = new File(".");
8889 File[] files = dir.listFiles();
89- for (File iFile : files) {
90- if (checkFile(iFile)) {
90+ for (File iDir : files) {
91+ if (checkGMLdir(iDir)) {
92+ // GMLディレクトリを処理する
93+ new ConvBusstop(con, iDir);
9194 fcounter++;
92- ConvBusstop.clearDb(con);
93- inputFile(con, iFile);
95+ }
96+ }
97+ System.out.println("["+ fcounter +"]つのファイルをインポートしました。");
98+ }
99+ finally {
100+ DatabaseTool.closeDb(con);
101+ }
102+ }
103+
104+ public ConvBusstop(Connection con, File gmldir) throws SQLException, FileNotFoundException, ClassNotFoundException, IOException, ParserConfigurationException, SAXException, TransformerException {
105+ int areacode = Integer.parseInt(gmldir.getName().substring(GML_DIR_PREFIX.length(), GML_DIR_PREFIX.length()+2));
94106
95- String iStr = iFile.getName();
96- iStr = iStr.substring(0, iStr.length() - 4);
97-
98- /**
99- * 既存のOSMバス停を読み込む
100- * --> 'existing.xml'
107+ ToPostgis postgis = null;
108+
109+ File[] files = gmldir.listFiles();
110+ for (File iFile : files) {
111+ if (checkFile(iFile, areacode)) {
112+ ConvBusstop.clearDb(con);
113+ inputFile(con, iFile, areacode);
114+
115+ /**
116+ * 既存のOSMバス停を読み込む
117+ * --> 'existing.xml'
118+ */
119+ if (!ConvBusstop.nocheck) {
120+ /*
121+ * 既存のOSMデータファイルがなければ、新たにダウンロードする。
122+ * OSMデータファイルがあるときは、ダウンロードしないでそれを使う。
101123 */
102- if (!ConvBusstop.nocheck && (fcounter > 0)) {
103- /*
104- * 既存のOSMデータファイルがなければ、新たにダウンロードする。
105- * OSMデータファイルがあるときは、ダウンロードしないでそれを使う。
124+ File existingFile = new File(gmldir, String.format("existing_%02d.xml", areacode));
125+ if (!existingFile.isFile()) {
126+ /**
127+ * インポートしたデータの緯度経度範囲を読み取る
106128 */
107- File existingFile = new File(iStr, "existing.xml");
108- if (!existingFile.isFile()) {
109- /**
110- * インポートしたデータの緯度経度範囲を読み取る
111- */
112- double maxLat = -90.0D;
113- double minLat = 90.0D;
114- double maxLon = -180.0D;
115- double minLon = 180.0D;
116- PreparedStatement ps8 = con.prepareStatement("SELECT lat,lon FROM bus_stop");
117- ResultSet rset8 = ps8.executeQuery();
118- while (rset8.next()) {
119- Double lat = rset8.getDouble("lat");
120- Double lon = rset8.getDouble("lon");
121-
122- if (lat > maxLat) {
123- maxLat = lat;
124- }
125- if (lon > maxLon) {
126- maxLon = lon;
127- }
128- if (lat < minLat) {
129- minLat = lat;
130- }
131- if (lon < minLon) {
132- minLon = lon;
133- }
129+ double maxLat = -90.0D;
130+ double minLat = 90.0D;
131+ double maxLon = -180.0D;
132+ double minLon = 180.0D;
133+ PreparedStatement ps8 = con.prepareStatement("SELECT lat,lon FROM bus_stop");
134+ ResultSet rset8 = ps8.executeQuery();
135+ while (rset8.next()) {
136+ Double lat = rset8.getDouble("lat");
137+ Double lon = rset8.getDouble("lon");
138+
139+ if (lat > maxLat) {
140+ maxLat = lat;
141+ }
142+ if (lon > maxLon) {
143+ maxLon = lon;
144+ }
145+ if (lat < minLat) {
146+ minLat = lat;
147+ }
148+ if (lon < minLon) {
149+ minLon = lon;
134150 }
135- rset8.close();
136-
137- /**
138- * OSM OverPassAPI を使って、既存のOSMバス停のデータを取得して、「existing.xml」に出力する
139- */
140- HttpPOST.getCapabilities(new File(iStr), minLat, maxLat, minLon, maxLon);
141151 }
142- readExistingFile(con, existingFile);
152+ rset8.close();
153+
154+ /**
155+ * OSM OverPassAPI を使って、既存のOSMバス停のデータを取得して、「existing.xml」に出力する
156+ */
157+ HttpPOST.getCapabilities(existingFile, minLat, maxLat, minLon, maxLon);
158+ }
159+ readExistingFile(con, existingFile);
160+
161+ PreparedStatement ps1 = con.prepareStatement("SELECT idref,name,lat,lon FROM bus_stop WHERE area=?");
162+ PreparedStatement ps2 = con.prepareStatement("SELECT count(idref) FROM existing_data where (lat > ?) and (lat < ?) and (lon > ?) and (lon < ?)");
163+ PreparedStatement ps3 = con.prepareStatement("UPDATE bus_stop SET fixed=? WHERE idref=?");
164+ PreparedStatement ps4 = con.prepareStatement("SELECT count(idref) FROM existing_data where (lat > ?) and (lat < ?) and (lon > ?) and (lon < ?) and (name = ?)");
165+ ps1.setInt(1, areacode);
166+ ResultSet rset1 = ps1.executeQuery();
167+ while (rset1.next()) {
168+ String idref = rset1.getString("idref");
169+ String name = rset1.getString("name");
170+ Double lat = rset1.getDouble("lat");
171+ Double lon = rset1.getDouble("lon");
143172
144- PreparedStatement ps1 = con.prepareStatement("SELECT idref,name,lat,lon FROM bus_stop");
145- PreparedStatement ps2 = con.prepareStatement("SELECT count(idref) FROM existing_data where (lat > ?) and (lat < ?) and (lon > ?) and (lon < ?)");
146- PreparedStatement ps3 = con.prepareStatement("UPDATE bus_stop SET fixed=? WHERE idref=?");
147- PreparedStatement ps4 = con.prepareStatement("SELECT count(idref) FROM existing_data where (lat > ?) and (lat < ?) and (lon > ?) and (lon < ?) and (name = ?)");
148- ResultSet rset1 = ps1.executeQuery();
149- while (rset1.next()) {
150- String idref = rset1.getString("idref");
151- String name = rset1.getString("name");
152- Double lat = rset1.getDouble("lat");
153- Double lon = rset1.getDouble("lon");
154-
155- // 指定の緯度経度を中心とする半径150x2m四方の矩形領域
156- System.out.print(idref + "("+ name + ") ....");
157- RectArea rect = new RectArea(lat, lon, NEER); // 300m 四方
158- ps2.setDouble(1, rect.minlat);
159- ps2.setDouble(2, rect.maxlat);
160- ps2.setDouble(3, rect.minlon);
161- ps2.setDouble(4, rect.maxlon);
162- ResultSet rset2 = ps2.executeQuery();
163- if (rset2.next()) {
164- int count = rset2.getInt(1);
165- if (count > 0) {
166- System.out.println("."+ count);
173+ // 指定の緯度経度を中心とする半径150x2m四方の矩形領域
174+ System.out.print(idref + "("+ name + ") ....");
175+ RectArea rect = new RectArea(lat, lon, NEER); // 300m 四方
176+ ps2.setDouble(1, rect.minlat);
177+ ps2.setDouble(2, rect.maxlat);
178+ ps2.setDouble(3, rect.minlon);
179+ ps2.setDouble(4, rect.maxlon);
180+ ResultSet rset2 = ps2.executeQuery();
181+ if (rset2.next()) {
182+ int count = rset2.getInt(1);
183+ if (count > 0) {
184+ System.out.println("."+ count);
185+ ps3.setInt(1, count);
186+ ps3.setString(2, idref);
187+ ps3.executeUpdate();
188+ }
189+ else {
190+ // 指定の緯度経度を中心とする半径150x4m四方の矩形領域
191+ System.out.print("***");
192+ rect = new RectArea(lat, lon, NEER*2); // 600m 四方
193+ ps4.setDouble(1, rect.minlat);
194+ ps4.setDouble(2, rect.maxlat);
195+ ps4.setDouble(3, rect.minlon);
196+ ps4.setDouble(4, rect.maxlon);
197+ ps4.setString(5, name);
198+ ResultSet rset4 = ps4.executeQuery();
199+ if (rset4.next()) {
200+ count = rset4.getInt(1);
201+ System.out.println(".."+ count);
167202 ps3.setInt(1, count);
168203 ps3.setString(2, idref);
169204 ps3.executeUpdate();
170205 }
171- else {
172- // 指定の緯度経度を中心とする半径150x4m四方の矩形領域
173- System.out.print("***");
174- rect = new RectArea(lat, lon, NEER*2); // 600m 四方
175- ps4.setDouble(1, rect.minlat);
176- ps4.setDouble(2, rect.maxlat);
177- ps4.setDouble(3, rect.minlon);
178- ps4.setDouble(4, rect.maxlon);
179- ps4.setString(5, name);
180- ResultSet rset4 = ps4.executeQuery();
181- if (rset4.next()) {
182- count = rset4.getInt(1);
183- System.out.println(".."+ count);
184- ps3.setInt(1, count);
185- ps3.setString(2, idref);
186- ps3.executeUpdate();
187- }
188- rset4.close();
189- }
206+ rset4.close();
190207 }
191- rset2.close();
192208 }
193- rset1.close();
194- ps3.close();
195- ps2.close();
196- ps1.close();
209+ rset2.close();
197210 }
198-
199-
200- // ローカルデータベース内の情報を出力する
201- outputDb(con, iStr);
202-
203- // ローカルデータベース内の情報を「busstop.xml」に出力する
204- int counter = outputDb(con, new File(iStr));
205- System.out.println("["+ counter +"] 変換完了しました。");
206-
207- // ローカルデータベース内の情報をPostGIS用の「busstop.sql」に出力する
208- ToPostgis.outputDb(con, new File(iStr));
211+ rset1.close();
212+ ps3.close();
213+ ps2.close();
214+ ps1.close();
209215 }
216+
217+
218+ // ローカルデータベース内の情報を出力する
219+ outputDb(con, gmldir.getName());
220+
221+ // ローカルデータベース内の情報を「busstop.xml」に出力する
222+ int counter = outputDb(con, gmldir);
223+ System.out.println("["+ counter +"] 変換完了しました。");
224+
225+ // ローカルデータベース内の情報をPostGIS用の「busstop.sql」に出力する
226+ postgis = new ToPostgis(gmldir);
227+ postgis.outputDb(con);
228+ postgis.close();
210229 }
211- System.out.println("["+ fcounter +"]つのファイルをインポートしました。");
212- }
213- finally {
214- DatabaseTool.closeDb(con);
215230 }
216231 }
217232
@@ -327,13 +342,11 @@ public class ConvBusstop {
327342 * @throws ParserConfigurationException
328343 * @throws SAXException
329344 */
330- public static void inputFile (Connection con, File iFile) throws FileNotFoundException, ClassNotFoundException, SQLException, IOException, ParserConfigurationException, SAXException {
345+ public static void inputFile (Connection con, File iFile, int areacode) throws FileNotFoundException, ClassNotFoundException, SQLException, IOException, ParserConfigurationException, SAXException {
331346 int iCounter = 0;
332347 String timeStampStr = null;
333348
334349 String iStr = iFile.getName();
335- File dir = new File(iStr.substring(0, iStr.length() - 4));
336- dir.mkdir();
337350
338351 DocumentBuilderFactory factory;
339352 DocumentBuilder builder;
@@ -345,9 +358,9 @@ public class ConvBusstop {
345358 factory.setIgnoringElementContentWhitespace(true);
346359 factory.setIgnoringComments(true);
347360 factory.setValidating(true);
348- root = builder.parse(iStr);
361+ root = builder.parse(iFile);
349362
350- iCounter += showNodes(con, root, iStr.substring(0, iStr.length() - 4), timeStampStr);
363+ iCounter += showNodes(con, root, iStr.substring(0, iStr.length() - 4), timeStampStr, areacode);
351364 System.out.println("バス停数["+ iCounter +"]");
352365 }
353366
@@ -787,7 +800,7 @@ public class ConvBusstop {
787800 * @throws IOException
788801 * @throws SQLException
789802 */
790- public static int showNodes(Connection con, Node node, String iFileName, String timeStampStr) throws IOException, SQLException {
803+ public static int showNodes(Connection con, Node node, String iFileName, String timeStampStr, int areacode) throws IOException, SQLException {
791804 int iCounter = 0;
792805 NamedNodeMap nodeMap = node.getAttributes();
793806 if ( null != nodeMap ) {
@@ -805,7 +818,7 @@ public class ConvBusstop {
805818 showGmPoint(con, node2);
806819 }
807820 else if (node2.getNodeName().equals("gml:Point")) {
808- showGmlPoint(con, node2);
821+ showGmlPoint(con, node2, areacode);
809822 }
810823
811824 else if (node2.getNodeName().equals("ksj:ED01")) {
@@ -818,7 +831,7 @@ public class ConvBusstop {
818831 }
819832
820833 else {
821- iCounter += showNodes(con, node2, iFileName, timeStampStr);
834+ iCounter += showNodes(con, node2, iFileName, timeStampStr, areacode);
822835 }
823836 }
824837 return iCounter;
@@ -1175,7 +1188,7 @@ public class ConvBusstop {
11751188 * @throws IOException
11761189 * @throws SQLException
11771190 */
1178- public static void showGmlPoint(Connection con, Node node) throws IOException, SQLException {
1191+ public static void showGmlPoint(Connection con, Node node, int areacode) throws IOException, SQLException {
11791192 String positionStr = "";
11801193 String latStr = "";
11811194 String lonStr = "";
@@ -1199,30 +1212,62 @@ public class ConvBusstop {
11991212 latStr = str4Ary[0];
12001213 lonStr = str4Ary[1];
12011214
1202- PreparedStatement ps6 = con.prepareStatement("INSERT INTO bus_stop (lat,lon,fixed,idref) VALUES (?,?,?,?)");
1215+ PreparedStatement ps6 = con.prepareStatement("INSERT INTO bus_stop (lat,lon,fixed, area,idref) VALUES (?,?,?,?,?)");
12031216 double lat = Double.parseDouble(latStr);
12041217 double lon = Double.parseDouble(lonStr);
1205- System.out.println("INSERT INTO bus_stop (lat,lon,fixed,idref) VALUES ('"+ latStr +"','"+ lonStr +"','0','"+ idStr +"')");
1218+ System.out.println("INSERT INTO bus_stop (lat,lon,fixed,area, idref) VALUES ('"+ latStr +"','"+ lonStr +"','0',"+ areacode +",'"+ idStr +"')");
12061219
12071220 ps6.setDouble(1, lat);
12081221 ps6.setDouble(2, lon);
12091222 //ps6.setInt(3, (ConvBusstop.nocheck ? 0 : HttpGET.getMap(lat, lon, NEER)));
12101223 ps6.setInt(3, 0);
1211- ps6.setString(4, idStr);
1224+ ps6.setInt(4, areacode);
1225+ ps6.setString(5, idStr);
12121226 ps6.executeUpdate();
12131227 ps6.close();
12141228 }
12151229 }
12161230 }
12171231
1218- static boolean checkFile(File f) {
1232+ /**
1233+ * OSMデータファイルかどうかを見極める
1234+ * @param f
1235+ * @return
1236+ */
1237+ static boolean checkFile(File f, int areacode) {
12191238 String name = f.getName();
1220- if (!name.startsWith("P11-")) {
1239+ if (!name.startsWith(GML_DIR_PREFIX)) {
12211240 return false;
12221241 }
12231242 if (!name.toUpperCase().endsWith(".XML")) {
12241243 return false;
12251244 }
1245+ if (Integer.parseInt(name.substring(GML_DIR_PREFIX.length(), GML_DIR_PREFIX.length()+2)) == areacode) {
1246+ return true;
1247+ }
1248+ return false;
1249+ }
1250+
1251+ /**
1252+ * OSMデータファイルかどうかを見極める
1253+ * @param f
1254+ * @return
1255+ */
1256+ static boolean checkGMLdir(File f) {
1257+ if (!f.isDirectory()) {
1258+ return false;
1259+ }
1260+ String name = f.getName();
1261+ if (!name.startsWith(GML_DIR_PREFIX)) {
1262+ return false;
1263+ }
1264+ if (!name.toUpperCase().endsWith(GML_DIR_PRIFIX)) {
1265+ return false;
1266+ }
12261267 return true;
12271268 }
1269+
1270+ public static final String GML_DIR_PREFIX = "P11-10_";
1271+ public static final String GML_DIR_PRIFIX = "_GML";
1272+
12281273 }
\ No newline at end of file
--- a/src/osm/jp/DbBusstop.java
+++ b/src/osm/jp/DbBusstop.java
@@ -48,7 +48,7 @@ public class DbBusstop {
4848
4949 // 'table.BUS_STOP'を新規に作る
5050 drop(con, "bus_stop");
51- createSt = "CREATE TABLE bus_stop (idref VARCHAR(12) NOT NULL, name VARCHAR(128), lat DOUBLE, lon DOUBLE, fixed INT, ifile VARCHAR(128), CONSTRAINT bus_stop_pk PRIMARY KEY(idref));";
51+ createSt = "CREATE TABLE bus_stop (idref VARCHAR(12) NOT NULL, name VARCHAR(128), lat DOUBLE, lon DOUBLE, fixed INT, area INT, ifile VARCHAR(128), CONSTRAINT bus_stop_pk PRIMARY KEY(idref));";
5252 create(con, createSt);
5353
5454 drop(con, "existing_data");
--- a/src/osm/jp/RectArea.java
+++ b/src/osm/jp/RectArea.java
@@ -5,6 +5,8 @@ public class RectArea {
55 public double maxlon; // 経度(東)
66 public double minlat; // 緯度(南)
77 public double maxlat; // 緯度(北)
8+ public static final double ONE_KM_LAT = 0.009013372D; // 1km距離を表す緯度(差分)
9+ public static final double ONE_KM_LON = 0.010966404D; // 1km距離を表す経度(差分)
810
911 /**
1012 * 矩形領域を中心点と中心点からの距離(メートル)でセットする
@@ -22,8 +24,8 @@ public class RectArea {
2224 double lon1 = y * 2.0d * Math.PI; // 経度1度の距離(m)
2325 double dLon = m / lon1; // 距離を表す経度(差分)
2426 */
25- double dLat = 0.000453D * m / 50D; // 距離を表す緯度(差分)
26- double dLon = 0.0005588D * m / 50D; // 距離を表す経度(差分)
27+ double dLat = ONE_KM_LAT * m / 1000D; // 距離を表す緯度(差分)
28+ double dLon = ONE_KM_LON * m / 1000D; // 距離を表す経度(差分)
2729 minlat = lat - dLat; // 底辺(緯度)
2830 maxlat = lat + dLat; // 上辺(緯度)
2931 minlon = lon - dLon; // 左辺
@@ -37,11 +39,6 @@ public class RectArea {
3739 * @param m
3840 */
3941 public RectArea(double lat, double lon) {
40- double dLat = 0.000453; // 距離を表す緯度(差分)
41- double dLon = 0.0005588; // 距離を表す経度(差分)
42- minlat = lat - dLat; // 底辺(緯度)
43- maxlat = lat + dLat; // 上辺(緯度)
44- minlon = lon - dLon; // 左辺
45- maxlon = lon + dLon; // 右辺
42+ this(lat, lon, 50);
4643 }
4744 }
--- a/src/osm/jp/ToPostgis.java
+++ b/src/osm/jp/ToPostgis.java
@@ -2,9 +2,11 @@ package osm.jp;
22
33 import java.io.BufferedWriter;
44 import java.io.File;
5+import java.io.FileNotFoundException;
56 import java.io.FileOutputStream;
67 import java.io.IOException;
78 import java.io.OutputStreamWriter;
9+import java.io.UnsupportedEncodingException;
810 import java.sql.Connection;
911 import java.sql.PreparedStatement;
1012 import java.sql.ResultSet;
@@ -24,26 +26,18 @@ import java.sql.SQLException;
2426 */
2527 public class ToPostgis {
2628 public static final String SQL_FILE_NAME = "busstop.sql";
29+ BufferedWriter ow = null;
2730
28- public static int outputDb(Connection con, File dir) throws IOException, SQLException {
31+ public ToPostgis(File dir) throws UnsupportedEncodingException, FileNotFoundException {
2932 File sqlFile = new File(dir, SQL_FILE_NAME);
33+ this.ow = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(sqlFile), "UTF-8"));
34+ }
35+
36+ public int outputDb(Connection con) throws IOException, SQLException {
37+
3038 int counter = 0;
3139
32- BufferedWriter ow = null;
33-
34- // OSM file header
35- ow = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(sqlFile), "UTF-8"));
36- ow.write("CREATE TABLE t_busstop ("
37- + "gid SERIAL PRIMARY KEY,"
38- + "name text,"
39- + "fixed integer,"
40- + "geom GEOMETRY(POINT, 4612)"
41- + ");");
42- ow.newLine();
43- ow.write("CREATE INDEX ix_busstop_geom ON t_busstop USING GiST (geom);");
44- ow.newLine();
45-
46- PreparedStatement ps8 = con.prepareStatement("SELECT idref,name,lat,lon,fixed FROM bus_stop");
40+ PreparedStatement ps8 = con.prepareStatement("SELECT idref,name,lat,lon,fixed,area FROM bus_stop");
4741 ResultSet rset8 = ps8.executeQuery();
4842 while (rset8.next()) {
4943 String idref = rset8.getString("idref");
@@ -51,15 +45,24 @@ public class ToPostgis {
5145 Double lat = rset8.getDouble("lat");
5246 Double lon = rset8.getDouble("lon");
5347 int fixed = rset8.getInt("fixed");
48+ int areacode = rset8.getInt("area");
5449
5550 counter++;
56- String osm_node = "insert into t_busstop(name,fixed,geom) VALUES('"+ name +"',"+ fixed +" , ST_GeomFromText('POINT("+ Double.toString(lon) +" "+ Double.toString(lat) +")', 4612));";
51+ String osm_node = "insert into t_busstop(name,fixed,area,geom) VALUES('"+ name +"',"+ fixed +","+ areacode +", ST_GeomFromText('POINT("+ Double.toString(lon) +" "+ Double.toString(lat) +")', 4612));";
5752 System.out.println(osm_node);
58- ow.write(osm_node);
59- ow.newLine();
53+ this.ow.write(osm_node);
54+ this.ow.newLine();
6055 }
6156 rset8.close();
62- ow.close();
57+ this.ow.flush();
6358 return counter;
6459 }
60+
61+ public void close() {
62+ try {
63+ this.ow.close();
64+ } catch (IOException e) {
65+ e.printStackTrace();
66+ }
67+ }
6568 }
--- a/src/osm/jp/api/HttpPOST.java
+++ b/src/osm/jp/api/HttpPOST.java
@@ -21,7 +21,7 @@ public class HttpPOST {
2121 getCapabilities(new File("."), minlat, maxlat, minlon, maxlon);
2222 }
2323
24- public static void getCapabilities(File dir, double minLat, double maxLat, double minLon, double maxLon) throws MalformedURLException, ProtocolException, IOException {
24+ public static void getCapabilities(File oFile, double minLat, double maxLat, double minLon, double maxLon) throws MalformedURLException, ProtocolException, IOException {
2525 System.out.println(host + "/api/interpreter");
2626 URL url = new URL(host + "/api/interpreter");
2727
@@ -57,7 +57,6 @@ public class HttpPOST {
5757
5858 BufferedReader reader = new BufferedReader(new InputStreamReader(urlconn.getInputStream(), "UTF-8"));
5959
60- File oFile = new File(dir, "existing.xml");
6160 BufferedWriter hw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(oFile), "UTF-8"));
6261 while (true) {
6362 String line = reader.readLine();
Show on old repository browser