Hi, I hacked together something along these lines here - http://www.whatsthatpicture.com/flickr/commons-map.php?lon=99796.004965972&lat=6945659.600239&zoom=4
Sorry, the code needs a good clean up but you'll see there's a function getParameterByName(name) which makes all the url parameters available (much like Arnd's example) e.g. setting lon = urlparams.lon or setting default values if none are present in the url. These are then used in map.setCenter(new OpenLayers.LonLat(lon,lat), zoom); When a user moves around the map it also updates the url using window.history.pushState so you get permalinks for specific views. On Wed, Oct 24, 2012 at 10:17 PM, Arnd Wippermann <[email protected]> wrote: > > You can use > > /** > * Function: getParameters > * Parse the parameters from a URL or from the current page itself into a > * JavaScript Object. Note that parameter values with commas are > separated > * out into an Array. > * > * Parameters: > * url - {String} Optional url used to extract the query string. > * If url is null or is not supplied, query string is taken > * from the page location. > * > * Returns: > * {Object} An object of key/value pairs from the query string. > */ > OpenLayers.Util.getParameters = function(url) { > > to parse the url and use the parameters to do something like Curtis > suggested. > > Arnd > > > ________________________________ > > Von: [email protected] > [mailto:[email protected]] Im Auftrag von Basques, > Bob (CI-StPaul) > Gesendet: Mittwoch, 24. Oktober 2012 21:47 > An: [email protected] > Betreff: [OpenLayers-Users] Looking for Example interface for > auto-re-centering of view (from URL call) > > > All, > > Anyone know of a demo that Auto-recenters view from a URL call. Want to > zoom to a point on a map, and recenter the view based on a URL. > > The idea is to stay tuned to a tracking GPS in a Fleet asset, and basically > follow along as they move. > > Thanks > > Bobb > > _______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users -- --- James Morley www.jamesmorley.net / @jamesinealing www.whatsthatpicture.com / @PhotosOfThePast www.apennypermile.com _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
