Direct loading of background maps in Templot

Discuss the prototype and how to model it.
User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Direct loading of background maps in Templot

Postby Martin Wynne » Sun Jul 23, 2017 2:51 am

Well that was fun. How much actual use can be made of it remains to be seen. Image

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:

Image

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:

Image

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:

Image
© 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:

Image
© OpenStreetMap contributors

Here I have started overlaying a template on the map:

Image
© OpenStreetMap contributors

This is Bewdley on the Severn Valley Railway:

Image
© 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. Image

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.
38 years developing Templot. And counting ...

User avatar
Guy Rixon
Posts: 424
Joined: Sun Mar 27, 2011 6:40 pm

Re: Direct loading of background maps in Templot

Postby Guy Rixon » Sun Jul 23, 2017 9:38 am

Hi Martin, many thanks for this and I shall certainly use it. When is the update due?

OSM will do for my purposes, but would it be worth building an interface to the historic maps served by the National Library of Scotland?

User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Re: Direct loading of background maps in Templot

Postby Martin Wynne » Sun Jul 23, 2017 11:54 am

Guy Rixon wrote:Hi Martin, many thanks for this and I shall certainly use it. When is the update due? OSM will do for my purposes, but would it be worth building an interface to the historic maps served by the National Library of Scotland?

Hi Guy,

Thanks. Templot updates don't have a due date. They are ready when they are ready. However I think I have failed if I don't manage one every 6 months or so, which means we are well overdue for the next one. It really depends on whether I decide to release one in its present state, or wait until I have finished other changes which I may have on the go. For example I am currently working on making the trackbed edges/ballast/cess lines adjustable for length and position within a template, instead of running the full length of it.

It would be wonderful to include the NLS historic maps directly in Templot, but there are a couple of problems. Firstly they are copyright (OS mapping is out of copyright after 50 years, but the scans belong to the NLS). The NLS allow non-commercial use of screenshots, but they may not be happy to have the maps integrated in other software. And secondly, like Google maps, they are served via scripting rather than as plain image tiles, so can't simply be loaded into background picture shapes. To be usable in Templot the bitmaps would need to be copied from a hidden browser window. I'm working on it, but we're not there yet.

In the meantime the NLS maps can of course be used in Templot, but you need to make your own screenshots, merge them and scale them to size, and use the crop/combine function in Templot to create a larger continuous map. See:

http://templot.com/companion/crop_combine.html

http://85a.co.uk/forum/view_topic.php?i ... forum_id=1


Image

regards,

Martin.
38 years developing Templot. And counting ...

petermeyer
Posts: 1
Joined: Tue Oct 01, 2013 10:06 am

Re: Direct loading of background maps in Templot

Postby petermeyer » Sun Jul 23, 2017 1:16 pm

Martin

These are fantastic functions. You may recall I uploaded a background map and also used the Templot function that matches the transition curve to bend it to fit my layout. Without Templot I could not have built it and got it into the small space I have available. Keep up the developments. Peter

Armchair Modeller
Posts: 898
Joined: Thu Jan 06, 2011 7:34 pm

Re: Direct loading of background maps in Templot

Postby Armchair Modeller » Sun Jul 23, 2017 1:34 pm

Using NLS screenshots is great, especially as they are scanned to a very high resolution. You can also copy and paste the map scale, which enables accurate measurement and scaling.

I see they have just completed all of England now. There are also some 1:500 maps of towns and cities in SW England that I only noticed recently.

User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Re: Direct loading of background maps in Templot

Postby Martin Wynne » Tue Jul 25, 2017 1:00 pm

Thanks for the kind comments.

It seems NLS do have a tile server, but only the historic 1"/mile map is available for free use.

The largest scale available in tiled format for the whole of the UK is the old 6"/mile maps (1888-1913), for which the licence subscription is £199+vat per year. They are useful, but not really large enough for detailed track planning. Here is Shrewsbury, drag the transparency slider to see the modern view:

http://maps.nls.uk/geo/explore/#zoom=18 ... yers=6&b=2

When they have finished the 25" map project hopefully they will make that available in tiled format, in which case it could be well worth raiding the Templot donations fund for what is likely to be a hefty subscription fee.

In the meantime we could have the fantastic 60"/mile maps of London 1893-1896 for £99+vat per year, and I may go for that just to see how well it works for direct loading in Templot. Here is Willesden Junction, drag the slider to see the modern view:

http://maps.nls.uk/geo/explore/#zoom=19 ... rs=163&b=2

In the meantime I have added the option to specify the location in latitude/longitude for non-UK locations, here is Buenos Aires on OSM in EM:

Image

regards,

Martin.
38 years developing Templot. And counting ...

Armchair Modeller
Posts: 898
Joined: Thu Jan 06, 2011 7:34 pm

Re: Direct loading of background maps in Templot

Postby Armchair Modeller » Tue Jul 25, 2017 3:25 pm

Wow! That map of Buenos Aires brings back some happy memories. I remember taking photos of the complex from a bus on the overbridge on the left of the map many years ago! It was sad to see how run down and derelict so much of it was at the time.

User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Re: Direct loading of background maps in Templot

Postby Martin Wynne » Tue Jul 25, 2017 4:25 pm

Armchair Modeller wrote:Wow! That map of Buenos Aires brings back some happy memories. I remember taking photos of the complex from a bus on the overbridge on the left of the map many years ago! It was sad to see how run down and derelict so much of it was at the time.

How strange. I stick a pin in a map of the world at random, and it turns out to be a location known to someone already posting in this topic. Image

Here is the Google view from the overbridge in 2015:

https://goo.gl/maps/xSsis1gdx1P2

And looking the other way:

https://goo.gl/maps/p4orprsY7Nr

The semaphore signalling and curving pointwork give it a familiar feel. Image

regards,

Martin.
38 years developing Templot. And counting ...

Armchair Modeller
Posts: 898
Joined: Thu Jan 06, 2011 7:34 pm

Re: Direct loading of background maps in Templot

Postby Armchair Modeller » Tue Jul 25, 2017 6:01 pm

Martin Wynne wrote:How strange. I stick a pin in a map of the world at random, and it turns out to be a location known to someone already posting in this topic.


Martin,

Many people find me strange. I am also very well travelled.

I guess it had to be me, really ;)

User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Re: Direct loading of background maps in Templot

Postby Martin Wynne » Thu Jul 27, 2017 8:18 pm

Armchair Modeller wrote:There are also some 1:500 maps of towns and cities in SW England that I only noticed recently.

While looking for something else I found this large scale map of York 1852 online:

http://www.davidrumsey.com/luna/servlet ... 8&trs=3470

Here is a bit of it:

Image
creativecommons/by-nc-sa/3.0/

The full-size capture is at: http://85a.co.uk/forum/gallery/2/origin ... 000000.png

Martin.
38 years developing Templot. And counting ...

User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Re: Direct loading of background maps in Templot

Postby Martin Wynne » Fri Jul 28, 2017 8:52 am

I decided to go ahead and buy a subscription for Templot to the NLS London 1890s maps. Image

I'm well pleased with the results -- this is the shed area at Palace Gates station. See:

http://www.disused-stations.org.uk/p/palace_gates/

These are not screenshots made separately and then manually imported and scaled to size.

I simply specified the OS Grid Reference (TQ 301 907) and Templot loaded the map from NLS automatically and at exactly the right scaled size ready to start track planning over it.

This function will be in the next Templot program update.

Image
© National Library of Scotland

Image
© National Library of Scotland

Image
© National Library of Scotland

As you can see I have started aligning some templates over the tracks. These are in P4.

To match prototype turnouts exactly it is necessary to change to CLM unit angles and in most cases to generic V-crossings (it's not worth bothering to do this if you are not using an exact scale/gauge such as P4 or S7).

This crossover then turned out to have 15ft straight switches and 1:10 V-crossings. The switch toes for the crossover then matched the switch location marks on the map.

The accuracy of these 60"/mile maps is surprising -- the track gauge and 6ft way match exactly:

Image

Having paid for a year's subscription to this NLS service I now need to get the next Templot update out quickly so that everyone can get a full year's benefit of it. Image

Just to repeat, this is for London only, and the 1890s. But of course much of the infrastructure remained the same for years, even if track layouts changed a bit.

Now hopefully the NLS will in due course make the 25" maps for the whole country available in the same way, although the subscription fee is likely to be eye-watering.

Here is Palace Gates on the NLS site with a transparency slider so that you can see the modern aerial view:

http://maps.nls.uk/geo/explore/#zoom=19 ... rs=163&b=2

regards,

Martin.
38 years developing Templot. And counting ...

User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Re: Direct loading of background maps in Templot

Postby Martin Wynne » Tue Aug 01, 2017 2:41 am

A further update.

I'm so pleased with the way this is looking that I have had a rush of blood to the head and now also purchased a subscription for Templot to the 6-inch maps. Image

Image

In truth the 6-inch maps are too small-scale to be much help with detailed track planning, such as identifying the size of turnouts, etc. But they are the only historic maps currently available GB-wide, and available on subscription from the NLS tile server.

The NLS 25-inch project has not yet covered the whole of GB (and may never do so for all areas), and the maps are not currently available on subscription, so cannot be directly loaded in Templot -- you must make your own screenshots from the NLS web site.

Here is a direct comparison between the two (Tewkesbury):

6-inch map:

Image

25-inch map:

Image

Clearly the 6-inch map is not going to be much help in the finer track details (or even the exact number of sidings), but it does show the ruling radii, correct positions of bridges, goods sheds, signal boxes, etc. So it is still useful, and could be used to correctly scale a 25-inch map over the top of it if the latter is set to transparent.

Talking of which, I have also included a function to perform the scaling for manually created screenshots, using the same maths as for the directly loaded ones.

For those adept with a calculator, here it is:

image width in mm =

    513592.631 x COS(latitude) x pixels x scale / 2^zoom

where

513592.631 is a magic number derived from the circumference of Earth at the Equator.

latitude is at the centre of the map area, e.g. 52.1234 degrees

pixels is the width of the image in pixels, e.g. 1280

scale is your model scale in mm/ft, e.g. 4

zoom is the zoom level of the map, e.g. typically in the range 17-21 for our purposes,
           where zoom=0 means a map of the entire world.

Fortunately if you get zoom wrong it causes the width to double or halve for each step, so it is fairly obvious to correct.

Here is how to find the information in a typical URL:

maps.nls.uk/geo/explore/#zoom=18&lat=51.9959&lon=-2.1498&layers=6&b=3

p.s. 2^zoom means 2zoom i.e. 2 raised to the power zoom

regards,

Martin.
38 years developing Templot. And counting ...

Armchair Modeller
Posts: 898
Joined: Thu Jan 06, 2011 7:34 pm

Re: Direct loading of background maps in Templot

Postby Armchair Modeller » Tue Aug 01, 2017 9:25 am

NLS is indeed a wonderful resource. I do find a few maps slightly distorted though - probably inevitable with paper maps stored for such a long time.

User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Re: Direct loading of background maps in Templot

Postby Martin Wynne » Mon Aug 07, 2017 2:59 am

Another update. Image

The directly-loaded tiled maps are great. They can be extended by adding additional rows and columns of tiles to almost any size, with little impact on panning and zooming performance.

But the map which many users will want is the NLS 25-inch historic map of the whole country, which is the smallest scale which can really be used for track planning with any hope of replicating prototype turnout sizes and actual positions of pointwork.

That's still a work-in-progress at NLS -- so far they have done about half of the many thousands of sheets needed for England & Wales. Which means it is not yet available as a subscription API for direct loading of tiles. But it is available as a "slippy map" web site with a useful option of adjustable transparency over an underlying base map or aerial image -- in effect you get two maps for each web URL.

Which means screenshots can be made manually for use as background picture shapes in Templot. The difficulty is sizing them to the exact scale to match your model.

So I thought I would look at supplementing the directly loaded maps with an option for Templot to make the screenshots for you, and insert them automatically at the correct scaled size.

It's working quite well, and will be in the next program update.

Image

As usual, getting it to work is the easy bit. What always makes me sweat is creating a simple user interface, and especially writing the notes in words which folks will actually read, and not glaze over when they see them. Image

So here is the first draft for this function. Please read these notes and let me know if anything is unclear. Thanks:

Image

Image

Image

regards,

Martin.
38 years developing Templot. And counting ...

RichardS
Posts: 37
Joined: Mon Sep 26, 2016 7:51 am

Re: Direct loading of background maps in Templot

Postby RichardS » Mon Aug 07, 2017 12:31 pm

Martin Wynne; you're a clever b*gg*r! :D
Kind regards
Richard

User avatar
Allan Goodwillie
Posts: 512
Joined: Sun Jul 20, 2008 7:00 pm

Re: Direct loading of background maps in Templot

Postby Allan Goodwillie » Fri Aug 18, 2017 5:47 pm

Hi Martin, :)

We in our starters group will be looking again at Templot after the summer and just what you have done here is really good news - I am going to try it out for myself, if I get the time next month. :D The fact that the Scottish Region is available in maps will be of real use to our small group as most are at the planning stage.

User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Re: Direct loading of background maps in Templot

Postby Martin Wynne » Fri Aug 18, 2017 7:16 pm

Thanks Allan. It's proving difficult to keep up with the NLS. Image

Both the 50" and 25" Scotland maps are now available in "slippy" format, although the 25" coverage is much greater so far.

This is the 50"/mile from the 1950s, layer 170 at zoom 19:

Image

Image


This is the 25"/mile from the 1890s, layer 168 at zoom 18:

Image
© National Library of Scotland

Provided the longitude, latitude and zoom level are in the URL (slippy map format), I can get Templot to capture the screenshot and scale it to the model size.

I'm hoping to get this Templot update available before the end of this month.

Hopefully all this will eventually be available as a subscription API from NLS, which allows the image to be loaded as tiles regardless of the screen size, which is a limitation for the screenshots (needing multiple screenshots to be aligned).

regards,

Martin.
38 years developing Templot. And counting ...

User avatar
Allan Goodwillie
Posts: 512
Joined: Sun Jul 20, 2008 7:00 pm

Re: Direct loading of background maps in Templot

Postby Allan Goodwillie » Sat Aug 19, 2017 9:32 am

This is all very interesting and encouraging Martyn, I will try to get a look at the Scotts Road sidings area in Fife at East Wemyss and see what can be done over the next month. I have already started track making based on a photocopy of one of the 25" maps, but it will still be a useful tool for further planned layouts amongst our group and another couple of layouts I would like to make as future builds.

My new layout will have a standard sub base and removable top boards to allow for several railways to be built over the next few years if I am spared. My friend Richard Chown, who sadly is no longer with us, was always producing railways at a prodigious rate as he was interested in different forms of railway. I think there are better and quicker ways to produce layouts than we have at present. I am also concentrating on building layouts which can be taken in a car to shows and be assembled quickly and disassembled just as fast, so planning is an essential part of this. :D

More power to your elbow! :thumb (or should it be thumbs up!)

PeteT
Posts: 102
Joined: Tue Jan 11, 2011 9:53 pm

Re: Direct loading of background maps in Templot

Postby PeteT » Sat Aug 19, 2017 11:00 am

Sounds interesting Martin!

My only play so far has been importing a 1:2500 map of Embsay I obtained from old maps, & that worked well. The only odd bit was that it didnt seem to save within the project files. This doesnt look to be much of an issue, as reimporting it puts it in exactly the same spot - but was there something I should have done to embed it?

Cheers,

User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Re: Direct loading of background maps in Templot

Postby Martin Wynne » Sat Aug 19, 2017 12:49 pm

PeteT wrote:The only odd bit was that it didn't seem to save within the project files.

Hi Pete,

Background picture shapes are part of the background shapes, and are saved separately from trackplan projects:

Image

That way you can use the same background with different projects. In addition to picture shapes (maps) the file might include an outline of the railway room, baseboards, etc.

If you save it with the file name start.bgs it will be loaded automatically each time you start Templot.

regards,

Martin.
38 years developing Templot. And counting ...

User avatar
Martin Wynne
Posts: 605
Joined: Mon May 14, 2012 4:27 pm

Re: Direct loading of background maps in Templot

Postby Martin Wynne » Wed Sep 06, 2017 8:47 pm

This Templot update to version 215a is now available. Your copy of Templot should update automatically if you restart it and follow the instructions. If you have any problems with that, follow the download links on the Templot web site.

Also in this update, Templot can now create slips automatically, for those who find it too difficult or time-consuming. Slips can be of any crossing angle, in straight or curved track, or even on a transition curve.

More info on the Templot Club user forum shortly.

regards,

Martin.
38 years developing Templot. And counting ...


Return to “Track and Turnouts”

Who is online

Users browsing this forum: No registered users and 2 guests