Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can extend OpenLayers to support this operation. I make this using OpenLayers native functions. Try this, maybe you must fix and customize this code.</p> <pre><code>// The first object is instanced using data given from gmaps var objBound1 = new OpenLayers.Bounds(); objBound1.extend(new OpenLayers.LonLat(2,2)); objBound1.extend(new OpenLayers.LonLat(8,8)); // The second object is instanced using data given from gmaps var objBound2 = new OpenLayers.Bounds(); objBound2.extend(new OpenLayers.LonLat(5,5)); objBound2.extend(new OpenLayers.LonLat(10,10)); // Extract limits from our objects var arrBound1 = objBound1.toArray(); var arrBound2 = objBound2.toArray(); // Determine an virtual bound. It must contain our two bounds var intMinLeft = arrBound1.left &lt; arrBound2.left ? arrBound1.left : arrBound2.left; var intMinTop = arrBound1.top &lt; arrBound2.top ? arrBound1.top : arrBound2.top; var intMaxRight = arrBound1.right &gt; arrBound2.right ? arrBound1.right : arrBound2.right; var intMaxBottom = arrBound1.bottom &gt; arrBound2.bottom ? arrBound1.bottom : arrBound2.bottom; // Search all points of virtual bound, storing the points contained in bound1 or bound2 var objBoundResult = new OpenLayers.Bounds(); for(var intI = intMinLeft; intI &lt; intMaxRight; intI++) { for(var intJ = intMinTop; intJ &lt; intMaxBottom; intJ++) { if(objBound1.containsLonLat(new OpenLayers.LonLat(intI, intJ)) || objBound2.containsLonLat(new OpenLayers.LonLat(intI, intJ))) { objBoundResult.add(intI, intJ); } } } // objBoundResult is what you want </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload