Embed Maps: Difference between revisions

From WikiMLT
m (Стадий: 5 [Фаза:Утвърждаване, Статус:Авторизиран]; Категория:WikiMLT Features)
 
(One intermediate revision 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 ===
=== 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?]:
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?]:
Line 62: Line 65:
{{devStage  
{{devStage  
  | Прндл  = WikiMLT Features
  | Прндл  = WikiMLT Features
  | Стадий = 5
  | Стадий = 6
  | Фаза  = Утвърждаване
  | Фаза  = Утвърждаване
  | Статус = Авторизиран
  | Статус = Утвърден
  | ИдтПт  = Spas
  | ИдтПт  = Spas
  | РзбПт  = Spas
  | РзбПт  = Spas

Latest revision as of 00:16, 28 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"} # 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 de­tails and ow to use Google maps in­stead of Leaflet maps read the in­stal­la­tion man­u­al.

Ob­tain Geo­J­son da­ta

More de­tails can be can be found in the sec­tion Leaflet Geo­J­SON at the doc­u­men­ta­tion. Here is de­cried one ap­proach how to ob­tain (poly­gon co­or­di­nates in JSON) Geo­J­son, pro­vid­ed with­in the an­swers of the ques­tion Get­ting poly­gon bound­aries 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 Bul­gar­ia".

3. Shen click on the de­tails but­ton for the lo­ca­tion.

4. Find the en­try OSM for the lo­ca­tion 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 re­la­tion" and press the Sub­mit but­ton.

6. At the page List of avail­able poly­gons for id = 1739543 click on the link Geo­J­SON with­in the ta­ble.

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}}