map singleclick getfeatureinfo

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

map singleclick getfeatureinfo

annalisa
This post has NOT been accepted by the mailing list yet.
Hi guy
anyone can help me?
In my page i have a layer  that is connected with a geoserver layer, but i want that, clicking a point on the map, i want to extract a property (es. in my layer i have id, city, cap and i want to extract city) but i'm not able to...
My actual situation is this
my popup

but i want to see not all the proprities but only one (and to modify css style) like this

wish
how can i do???

that's my code

  map.on('singleclick', function (evt) {

          var view = map.getView();
          var viewResolution = view.getResolution();
          var source = untiled.get('visible') ? untiled.getSource() : tiled.getSource();
          var url = source.getGetFeatureInfoUrl(
            evt.coordinate, viewResolution, view.getProjection(),
            { 'INFO_FORMAT': 'text/html', 'FEATURE_COUNT': 50 });
          if (url) {
            var coordinate = evt.coordinate;
            content.innerHTML = 'my test '+'<iframe seamless src="' + url + '"></iframe>';
            overlay.setPosition(coordinate);
 }
 }

I think my problem is info format and how to read data...

please help me!!
annalisa
Reply | Threaded
Open this post in threaded view
|

Re: map singleclick getfeatureinfo

reno.sun.gis
This post has NOT been accepted by the mailing list yet.
Hey annalisa,

Check these URL, I think it's very simple to achieve your goal!

Understanding getGetFeatureInfoUrl method

Info for WMS layer

I think you can just called the properties you would like to see from Geoserver.

Cheers!