*/ function err($msg) { echo $msg . "\n"; exit(1); } if ($argc < 2) { err("combine-geojson.php "); } $files = $argv; array_shift($files); $combined = [ 'type' => 'FeatureCollection', 'features' => [], ]; foreach ($files as $file) { $combined['features'][] = json_decode(file_get_contents($file)); } echo json_encode($combined, JSON_PRETTY_PRINT) . "\n"; ?>