Extension talk:Maps

About this board

Post questions, bug reports and feature requests at https://github.com/JeroenDeDauw/Maps/issues.

The maintainer of the Maps extension does not check this page frequently!

The documentation for the Maps extension is located at https://www.semantic-mediawiki.org/wiki/Extension:Maps


C.Syde65 (talkcontribs)

Hey, I've just discovered that the (geocode) permission has been removed in later versions of MediaWiki. I'm not saying that I have a problem with this. Since I've never properly understood what users with the permission were able to do that users without the permission weren't able to do. But I really want to know when exactly the said permission was removed. Since I want this information for my personal research.

Dylsss (talkcontribs)
This post was hidden by C.Syde65 (history)
Larslaki (talkcontribs)

Hi Jeroen,

thank you for this great extension. By using it the question pops up if it would be possible to create my own layers out of a shape or geojson file. Just to overlay a given map but with the possibility to chose which overlay I want to see implemented in same menu where you can chose the layer (topo cycle etc).

Thank you!


Kghbln (talkcontribs)
Reply to "Creating my own layers"

Error: Maps\MapsSetup::__construct(): Argument #1 ($mwGlobals) cannot be passed by reference

Gachangi (talkcontribs)
Product Version
MediaWiki 1.37.1
PHP 8.0.14 (fpm-fcgi)
MariaDB 10.3.32-MariaDB-0ubuntu0.20.04.1

Just upgraded to 1.37.1 but I get error below when I try to run /maintenance/update.php. Disabling the extension Maps solves this issue.

[no req]   Error: Maps\MapsSetup::__construct(): Argument #1 ($mwGlobals) cannot be passed by reference


from /var/lib/mediawiki/extensions/Maps/MapsRegistration.php(48)

#0 /var/lib/mediawiki/includes/Setup.php(856): MapsRegistration::{closure}()

#1 /var/lib/mediawiki/maintenance/doMaintenance.php(90): require_once(string)

#2 /var/lib/mediawiki/maintenance/update.php(264): require_once(string)

#3 {main}

Jeroen De Dauw (talkcontribs)

What version of Maps?

Gachangi (talkcontribs)
Jeroen De Dauw (talkcontribs)
Reply to "Error: Maps\MapsSetup::__construct(): Argument #1 ($mwGlobals) cannot be passed by reference"

Compound Queries with multiple attributes as result don't show on map

C holtermann (talkcontribs)


I've got this query to show a map of subobjects:

{{#ask: [[Belongs to::{{PAGENAME}}]] |[[Coordinates::+]] |?Coordinates |?Name |?Adresse |?Online |?Typ | template=Popup Maps | showtitle=off | format=leaflet | icon=Map marker icon – Nicolas Mollet – Library – Stores – classic.png | cluster=yes | clustermaxradius=8 }}

which works fine. I want to make use of the same thing with compound subqueries.

{{#compound_query: [[Belongs to::{{PAGENAME}}]] [[Coordinates::+]]  ; format=leaflet  ; ?Coordinates  ; ?Name | [[Belongs to::{{PAGENAME}}]] [[Coordinates::+]] [[Typ::Krankenhaus]]  ; format=leaflet  ; icon=Hospital_symbol_FLC.svg  ; ?Coordinates | template=Popup Maps | showtitle=off | cluster=yes | clustermaxradius=8 }}

does not work as it does not return a map but a table of results. As soon as I add another attribute except for the coordinates like "Name" above which I'd like to show using the template things don't work. I couldn't find a clue yet. Maybe someone can help.


C holtermann (talkcontribs)

And just seconds after writing this I found a solution:

{{#compound_query: [[Belongs to::{{PAGENAME}}]] [[Coordinates::+]] ; ?Coordinates ; ?Name | [[Belongs to::{{PAGENAME}}]] [[Coordinates::+]] [[Typ::Krankenhaus]] ; icon=Hospital_symbol_FLC.svg; ?Coordinates | template=Popup Maps | showtitle=off | cluster=yes | clustermaxradius=8 | format=leaflet }}

format=leaflet needs to be at the end. It's a bit weird though that it only breaks when searching for a second attribute.

Bug with some special characters

Varlin (talkcontribs)

The bugs occured with country names in French in my case, but I guess it can occur in many non English languages. I give just one weird example :

{{#display_map:Côte dIvoire~Côte d'Ivoire}}

This displays two (!) markers on the map

Jeroen De Dauw (talkcontribs)

Just put the ' symbol rather than the HTML code. The HTML code does not work since it contains a semicolon, which is used to separate locations, hence the two markers.

Entering coordinates of a polygon

Jvos2020 (talkcontribs)

A point location is stored as e.g. 51.752367847997384, 5.0420263451101572

I want to record a polygon. Via the Forms extension I didn't see how to add a polygon. On the Leaflet map it looks like I only can add a point. So I manually added a series of coordinates to the page. But they aren't recognized. This is what I entered on the page (within a template):

|Parcel=269 |Place=MyPlace |Contour=51.752367847997384, 5.0420263451101572:

51.754842329817762, 5.0411433012562128:

51.754655975172547, 5.0408091395273438:

51.754514557197254, 5.0405474436405431:

51.752183917880750, 5.0413954272633106:

51.752340178664198, 5.0420365855845324:

51.752367847997384, 5.0420263451101572

And maybe to better illustrate my intention. See below the code to display some parcels.


51.752367847997384, 5.0420263451101572:

51.754842329817762, 5.0411433012562128:

51.754655975172547, 5.0408091395273438:

51.754514557197254, 5.0405474436405431:

51.752183917880750, 5.0413954272633106:

51.752340178664198, 5.0420365855845324:

51.752367847997384, 5.0420263451101572

~MyPlace - 269~Details about this parcel <link to page goes here>

51.75284463529357, 5.0431281849590839:

51.755482428207017, 5.0421830972897626:

51.754842329817762, 5.0411433012562128:

51.752367847997384, 5.0420263451101572:

51.752488841037191, 5.0425605930727997:

51.752520221076558, 5.0426892422115497:

51.752655384114384, 5.0426353602107286:

51.752733376720805, 5.0431660421107614:

51.75284463529357, 5.0431281849590839

~MyPlace - 268~Details about this parcel <link to page goes here>; | width=800 | height=400 | resizable=yes


However what I want is an #ask to retrieve the coordinates from alle the parcel pages.

What should I do to have a polygon on each page as a semantic property?

Reply to "Entering coordinates of a polygon"

GeoJson: possibility to link to Wiki page?

Jvos2020 (talkcontribs)
Reply to "GeoJson: possibility to link to Wiki page?"

Map don't load on form

Summary by Tgschaef

Old extensions are disrupting Maps from loading parser extensions. I was adding a note of my problematic extension to help others that come here looking for help with similar problems.

Cible30 (talkcontribs)

Hello, i'm trying to do a interactive query with page form that display a map with only the subject selected by the visitor. I've written all the codes but in the runquery page the map doesn't load. The code:

  • Template Mappa interattiva:

 [[Category:Campione generico]]
 ; {{#if: {{{specie|}}} | [[Specie::{{{specie|}}}]] |   }}
 ; {{#if: {{{genere|}}} | [[Genere::{{{genere|}}}]] |   }}
 ; {{#if: {{{sottofamiglia|}}} | [[Sottofamiglia::{{{sottofamiglia|}}}]] |   }}
 ; {{#if: {{{famiglia|}}} | [[Famiglia::{{{famiglia|}}}]] |   }}
 ; ?Coordinate
 ; icon=Campione generico.png
 | format=leaflet
 | fullscreen=yes
 | cluster=yes
 | clusterspiderfy=yes
 | clusterzoomonclick=yes
 | zoom=5
 | layers=OpenTopoMap,OpenStreetMap

  • Form:

{{{standard input|run query|label=Cerca}}}
{{{info|query form at top}}}
{{{for template|Mappa interattiva}}}

{| class="formtable"
! Specie:
| {{{field|specie|input type=combobox|existing values only}}}
! Genere:
| {{{field|genere|input type=combobox|existing values only}}}
! Sottofamiglia:
| {{{field|sottofamiglia|input type=combobox|existing values only}}}
! Famiglia:
| {{{field|famiglia|input type=combobox|existing values only}}}
{{{end template}}}

Are there some errors or is not possible to display maps in the special page runquery?

Tgschaef (talkcontribs)

Chiming in to say I have the same problems. You are not alone. Even a plain #ask format=leaflet or googlemap, that works on normal pages will not work on a Run Query template.

Jeroen De Dauw (talkcontribs)

Please make sure you are using Maps 7.20.1 or later. Let me know if the problem occurs on those versions as well.

DiscordiaChaos (talkcontribs)

I'm having the same issue after updating my wiki to MediaWiki 1.35.0, during the process I upgraded Semantic to 3.2.0 and Maps to 7.20.1. It stopped working when it had worked just fine previously. I did try using Semantic 3.1.0 instead, but with no luck.

Jeroen De Dauw (talkcontribs)

Thanks for reporting. Is there a live example of this bug somewhere that I can have a look at?

DiscordiaChaos (talkcontribs)

Yes. Note that my wiki is not open-edit, but you can still see the source code. For some reason it won't let me share links.

The map that is supposed to show:

wiki. rlsh. net/wiki/RLSH_Map_Test

Then the template that is supposed to be able to pull the coords from the location is this one, it is used on all the pages that the map code looks through:


Jeroen De Dauw (talkcontribs)
DiscordiaChaos (talkcontribs)

Very strange. I'll try turning off extensions to see if I could fix it that way and report back. Thank you for the very helpful clue!

DiscordiaChaos (talkcontribs)

Alright, so I commented out this line:

require_once "$IP/extensions/DynamicPageList/DynamicPageList.php";

It was Extension:DynamicPageList (third-party) that I was using, but I don't recall for what exact purpose.

It didn't start working again immediately, but I waited a bit and it's back up! Thank you so much.

Tgschaef (talkcontribs)

Chiming in again to say I had a similar problem of an old extension loaded with the "require_once" was interrupting parser extensions from being loaded. Specifically Maps parser extensions. My culprit was Extension:SimpleTable. It has been fixed by someone and posted at: https://github.com/jrbray1/SimpleTable.

Can't get custom icon to work

Jvos2020 (talkcontribs)

I can't get non-default icons working. For example in an semantic query:

| icon=Red-marker.png

and having Red-marker.png in \Maps\resources\lib\leaflet\images, it does not work.

Felix Englisch (talkcontribs)

In my wiki installation, custom icons are working. Yet, I didn't upload them to the mentioned path, but simply as files in the wiki frontend (like uploading an image). Your syntax looks correctly, so it should work, if you upload them as described.

Jvos2020 (talkcontribs)
Reply to "Can't get custom icon to work"

CSS class for better look and mobile responsiveness

Felix Englisch (talkcontribs)

Although I am a big fan of this extension, I was dissatisfied with how the leaflet maps were displayed. Unlike photos or videos, the appear on the left side of the screen, and even worse, the map normally goes over the edge of mobile screens. So, I decided to create a new CSS class and put all my maps into a div element with this class. Since I am quite happy with this solution, I'd like to share it with you.

.map {
   float: right;
   border: 1px solid #c8ccd1; /* Same as picture thumbnails*/
   padding: 3px;
   background-color: #f8f9fa;
   min-width: 300px; /* With this, you can set the inline width property of the map to 100% */
   margin-bottom: 20px;
   clear: both; /* To avoid two elements next to each other - force them below another instead*/
   width: min-content; /* To force the caption to break lines if it is longer than the map*/

.map > p {
    font-size: 94%; /* Smaller caption, same as picture captions */
    padding: 3px 0 0 3px;

/* Make map mobile-friendly by forcing it to stretch 100% width */
@media only screen and (max-width: 750px) {
	.map {
		float: left; 
		width: 100%;
	.leaflet-container {
		width: 100% !important; /* Override the (inline) width property set when writing e. g. {{#display_map: ... |width=400px}}, because this could be too large for mobile screens */

In the article, I write the following:

<div class="map">
{{#display_map:... |fullscreen=on|width=100%|height=300px}}
Description of the map (caption)
Reply to "CSS class for better look and mobile responsiveness"