<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.28.3">
</HEAD>
<BODY>
thanks Arnd Wippermann!!!<BR>
I try immediately<BR>
<BR>
-beppe-<BR>
<BR>
Il giorno mar, 06/12/2011 alle 23.24 +0100, Arnd Wippermann ha scritto:
<BLOCKQUOTE TYPE=CITE>
<FONT SIZE="2"><FONT COLOR="#0000ff">Hi,</FONT></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT SIZE="2"><FONT COLOR="#0000ff">register featureadded for your vector layer:</FONT></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT SIZE="2"><FONT COLOR="#0000ff">yourLayer.events.register("featureadded", yourLayer, function (e){</FONT></FONT><BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
comunePickFunc(e)
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT SIZE="2"><FONT COLOR="#0000ff">/*</FONT></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT SIZE="2"><FONT COLOR="#0000ff"> var lon = e.feature.geometry.x;</FONT></FONT><BR>
<FONT SIZE="2"><FONT COLOR="#0000ff"> var lat = e.feature.geometry.y;</FONT></FONT><BR>
<FONT SIZE="2"><FONT COLOR="#0000ff"> var w = 5*map.resolution;</FONT></FONT><BR>
<FONT SIZE="2"><FONT COLOR="#0000ff"> BBOX = (lon-w) + "," + (lat-w) + "," + (lon+w) + "," + (lat+w);</FONT></FONT><BR>
<FONT SIZE="2"><FONT COLOR="#0000ff"> 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=");</FONT></FONT><BR>
<FONT SIZE="2"><FONT COLOR="#0000ff">*/</FONT></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT SIZE="2"><FONT COLOR="#0000ff">});</FONT></FONT><BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT SIZE="2"><FONT COLOR="#0000ff">Arnd</FONT></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<HR>
<BR>
<B><FONT SIZE="2">Von:</FONT></B><FONT SIZE="2"> openlayers-users-bounces@lists.osgeo.org [mailto:openlayers-users-bounces@lists.osgeo.org] </FONT><B><FONT SIZE="2">Im Auftrag von </FONT></B><FONT SIZE="2">beppe</FONT><BR>
<B><FONT SIZE="2">Gesendet:</FONT></B><FONT SIZE="2"> Dienstag, 6. Dezember 2011 17:03</FONT><BR>
<B><FONT SIZE="2">An:</FONT></B><FONT SIZE="2"> users@openlayers.org</FONT><BR>
<B><FONT SIZE="2">Betreff:</FONT></B><FONT SIZE="2"> [OpenLayers-Users] pick an attribute from a wms layer when I draw a point in another vector layer</FONT><BR>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
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>
} <BR>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>