mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-09 11:34:07 +00:00
huge cleanup of tigerAddressImport.py
This commit is contained in:
committed by
Sarah Hoffmann
parent
d42aa08705
commit
b062e7e774
@@ -28,20 +28,22 @@ if (isset($aCMDResult['parse-tiger'])) {
|
|||||||
set_time_limit(30);
|
set_time_limit(30);
|
||||||
preg_match('#([0-9]{5})_(.*)#', basename($sImportFile), $aMatch);
|
preg_match('#([0-9]{5})_(.*)#', basename($sImportFile), $aMatch);
|
||||||
$sCountyID = $aMatch[1];
|
$sCountyID = $aMatch[1];
|
||||||
|
|
||||||
echo "Processing ".$sCountyID."...\n";
|
echo "Processing ".$sCountyID."...\n";
|
||||||
$sUnzipCmd = "unzip -d $sTempDir $sImportFile";
|
$sUnzipCmd = "unzip -d $sTempDir $sImportFile";
|
||||||
exec($sUnzipCmd);
|
exec($sUnzipCmd);
|
||||||
$sShapeFile = $sTempDir.'/'.basename($sImportFile, '.zip').'.shp';
|
|
||||||
if (!file_exists($sShapeFile)) {
|
$sShapeFilename = $sTempDir.'/'.basename($sImportFile, '.zip').'.shp';
|
||||||
|
$sSqlFilename = CONST_Tiger_Data_Path.'/'.$sCountyID.'.sql')
|
||||||
|
|
||||||
|
if (!file_exists($sShapeFilename)) {
|
||||||
echo "Failed unzip ($sImportFile)\n";
|
echo "Failed unzip ($sImportFile)\n";
|
||||||
} else {
|
} else {
|
||||||
$sParseCmd = CONST_BasePath.'/utils/tigerAddressImport.py '.$sShapeFile;
|
$sParseCmd = CONST_BasePath.'/utils/tigerAddressImport.py '.$sShapeFilename.' '.$sSqlFilename;
|
||||||
exec($sParseCmd);
|
exec($sParseCmd);
|
||||||
$sOsmFile = $sTempDir.'/'.basename($sImportFile, '.zip').'.osm1.osm';
|
|
||||||
if (!file_exists($sOsmFile)) {
|
if (!file_exists($sOsmFile)) {
|
||||||
echo "Failed parse ($sImportFile)\n";
|
echo "Failed parse ($sImportFile)\n";
|
||||||
} else {
|
if file_exists($sSqlFilename) unlink($sSqlFilename);
|
||||||
copy($sOsmFile, CONST_Tiger_Data_Path.'/'.$sCountyID.'.sql');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cleanup
|
// Cleanup
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
3300
utils/tiger_county_fips.json
Normal file
3300
utils/tiger_county_fips.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user