Direct loading of background maps in Templot
Posted: Sun Jul 23, 2017 2:51 am
Well that was fun. How much actual use can be made of it remains to be seen.
Lots of folks like to use maps as a background guide to their track planning. But it's not always straightforward to capture and merge multiple screenshots from the mapping web sites, and scale them accurately to match the model scale.
So I thought it would be useful if Templot could load maps directly from the server. That way the map can be as large as you like, within reason, and Templot can do the scaling to your model scale automatically.
The big fly in that ointment is the copyright and licensing restrictions on most mapping and aerial imagery web sites.
But that doesn't apply to OpenStreetMap (OSM), so I have had a go at loading the OSM map tiles directly, with promising results.
The first requirement is to specify the location, and for the UK the easiest way is to use the OS Grid Ref:
Of course that doesn't work for the rest of the world, so I shall have to add an option to enter latitude/longitude instead. But the OS grid numbers are far more brain-friendly -- they are easily found by zooming in on this map:
https://osmaps.ordnancesurvey.co.uk
Next Templot needs to know how much area of map you want. That is specified in the equivalent model size, so it's important to have set your gauge/scale before doing this:
Templot then does some quite complex maths (maps are flat, the Earth's surface is curved), and loads all the necessary OSM tiles as background picture shapes. This is Shrewsbury in EM:
© OpenStreetMap contributors
which might take a minute or two to load.
As you can see, there could be several hundred picture shape tiles to fill the required area. But because each one is only a few KB, Templot can zoom and pan over them very quickly -- I have tried up to 2000 picture shape tiles without any noticeable effect on zoom and pan speeds. That certainly wouldn't be the case if this was a single large captured screenshot of several dozen MB. The BGS shapes file can be saved in the usual way, it is only necessary to load the map tiles from the OSM server once.
It's much easier to work with the picture shape borders turned off. A rectangle shape is also drawn showing the requested area -- Templot loads only full tiles, so these overlap the requested area a little way:
© OpenStreetMap contributors
Here I have started overlaying a template on the map:
© OpenStreetMap contributors
This is Bewdley on the Severn Valley Railway:
© OpenStreetMap contributors
The disadvantage with OSM is that it is not always as accurate as OS maps. But of course anyone can go on there and edit it, so if the map doesn't have all the information you need you can add or amend it. Usually that means tracing from aerial imagery, but you can also cross-fade from OSM to the historic 25" maps on the NLS site, so it's possible to double check OSM for accuracy -- bridges, churches, etc., don't tend to wander about much over the years.
OSM is at: http://www.openstreetmap.org/about
Nowadays the OSM servers update most zoom levels within a couple of minutes, so it's much easier to check your work than it used to be. Press CTRL+F5 to refresh your browser if you don't see a change after a few minutes. Be warned though, editing OSM can be very addictive.
This new function will be in the next Templot program update. Comments welcome. Would you ever use this?
regards,
Martin.
Lots of folks like to use maps as a background guide to their track planning. But it's not always straightforward to capture and merge multiple screenshots from the mapping web sites, and scale them accurately to match the model scale.
So I thought it would be useful if Templot could load maps directly from the server. That way the map can be as large as you like, within reason, and Templot can do the scaling to your model scale automatically.
The big fly in that ointment is the copyright and licensing restrictions on most mapping and aerial imagery web sites.
But that doesn't apply to OpenStreetMap (OSM), so I have had a go at loading the OSM map tiles directly, with promising results.
The first requirement is to specify the location, and for the UK the easiest way is to use the OS Grid Ref:
Of course that doesn't work for the rest of the world, so I shall have to add an option to enter latitude/longitude instead. But the OS grid numbers are far more brain-friendly -- they are easily found by zooming in on this map:
https://osmaps.ordnancesurvey.co.uk
Next Templot needs to know how much area of map you want. That is specified in the equivalent model size, so it's important to have set your gauge/scale before doing this:
Templot then does some quite complex maths (maps are flat, the Earth's surface is curved), and loads all the necessary OSM tiles as background picture shapes. This is Shrewsbury in EM:
© OpenStreetMap contributors
which might take a minute or two to load.
As you can see, there could be several hundred picture shape tiles to fill the required area. But because each one is only a few KB, Templot can zoom and pan over them very quickly -- I have tried up to 2000 picture shape tiles without any noticeable effect on zoom and pan speeds. That certainly wouldn't be the case if this was a single large captured screenshot of several dozen MB. The BGS shapes file can be saved in the usual way, it is only necessary to load the map tiles from the OSM server once.
It's much easier to work with the picture shape borders turned off. A rectangle shape is also drawn showing the requested area -- Templot loads only full tiles, so these overlap the requested area a little way:
© OpenStreetMap contributors
Here I have started overlaying a template on the map:
© OpenStreetMap contributors
This is Bewdley on the Severn Valley Railway:
© OpenStreetMap contributors
The disadvantage with OSM is that it is not always as accurate as OS maps. But of course anyone can go on there and edit it, so if the map doesn't have all the information you need you can add or amend it. Usually that means tracing from aerial imagery, but you can also cross-fade from OSM to the historic 25" maps on the NLS site, so it's possible to double check OSM for accuracy -- bridges, churches, etc., don't tend to wander about much over the years.
OSM is at: http://www.openstreetmap.org/about
Nowadays the OSM servers update most zoom levels within a couple of minutes, so it's much easier to check your work than it used to be. Press CTRL+F5 to refresh your browser if you don't see a change after a few minutes. Be warned though, editing OSM can be very addictive.
This new function will be in the next Templot program update. Comments welcome. Would you ever use this?
regards,
Martin.