On 18/03/2016 19:57, Amaroussi (OpenStreetMap) wrote:
Hi,

I thought it may be useful to pitch my idea here, but I plan to develop two 
custom sets of tile sets that use the standard OSM layer, but with “British” 
and “Greek” colours respectively.

It's certainly possible; I've got something very like that sat on a VM on a desktop PC about five feet away :)

Depending on how much technical expertise I require for this, I plan to develop 
these tile sets in response to demand from the UK community in response the the 
change of colours recently.

The British tile set will have the old colours before the changeover to the 
red-yellow scheme, and it initially cover Great Britain and the Republic of 
Ireland only.

The Greek tile set will have green for motorways, two shades of blue for 
national roads, red for provincial roads and yellow for other connecting roads 
to villages, and it will initially cover Greece. This stylesheet reflects the 
road signs on motorways and national roads, with the rest being based on the 
old stylesheet.

Other than the change of colour, I plan to make the custom tile set stylesheet 
a dependency of the main stylesheet, to minimise the need to update them often.

I desire that the tiles update about five minutes after an edit, like the main 
map, so it does not turn out to be a half-baked alternative.


First, start with https://switch2osm.org/serving-tiles/manually-building-a-tile-server-14-04/ . That'll talk you through the basics of setting up a tile server. I'd start with something small (an English county, perhaps) so that when you need to reload because something has gone wrong, you can do so quickly. Initially I'd stick as close as possible to the instructions as written, so that if something goes wrong you can be reasonably sure that it was something that you misread, not something different you tried to do. I'd also initially use a virtual machine of some sort, perhaps running on a desktop or laptop you have - that way it's possible to revert to a previously working setup easily if something goes wrong. For small areas a couple of Gb of memory and around 20Gb disk should be enough - though when you start wanting to render UK and Greece you'll need more (at a guess, 8Gb memory might be enough - but someone else would need to confirm).

I ran through the instructions a couple of months to go "soup to nuts" and they worked; the only issue I'm aware of since then is that the "Installing osm2pgsql" bit needs to be changed slightly due to some recent commits there. Details are on https://github.com/openstreetmap/osm2pgsql , but if you have problems with that just get a couple-of-months-old version of osm2pgsql from git and run with that.

After that you should have a tile server and should be able to browse to your equivalent of http://b.tile.openstreetmap.org/0/0/0.png . Do be aware that creating low zoom tiles on a small server can take a while (minutes) - so don't expect pretty pictures immediately. The switch2osm instructions describing looking at logs to watch requests for tiles to be rendered.

You'll want a basic map viewer - I'd use Leaflet for that. See https://switch2osm.org/using-tiles/getting-started-with-leaflet/ (which actually contains rather more details than you need - just look at the links to the Leaflet site) and there are lots of examples, tutorials etc. on http://leafletjs.com/ . As an alternative, if you want to cheat you can have your tiles behind osm.org - see http://wiki.openstreetmap.org/wiki/User:SomeoneElse/Your_tiles_from_osm.org for that.

By this stage you've got a database and some "OSM Bright" tiles. You'll want to add a new tile layer initially consisting of OSM's "standard layer" ones.

The "standard style" is over at https://github.com/gravitystorm/openstreetmap-carto , and there's a link to the installation document from the readme there. In order to add more tile layers to your "renderd.conf" file (which you will have created during the "manually-building-a-tile-server-14-04" process), have a look at these questions:

https://help.openstreetmap.org/questions/45011/serving-multiple-layers-on-single-tile-server
http://gis.stackexchange.com/questions/79077/serving-multiple-styles-from-tile-server

OSM's standard style installation instructions "just worked" for me when I last tried them, which was last year just before OSM moved to "orange roads".

Next, you'll want to add your new tile layer to your Leaflet site - that's pretty straightforward and many or most of the Leaflet examples I mentioned above use multiple tile layers.

After that, it's on to changing road colours. At the top of https://github.com/gravitystorm/openstreetmap-carto/blob/master/roads.mss there are a bunch of colours. Initially, I'd try changing those to different values in your copy of the file, rerunning the "carto" command line (which you'll have previously run with the styles you've setup already), deleting tiles you've previously generated and seeing how the new colours look. As a background to "managing" tiles, see http://wiki.openstreetmap.org/wiki/User:SomeoneElse/Force-rending_tiles,_and_tidying_old_or_empty_ones .

When you're happy after having done this twice (once for the UK colours, once for Greek ones) you'll want to set up updates on the fly. I use a version of https://github.com/openstreetmap/mod_tile/blob/master/openstreetmap-tiles-update-expire for that - it's modified slightly to run in a crontab, and also to call "trim_osc.py" from https://github.com/Zverik/regional to only apply updates within a bounding box that I'm interested in. The changes are pretty obvious, but I can post a copy somewhere if it helps.

Slightly confusingly, the "setting up updates" bits are over at https://switch2osm.org/serving-tiles/building-a-tile-server-from-packages/ on the switch2osm site - but it's actually quite straightforward to do.

Now it's all working "all" you need to do is to scale it up to a large area, containing UK data and Greek data. I suspect you'll need to use something like osmosis to cut a larger file down to include the data you want (or to combine two separate files). There's lots of information about osmosis around the place; I wrote some at http://wiki.openstreetmap.org/wiki/User:SomeoneElse/Ubuntu_1404_tileserver_load (but not all of that will be relevant for you if you're not changing tagging on the fly on the way into the database). Be aware that you'll want to load it in one go - if you load the UK data into the database, and then the Greek data, you'll end up with only the Greek data on there.

Great! You've now got a server with UK and Greek map tiles on it, and a website that users can switch between UK and Greek colours. Next you'll have to think about "what happens if people try and scrape all my tiles". I suspect that you'll have to have a way of detecting problem users and preventing them from doing things that they should not. Unfortunately I can't help with that bit, but I'm sure that there are plenty of people on this list that can because they already do it.

That, I think is everything (or at least the minimum you can get away with). It's a bit "Monty Python how to play the flute"*, but I suspect any more detail would make it impossible to read in one go. I also suspect that there will be better places to link to explaining some of the steps, too - I'm sure that people will be able to help there.

Cheers,

Andy (SomeoneElse)



* you blow across the hole and move your fingers up and down


_______________________________________________
dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/dev

Reply via email to