[OpenLayers-Users] can't get dynamic tiles to draw

thomcat chewiecat at gmail.com
Mon Jun 27 10:17:13 EDT 2011


For a proof of concept to migrate from a working google site I'm using the
"spherical mercator" example and am trying to use the get_my_url example to
get the name for dynamic tiles of the google type.
The tiles are made (and saved so they may exist on the next go round) by a
ashx handler. I'm missing some basics with openlayers I think. Can't seem to
grasp when the extent is set and when the setCenter is needed for one
thing...and I'm married to the google tile names so perhaps I'm missing
something hacking up the google projection setup as well..

Not sure how to get an extent set for this example before I try to make the
tile. Do I need to draw a google layer first? the get_my_url needs a map
extent and a bounds can't seem to get the map extent set before the
get_my_url call...if I do an addlayers before my wms setup then I don't get
to my code at all. 

Can anyone provide a better get_my_url example to provide the tile names?

Here is what I have that doesn't work at all..

  map = new OpenLayers.Map("map", {
                maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34),
                 numZoomLevels: 18,
                 maxResolution: 156543.0339,
                 units: 'm',
                 projection: "EPSG:900913",
                 displayProjection: new OpenLayers.Projection("EPSG:4326"),
                 allOverlays: true
             });
         

            var proj = new OpenLayers.Projection("EPSG:4326");
            var bounds = new OpenLayers.Bounds(-81.88, 35.88, -80.80, 35.74)
            bounds.transform(proj, map.getProjectionObject());
                                    
              var tilename = get_my_url(bounds); // returns with garbage as
there's no extent to the map yet

              var my_wms = new OpenLayers.Layer.WMS("Webservice",
                "http://localhost:xxx/MyWebO/MyWebOH.ashx?path=" + tilename,
                { LAYERS: "MyStreets",
                    REQUEST: "GetMap",
                    SERVICE: "WMS",
                    VERSION: "1.1.1",
                    FORMAT: "png",
                    TRANSPARENT: "TRUE",
                    SRS: "41001",
                    BBOX: "0,0,0,0",
                    WIDTH: "256",
                    HEIGHT: "256" 
                });
             
               map.addLayers([my_wms]);
           
               map.setCenter(new OpenLayers.LonLat(-81.84, 35.80).transform(
                    new OpenLayers.Projection("EPSG:4326"),
                    map.getProjectionObject()
            ), 11);





--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/can-t-get-dynamic-tiles-to-draw-tp6520596p6520596.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list