Newer
Older
osmCoverage / src / osm / jp / coverage / police / Coverage4.java
@hayashi hayashi on 3 May 2018 1 KB fixed: Police
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 javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.xml.sax.SAXException;
import jp.co.areaweb.tools.database.DatabaseTool;

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

    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");
        
        Coverage4 obj = new Coverage4(DbPolice.TABLE_NAME);
        
        Connection conPost = DatabaseTool.openDb("postgis");
        Connection conHsql = DatabaseTool.openDb("database");
        try {
            obj.load(conPost, conHsql);
            obj.outputCSV(outputFileCsv);
            obj.outputJson(outputFileJson, "国土数値情報 警察署データ(平成24年:2012)4:交番");
        }
        finally {
            DatabaseTool.closeDb(conHsql);
            DatabaseTool.closeDb(conPost);
        }
    }

    public Coverage4(String tableName) throws ClassNotFoundException, SQLException, IOException {
        super(tableName);
    }

    @Override
    public void load(Connection conPost, Connection conHsql) throws ClassNotFoundException, SQLException, IOException {
        load(conPost, conHsql, DbPolice.TABLE_NAME, "code=4");
    }
}