[OpenLayers-Users] Parameters in URL

Paul Spencer pagameba at gmail.com
Wed Oct 8 09:25:56 EDT 2008


I haven't done this myself, but I believe the ArgParser control is  
designed to work with the getParameters function and automatically  
apply certain arguments to the map when it is created.  From the code,  
it looks like it will automatically pick up layers, lat, lon, and zoom  
from the url.

So your 'viewer' page just needs to add an ArgParser control to the  
map during or after construction and it will use those parameters.  If  
you need other parameters, you would need to modify ArgParser to  
support them or create some custom code in your 'viewer'.

map.addControl(new OpenLayers.Control.ArgParser());

Cheers

Paul

On 7-Oct-08, at 3:19 PM, Yves Moisan wrote:

> Hi All,
>
> Our application generates an iframe that calls an html in which our
> OpenLayers map is defined.  We use that to have an overall map.  Now,
> we'd like to be able to zoom in around a given feature.  I know a
> combination of setCenter and zoom level can do it for a point (or a  
> bbox
> in the general case) but we'd like to use the same html file and pass
> arguments in the url.
>
> I came across this : http://openlayers.org/QuickTutorial/ where one  
> can
> see a "viewer" that points to an html file that can parse arguments in
> the url.  That's exactly what we're looking for.  Looking around, I
> found the OpenLayers.Util.getArgs function that is used in the  
> viewer is
> now deprecated in favor of OpenLayers.Util.getParameters, so that kind
> of rang a bell (e.g. is this still the "best practice").  If I follow
> the example, that means every html file where an Openlayers map is
> defined that one wants to send url paramters to needs to be  
> "viewified"
> like in the viewer example.  Are there higher level wrappers to allow
> one to pass url parameters to existing html files or do we need to
> modify the html files directly ?
>
> TIA,
>
> Yves Moisan
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list