Embed Maps: Difference between revisions
(6 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
If you are using MediaWiki 1.35 or later and PHP 7.4 or later, run the following two commands. | If you are using MediaWiki 1.35 or later and PHP 7.4 or later, run the following two commands. | ||
<syntaxhighlight lang="shell" line="1" class="code-continue mlw-shell-gray"> | <syntaxhighlight lang="shell" line="1" class="code-continue mlw-shell-gray"> | ||
IP="/var/www/wiki.example.com" | : ${IP:="/var/www/wiki.example.com"} # The DocumentRoot directory of the wiki | ||
OWNER="www-data" | : ${OWNER:="www-data"} # The user that owns the $IP directory | ||
</syntaxhighlight><syntaxhighlight lang="shell" line="1"> | : ${BRANCH:="REL1_38"} # The MediaWiki's branch in use | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="shell" line="1"> | |||
cd "$IP" | cd "$IP" | ||
sudo -u "$OENER" COMPOSER=composer.local.json composer require --no-update mediawiki/maps:~9.0 | sudo -u "$OENER" COMPOSER=composer.local.json composer require --no-update mediawiki/maps:~9.0 | ||
Line 24: | Line 26: | ||
wfLoadExtension( 'Maps' ); | wfLoadExtension( 'Maps' ); | ||
</syntaxhighlight>For more details and ow to use Google maps instead of Leaflet maps read the [https://maps.extension.wiki/wiki/Installation installation manual]. | </syntaxhighlight>For more details and ow to use Google maps instead of Leaflet maps read the [https://maps.extension.wiki/wiki/Installation installation manual]. | ||
=== Obtain GeoJson data === | |||
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¶ms=0 GeoJSON] within the table. | |||
== Usage samples == | == Usage samples == | ||
Line 30: | Line 47: | ||
=== Sofia === | === Sofia === | ||
<syntaxhighlight lang="html+handlebars"> | <syntaxhighlight lang="html+handlebars"> | ||
{{#display_map: Mladost 4, Sofia, Bulgaria }} | |||
</syntaxhighlight>{{#display_map: Mladost 4, Sofia, Bulgaria | geojson= }}<syntaxhighlight lang="html+handlebars"> | |||
{{#display_map: center=Sofia, Bulgaria | geojson=Sofia}} | {{#display_map: center=Sofia, Bulgaria | geojson=Sofia}} | ||
</syntaxhighlight>{{#display_map:center=Sofia, Bulgaria| geojson=Sofia}} | </syntaxhighlight>{{#display_map:center=Sofia, Bulgaria| geojson=Sofia}} | ||
* GeoJson in use: [[GeoJson:Sofia]] | |||
=== Berlin === | === Berlin === | ||
<syntaxhighlight lang="html+handlebars"> | |||
{{#display_map: center=Berlin | geojson=Berlin }} | |||
</syntaxhighlight>{{#display_map: center=Berlin | geojson=Berlin}} | |||
* GeoJson in use: [[GeoJson:Berlin]] | |||
* | |||
<noinclude> | <noinclude><div id='devStage'> | ||
<div id='devStage'> | |||
{{devStage | {{devStage | ||
| Прндл = WikiMLT Features | | Прндл = WikiMLT Features | ||
| Стадий = | | Стадий = 6 | ||
| Фаза = | | Фаза = Утвърждаване | ||
| Статус = | | Статус = Утвърден | ||
| ИдтПт = Spas | | ИдтПт = Spas | ||
| РзбПт = {{REVISIONUSER}} | | РзбПт = Spas | ||
| АвтПт = Spas | |||
| УтвПт = {{REVISIONUSER}} | |||
| ИдтДт = 27.09.2022 | | ИдтДт = 27.09.2022 | ||
| РзбДт = {{Today}} | | РзбДт = 27.09.2022 | ||
| АвтДт = 27.09.2022 | |||
| УтвДт = {{Today}} | |||
| ИдтРв = [[Special:Permalink/32005|32005]] | | ИдтРв = [[Special:Permalink/32005|32005]] | ||
| РзбРв = {{REVISIONID}} | | РзбРв = [[Special:Permalink/32019|32019]] | ||
| АвтРв = [[Special:Permalink/32020|32020]] | |||
| УтвРв = {{REVISIONID}} | |||
}} | }} | ||
</div> | </div> | ||
</noinclude> | </noinclude> |
Latest revision as of 23:16, 27 September 2022
Exension:Maps
- MediaWiki Extension: Extension:Maps
- ProfessionalWiki at GitHub: Maps
- Home page: Maps for MediaWiki
Installation
If you are using MediaWiki 1.35 or later and PHP 7.4 or later, run the following two commands.
: ${IP:="/var/www/wiki.example.com"} # The DocumentRoot directory of the wiki
: ${OWNER:="www-data"} # The user that owns the $IP directory
: ${BRANCH:="REL1_38"} # The MediaWiki's branch in use
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 details and ow to use Google maps instead of Leaflet maps read the installation manual.
Obtain GeoJson data
More details can be can be found in the section 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 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 "Sofia-City Bulgaria".
3. Shen click on the details button for the location.
4. Find the entry OSM for the location and copy the Id, i.e. 1739543
. Don't click at the link just copy the Id.
5. Go to https://polygons.openstreetmap.fr/ and past the If in the field "Id relation" and press the Submit button.
6. At the page List of available polygons for id = 1739543 click on the link GeoJSON within the table.
Usage samples
For more details read the the documentation provided at the Maps for MediaWiki's homepage.
Sofia
{{#display_map: Mladost 4, Sofia, Bulgaria | geojson= }}
{{#display_map:center=Sofia, Bulgaria| geojson=Sofia}}
- GeoJson in use: GeoJson:Sofia
Berlin
{{#display_map: center=Berlin | geojson=Berlin}}
- GeoJson in use: GeoJson:Berlin