Hi,<br><br> I got solution based on Tac & Sveen reply. I have selected min and max values of x & y from all points. And i set that as extent like follow,<br><br> map.zoomToExtent(new OpenLayers.Bounds(minx,miny,maxx,maxy))<br>
<br>Thanks for the Solution.<br><br>Regards,<br>Bala<br><br><div class="gmail_quote">On Tue, Nov 8, 2011 at 7:35 PM, Sveen Atle Frenvik (Geomatikk IKT) <span dir="ltr"><<a href="mailto:Atle.Frenvik.Sveen@geomatikk.no" target="_blank">Atle.Frenvik.Sveen@geomatikk.no</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div bgcolor="#ffffff" text="#000000">
I guess something along these lines should do the trick (not tested)<br>
<br>
<br>
//create map etc..<br>
<br>
<br>
var vectorLayer = new OpenLayers.Layer.Vector("vectors");<br>
map.addLayer(vectorLayer);<br>
<br>
var draw = new
OpenLayers.Control.DrawFeature(vectorLayer,OpenLayers.Handler.Path);<br>
<br>
map.addControl(draw);<br>
<br>
draw.events.register("featureadded",this,function(feature){map.zoomToExtent(feature.geometry.getBounds());});<div><div><br>
<br>
<br>
<br>
<br>
On 2011-11-08 14:55, Imran Rajjad wrote:
<blockquote type="cite">
<div dir="ltr">if the points are in your vector layer, you can get
the extent of that layer and set zoom accordingly<br>
<br>
<div class="gmail_quote">On Tue, Nov 8, 2011 at 4:48 PM, Tac
Tacelosky <span dir="ltr"><<a href="mailto:tacman@gmail.com" target="_blank">tacman@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">As you're going through the points, keep
track of the min/max x and y, then use those values to set
the extent (the boundaries).
<div>
<br>
</div>
<div>While you can do this in Javascript, we ended up doing
that calculation in the server-side call that got the
points, and sending it over with the json that used to
populate the array of points.</div>
<div><br>
</div>
<div>Tac<br>
<br>
<div class="gmail_quote">On Tue, Nov 8, 2011 at 8:30 AM,
BalaVignesh Kasinathan <span dir="ltr"><<a href="mailto:kbalavignesh@gmail.com" target="_blank">kbalavignesh@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
Hi,<br>
I want to draw the line (route using x,y
coordinate points) over the map as vector layer. After
route drawn on map, i want to adjust the zoom level to
show the complete route. How can i do this? Is there
any direct way to do this? If not how to do using math
calculations?<br>
<br>
Regards,<br>
Bala<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
I.R<br>
</div>
<pre><fieldset></fieldset>
_______________________________________________
Users mailing list
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
</blockquote>
<br>
<br>
</div></div><span><font color="#888888"><pre cols="72">--
Atle Frenvik Sveen
Utvikler
Geomatikk IKT AS
tlf: 45 27 86 89
<a href="mailto:atle.frenvik.sveen@geomatikk.no" target="_blank">atle.frenvik.sveen@geomatikk.no</a></pre>
</font></span></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
<br></blockquote></div><br>