Dies ist eine alte Version des Dokuments!
<?php
if (!$argv[1]) {
echo „erstes argument muss datenbankname sein“;
exit;
}
if (!$argv[2]) {
echo „zweites argument muss dateipfad sein“;
exit;
}
$dir = $argv[2];
$files = scandir($dir);
foreach($files as $file) {
if (endsWith($file,„.shp“)) {
$f = str_replace(".shp","",$file);\\ echo "ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL PG:'host=postgresql.cqubs0xna6kf.eu-west-1.rds.amazonaws.com port=5432 dbname={$argv[1]} password=postgresql active_schema=public user=postgresql' -lco DIM=2 {$dir}/{$file} $f -overwrite -lco GEOMETRY_NAME=geom -lco FID=id -nlt PROMOTE_TO_MULTI%%\%%n";\\ \\
}
}
function endsWith($haystack, $needle) {
search forward starting from end minus needle length characters
return $needle === „“ || 1) >= 0 && strpos($haystack, $needle, $temp) !== false);
}