Embed Maps: Difference between revisions

From WikiMLT
Line 44: Line 44:
* GeoJson in use: [[GeoJson:Berlin]]
* GeoJson in use: [[GeoJson:Berlin]]


== GeoJson ==
More details can be can be found in the section [https://maps.extension.wiki/wiki/Leaflet_GeoJSON Leaflet GeoJSON] at the documentation. Here is decried one approach how to obtain (polygon coordinates in JSON) GeoJson, provided within the answers of the question [https://gis.stackexchange.com/a/192298/212523 Getting polygon boundaries of City in JSON from Google Maps API?]:
'''1.'''  Go to https://nominatim.openstreetmap.org/.
'''2.''' In the search bar type the name of the area, like [https://nominatim.openstreetmap.org/ui/search.html?q=Sofia-City+Bulgaria "Sofia-City Bulgaria"].
'''3.''' Shen click on the [https://nominatim.openstreetmap.org/ui/details.html?osmtype=R&osmid=1739543&class=boundary details] button for the location.
'''4.''' Find the entry [https://www.openstreetmap.org/relation/1739543 OSM] for the location and copy the Id, i.e. <code>1739543</code>. Don't click at the link just copy the Id.
'''5.''' Go to [https://polygons.openstreetmap.fr/index.py https://polygons.openstreetmap.fr/] and past the If in the field "Id relation" and press the Submit button.
'''6.''' At the page [https://polygons.openstreetmap.fr/?id=1739543 List of available polygons for id = 1739543] click on the link [https://polygons.openstreetmap.fr/get_geojson.py?id=1739543&params=0 GeoJSON] within the table.


<noinclude><div id='devStage'>
<noinclude><div id='devStage'>

Revision as of 22:24, 27 September 2022

Exension:Maps

In­stal­la­tion

If you are us­ing Me­di­aWi­ki 1.35 or lat­er and PHP 7.4 or lat­er, run the fol­low­ing two com­mands.

IP="/var/www/wiki.example.com"
OWNER="www-data"
cd "$IP"
sudo -u "$OENER" COMPOSER=composer.local.json composer require --no-update mediawiki/maps:~9.0
sudo -u "$OENER" composer update mediawiki/maps --no-dev -o
sudo nano "${IP}/LocalSettings.php"
/**
 * Extension:Maps, https://maps.extension.wiki/wiki/Installation
 */
wfLoadExtension( 'Maps' );

For more de­tails and ow to use Google maps in­stead of Leaflet maps read the in­stal­la­tion man­u­al.

Us­age sam­ples

For more de­tails read the the doc­u­men­ta­tion pro­vid­ed at the Maps for MediaWiki's home­page.

Sofia

{{#display_map: Mladost 4, Sofia, Bulgaria }}

{{#display_​​​map: Mla­dost 4, Sofia, Bul­gar­ia | geo­j­son= }}

{{#display_map: center=Sofia, Bulgaria | geojson=Sofia}}

{{#display_map:center=Sofia, Bul­gar­ia| geojson=Sofia}}

Berlin

{{#display_map: center=Berlin | geojson=Berlin }}

{{#display_​​​map: center=Berlin | geojson=Berlin}}