diff --git a/src/osm/jp/coverage/postoffice/CoverageAll.java b/src/osm/jp/coverage/postoffice/CoverageAll.java index d8bc432..2018c6f 100644 --- a/src/osm/jp/coverage/postoffice/CoverageAll.java +++ b/src/osm/jp/coverage/postoffice/CoverageAll.java @@ -16,8 +16,8 @@ public static void main(String[] args) throws FileNotFoundException, ClassNotFoundException, SQLException, IOException, ParserConfigurationException, SAXException, TransformerException { - File outputFileCsv = new File(DbPostoffice.TABLE_NAME +".csv"); - File outputFileJson = new File(DbPostoffice.TABLE_NAME +".json"); + File outputFileCsv = new File("coverage.postoffice.csv"); + File outputFileJson = new File("coverage.postoffice.json"); osm.jp.postgis.CoverageAll obj = new osm.jp.postgis.CoverageAll(DbPostoffice.TABLE_NAME); @@ -26,7 +26,7 @@ try { obj.load(conPost, conHsql); obj.outputCSV(outputFileCsv); - obj.outputJson(outputFileJson); + obj.outputJson(outputFileJson, "国土数値情報 郵便局データ(平成25年)"); } finally { DatabaseTool.closeDb(conHsql); diff --git a/src/osm/jp/postgis/CoverageAll.java b/src/osm/jp/postgis/CoverageAll.java index 739914f..5c0015d 100644 --- a/src/osm/jp/postgis/CoverageAll.java +++ b/src/osm/jp/postgis/CoverageAll.java @@ -43,7 +43,7 @@ try { obj.load(conPost, conHsql); obj.outputCSV(outputFileCsv); - obj.outputJson(outputFileJson); + obj.outputJson(outputFileJson, "Data source"); } finally { DatabaseTool.closeDb(conHsql); @@ -148,14 +148,14 @@ } } - public void outputJson(File outputFile) throws FileNotFoundException, UnsupportedEncodingException, IOException { + public void outputJson(File outputFile, String sourcedata) throws FileNotFoundException, UnsupportedEncodingException, IOException { try (BufferedWriter hw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8"))) { int level = 0; hw.write(space(level++) + "{"); hw.newLine(); hw.write(space(level) + "\"timestamp\": \""+ LocalDate.now().format(DateTimeFormatter.ISO_DATE) +"\","); hw.newLine(); - hw.write(space(level) + "\"sourcedata\": \"国土数値情報 燃料給油所データ 平成28年(2016)\","); + hw.write(space(level) + "\"sourcedata\": \""+ sourcedata +"\","); hw.newLine(); hw.write(space(level++) + "\"coverage\": ["); hw.newLine(); @@ -176,6 +176,8 @@ hw.newLine(); hw.write(space(level) + "\"denominator\": "+ String.valueOf(cover.denominator) +","); hw.newLine(); + hw.write(space(level) + "\"molecule\": "+ String.valueOf(cover.molecule) +","); + hw.newLine(); hw.write(space(level) + "\"par\": "+ String.valueOf(df3.format(cover.par))); hw.newLine();