<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">&lt;?php
/**
 * Takes several geojson files and combines them into a single one.
 *
 * @author Christian Weiske &lt;cweiske@cweiske.de&gt;
 */
function err($msg)
{
    echo $msg . "\n";
    exit(1);
}

if ($argc &lt; 2) {
    err("combine-geojson.php &lt;files&gt;");
}

$files = $argv;
array_shift($files);

$combined = [
    'type'     =&gt; 'FeatureCollection',
    'features' =&gt; [],
];

foreach ($files as $file) {
    $combined['features'][] = json_decode(file_get_contents($file));
}

echo json_encode($combined, JSON_PRETTY_PRINT) . "\n";
?&gt;
</pre></body></html>