Extension talk:Maps

Jump to navigation Jump to search

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



Archive

Map don't load on form

10
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:

{{#compound_query:
 [[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:

Template:InfoboxHero

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

3
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

1
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)
</div>
Reply to "CSS class for better look and mobile responsiveness"

Bug with some special characters

2
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&apos;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.

Reply to "Bug with some special characters"
Mbolatsara (talkcontribs)

I have a Unix server running MW and full root access but cannot get Composer to run without error for some reason. The composer command complain about a missing lock file, but where? Is it possible to install Maps without Composer? If so, can anyone kindly give me some tips on what configuration files should be modified after having downloaded and placed Maps in the extensions directory?

Felix Englisch (talkcontribs)
Felix Englisch (talkcontribs)

So, you still need Composer, but it's sufficient to run it locally and then manually upload the directories from /vendor

Reply to "Installing without Composer?"
EFFemeer (talkcontribs)

Installation was successful but when I include {_{#display_map:center=Brandenburg Gate, Berlin, Germany}_} (without underscores!) on a page I only get {_{#display_map:center=Brandenburg Gate, Berlin, Germany}_} as a result.

Product Version
MediaWiki 1.35.0
PHP 7.4.12 (apache2handler)
MySQL 5.7.32-0ubuntu0.18.04.1
ICU 65.1

Installed extensions

Semantic extensions
Extension Version
Semantic MediaWiki 3.2.0
Special pages
Extension Version
BlockAndNuke 1.1 (cf48015) 09:18, 2 October 2019
Collection 1.8.0 (17850c6) 09:20, 27 September 2019
Confirm User Accounts (3ffa446) 10:05, 3 October 2019
ContactPage 2.3 (48b0c07) 10:17, 13 September 2019
Data Transfer 1.0.1 (1fc1c61) 11:42, 20 September 2019
MaintenanceShell 0.5.0 (038586a) 10:03, 12 September 2019
Mass Edit via Regular Expressions 8.4.0 (b46d2bf) 19:35, 27 August 2020
Nuke 1.3.0
Page Forms 5.0-alpha (9862e06) 15:37, 11 November 2020
Renameuser
Replace Text 1.4.1 (e027d41) 03:48, 11 July 2020
Editors
Extension Version
VisualEditor 0.1.2 (10ac245) 05:46, 11 September 2020
WikiEditor 0.5.2
Parser hooks
Extension Version
Arrays 2.2.0 (40737de) 09:27, 1 August 2019
Babel 1.11.1 (33fc3fd) 09:23, 1 October 2019
Cargo 2.7 (aad4151) 18:10, 10 November 2020
CategoryTree
Cite 1.0.0
DynamicPageList3 3.3.3
Embed Document 0.13
GoogleDocs4MW 1.4 (83c0ccd) 10:01, 12 September 2019
Header Tabs 1.3 (1934f9c) 01:51, 10 July 2020
ImageMap
InputBox 0.3.0
InteractiveTimeline 1.9.0
Javascript Slideshow 2.0.0
Maps 7.20.1
Math 3.0.0
NamespaceHTML 0.2 (edde7aa) 10:19, 13 September 2019
NoTitle 0.4.0 (8bc61aa) 02:19, 3 August 2019
ParserFunctions 1.6.0 (59a9135) 19:43, 10 July 2020
PDFEmbed 2.0.3
Poem
TimelineTable 2.1 (9130229) 04:32, 18 July 2019
VideoPlayer 1
Widgets 1.4.0 (6392516) 08:52, 7 April 2020
YouTube 1.9.3 (a0bbd39) 10:21, 2 September 2019
Media handlers
Extension Version
PDF Handler – (8b39cdd) 13:57, 13 July 2020
Spam prevention
Extension Version
ConfirmEdit 1.6.0
MathCaptcha
API
Extension Version
PageImages
Extension Version
AutoCreateCategoryPages 1.0.0 (2a5f5e7) 20:14, 24 May 2015
CollapsibleVector 0.1.10 (3bd32f3) 10:29, 25 August 2019
Gadgets
Google Analytics Integration 3.0.1 (6441403) 09:12, 6 August 2019
MultimediaViewer
ParserHooks 1.6.1
Page previews (375d27b) 16:18, 23 September 2019
TextExtracts
Validator 2.2.1

Installed libraries

Library Version License
smarty/smarty 3.1.36 LGPL-3.0
Jeroen De Dauw (talkcontribs)
EFFemeer (talkcontribs)

Thanks of lot. Videoplayer stood in the way!

Reply to "Nothing happens"

imageoverlays - no equivalent for leaflet?

2
NeirinD (talkcontribs)

Hey,

maybe I am just configuring the parameters the wrong way. I would like to overlay some parts of the map with images of my own, so I can use the geocoding to show where things are, but have them shown on the image instead of the normal map-base.


The imageoverlays parameter (googlemaps3) seems like it would to the trick, but I just can't get the overlays to work in Leaflet (OSM). From the LeafletService.php/DefaultSettings.php it seems like one can only use predetermined overlays for the maps.


Is there a workaround or am I stuck with Gmaps? Thanks

Jeroen De Dauw (talkcontribs)
68.2.54.76 (talkcontribs)

Is there a way to configure the Maps extension to use a host source per layer? For examples:

"/tiles/{z}/{x}/{y}.png"

"/tiles/{z}/{x}/{y}geoform.pbf"

"/tiles/{z}/{x}/{y}road.pbf"

"/tiles/{z}/{x}/{y}building.pbf"

"/tiles/{z}/{x}/{y}census.pbf"

"/tiles/{z}/{x}/{y}landmark.pbf"

Jeroen De Dauw (talkcontribs)

Not at the moment. I if you a budget I can add it. Or you are welcome to submit a pull request.

Vicarage (talkcontribs)

I found with mediawiki 1.35 that old extensions like SimpleTable would stop Maps working, it would just display the raw tags. The problem was code like

   public function __construct() { 
       global $wgParser; 
       $wgParser->setHook('tab', array(&$this, 'hookTab')); 
   }

or
   public function __construct() {
     $parser = MediaWikiServices::getInstance()->getParser();
     $parser->setHook('tab', array(&$this, 'hookTab'));
   }

Rewriting that extension to use extension.json and the advice in Manual:Tag extensions (as here) got it working with Maps. If people see other clashes, they might want to adopt the same approach.

Reply to "Clashes with old extensions"

Maps extension leaves parsing error with {{coord}}

11
Chapjo (talkcontribs)

Installing MAPS extension causes a call to {{coord}} to print this error; "Fatal error: The format of the coordinate could not be determined. Parsing failed." The {{coord}} continues to display correctly, however, the error message displays in a pink window below the coordinate.

Maps is installed via composer as the installation docs say. The only way I have been able to remove the error is to remove "mediawiki/maps" from composer.json AND reboot the server. The error will persist until machine is rebooted.

Hoping someone has seen this error and knows the fix.Or perhaps I am missing some other template/module/extension that needs to be installed.

Thanks,

Chap

Kghbln (talkcontribs)

I assume that there is something wrong with the "Coord" template you created on you wiki.

Chapjo (talkcontribs)

Thank you,

I have reverted to version 3.8.2 where the parsing error does not occur. I should have tried that to begin with. Installing 4.x.x seems to cause the error.

Thanks,

Chap

Kghbln (talkcontribs)

What is the content of the "Coord" template? Is it a public wiki you could point to.

Chapjo (talkcontribs)
Kghbln (talkcontribs)

Ah ok, one of these wikipedia template monsters. Note that Wikipedia does not use the Maps extension so there is probably something it the lua module the template uses that does not play. So something will have to be adapted.

Probably it will be good to get a stack trance for the error. Perhaps there is something that the Maps extension can do to fail more user friendly.

Chapjo (talkcontribs)

Thank you Kghbln,

Having turned on all the debug tools, I found only one message that appeared to sorta-kinda look suspicious;

[GlobalTitleFail] MessageCache::parse called by ParserHook->validateAndRender/ParserHook->renderFatalError/Message->parse/Message->toString/Message->parseText/MessageCache->parse with no title set.

However, and for what it's worth, the actual language of the error message is found on line 83 @

extensions/Geo/src/Parsers/GeoCoordinateParser.php

which is part of the data-values/geo package. I'm not sure, but I think that it is installed during the Maps composer installation. In the meantime, I have added "data-values/geo": "1.1.8" into composer.json. No difference was made with 1.1.8 installed with Maps 4.0.5. The parsing errors still occurs.

Thanks again,

Chap

Kghbln (talkcontribs)

Indeed, "data-values/geo" is fetched as a dependency of "Maps". Adding it manually to your "composer.local.json" file will not change this. I am not sure where best to report. Since Maps 3.x is working I would report initially at this spot to make the developer aware. That spot will be the second approach.

Chapjo (talkcontribs)

Thanks K.

Will follow your advice.

Chap

Brunodapei (talkcontribs)

i have the same problem. did you found how to fix? thank you

Foreclosurepedia (talkcontribs)
Reply to "Maps extension leaves parsing error with {{coord}}"