Newer
Older
osmCoverage / src / osm / jp / coverage / busstop / Coverage.java
package osm.jp.coverage.busstop;

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;
import osm.jp.postgis.CoverageAll;

public class Coverage {
    public static final String TABLE_NAME = "t_busstop"; 

    public static void main(String[] args) throws FileNotFoundException, ClassNotFoundException, SQLException, IOException, ParserConfigurationException, SAXException, TransformerException
    {
        File dir = new File("GML_BUSSTOP");
        File outputFileCsv = new File(dir, "coverage.busstop.csv");
        File outputFileJson = new File(dir, "coverage.busstop.json");
        
        CoverageAll obj = new CoverageAll(new File(dir, "pbfDate.json"));
        obj.setTablename(DbBusstop.TABLE_NAME);
        obj.setData(new ArrayList<>());
        
        Connection conPost = DatabaseTool.openDb("postgis");
        Connection conHsql = DatabaseTool.openDb("database");
        try {
            obj.load(conPost, conHsql, "busstop", null);
            obj.outputCSV(outputFileCsv);
            obj.outputJson(outputFileJson, "国土数値情報 バス停留所データ 平成22年");
        }
        finally {
            DatabaseTool.closeDb(conHsql);
            DatabaseTool.closeDb(conPost);
        }
    }
}