More

How to fit selected features to page using openlayers2.13?

How to fit selected features to page using openlayers2.13?


I want to select feature and then fit feature to page bound.

I use this code:

selected.geometry.resize(2, origin);

my code, double the selected, but i want fit selected to page bound. I do not know how to calculate scale and put in place 2 in the above code.

Can someone help me?


I found the answer:

function fitToScale(){ // get min , max bound of selected features; minBoundX=vectors.selectedFeatures[0].geometry.getBounds().left; minBoundY=vectors.selectedFeatures[0].geometry.getBounds().top; maxBoundX=vectors.selectedFeatures[0].geometry.getBounds().right; maxBoundY=vectors.selectedFeatures[0].geometry.getBounds().bottom; for(i=0 ; i < vectors.selectedFeatures.length ; i++){ gBound = vectors.selectedFeatures[i].geometry.getBounds(); if(minBoundX>gBound.left){ minBoundX=gBound.left; } if(minBoundY>gBound.bottom){ minBoundY=gBound.bottom; } if(maxBoundX

I hope it can help you.


Watch the video: Making Multiple Selections from ArcMap layer attribute table tutorial