how to properly implement Open Transport Map

787
8
01-07-2013 11:26 AM
NigelAlford
New Contributor III
I've worked through the example (which is broken) and can't seem to properly pull the Open Streetmap layers as a web tiled layer.  In the example the server is returning back a 404 error, which leads me to believe that the service call or address has been updated by open transport maps.
This is the address given in the sample from Open Transport Maps
 http://[abc].tile2.opencyclemap.org/transport/${z}/${x}/${y}.png 


Here's my non-working attempt:

 var sub = ["a","b","c"];
            var wtl = esri.layers.WebTiledLayer;
            var cycleMap = new wtl("http://{subDomains}.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png",
            {
                "id": "OTranspoMap",
                "copyright": "OTM",
                "subDomains": sub
            });
map.addLayer(cycleMap);


I'm getting this error:
Uncaught TypeError: Cannot call method 'toString' of undefined


I've been searching around and haven't found anyone else with this question, but sorry if this is a repost.
0 Kudos
8 Replies
JeffJacobson
Occasional Contributor III
In your format string try changing {subDomains} to {subDomain}.
0 Kudos
NigelAlford
New Contributor III
I tried that change and received the same error
0 Kudos
JeffPace
MVP Alum
http://${subDomain} (singular)

"subDomains":
in the JSON
0 Kudos
NigelAlford
New Contributor III
 var cycleMap = new wtl("http://${subDomain}.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png",
            {
                "id": "OTranspoMap",
                "copyright": "OTM",
                "subDomains": sub
            });


Is this a jquery function? if so I'll try adding the jquery library in the beginning
0 Kudos
NigelAlford
New Contributor III
When I run the sample code, the tiles are not being found has anyone else seen this?

var cycleMap = new wtl("http://${subDomain}.tile.opencyclemap.org/cycle/${level}/${col}/${row}.jpg", {
          "copyright": "Open Cycle Map",
          "id": "Open Cycle Map",
          "subDomains": ["a", "b", "c"]
        });
0 Kudos
JeffJacobson
Occasional Contributor III
I was able to get it to work: https://github.com/WSDOT-GIS/OsmTilesInArcGisJS.
0 Kudos
JeffPace
MVP Alum
It works fine, except it only has PNG tiles.  change the url to png and it works.
0 Kudos
NigelAlford
New Contributor III
@jacobsj and @jeff.pace

Thanks for the help guys I was off by such a small amount...gotta love it
0 Kudos