[Geoprisma-dev] maxextent on OSM

Alexandre Dube adube at mapgears.com
Tue Sep 14 15:40:37 EDT 2010


Hi Yves,

   To my eyes, it's an OpenLayers issue.  You should open a ticket 
showing a live (very simple) openlayers demo demonstrating the problem.

   For the time being, you could set the map center in your 
template.xslt file directly.  That would do the trick on load but when 
clicking on the "maxextent" button you would still be zoomed out of your 
extent.  A quick fix for that could be to overwrite the control like 
this (add this in your template.xslt) :

OpenLayers.Control.ZoomToMaxExtent.prototype.trigger = function(){
     if (this.map) {
         this.map.setCenter(new OpenLayers.LonLat(55,55), 5);
     }
}

Regards,

Alexandre


On 10-09-14 03:32 PM, Yves Moisan wrote:
>  Le 2010-08-31 13:22, Alexandre Dube a écrit :
>> Yves,
>>
>> Ok, it would seem that defining a 'maxExtent' option to the 
>> OpenLayers.Map object automatically set the maxExtent of the layers 
>> added, but not the XYZ (OSM) ones.  They are automatically calculated 
>> and ignore the one from the map.
> Hi Alexandre,
>
> My understanding is that the maxExtent works on regular WMS layers 
> because we have control over the service.  Another fellow showed me 
> how he could not do a maxExtent on a Google layer, so it looks like 
> all services over which we have no control we can't set an arbitrary 
> maxExtent to them.
>
> I found on the OpenLayers example site how they use setCenter with a 
> zoom level : http://openlayers.org/dev/examples/osm-google.html.  To 
> me this shows we can't just set another maxExtent in the map object if 
> we have a gymo type map.  Could it be that if we specified a maxExtent 
> for a layer the code in GP would trigger a setCenter ?
>
> This is a bugging issue for us because I'm trying to push the use of 
> OSM as a baselayer but if we can't open the map zoomed over a specific 
> area (which we can normally do in WMS by setting the service 
> maxExtent) then that's a turn off.
>
> Ideas appreciated.
>
> Yves
>


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Geoprisma-dev mailing list