Help talk:Extension:Kartographer

Jump to navigation Jump to search

About this board

Welcome to the Maps discussion. This is a place to provide overall maps feedback.

Previous discussion was archived at Help talk:Extension:Kartographer/Archive 0 and Help talk:Extension:Kartographer/Archive 1.

Commons Geoshapes with SPARQL queries

9
Yair rand (talkcontribs)

(I hope this is an acceptable place to ask questions regarding how to use this extension?)


Is there any way to use specific geoshapes from Commons (using Wikidata's geoshape property) on maps pulled using Wikidata SPARQL queries?

2A02:8109:9B40:78:452:F808:5C06:3550 (talkcontribs)
Yair rand (talkcontribs)

No, those geoshapes are not pulled from Commons via Wikidata. They are pulled from another source (I'm not completely sure which), that has a very limited set of geoshapes available, and does not, for example, include all countries.

Dipsacus fullonum (talkcontribs)

That other source is Open Street Map (OSM) which indeed do have geoshapes for very many things, but you need to put a Wikidata tag to the OSM relations before they can be used by Kartographer. You can log in OSM with your Wikimedia login and edit the map data. They is a brief explanation of how to that at Help:Extension:Kartographer/OSM. But not all relations (geoshapes) at OSM can be used. It depends on their their type. See phab:T156433.

The answer to the original question is no as far as I know.

Yair rand (talkcontribs)

Adding Wikidata tags to OSM relations doesn't seem to work.

See for example, w:User:Yair rand/mapsandbox2. This is a very simple, one-line query showing all UN member states. However, despite the Wikidata item for Russia linking to the correct OSM relation, which links back to the Wikidata item, the boundaries for Russia still don't work (along with the boundaries for China, Brazil, Argentina, and many others).

Dipsacus fullonum (talkcontribs)

The boundaries for these countries works when I look at your mapsandbox2.

Yair rand (talkcontribs)

That's really confusing. I just tried it on multiple browsers on multiple computers, and couldn't get those countries to show up highlighted in the dark grey. Other countries show up highlighted, but certain ones aren't.

Very bizarre.

Dipsacus fullonum (talkcontribs)

Yes, I have also several times experienced some strange behavior from using Kartographer with external OSM data. I just made a new case about it on Phabricator at phab:T224846.

Yair rand (talkcontribs)

That task is marked as fixed, but certain countries still don't show up. May or may not be related to phab:T218097, I'm not sure...

Reply to "Commons Geoshapes with SPARQL queries"
Fokebox (talkcontribs)

Hello,

Is it possible to insert any text inside of the symbol or not?

Matroc (talkcontribs)

Not that I know of... A-Z, 1-99 and maki symbols (and blank) are what I use. -- ~~~~


Reply to "Text inside of symbol"

Problem getting some geoshapes via Wikidata ID

8
2A02:8109:9B40:78:452:F808:5C06:3550 (talkcontribs)

Hello,

I can't get the geoshapes from Bosnia and Hercegovina (Q224) and Montenegro (Q236). Does someone know why this does not work?

I use

{"type": "ExternalData",
 "service": "geoshape",
 "ids": "Q224",
 "properties": {
   "title": "BiH",
   "description": "BiH",
   "fill": "#7DF9FF"
 }}

and

 {"type": "ExternalData",
 "service": "geoshape",
 "ids": "Q236",
 "properties": {
   "title": "Montenegro",
   "description": "Montenegro",
   "fill": "#808080"
 }}

.

2A02:8109:9B40:78:452:F808:5C06:3550 (talkcontribs)

Sorry, I mean Q22 for BiH.

2A02:8109:9B40:78:452:F808:5C06:3550 (talkcontribs)

Sorry, Q225.

Matroc (talkcontribs)

Both do not have a link to OSM shape in Wikidata - however you can use the Data files from Commons with the shapes:

Data:Bosnia.map and Data:Montenegro.map

{ "type": "ExternalData", "service": "page", "title": "Montenegro.map"}

and

{ "type": "ExternalData", "service": "page", "title": "Bosnia.map"}


Cheers! -- ~~~~

2A02:8109:9B40:78:E4DF:2B35:F544:FAD5 (talkcontribs)

Thank you! Where do you see this that there is no link? In the article https://www.wikidata.org/wiki/Q236 (montenegro), there is a geoshape attribute and a link to a map file. --~~~~

Dipsacus fullonum (talkcontribs)

There are some misunderstandings here. The code with "type": "ExternalData", "service": "geoshape" do not access the geoshape linked from Q236 at Wikidata with property P:P3896 (geoshape). It will take the geoshape from OpenStreet Map relation 53296 (https://www.openstreetmap.org/relation/53296) because that relation is tagged with wikidata:Q236. But there some problems so it not always works. See phab:T224846.


To access the geoshape file at Commons you should use code like this, that works:


<mapframe text="Montenegro with geoshape from Commons" latitude="42.8" longitude="19.5" zoom="6" width="200" height="200">

{

  "type": "ExternalData",

  "service": "page",

  "title": "Montenegro.map"

}

</mapframe>


See the manual at mw:Help:Extension:Kartographer#Map data from Commons.

Dipsacus fullonum (talkcontribs)

It doesn't matter if Wikidata points to the OSM relation or not. What matters is that the OSM relations must point to the Wikidata items, and relations do that (https://www.openstreetmap.org/relation/2528142 for Bosnia and Hercegovina, and https://www.openstreetmap.org/relation/53296 for Montenegro). It works for other countries, for instance Croatia (Q224 which is in the example above by mistake, realation https://www.openstreetmap.org/relation/214885)

One difference between the OSM relations for Bosnia and Hercegovina, Montenegro, and Croatia is that the first two have a point for label, while the Croatia relation doesn't have a label point. I don't know but the label point could be a reason it doesn't work with Bosnia and Hercegovina and Montenegro.

Matroc (talkcontribs)

Thanks... I forgot to mention about OSM relation pointing to Wikidata - I was under the impression that it was a 2 way street (both directions) as well.

Reply to "Problem getting some geoshapes via Wikidata ID"

Did something just change with the zoom levels?

4
Summary by Mike Peel

no

Mike Peel (talkcontribs)

It seems that zoom level 15 is no longer the highest zoom level on Commons - did something change?

TheDJ (talkcontribs)

link ?

Mike Peel (talkcontribs)
MSantos (WMF) (talkcontribs)
Ederporto (talkcontribs)

Hello, everybody,

I'm trying to discover what is going on with mapframe maps on this article: Lista de governadores das unidades federativas do Brasil (2015–2019). It's blank, no matter what I try to do to solve. The query is correct, it returns the right amount of items (27 states). Some time ago one person changed the P31 of all states of Brasil on Wikidata, but it was reverted to the original P31, I'm not sure if has influence or not. Can anyone give me some light on that? Thanks!

Matroc (talkcontribs)

I don't do queries but I would hazard a guess that you are not getting the OpenStreetMap coordinates to create the shapes... I am sure someone will provide an answer - best wishes - ~~~~

197.218.88.81 (talkcontribs)

This is because there is an error with the query, two governors from the same place, Alagoas, Q40885. Even before that the query wasn't correct, it contained a newline before the "select". There might be other errors.

Reply to "Broken maps based on queries"
Matroc (talkcontribs)

Can one just get the actual coordinates of a mapshape from OSM via Wikidata and only that as text (nothing else)? The basic reason is that I have been comparing several hundred positions against various mapshapes (polyons) to see if those positions are within or outside that shape in order to make some selections as POIs. It would make things a bit easier than having to create that information by hand. Thanks... -- ~~~~

Arlo Barnes (talkcontribs)

This is definitely the kind of query Overpass (a popular way to access the OSM API) can handle, but I am not sure how Overpass and Wikidata could be linked.

Matroc (talkcontribs)

Thank you for your response! -- I was originally thinking of the possibility of using a Lua module to access Wikidata/OSM and retrieve it that way... I do remember some time ago downloading by hand from OSM but forgot how I did it lol. It just seemed a nice idea to be able to do something like that. Some OSM entries have a Wikidata ID which links it to Wikidata. On Wikivoyage we use Kartographer which accesses Wikidata's matching OSM (an external process of sorts) and used to create shapes, rail lines etc. on a map. Again -- thank you for your response - I will take a look at Overpass - Best wishes. -- ~~~~

Reply to "OSM mapshape"

Links in titles and descriptions made by SPARQL queries are red

3
Dipsacus fullonum (talkcontribs)
CKoerner (WMF) (talkcontribs)
Dipsacus fullonum (talkcontribs)
Reply to "Links in titles and descriptions made by SPARQL queries are red"
Jts1882 (talkcontribs)

The description says the " code will insert a simple interactive map ... with the ability to maximize it by either double-clicking the map or clicking the icon in the right corner". I find that the map maximizes on a single click. I see this behaviour for the examples on this help page and on the English language wiki.

However, if you edit the pages and use show preview the maps behave as described, with the single click gaining focus and allowing the map to be used interactively within the page. The correct behaviour is also seen on the test2 wiki.

Evad37 (talkcontribs)
Reply to "Map maximizing on single click?"

Bug(?): Embedded map preview within an article does not render

1
NeoGeneric (talkcontribs)

Issue

The map preview within a page will sometimes show a blank white box. The full screen button and bottom-right attribution text is still visible. The map renders correctly when the user opens the full screen mode.

How to reproduce

No idea on what causes this, but it will sometimes appear after making an edit to the page that contains the map. The problem persists across different browsers and machines, suggesting it may be a bug on the wiki-side.

Workaround

Make an edit that breaks the Kartographer map (such as delete a parenthesis), then revert. This normally clears the problem. Purging the page doesn't fix: https://en.wikipedia.org/wiki/Wikipedia:Purge

Issue: Transcluded maps will go blank when changing the content of <mapframe>

4
NeoGeneric (talkcontribs)

Problem:

When using the <mapframe> tag in a template, any changes made to the map data (i.e. data within the <mapframe>...</mapframe> tags) will cause any transcluded instances of the map to go blank. While the map can still be viewed when clicked on, the small preview window is blank.

How to reproduce:

  • Create a template page (such as a template sandbox ) that contains the <mapframe> tag. (e.g. The San Francisco museums example at Help:Extension:Kartographer#<mapframe>_usage
  • Create a page that transcludes the template with this map
  • Make an edit to the content of the <mapframe> tag (e.g. change marker-size from "large" to "medium")
  • Reload the page that transcludes the template, the map will now appear blank on this page.
CKoerner (WMF) (talkcontribs)

That doesn't sound right, but I'm afraid I can't reproduce. Here's an example on English Wikipedia using the Template:Mapframe. I think this might be something where it can take a few minutes to generate a thumbnail. Do you have an example I can see on-wiki somewhere?

NeoGeneric (talkcontribs)
NeoGeneric (talkcontribs)

The thumbnail has since appeared without any intervention. So as you suggested, it appears to just be a delay in rendering the thumbnail. My mistake!