[OpenLayers-Users] Noob - Serving Tiles Without a 'Server'

christopher.schmidt at nokia.com christopher.schmidt at nokia.com
Sat Jun 5 09:59:49 EDT 2010


On Jun 5, 2010, at 9:45 AM, ext Arnie Shore wrote:

> Hello all.
> 
> I'm using the script at 
> http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example:
> 
> I have a set of OSM tiles under my 'tiles'directory - named correctly, I 
> believe.  (e.g., '13/2352/3131.png') - on my web server's /osm/tiles 
> directory.
> 
> I'm trying to serve these up with the following lines (using the base 
> example script noted above) , which gets me the empty pink:
>                 layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
> "http://127.0.0.1/osm/tiles/");
>                 map.addLayer(layer);
> 
> which I've adapted from the following lines in the simple example, which 
> works correctly:
>                 var my_map_obj = new OpenLayers.Layer.OSM();
>                 map.addLayer(my_map_obj);
> 
> My question is whether something this lightweight can really work?  (I'd 
> like to RTFM on this, but I haven't yet found the M to R.)  If yes, what 
> do I need to do to make it work?

You'll note that you've got two completely different layers in the two
snippets you posted. It's not clear to me why you switched layer types,
but that definitely won't work.

If you consult the Layer.OSM docs:

 http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/XYZ-js.html#OpenLayers.Layer.OSM

" If you wish to use tiles at home / osmarender layer instead, you 
can pass a layer like:

new OpenLayers.Layer.OSM("t at h",
  "http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png");"

I presume you can adapt this example to your particular use case. (A
hint: Change the string with 'tah.openstreetmap.org' in it.)

Best Regards,
-- 
Christopher Schmidt
Nokia




More information about the Users mailing list