Jump to content

Template talk:Cyclone map

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Matroc (talk | contribs) at 05:01, 11 June 2020 (Break: add to notes about Test Map). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Proposal for map for cyclone tracks

Hello. I want to propose a blanket change to Wikipedia:WikiProject Tropical cyclones on how cyclone track maps are made, stored, and used. But before I do so, I want to clarify if this is in fact possible based on available features.

Looking at this Wikidata sandbox (consider this a Wikidata item for a given storm within the IMD region), you will notice that there are 6 coordinates with series ordinal (P1545) set for each tracking interval. instance of (P31) are also set for each of those coordinates, which corresponds to the IMD tropical cyclone scales at each point (a more appropriate property could be decided later).

Based on this data, is it possible to use the Qid (Q15397819 in this case) to generate an image that shows:

  1. The path of the storm from point 1 through 6
  2. The intensity of the storm at each point (with different point icons/colours rendered based on P31)
  3. While being able to use other features of Mapframe, such as zoom, geomask, etc.

And considering we can currently enter multiple QIDs for one mapframe (example), this would also allow us to plot multiple storms in one image. Is such an arrangement possible with currently available features? Or is something similar possible with Mapframe, without having to manually create these raster images of tracks? Rehman 09:05, 19 May 2020 (UTC)[reply]

Interesting idea. I think right now we lack the ability to automatically create lines that link points, and we're limited to a small set of icons. Perhaps consider {{OSM Location map}}? You can create overlay lines, like in the Leicester Castle example there. ɱ (talk) 16:29, 19 May 2020 (UTC)[reply]
Do you think this is a Lua limitation? Or something the site cannot support yet? I wouldn't mind cross-posting at VPT to see if anyone is willing to code... Rehman 17:13, 19 May 2020 (UTC)[reply]
No idea, I only use maplink and know its current limitations. ɱ (talk) 17:24, 19 May 2020 (UTC)[reply]
Kartographer only supports getting polygons from Wikidata, not points or lines. It is possible to do what you want with Lua though, but that's outside by abilities. --AntiCompositeNumber (talk) 04:38, 20 May 2020 (UTC)[reply]
Map
The example here uses <mapframe> to draw lines between the set of coordinates, which are inserted manually. I've drawn lines between all five coordinates and added a symbol to the last for illustration.
So what is wanted is to get the collection of coordinates from Wikidata and generate the map with <mapframe> automatically. This can be done with Lua.
What would be wanted? Lines, symbols, or both? —  Jts1882 | talk  07:39, 20 May 2020 (UTC)[reply]
Map
I already have a module that creates maps for a list of football stadium names using template {{football map}}. Fortunately it can't tell the difference between a football stadium and a hurricane and can be used to demo what might be possible. The example uses the following code for Hurricane Patricia:
{{Football map |stadium1=Hurricane Patricia |zoom=1}}
The point coordinates, a single set in this case, are retrieved from Wikidata and <mapframe> used to generate map. Note also that clicking the symbol produces a popup with the an image of the cyclone, which also comes from Wikidata.
A {{cyclone map}} could be created along the same lines. Given a list of cyclone names or wikidata ids it could retrieve the coordinate data from wikidata and plot the path for each cyclone. The series ordinal (P1545) and storm type can also be retrieved. The latter can be used to set the colour of the line or symbol. Additional information such as date and wind speed could also be added to the popup. —  Jts1882 | talk  08:27, 20 May 2020 (UTC)[reply]
Thanks for the detailed reply, Jts1882. Do you think it is possible to match the design of the current cyclone track maps? If so, I'm sure this would be widely used, especially with the added features (such as clicking points for further data). Would you be able to create the module as a start? I'd start it myself, but my Lua skills are next to none. Rehman 14:30, 20 May 2020 (UTC)[reply]
I think something with similar could be generated. There is a limit on what can be used for marker symbols, but circles can be added as zero-length lines (see modification above). There is also the limit of only having the street map, so the geographical maps are not an option.
I've being reacquainting myself with my code (yikes!!) and I think I have all the elements. I have code to get the wikidata information and to create the json for mapframe, so I think can put something together as a demo. —  Jts1882 | talk  15:10, 20 May 2020 (UTC)[reply]
Brilliant! I think the street maps wont be an issue, as most/all the time, the maps are well zoomed out. Once we get the demo, I'll post at the cyclone wikiproject, and get some comments from there. Hopefully this will stop all those manually made and manually updated raster images. Looking forward to the demo :) Btw, not too sure if it's some caching issue from my end, but I can only see the modification you made in preview. I don't see the circles in normal reading mode. Rehman 16:27, 20 May 2020 (UTC)[reply]
No, not just you. I hadn't noticed that the large circles disappeared in the static map. This is unfortunate, as the markers give a different look. Anyway, I'll put something to together and we can get some feedback. —  Jts1882 | talk  17:25, 20 May 2020 (UTC)[reply]
Map
Test Map
  • This is an interesting subject and I started looking at it a few days ago. (Day late and a dollar short) I thought maybe something like the map I created as a sample using information from wikidata using Lua. More information can be added by adding descriptions etc.
  • The Point information was created by going through the P265 claims arrays containing the latitude and longitude. The LineString was created using the same latitude and longitude info. Markers could be used with or without icons. Different colors could be used based on instance P31? The LineString can be any color, width etc.
  • Instead of markers circular polygons/other shapes/zero length lines (with large stroke-width etc. can also be used. Again different colors can be used.
  • Basically you all have this well in hand so best wishes -- Matroc (talk) 03:19, 21 May 2020 (UTC)[reply]
I like the broad opaque lines to show the path. There are lots of options on how to show these cyclone maps. —  Jts1882 | talk  07:14, 21 May 2020 (UTC)[reply]

Template {{Cyclone map}}

I have created a {{Cyclone map}} template that uses a modified version of Module:Football map. Here is an example:

Map
{{Cyclone map
|width=370 |height=270 |align=right
|latitude=15 |longitude=80.5 |zoom=4 
|name2=Hurricane Patricia
|id1=Q15397819
}}
  • The |width=, |height= and |align= parameters determine the size and position of the map.
  • The |latitude=, |longitude= and |zoom= parameters set the centre coordinates for the map and its zoom level.
  • :* The |name= and |id= parameters indicate the cyclones to show using data from Wikidata.
    • |name= must be an exact Wikipedia article title with a corresponding Wikidata entity. The example Hurricane Patricia is outside the boundaries of the map, but can be seen you zoom out.
    • |id= is a Wikidata entity, in this case Wikidata sandbox 3, an example with coordinates for the path of a cyclone.
    • The map can show dozens of storms. If mixing names and Wikidata ids use separate indices.
  • The coordinates and other properties are retrieved from Wikidata with Lua. The colours are determined by the type of storm (depression, Cyclone storm, etc).
  • There are a number of other parameters inherited from and described in {{football map}}, including a properties of the marker symbols (icon, colour, size) and a |geoshape= parameter for adding shapes and masks.
This example is meant to demonstrate how the map could appear. The colours for both symbol and lines are clearly over the top. The broad opaque path in Matroc's example is a nice alternative. Suggestions welcome. —  Jts1882 | talk  07:14, 21 May 2020 (UTC)[reply]
Pretty much things that I had thought of were mentioned... Not sure if mapshapes of countries or markers of major cities in the area of the cyclonic activity would be useful or readily accessible. Description field of course can be used for any image and or added information. I also agree that other storms can be plotted on the same mapframe (time frame limited); however, 1 thing at a time maybe. For now "Well done" and "Best wishes" -- Cheers! -- Matroc (talk) 02:57, 22 May 2020 (UTC)[reply]
Map
Here is the template version of Matroc's map (with reduced canvas).
{{Cyclone map 
|width=370 |height=270 |align=right
|latitude=15 |longitude=80.5 |zoom=4 
|marker-color1=#bbccff  |marker-symbol1=-number
|stroke-width1=50 |stroke1=#D3D3D3 |stroke-opacity1=0.7 
|id1=Q15397819
}}
  • |marker-symbol=-number sets the marker symbol to an incrementing number (this should match the series ordinal on Wikidata)
  • |marker-colorl=#bbccff sets the color of the marker symbol to a pale blue. The default is to let the storm type set the colour (e.g. severe cyclone storm = red)
  • |stroke1=, |stroke-width1= and |stroke-opacity1= set the properties of the line between each point in the storm path, respectively the line colour, line width and line opacity. The default is to let the storm type set the line colour.
  • In general, an index at the end of the parameter name sets the properties for the storm with that index. Without an index number the property is set for all storms listed, unless overridden with a indexed parameter. In the examples, with a single storm, there is not difference.
Both the lua coded map (the template version, right) and the map coded with the <mapframe> tag look different in preview mode. The line gets a rounded margin in preview, but the line ends are straight on the saved page. —  Jts1882 | talk  12:05, 22 May 2020 (UTC)[reply]
Thank you, Jts1882. This is great start! There are some known bugs with Kartographer; the different behaviour in preview vs live is one of them. Some feedback:
  • I've changed the coords to be more far apart (more realistic) so we could assess the output better.
  • While the thick-transparent lines are nice, the behaviour at different zoom levels could be problematic. For instance, a zoomed out version with the current thick borders, just show a bunch of polygons bunched up together. This would be a particular issue with cyclones with shorter tracks. I think lines on the thinner range would be ideal for wider scenarios, but that being said, Matroc's "Test Map" seems to be handling the polygons in a smoother way. Maybe we could base on that, and simply halve the thickness? Worst case, we can simply stick to a 1px solid black line.
  • It seems like whatever icon we choose, it will still be placed within the 3D placemark symbol. Would anyone know if there is a way to override this? It would be nice if we can simply have a colour-coded 2D circle/spot for each placemark.
  • On a separate note, while this isn't important, would anyone know if it is be possible to change the colour theme used in the map itself? To match to something close to current maps? Or maybe at least select another OSM layer?
Maybe it is time we move Module:Football map/cyclone to Module:Cyclones tracks, and start on the live version? Thank you! Rehman 12:25, 23 May 2020 (UTC)[reply]
A few brief answers.
  • I've modified the examples above for the new data. Have you thought of adding the times to each coordinate item?
  • The different static/dynamic map appearances are a real nuisance. Unfortunately its a performance issue and unlikely to change. However, Matroc's map uses one polyline to draw the path, whereas I used lines for each pair so I could change the line colour. This can be changed so that it uses the single line when the path is all one colour.
  • Yes, the icons are very limited and all have the markers. I've been experimenting with circles and polygons, which work nicely in preview but not on the page (see the third example at {{cyclone map}} in preview or expanded mode).
    • I've just chose the colours for the storm types on wikidata to make them obviously different. There is a separate function handling these colours so it's easy to edit them to whatever colour code desired.
    • The symbols should be straightforward too.
  • As far as I know Kartographer only supports the one background map. Is that layer a new thing on OSM? That would be a big step forward if it could be incorporated, but is seems development of Kartographer is low on the WMF agenda.
Yes, it might be a good time to move the module and possibly copy this discussion over to the template or module talk page. Do you prefer {{Cyclone tracks}} to {{Cyclone map}}? —  Jts1882 | talk  13:17, 23 May 2020 (UTC)[reply]
Thanks Jts1882. By adding times, you mean as part of this maps function? If not, I guess the cyclone project members could decide what else to include. It would probably be a separate ontology project at Wikidata. I look forward to the updated code. I don't have a naming preference, though maps do sound better. Feel free to move the discussion as well. Will update regarding the QIDs on the new talkpage. Cheers, Rehman 13:38, 23 May 2020 (UTC)[reply]
I was think of adding the times to the wikidata for each coordinate item, so we have date/time, series ordinal and storm type (via P31). Then the popup can have time, coordinates and storm type (the latter is currently included). —  Jts1882 | talk  16:39, 23 May 2020 (UTC)[reply]
Yes, that would make sense. Actually, this way we could scrap the series ordinal. The sequence could be determined based on the date/time. What do you think? Rehman 03:25, 24 May 2020 (UTC)[reply]
Agree, that is probably the best approach. The series ordinal is necessary for the code at the moment, but that should be changed. I added point in time (P585) qualifiers to the wikidata sandbox, but for some reason it only allows the date (with 00:00 for the time). While this will do for testing, a precise time stamp for the measurement would be better.
The storm colours now should match the colours in Tropical_cyclone_scales#Comparisons_across_basins. That Typhoon colour is out of place. All the names in the table are included. "Tropical Disturbance" uses the MF Indian ocean column colour rather than the Australian one. —  Jts1882 | talk  14:44, 24 May 2020 (UTC)[reply]

Break

Hi Jts1882. Sorry for the delay in replying. Got stuck with some other work, and was also preparing these Wikidata items - to be used as instance of (P31) for individual storms. Would you be able to integrate those QIDs, such that if they are used as P31, the line colour would change accordingly (to the respective table cell colour)?

Since current cyclone track maps have placemarks very close to each other, and considering how "bulky" the Kartographer markers are currently (and the inability to switch the 3D marker off), I think the most practical/least messy approach at the moment would be to use lines (and no placemarks). But that would mean giving up on the shape information (triangle for extratropical cyclone (Q1063457), square for subtropical cyclone (Q2331851)); which is not a good way to go, and editors would probably not accept this.

What do you think of manually overlaying those shapes at the start of each line segment (not as placemarks, but as overlay shapes)? Does that make sense, or is it too complex? Do you think there's a better way around this problem? Matroc? Rehman 13:23, 6 June 2020 (UTC)[reply]

Map
The colours for different storm descriptions should already map the template colours (see last comment before the break). It checks the names rather than the wikidata ids. If you change the storm type on Wikidata, the colours of the lines should change in the test version (i.e. with |mode=test) of the map.
One option is to use the lines and place the marker only on the first point. The example to the right uses wikidata to determine line colour and shows the marker sympbol with a square (this can be automated to storm type). The circles currently show on each point of the path in edit preview and when the map is expanded, but that can be removed. —  Jts1882 | talk  13:58, 6 June 2020 (UTC)[reply]

Map
Test Map
  • Bulky pointer (markers on map) - There are 3 sizes of markers - "small, medium and large" - Even with use of small there isn't much difference - They may still overlap each other depending on zoom level.
  • Line colour change is fine as is one marker to start the track if so desired.
  • I added a mapframe test with various shapes that act like pointers (can add pictures, descriptions, colors etc.). These were created using a Module I wrote circa 2017. I thought this is what was meant as an overlay shape???
  • Hope this is of some help! -- Matroc (talk) 04:46, 10 June 2020 (UTC)[reply]
Map
@Matroc: Yes, that is very helpful. I had played with the polygon in one of my test options, but I didn't like the behaviour. Now I see the reason. I was using a larger stroke-width which stays the same regardless of zoom and gives rounded edges to the shapes. You used a stroke-width of 1 which gives cleaner shapes that change size with the zoom. That is much better.
The map to the right (below yours) is an example using a square. I don't like the circle shape (not clean at all zooms), but the square, triangle, and star give crisp shapes and inverse triangle and diamond should as well. I will add an overlaid symbol feature with shape, color and size properties.
The circle I used is a multisided figure with a limited number of sides (40 which accounts for the zoom effect for the circle not being cleaner - probably can attain a better shape using 100 or so more) I am going to replace that with a circle shape which is large [360] positions and would appear better though probably at a higher processing cost. -- Matroc (talk) 19:04, 10 June 2020 (UTC)[reply]
As an extra (not for the fainthearted) - I put a sunburst shape on the map that has links to various positions on my map - One can also add such links to markers or shapes in order to traverse the map (I will illustrate that on Position 3 (square). This was an idea I came up with on wikivoyage while conversing with Yurik. There are several caveats (gotchas) in order to accomplish this type of thing... I came back and corrected a few issues but you can get the picture. This may be useful in another project. Cheers! -- Matroc (talk) 21:42, 10 June 2020 (UTC)[reply]
There is one difference with the popups on these overlaid shape symbols in that the popups don't close properly like they do with the marker symbols. —  Jts1882 | talk  14:14, 10 June 2020 (UTC)[reply]