<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19154"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=828262122-06122011>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=828262122-06122011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=828262122-06122011>register featureadded for your vector
layer:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=828262122-06122011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=828262122-06122011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial>yourLayer.events.register("featureadded", yourLayer, function
(e){<BR></FONT></DIV>
<DIV dir=ltr align=left><SPAN class=828262122-06122011>
</SPAN>comunePickFunc(e) </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=828262122-06122011>/*</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT
size=2> var lon = e.feature.geometry.x;<BR>
var lat = e.feature.geometry.y;<BR> var w =
5*map.resolution;<BR> BBOX = (lon-w) + "," + (lat-w) + "," +
(lon+w) + "," + (lat+w);<BR>
window.open("someServer&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&QUERY_LAYERS=[layers]&LAYERS=[layers]&BBOX="
+ BBOX +
"&SRS=EPSG:31466&X=50&Y=50&WIDTH=100&HEIGHT=100&FORMAT=image/png&INFO_FORMAT=text/html&FEATURE_COUNT=1&STYLES=");<BR><SPAN
class=828262122-06122011>*/</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>});<BR></DIV>
<DIV></FONT><SPAN class=828262122-06122011><FONT color=#0000ff size=2
face=Arial>Arnd</FONT></SPAN></DIV>
<DIV><BR></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von
</B>beppe<BR><B>Gesendet:</B> Dienstag, 6. Dezember 2011 17:03<BR><B>An:</B>
users@openlayers.org<BR><B>Betreff:</B> [OpenLayers-Users] pick an attribute
from a wms layer when I draw a point in another vector
layer<BR></FONT><BR></DIV>
<DIV></DIV>Hi all,<BR>I've a function "A"[0] for picking an attribute from a wms
layer, the value is passed to a form.<BR>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.<BR>Function A works fine except when I want
to insert a new point.<BR>I want the function A to be triggered when drawing a
point on the map...but I don't know how!<BR>Some suggestion?<BR><BR>thanks a
lot<BR><BR>-beppe-<BR><BR>[0] <BR>function comunePickFunc(e) {<BR> if
(e.features && e.features.length) {<BR> var
nomeComune = e.features[0].attributes.nome;<BR> var id =
e.features[0].attributes.id;<BR>
document.getElementById('comune').innerHTML =
nomeComune;<BR> $('#id_comune').val(id);
<BR> $.ajax({<BR>type: "POST",<BR>url:
"inc/dinSelComune.php",<BR>data: {id:id},<BR>cache: false,<BR>success:
function(html){$("#indirizzo").html(html);} <BR>
});//ajax<BR> }<BR>} <BR><BR>var comunePick = new
OpenLayers.Control.WMSGetFeatureInfo({<BR> url:
'http://localhost:8080/geoserver/wms', <BR> title: 'identify
features on click',<BR> layers:
[comuni],<BR> queryVisible:
true<BR>});<BR>comunePick.infoFormat =
'application/vnd.ogc.gml';<BR>comunePick.events.register("getfeatureinfo", this,
comunePickFunc);<BR>map.addControl(comunePick);<BR>comunePick.activate();<BR><BR>[1]<BR>function
salvaSito(fid){<BR> var fid =
OpenLayers.Util.getElement('fid').value;<BR> var feature =
siti.getFeatureById(fid);<BR> feature.attributes.comune =
OpenLayers.Util.getElement('comune').value;<BR>
feature.attributes.indirizzo =
OpenLayers.Util.getElement('indirizzo').value;<BR>
feature.attributes.data =
OpenLayers.Util.getElement('data').value;<BR> <BR>
onFeatureUnselect(feature);<BR>} </BODY></HTML>