http://lemuria.org/dragoneye/index.php?title=Merge_overlays&feed=atom&action=history
Merge overlays - Revision history
2024-03-29T02:17:29Z
Revision history for this page on the wiki
MediaWiki 1.36.0
http://lemuria.org/dragoneye/index.php?title=Merge_overlays&diff=1512&oldid=prev
Tom at 09:07, 27 November 2019
2019-11-27T09:07:14Z
<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 09:07, 27 November 2019</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l2">Line 2:</td>
<td colspan="2" class="diff-lineno">Line 2:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><source></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><source></div></td></tr>
<tr><td colspan="2"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><?php</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><?php</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
</table>
Tom
http://lemuria.org/dragoneye/index.php?title=Merge_overlays&diff=1511&oldid=prev
Tom: Created page with "This script combines the various overlay layers (realms, religions, etc.) into one for use in Mapbox: <source> <?php /* (C)2019 by Tom Vogt <tom@lemuria.org> This m..."
2019-11-27T09:05:44Z
<p>Created page with "This script combines the various overlay layers (realms, religions, etc.) into one for use in Mapbox: <source> <?php /* (C)2019 by Tom Vogt <tom@lemuria.org> This m..."</p>
<p><b>New page</b></p><div>This script combines the various overlay layers (realms, religions, etc.) into one for use in Mapbox:<br />
<br />
<source><br />
<?php<br />
<br />
/*<br />
(C)2019 by Tom Vogt <tom@lemuria.org><br />
<br />
This merges the various overlay layers into one<br />
<br />
intended to be used as described in my video tutorials on my patreon page:<br />
https://www.patreon.com/notveryprofessional<br />
<br />
*/<br />
<br />
<br />
$json = json_decode(file_get_contents("realms.geojson"));<br />
$realms = updata_dataset($json, 1000, 'realm', 'State');<br />
<br />
$json = json_decode(file_get_contents("cultures.geojson"));<br />
$cultures = updata_dataset($json, 2000, 'culture', 'Culture');<br />
<br />
$json = json_decode(file_get_contents("religions.geojson"));<br />
$religions = updata_dataset($json, 3000, 'religion', 'Religion');<br />
<br />
$json = json_decode(file_get_contents("provinces.geojson"));<br />
$provinces = updata_dataset($json, 3000, 'province', 'Province');<br />
<br />
<br />
function updata_dataset($data, $id, $class, $namefield) {<br />
foreach ($data->features as &$feature) {<br />
$feature->properties->id = $id++;<br />
$feature->properties->class = $class;<br />
$feature->properties->name = $feature->properties->$namefield;<br />
}<br />
return $data->features;<br />
}<br />
<br />
$output = json_decode('{"type": "FeatureCollection", "name": "overlays", "features": []}');<br />
<br />
$output->features = array_merge($realms, $cultures, $religions, $provinces);<br />
<br />
echo json_encode($output);<br />
<br />
<br />
?><br />
<br />
</source></div>
Tom