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



Archive

How can I (or if it's even possible) use this to construct maps?

2
DeadfirePrime (talkcontribs)

I'm looking to possibly use this to plot out planetary systems that have their data coordinates being on a 2d plane.

In no basic terms a map of this: sarna.net/wiki/File:3151_Known_Universe_(Sarna).svg

and have the points containing the other semantic information.

Jeroen De Dauw (talkcontribs)

visual map editor created polygon with wrong coordinates

2
OurOakland (talkcontribs)

I enabled the visual Leaflet map editor per the instructions for a test page. The test page contained:

{{#display_map: center=Oakland,CA | geojson=GeoJson:TestMap}}

Things almost worked correctly, except the resulting longitude values were all 360 too small. For example, the first coordinate was -482.262111 instead of -122.26111.

{

   "type": "FeatureCollection",
   "features": [
       {
           "type": "Feature",
           "properties": {
               "title": "lake merritt",
               "description": ""
           },
           "geometry": {
               "type": "Polygon",
               "coordinates": [
                   [
                       [
                           -482.262111,
                           37.810626
                       ],
                       [
                           -482.260566,
                           37.806523
                       ],
                       [
                           -482.258163,
                           37.804387
                       ],
                       [
                           -482.256274,
                           37.805641
                       ],
                       [
                           -482.255416,
                           37.807099
                       ],
                       [
                           -482.249494,
                           37.808354
                       ],
                       [
                           -482.251168,
                           37.804523
                       ],
                       [
                           -482.253356,
                           37.804251
                       ],
                       [
                           -482.254601,
                           37.801776
                       ],
                       [
                           -482.254601,
                           37.800826
                       ],
                       [
                           -482.257133,
                           37.799911
                       ],
                       [
                           -482.259192,
                           37.798588
                       ],
                       [
                           -482.261338,
                           37.799504
                       ],
                       [
                           -482.26151,
                           37.801912
                       ],
                       [
                           -482.260566,
                           37.804285
                       ],
                       [
                           -482.261596,
                           37.805167
                       ],
                       [
                           -482.263312,
                           37.807167
                       ],
                       [
                           -482.262111,
                           37.810626
                       ]
                   ]
               ]
           }
       }
   ]

}

OurOakland (talkcontribs)

It has to do with "which" Oakland, CA I zoom in on initially. When the GeoJson page is first created and the visual map editor comes up, it shows a map of the whole world, repeating horizontally. If I zoom in to the the copy towards the left, the coordinates are off by -360. If I zoom in to the one towards the right, the coordinates are off by +360. If I scroll further left or right on the world map, the latitudes are off by larger amounts.

Reply to "visual map editor created polygon with wrong coordinates"

conflict with Visual Editor

2
OurOakland (talkcontribs)

If I have a Maps template, e.g., #coordinates: on page, when I try to use the Visual Editor for that page, I get "Error contacting the Parsoid/RESTBase server (HTTP 500)" when I try to save the page. A page with nothing but {{#coordinates:37.8012055000000089,-122.2531170280909976}} shows the problem.

The error.log ends up with a bunch of things in it along the lines of: [Mon Jul 11 18:05:01.677269 2022] [:error] [pid 329230:tid 3645043091200] [client xx.xx.xx.xx:52242] [client xx.xx.xx.xx] ModSecurity: Warning. Pattern match "(?:;|\\\\{|\\\\||\\\\|\\\\||&|&&|\\\\n|\\\\r|\\\\$\\\\(|\\\\$\\\\(\\\\(|`|\\\\${|<\\\\(|>\\\\(|\\\\(\\\\s*\\\\))\\\\s*(?:{|\\\\s*\\\\(\\\\s*|\\\\w+=(?:[^\\\\s]*|\\\\$.*|\\\\$.*|<.*|>.*|\\\\'.*\\\\'|\\".*\\")\\\\s+|!\\\\s*|\\\\$)*\\\\s*(?:'|\\")*(?:[\\\\?\\\\*\\\\[\\\\]\\\\(\\\\)\\\\-\\\\|+\\\\w'\\"\\\\./\\\\\\\\]+/)?[\\\\\\\\'\\"]*(?:l[\\\\\\\\'\\"]* ..." at ARGS:html. [file "/dh/apache2/template/etc/mod_sec3_CRS/REQUEST-932-APPLICATION-ATTACK-RCE.conf"] [line "122"] [id "932100"] [msg "Remote Command Execution: Unix Command Injection"] [data "Matched Data: ;function found within ARGS:html: <!doctype html><html prefix=\\x22dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/\\x22 about=\\x22https://wiki.ouroakland.net/Special:Redirect/revision/427\\x22><head prefix=\\x22mwr: https://wiki.ouroakland.net/Special:Redirect/\\x22><meta charset=\\x22utf-8\\x22><meta property=\\x22mw:pageId\\x22 content=\\x22121\\x22><meta property=\\x22mw:pageNamespace\\x22 content=\\x220\\x22><link rel=\\x22dc:replaces\\x22 resource=\\x22mwr:revision/0\\x22><meta property=\\x22m..."] [severity "CRITICAL"] [ver "OWASP_ [hostname "wiki.ouroakland.net"] [uri "/oaklandwiki/rest.php/wiki.ouroakland.net/v3/transform/html/to/wikitext/TestMaps/427"] [unique_id "YszIvUki-DtamwvGJ51NqgAAAAo"]

I can provide more log info if that is helpful.


thanks,

Gene

OurOakland (talkcontribs)
Reply to "conflict with Visual Editor"

combined maps from a category?

1
OurOakland (talkcontribs)

I see in the examples how with Semantic MediaWiki a query can ask for pages in a particular category that have a given property like Has coordinates, and create a map of all those pages.

Is it possible to make a combined map of pages in a particular category that have different kinds of maps? That is, some that are single coordinates, and some that are polygons? The use case is a wiki with pages for different things in a neighborhood. Some are single coordinates (for example, the address of a historical building), some are larger areas (for example, a park or geographical feature), and some are lines (for example a street). On the page for the neighborhood, in addition to a list of the pages in that neighborhood, it would be nice to have a combined map, too.

thanks,

Gene

Reply to "combined maps from a category?"

Leaflet map doesn't display on small screen

8
Summary by Kghbln

Tracked with issue 704

OurOakland (talkcontribs)

I know this is a conflict somewhere between the Leaflet maps, the Map extension, MediaWiki, and the MonoBook skin involving CSS, but I don't know how to figure it where exactly the problem lies.

I have a new MediaWiki install (version 1.38.1, default skin = monobook) with the Maps extension (version 9.0.7), and maps I've added to pages work as described on the documentation pages.

The MonoBook skin with responsive mode checked mostly behaves as expected. But when a page gets narrow (as on mobile), about 550px or less, images and maps go from their normal left-aligned behavior to full width. Images become centered (OK), and maps become full width (OK), but the OSM map tiles disappear.

Part of what makes this more confusing to me is that the polygon for the map doesn't disappear, just the map tiles.

You can see this behavior here:

wiki.ouroakland.net/oaklandwiki/index.php/Peralta_Heights

Either resize your browser window narrower until the tiles disappear, or bring up the developer tools in Chrome, et al, toggle the device toolbar, then resize the simulator window until the tiles disappear.

OurOakland (talkcontribs)

Sorry for non-working link, kept getting ⧼abusefilter-warning-linkspam⧽

Kghbln (talkcontribs)

Did you wrap the map into a div that does the resizing for you?

OurOakland (talkcontribs)

I've tried both with an enclosing div and without. The results are the same -- below a certain width, the map tiles disappear. Currently the map is without a div.

Kghbln (talkcontribs)

Ah, now I get what the issue is. I guess it is indeed worth filing an issue

OurOakland (talkcontribs)

Is that a "you are going to file an issue" on GitHub, or should I?

Kghbln (talkcontribs)

It will be great if you could do it. Thus you could also provide more info if need be. Thanks a lot.

OurOakland (talkcontribs)
Reply to "Leaflet map doesn't display on small screen"

Add Maps icon to WikiEditor toolbar

4
Felix Englisch (talkcontribs)

If you are using the Maps extension in combination with Extension:WikiEditor, you might want to make it easier for your users to insert a map. It is quite easy to add an icon to the toolbar which automatically inserts the code snippet required for embedding. Simply add the following to you LocalSettings.php:

$wgUseSiteJs = true;


Then, open the page "MediaWiki:Common.js" on your wiki and insert the following:

var customizeToolbar = function () {
  $('#wpTextbox1').wikiEditor('addToToolbar', {
      section: 'advanced',
      group: 'insert',
      tools: {
        "Map": {
          label: 'Insert map',
          type: 'button',
          icon: '//upload.wikimedia.org/wikipedia/commons/b/b4/OOjs_UI_icon_map-ltr.svg',
          action: {
            type: 'encapsulate',
            options: {
              pre: '{{#display_map:',
              peri: "Example street 1, Berlin~'''Heading'''~Short description; optional: 2nd marker",
              post: '|fullscreen=on}}'
            }
          }
        }
      }
    });
};
    
    /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
    if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
    mw.loader.using( 'user.options' ).then( function () {
    if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
      $.when(
        mw.loader.using( 'ext.wikiEditor' ), $.ready
      ).then( customizeToolbar );
    }
  } );
}


Of course, you can change the default parameters of the map and also the icon. Just visit https://commons.wikimedia.org/wiki/Main_Page and look for a better one. And for more information about editing the toolbar, see Extension:WikiEditor/Toolbar customization.

Have fun!

Jeroen De Dauw (talkcontribs)
OurOakland (talkcontribs)

@Jeroen De Dauw -- any update on adding this to the Maps extension? It seems very useful to add directly to the Maps extension.

I tried the directions above on my new wiki, but when I try to save the Javascript, I get "Internal Server Error". I can make other changes to the file, so it doesn't seem to be a permissions thing.

Jeroen De Dauw (talkcontribs)

No work was done on this AFAIK

Reply to "Add Maps icon to WikiEditor toolbar"

Google Maps don't display / "not a LatLngBounds ..."

2
Summary by Kghbln

Tracked on GitHub: issue 697

Jorges (talkcontribs)

It seems the Google maps don't display anymore, even on the example page. The console reports a JS error:

   not a LatLngBounds or LatLngBoundsLiteral: not an Object

Can someone else confirm?

Kghbln (talkcontribs)

Coincidentally an issue was created for this on GitHub: issue 697. Let's see how that goes.

Reply to "Google Maps don't display / "not a LatLngBounds ...""
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!

Lars

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

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

4
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

Backtrace:

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"
Return to "Maps" page.