Newer
Older
osmCoverage / src / osm / jp / coverage / police / Coverage4.java
package osm.jp.coverage.police;

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;

/**
 * 国土数値情報 警察署データ(平成24年:2012)
 * code = 交番
 * @author yuu
 */
public class Coverage4 {

    public static void main(String[] args) throws FileNotFoundException, ClassNotFoundException, SQLException, IOException, ParserConfigurationException, SAXException, TransformerException
    {
        File dir = new File("GML_POLICE");
        File outputFileCsv = new File(dir, "coverage.police4.csv");
        File outputFileJson = new File(dir, "coverage.police4.json");
        
        CoverageAll obj = new CoverageAll(new File(dir, "pbfDate.json"));
        obj.setTablename(DbPolice.TABLE_NAME);
        obj.setData(new ArrayList<>());
        
        Connection conPost = DatabaseTool.openDb("postgis");
        Connection conHsql = DatabaseTool.openDb("database");
        try {
            obj.load(conPost, conHsql, DbPolice.TABLE_NAME, "code=4");
            obj.outputCSV(outputFileCsv);
            obj.outputJson(outputFileJson, "国土数値情報 警察署データ(平成24年:2012)4:交番");
        }
        finally {
            DatabaseTool.closeDb(conHsql);
            DatabaseTool.closeDb(conPost);
        }
    }
}