[OpenLayers-Users] Json selection

Andrea Maschio andrea.maschio at gmail.com
Sun Jan 27 09:22:40 EST 2008


Hi all, I am still trying to select two fields from my WMS layer, to  
create startPoint and endPoint for my routing application. I have seen  
GeoJson as a potential solution, and noticed that my geoserver  
installation is json capable.

so i was trying to setup a url that produces a json output

var jsonUrl =  map.layers[0].getFullRequestString(
                     {
                         REQUEST: "GetFeatureInfo",
                         EXCEPTIONS: "application/vnd.ogc.se_xml",
                         BBOX: map.getExtent().toBBOX(),
                         X: e.xy.x,
                         Y: e.xy.y,
                         INFO_FORMAT: 'xml/json',
                         QUERY_LAYERS: map.layers[0].params.LAYERS,
                         FEATURE_COUNT: 50,
                         srs: 'EPSG:4326',
                         layers: 'topp:kanagawa',
                         styles: '',
                         WIDTH: map.size.w,
                         HEIGHT: map.size.h,
                         outputformat: 'json'
                     },
                     "/geoserver/wfs"
                 );

my url will be more or less like that

http://localhost:8080/geoserver/wfs?typename=topp%3Akanagawa&SERVICE=WFS&REQUEST=GetFeature&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_xml&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=139.467394%2C35.402085%2C139.639056%2C35.487915&X=432&Y=442&FEATURE_COUNT=1&srs=EPSG%3A4326&layers=topp%3Akanagawa&styles=&outputformat=json

I am able to obtain this JSON output:

{"type":"FeatureCollection","features":[]}

this means JSON output is working, but i get no feature. Removing the  
BBOX from the querystring, make me obtain the entire feature. I would  
be able to obtain only the element i have clicked on. Is this  
possible? I cannot find a way out.

Thanks




Andrea Maschio
http://www.superandrew.it




More information about the Users mailing list