[OpenLayers-Users] pick an attribute from a wms layer when I draw a
point in another vector layer
beppe
beppenapo at gmail.com
Tue Dec 6 11:03:10 EST 2011
Hi all,
I've a function "A"[0] for picking an attribute from a wms layer, the
value is passed to a form.
I've another function "B"[1] for draw and save a point in a postgis
table (via geoserver), this function is triggered when I click the form
"save" button.
Function A works fine except when I want to insert a new point.
I want the function A to be triggered when drawing a point on the
map...but I don't know how!
Some suggestion?
thanks a lot
-beppe-
[0]
function comunePickFunc(e) {
if (e.features && e.features.length) {
var nomeComune = e.features[0].attributes.nome;
var id = e.features[0].attributes.id;
document.getElementById('comune').innerHTML = nomeComune;
$('#id_comune').val(id);
$.ajax({
type: "POST",
url: "inc/dinSelComune.php",
data: {id:id},
cache: false,
success: function(html){$("#indirizzo").html(html);}
});//ajax
}
}
var comunePick = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://localhost:8080/geoserver/wms',
title: 'identify features on click',
layers: [comuni],
queryVisible: true
});
comunePick.infoFormat = 'application/vnd.ogc.gml';
comunePick.events.register("getfeatureinfo", this, comunePickFunc);
map.addControl(comunePick);
comunePick.activate();
[1]
function salvaSito(fid){
var fid = OpenLayers.Util.getElement('fid').value;
var feature = siti.getFeatureById(fid);
feature.attributes.comune =
OpenLayers.Util.getElement('comune').value;
feature.attributes.indirizzo =
OpenLayers.Util.getElement('indirizzo').value;
feature.attributes.data = OpenLayers.Util.getElement('data').value;
onFeatureUnselect(feature);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111206/e657a853/attachment.html
More information about the Users
mailing list