Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I draw polygon vectors and I can find intersection to each other:

vactorTest.features[0].geometry.intersects(vactorTest.features[1].geometry)

but I want to find which layer elements this polygon intersects.

How can I find it?

EDIT:

I have vector layer like this:

layerArray = new OpenLayers.Layer.WMS(wms_layer_configs[i].label, "http://somelink/geoserver/wms",
        {
        // srs: 'EPSG:xxxx',
            layers: workspace + ":" + wms_layer_configs[i].name,
            tilesOrigin: map.maxExtent.left + ',' + map.maxExtent.bottom,
            format: 'image/png',
            transparent: true
        }, {
            opacity: 0.75,
            isBaseLayer: false,
            visibility: false
        });

than I draw polygon and want to display on the map features from layer which intersects this drawn polygon

share|improve this question
    
Hi @Iliaka, can you share the code that you used for fetching the layer elements that intersects with the Vector Polygon? –  Sam007 Sep 17 '12 at 17:23
add comment

1 Answer 1

up vote 3 down vote accepted

What you meant saying "layer elements"? If layer elements is features you can use the following approach:

result = []
testPolygon = vectorTest.features[0].geometry;
for (var i=1; i<vectorTest.features.length; i+=1) {
    if testPolygon.intersects(vectorTest.features[i].geometry) {
        result.push(vectorTest.features[i]);
    }
}
share|improve this answer
    
NO, intersection to each other is not problem for me. I have another layers where I have geom objects and I want to find intersection between this geom objects to the drawn polygon –  Iliaka May 11 '12 at 16:34
    
I edited my question –  Iliaka May 11 '12 at 16:40
    
Use needed layer inside for loop: for (var i=1; i<LAYERNAME.features.length; i+=1) –  drnextgis May 11 '12 at 16:41
    
I tried but did not work, I'll try again now –  Iliaka May 11 '12 at 16:42
3  
WMS is not vector layer and you cannot check intersection on client side. –  drnextgis May 11 '12 at 16:42
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.