Hi Nishant,
In the latest sourcecode the getWidth and setWidth methods of Size
have been implemented, so you migth take a look there.
About the BBOX issue I do not currently have any idea what could be going wrong.
Greetings,
Edwin Commandeur
On 24 May 2010 09:37, nishant verma <nis...@gm...> wrote:
> Hi
> I am finding a problem with using toBBOX() function. I will really
> appreciate if you could please help me or give some suggestion. The problem
> is as follows:
> I am trying to add a functionality, where user should click on certain
> area of the map, and he should get feature info about that area. I am using
> WMS getFeatureInfo as of now, though I have also tried with WFS getFeature.
> I have added a layer to geoserver, and I am rendering it as the base
> layer in my map. I added a MapClickListener to the map which first
> calculates some basic parameters from the map. The code snippet goes as
> follows :
> LonLat lonlat = eventObject.getLonLat();
> String SRS = eventObject.getSource().getProjection();
> String BBOX = eventObject.getSource().getExtent().toBBox(6);
> String WIDTH = Float.toString(eventObject.getSource().getSize().getWidth());
> String HEIGHT =
> Float.toString(eventObject.getSource().getSize().getHeight());
> String QUERY_LAYERS = eventObject.getSource().getLayers()[0].;
> String X = new
> Integer(eventObject.getSource().getPixelFromLonLat(lonlat).x()).toString();
> String Y = new
> Integer(eventObject.getSource().getPixelFromLonLat(lonlat).y()).toString();
> String GEOSERVER_WMS_GETFEATUREINFO_REQUEST_URL =
> ExampleConstants.GEOSERVER_WMS_URL + "?SERVICE=WMS&VERSION=1.1.1" +
> "&REQUEST=GetFeatureInfo&SRS=" + SRS +
> "&EXCEPTIONS=application/vnd.ogc.se_xml" +
> "&BBOX=" + BBOX + "&WIDTH=" + 300 + "&HEIGHT=" + 300 +
> "&INFO_FORMAT=text/plain" +
> "&QUERY_LAYERS=" + "test:sld_cookbook_polygon" +
> "&LAYERS=test:sld_cookbook_polygon" + "&X=" + X + "&Y=" + Y;
> RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
> URL.encode(GEOSERVER_WMS_GETFEATUREINFO_REQUEST_URL));
> try {
> String requestData = ""; //since this is a GET request, no request data need
> to be sent
> RequestCallback wfsCallback = new GeoServerWMSGetFeatureInfoHandler();
> Request wfsRequest = builder.sendRequest(requestData, wfsCallback);
> }
> catch (RequestException e){
> Window.alert(e.getMessage());
> }
> There are two problems I am having with this code:
> 1) the .getSize().getWidth() and getHeight() functions don't work. I looked
> into .class files and found that implementation of these functions is of
> type 'void' rather than 'return' type.
> But for the time being, I am giving dummy value of 300.
> 2) When I added this code to showcase code, and added my own layer (from
> geoserver) it was returning correct BBOX bounds, but my callback Handler
> (GeoServerWMSGetFeatureInfoHandler) was showing a status code 0 from the
> server. But when I type the full URL
> (GEOSERVER_WMS_GETFEATUREINFO_REQUEST_URL) in a browser, it gives me correct
> features set!. That means I am getting correct values of BBOX.
> On the other hand when I added this code to my project
> code, the BBOX values that I get are unrealistic. I get -409.921875
> -194.4140625 409.921875 194.4140625 as BBOX. Due to this I get no features
> at all from the server. I am not able to understand why I am getting such
> values.
> I will be highly grateful if you could suggest some solution to this
> problem.
> Thanks and Regards,
> Nishant
> OpenXdata Team
|