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'm trying to query a feature in OpenLayers, but it's returning just an image highlighted that is not possible to make zoom, pan and drag.

My intention is to query a feature on the map like street name, city and country. Is there any function in OpenLayers?

I'm using this code:

var query = new OpenLayers.Layer.WMS( "Utbs", 
    "http://localhost/cgi-bin/wms.exe", 
    {
    srs: 'EPSG:4326',
    width: '800',
    styles: '',
    height: '600',
    layers: 'layer_name',   
    mode: 'itemquerymap',
    qstring: "(value = '03')",
    qlayer: 'layer_name',
    mapxy: 'shape'  
    },
    {
    singleTile: true    
    }
);

map.addLayers([utbs_query]);
map.zoomToMaxExtent();
share|improve this question

1 Answer 1

Take a look at the Feature Info example for OpenLayers.

This uses the GetFeatureInfo requests for WMS layers to return attribute data. You may have to modify your WMS configuration in MapServer or GeoServer (or whatever is serving your WMS layers) to support this.

share|improve this answer
    
Actually a want to highlight and make a zoom in a feature that was typed in a field name. The method GetFeatureInfo just return information about this feature where you clicked hover, so this is not what i want to. Thanks! –  Michel Andrade Jun 30 '11 at 11:54
    
The GetFeatureInfo requests can also return the geometry of a feature. With this you can zoom/highlight. –  geographika Jun 30 '11 at 12:01
1  
But i need to query by the name of a feature, not by a event click, is it possible? –  Michel Andrade Jun 30 '11 at 12:03
    
You could try building a GeoExt search form to query your WMS or WFS api.geoext.org/1.0/examples/search-form.html –  geographika Jun 30 '11 at 14:51

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.