Add a new layer

Hi,
I found on this link how to add the OSM layer on Google Maps:
http://wiki.openstreetmap.org/wiki/Google_Maps_Example (Example - Using Google Maps API v3 setting OSM as a base map layer)

How can I add to this OpenCycleMap layer?

Thanks in advance,
Midhat

Use one of the tile URL’s for OpenCycleMap found on http://wiki.openstreetmap.org/wiki/Tile_servers
instead of the line return “http://tile.openstreetmap.org/” + zoom + “/” + x + “/” + coord.y + “.png”;

Hi,
Thank you for your help. On this link I was unable to find tile URL’s for OpenCycleMap.
I found it on http://thunderforest.com/maps/opencyclemap/, registred for free api and add tile URL’s
https://[abc].tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=
instead of the line return “http://tile.openstreetmap.org/” + zoom + “/” + x + “/” + coord.y + “.png”; but not working
Did I do something wrong?

Isn’t the third map from the top the one you are looking for ? The under “a” or “b” you have the URLs for the tiles

I see in the one you list from thunderforest. Did you replace that with the API key you got from thunderforest (or whereever you can get that api key) ?

Yes, it is. But
“a” is http://a.tile.opencyclemap.org/cycle/$%7Bz%7D/$%7Bx%7D/$%7By%7D.png
“b” is http://b.tile.opencyclemap.org/cycle/$%7Bz%7D/$%7Bx%7D/$%7By%7D.png
Neither one works. I tried to use http://www.url-encode-decode.com/ but nothing again.
Then I found new tile URL’s for OpenCycleMap on http://thunderforest.com/maps/opencyclemap/ and I added my api instead of but still nothing

Did you replace the %7D with } and %7B with { ?

Yes I did.
This is my file:
http://planinarenje.ba/b.html
Can you please look at the source code?

You need to stick to the format mentioned on that Google Maps wiki page:

return “http://tile.openstreetmap.org/” + zoom + “/” + x + “/” + coord.y + “.png”;

Don’t put in any “{” or “}” placeholders, they only work with other frameworks, like OpenLayers or Leaflet.

But how can I add OpenCycle layer on this google map?

return “http://tile.thunderforest.com/cycle/” + zoom + “/” + x + “/” + coord.y + “.png”;

Please don’t forget the OSM attribution!

I tried with this new URL but again does not work http://planinarenje.ba/b.html
What is OSM attribution?
Anything else I need to change?

Thank You for your time and help :slight_smile:

Try + coord.x + instead of + x +

I assumed you were using the other example as a template

Now is OK, :smiley:
Thank You !