Module talk:Canada NTS

Latest comment: 2 years ago by Denelson83 in topic wikidata

maps of water edit

why? series 121, 341, 561, 780, 781, 910, may exist at https://maps.canada.ca/czs/index-en.html when the National Tiling System grid coverage is turned on (911 doesn't appear to exist there) but all that is within those grids is a lot of cold cold water. Why bother with that in this module? Does the mapping shift to nautical charts for those regions? And what about the other series omitted from File:NTS Zones and Map Series Numbers.png (0, 4–9, 17–19, 28, 50, 51, 60, 61, 70, 71, 80, 81, 90, 91, 100, 101, 108, 109, 118, 119)? Presumably there are no maps for those series; if there were, wouldn't series 0, 4–9, 17–19 etc NTS map sheet names be in Module:Canada NTS/data?

I've written a more strict lat/lon validator that returns false when lat/lon are outside the bounds of the grid overlay in File:NTS Zones and Map Series Numbers.png. The validator prevents grid() from calculating NTS IDs for points outside of the overlay by returning early with an error message. Using that validator means that for points in series 121, 341, 561, 780, 781, 910 (and 911 if it exists), grid() will return an error message so there is no need to accommodate those series within grid().

Trappist the monk (talk) 20:00, 29 March 2022 (UTC)Reply

That is the furthest extent of the National Tiling System. This is usable as a coarse method of geocoding, but the fact that the "name" function does not return any names for those areas is the sole indication that the National Topographic System has no map data there. Remember that the National Topographic System is the actual map catalogue, and the National Tiling System is the indexing system that the National Topographic System uses, and the National Tiling System covers a greater area than what the National Topographic System covers. If you wish to restrict the output of the grid function to the area covered by File:NTS Zones and Map Series Numbers.png, I will certainly let it stand. -- Denelson83 23:18, 29 March 2022 (UTC)Reply
If I understand the purpose of this exercise, grid() is a step toward restoring the functionality of {{Canada NTS Grid}}. The documentation page for that template used File:NTS Zones and Map Series Numbers.png so editors will expect that there is nothing beyond the 'tiles' enumerated in that diagram. So long as the diagram omits the cold cold water tiles, I think that grid() should not return anything for omitted 'tiles'. Unless..., unless explicitly asked for. Perhaps an |all-tiles=yes or some-such parameter which would expand the validation to the extents of the tiling system. I suspect that use of such a parameter would be extremely rare.
Trappist the monk (talk) 23:51, 29 March 2022 (UTC)Reply
It certainly is. The intent of these Lua modules is to restore that functionality, and essentially implement it in a more efficient way. And yes, I imagine no one would want to get an NTS designator for a point out on the high seas, because they already have a continuous readout of latitude and longitude for that. -- Denelson83 00:15, 30 March 2022 (UTC)Reply

Cedar Lake (Ontario) edit

Some error handling in Module:Canada NTS for Cedar Lake (Ontario) is probably needed. Cedar Lake (Ontario) (Q11838722) is missing coordinate location (P625) giving "Lua error in Module:Canada_NTS at line 19: attempt to index field '?' (a nil value)." Johnuniq (talk) 02:16, 9 April 2022 (UTC)Reply

We are actually working to re-implement the previous functionality of {{Canada NTS Map Sheet}}, which provides a link to a map sheet visualizer given the actual parts of the NTS map ID. -- Denelson83 02:30, 9 April 2022 (UTC)Reply
As I myself do not know how to complete this re-implementation, I have instead updated the NTS map sheet links in Cedar Lake to use their latitudes and longitudes, and I will revert that article to the original NTS map ID arguments once re-implementation is completed. -- Denelson83 04:50, 9 April 2022 (UTC)Reply
Bug fixed.
Trappist the monk (talk) 12:27, 9 April 2022 (UTC)Reply

wikidata edit

In a previous discussion, I suggested replacing en.wiki article names with qids for those articles that have qids. That allows some amount of 'automatic' internationalization so that the name link at the end of the {{Canada NTS Map Sheet}} rendering will point at a local wiki's article if there is one present.

I have hacked a bit of code in my sandbox that given a map-series number, fetches the associated NTS ids and data from Module:Canada NTS/data, and attempts to get a qid for the listed en.wiki article. When a qid exists, the code replaces the en.wiki article name with the qid but retains the article name as a comment (because qids are so awfully user unfriendly). The sandbox module's doc page has an invoke for map series 94.

For these data to be usable, Module:Canada NTS needs to be modified to recognize qids and then fetch the local language article name or when there isn't a local article name, fall back to the en.wiki article name. Further, to make this code more than a once-off thing, changing the format of ~/data makes some sense. For example, we might do this:

	["94E12"] = {["article"]="Spruce Hill (British Columbia)", ["map"]="Spruce Hill"},
	["94E13"] = {["article"]=""},
	["94E14"] = {["article"]="Lunar Creek"},
	["94E15"] = {["article"]="Thudaka Peak", ["qid"]="Q7798675"},

This sort of structured form might allow periodic scans to update the data in ~/data.

Is this worth pursuing?

Trappist the monk (talk) 19:38, 10 April 2022 (UTC)Reply

I would love to see this done, and have actually hinted at that by noting the Wikidata IDs of the items in map area 1K right at the top of ~/data. But we need to make sure we use the coordinates data in property P625 to match each feature up with its map area or sheet ID. -- Denelson83 07:48, 11 April 2022 (UTC)Reply
I hacked my sandbox so that it fetches P625 lat/lon and the map extents, looks to see if P625 is within the bounds of the NTS id. If in bounds, nothing different; if out of bounds, adds an additional comment with P625 lat/lon and the NW and SE corners of the map extents. Of the 128 qids found for map series 94, 16 P625 lat/lon are out of bounds which seems rather a lot.
Trappist the monk (talk) 15:08, 11 April 2022 (UTC)Reply
That is rather weird. There must be more than one feature in the province, in this case British Columbia, with each of those names, requiring a manual check to determine the correct one. A second possibility is the features with those names crossing map sheet boundaries. -- Denelson83 15:43, 11 April 2022 (UTC)Reply