thanks Arnd Wippermann!!!
I try immediately
-beppe-
Il giorno mar, 06/12/2011 alle 23.24 +0100, Arnd Wippermann ha scritto:
> Hi,
>
> register featureadded for your vector layer:
>
>
> yourLayer.events.register("featureadded", yourLayer, function (e){
>
> comunePickFunc(e)
> /*
> var lon = e.feature.geometry.x;
> var lat = e.feature.geometry.y;
> var w = 5*map.resolution;
> BBOX = (lon-w) + "," + (lat-w) + "," + (lon+w) + "," + (lat+w);
>
> 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=");
> */
> });
>
> Arnd
>
>
>
> ______________________________________________________________________
> Von: [email protected]
> [mailto:[email protected]] Im Auftrag von beppe
> Gesendet: Dienstag, 6. Dezember 2011 17:03
> An: [email protected]
> Betreff: [OpenLayers-Users] pick an attribute from a wms layer when I
> draw a point in another vector layer
>
>
>
>
> 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);
> }
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users