Hello again, as you can see in your request the output format of your request is INFO_FORMAT=text%2Fhtml<http://10.0.80.41:7004/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&LAYERS=topp%3Anetworkcoverage&QUERY_LAYERS=topp%3Anetworkcoverage&STYLES=&BBOX=72.96062%2C33.634027%2C73.097949%2C33.737024&FEATURE_COUNT=10&HEIGHT=600&WIDTH=800&FORMAT=image%2Fgif&INFO_FORMAT=text%2Fhtml&SRS=EPSG%3A4326&X=130&Y=208>. To get the info in json format you just need to make a template which will return text/html but formatted in the JSON way. You'll need to put this template in the folder of your layer inside data_dir folder of geoserver. After that, you'll have your response in JSON. This is my experience and i don't know if you have another way of achieving what you are trying to achieve. I've been working with Geoserver 1.7.6 and so i really don't know if more recent release have other options to do this.
Cheers, Hugo On Tue, Jun 8, 2010 at 1:59 PM, Imran Rajjad <[email protected]> wrote: > Hi, > > thanks for your reply, actually I had the json response working with > geoserver in my previous client , which did not use any API , since > now I`m using Openlayers. I made this wmsgetfeatureInfo object. Fire > Bug shows a url like > > > http://10.0.80.41:7004/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&LAYERS=topp%3Anetworkcoverage&QUERY_LAYERS=topp%3Anetworkcoverage&STYLES=&BBOX=72.96062%2C33.634027%2C73.097949%2C33.737024&FEATURE_COUNT=10&HEIGHT=600&WIDTH=800&FORMAT=image%2Fgif&INFO_FORMAT=text%2Fhtml&SRS=EPSG%3A4326&X=130&Y=208 > > when i copy paste this url seperately in a browser I get the response. > I have gone through the docs. There is no example on how to query a > wms layer with Json response. Do I need to specify some function in > wmsgetfeatureinfo where the response should be received. However I > will check this links, thanks a lot > > regards, > Imran > > On Tue, Jun 8, 2010 at 5:54 PM, Hugo <[email protected]> wrote: > > Hello Imran, > > > > The problem you are facing has nothing to do with openlayers, it is > though > > related with geoserver. I'm not sure if current releases of geoserver > > already present the json output format but you can always program a > template > > to return your results in json format. Check the following sites and if > you > > have further questions i think you'll have better chances of getting an > > answer to this problem in the geoserver list. > > > > http://geoserver.org/display/GEOSDOC/GetFeatureInfo+templates > > http://geoserver.org/display/GEOSDOC/Freemarker+templates > > > http://docs.geoserver.org/stable/en/user/googleearth/tutorials/kmlplacemark/index.html > > http://freemarker.sourceforge.net/docs/index.html > > > > Hope this can help. > > Cheers, > > > > Hugo Martins > > > > On Tue, Jun 8, 2010 at 1:42 PM, Imran Rajjad <[email protected]> wrote: > >> > >> firebug is showing the following request parameters > >> > >> BBOX 72.925254,33.54194,73.199912,33.747933 > >> FEATURE_COUNT 10 > >> FORMAT image/gif > >> HEIGHT 600 > >> INFO_FORMAT text/html > >> LAYERS topp:networkcoverage > >> QUERY_LAYERS topp:networkcoverage > >> REQUEST GetFeatureInfo > >> SERVICE WMS > >> SRS EPSG:4326 > >> STYLES > >> VERSION 1.1.1 > >> WIDTH 800 > >> X 690 > >> Y 295 > >> > >> On Tue, Jun 8, 2010 at 5:18 PM, Imran Rajjad <[email protected]> wrote: > >> > Hi , > >> > > >> > my WMSGetFeatureInfo control is not returning any json,, my code is as > >> > below > >> > > >> > basicControl = { > >> > click : new OpenLayers.Control.WMSGetFeatureInfo({ > >> > url: 'http://10.0.80.41:7004/geoserver/wms', > >> > title: 'Identify features by clicking', > >> > layers: [network_wms], > >> > queryVisible: true, > >> > vendorParams: { > >> > version: "1.1.1", > >> > info_format: "text/plain", > >> > }, > >> > format : new OpenLayers.Format.GeoJSON()}) > >> > }; > >> > > >> > > >> > basicControl.click.events.register("getfeatureinfo", > >> > this, showInfo); > >> > map.addControl(basicControl.click); > >> > > >> > function showInfo(evt) { > >> > alert(evt); // > >> > } > >> > > >> > > >> > when I check in FireBug. the request is sent but there is no > >> > responseTexT, what am i doing wrong here > >> > > >> > regards, > >> > Imran > >> > > >> > > >> > On Tue, Jun 8, 2010 at 1:20 PM, Imran Rajjad <[email protected]> > wrote: > >> >> Hi, > >> >> > >> >> I`m trying to create a box selection that selects features from a wms > >> >> overlay , I need the response to be in JSON and I also want to append > >> >> my cql filter to this request. > >> >> > >> >> Can anyone point me to the documentation closer to this task? > >> >> > >> >> regarsd, > >> >> Imran > >> >> > >> >> -- > >> >> I.R > >> >> > >> > > >> > > >> > > >> > -- > >> > I.R > >> > > >> > >> > >> > >> -- > >> I.R > >> _______________________________________________ > >> Users mailing list > >> [email protected] > >> http://openlayers.org/mailman/listinfo/users > > > > > > > > -- > > Hugo Martins > > FMV-UTL > > CIISA-Epidemiologia e Saúde Pública Veterinária > > Av. da Universidade Técnica > > 1300-477 Lisboa > > N 38°42'49.54", W 9°11'43.42" > > > > > > -- > I.R > -- Hugo Martins FMV-UTL CIISA-Epidemiologia e Saúde Pública Veterinária Av. da Universidade Técnica 1300-477 Lisboa N 38°42'49.54", W 9°11'43.42"
_______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
