[OpenLayers-Users] getDataExtent

Kenny kenny at xarex.com
Thu Sep 18 09:41:48 EDT 2008


Hi All,

 

I have the following function that retrieve info from a xml file and
displays the markers

 

What I am trying to do is zoom to the position where the markers are

I think I should be using the getDataExtent() function but unfortunately I
don’t really know how to to.

 

Could someone Please give me a tip?

 

Thanks

 

K-

 

 

 

 

 function loadSuccess(request) {

            

         doc = request.responseXML;

          

         var x_markers = doc.getElementsByTagName("marker");

                         

                         for (i=0; i<x_markers.length; i++){

                            var id =
x_markers[i].getElementsByTagName("id")[0].firstChild.nodeValue;

                                    var imei =
x_markers[i].getElementsByTagName("imei")[0].firstChild.nodeValue;

                                    var lat =
x_markers[i].getElementsByTagName("lat")[0].firstChild.nodeValue;

                                    var lng =
x_markers[i].getElementsByTagName("lng")[0].firstChild.nodeValue;

                                    var time =
x_markers[i].getElementsByTagName("time")[0].firstChild.nodeValue;

                                    var speed =
x_markers[i].getElementsByTagName("speed")[0].firstChild.nodeValue;

                                    var icon =
x_markers[i].getElementsByTagName("icon")[0].firstChild.nodeValue;

                                    var addpoly =
x_markers[i].getElementsByTagName("addpoly")[0].firstChild.nodeValue;

                                    //add the markers

                                            addMarkers(lat,lng,'../icons/'+
icon +'.gif',id); 

                                     //polys

                                     if (addpoly == 1){

                                                  newPoint = new
OpenLayers.Geometry.Point(lng,lat);

                                                   pointList.push(newPoint);

                                                   lineFeature = new
OpenLayers.Feature.Vector( new
OpenLayers.Geometry.LineString(pointList),null,poly_style);

                                                   lineFeature.fid = 52751;

 
polys.addFeatures([lineFeature]);

                                                             

                                   } //end Polys

 

               }

        }


  _____  

I am using the free version of SPAMfighter for home users.
SPAMfighter has removed 583 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter <http://www.spamfighter.com/len>  for free now!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080918/ca66d42a/attachment.html


More information about the Users mailing list