Newer
Older
osmCoverage / src / osm / jp / coverage / postoffice / CoverageAll.java
@hayashi hayashi on 27 Jan 2018 1 KB postoffice CoverageAll
package osm.jp.coverage.postoffice;

import osm.jp.postgis.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.xml.sax.SAXException;
import jp.co.areaweb.tools.database.DatabaseTool;

public class CoverageAll extends ArrayList<Coverage> {

    public static void main(String[] args) throws FileNotFoundException, ClassNotFoundException, SQLException, IOException, ParserConfigurationException, SAXException, TransformerException
    {
        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);
        
        Connection conPost = DatabaseTool.openDb("postgis");
        Connection conHsql = DatabaseTool.openDb("database");
        try {
            obj.load(conPost, conHsql);
            obj.outputCSV(outputFileCsv);
            obj.outputJson(outputFileJson, "国土数値情報 郵便局データ(平成25年)");
        }
        finally {
            DatabaseTool.closeDb(conHsql);
            DatabaseTool.closeDb(conPost);
        }
    }
}