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

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 void main(String[] args) throws FileNotFoundException, ClassNotFoundException, SQLException, IOException, ParserConfigurationException, SAXException, TransformerException
    {
        File dir = new File("GML_FUEL");
        File outputFileCsv = new File(dir, "coverage.fuel.csv");
        File outputFileJson = new File(dir, "coverage.fuel.json");

        CoverageAll obj = new CoverageAll(new File(dir, "pbfDate.json"));
        obj.setTablename(DbFuel.TABLE_NAME);
        obj.setData(new ArrayList<>());

        Connection conPost = DatabaseTool.openDb("postgis");
        Connection conHsql = DatabaseTool.openDb("database");
        try {
            obj.load(conPost, conHsql, DbFuel.TABLE_NAME, null);
            obj.outputCSV(outputFileCsv);
            obj.outputJson(outputFileJson, "国土数値情報 燃料給油所データ 平成28年(2016)");
        }
        finally {
            DatabaseTool.closeDb(conHsql);
            DatabaseTool.closeDb(conPost);
        }
    }
}