1

is it a must to use BBOX strategy with WFS protocol in Vector layers ?

I cannot display this layer without BBOX strategy:

vLayer = new OpenLayers.Layer.Vector("Test", { 

    styleMap: new OpenLayers.StyleMap({ 
        "default": style 
    }), 
      maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90).transform(geographic,mercator), 
      sphericalMercator: true,   
      protocol:  new OpenLayers.Protocol.WFS({   
      url: 'http://myDomain/geoserver/wfs', 
      featureType: "Layer_1",   
      featureNS: "http://mapmap.org", 
      srsName: "EPSG:3857", 
      version: "1.1.0", 
      extractAttributes: true, 
      isBaseLayer: false, 

        }) 
      }); 

I am not getting any request in firebug. What am I missing here ?


EDIT:

URL request in firebug:

url=http://myDomain/geoserver/wfs

XML Post:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Query typeName="myWorkSpace:Layer_1" srsName="EPSG:3857" xmlns:myWorkSpace="http://mapmap.org"></wfs:Query>
</wfs:GetFeature>

and sometimes the response came with error:

<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
  xsi:schemaLocation="http://www.opengis.net/ows http://myDomain/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows">
  <ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>java.lang.IllegalStateException: A transformation exception occurred while reprojecting data on the fly
A transformation exception occurred while reprojecting data on the fly
Latitude 91°00.0'N is too close to a pole.</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>
3
  • Which version of Geoserver are you using btw?
    – R.K.
    Commented Oct 7, 2012 at 7:12
  • GeoServer version 2.1.2
    – Shadin
    Commented Oct 7, 2012 at 7:21
  • In Google Chrome, there is a very very few features appear on the map. but in FireFox, nothing at all.
    – Shadin
    Commented Oct 7, 2012 at 7:30

2 Answers 2

2

When using the web mercator projection you should try to limit requests to +/- 85 degrees of latitude. Because of the way the maths works out things get tricky the nearer to the poles you get and in your case you are asking for a point (91N) beyond the pole which is definitely going to be a problem.

You can use a BBOX strategy and set it to be something like:

new OpenLayers.Bounds(-180, -85, 180, 85).transform(geographic,mercator);

which will fetch all reasonable data.

If you have data near the poles then you should probably be using a different projection.

1
  • you mean I have to set maxExtent of vector layer to new OpenLayers.Bounds(-180, -85, 180, 85).transform(geographic,mercator); ?? I did that but still the new request is sent when map's extent changes. I want all layer features to be loaded at the beginning (just one request)
    – Shadin
    Commented Oct 9, 2012 at 6:06
2

You don't have to use the BBOX strategy but you have to choose a strategy. The strategy is responsible for controlling tasks such as when to load or refresh the data in the layer. The BBOX strategy that you used for example, is used to display data that is within the map's extent.

As for your error, it seems to be related to a bug in GeTools which Geoserver used. You might want to check the bounds of the projection you're using.

7
  • Thanks.. well, When I replace BBOX with Fixed strategy, I got nothing displays on the map. There is a request in firebug with right response but nothing is shown on the map. Is there something I have to do ?
    – Shadin
    Commented Oct 7, 2012 at 6:16
  • Can you post a pastebin of the Firebug request response in ?
    – R.K.
    Commented Oct 7, 2012 at 6:27
  • Got it. Why do you want to remove the BBOX strategy btw?
    – R.K.
    Commented Oct 7, 2012 at 6:48
  • I want to load all layer features once at the beginning, not read new features when the viewport changes.
    – Shadin
    Commented Oct 7, 2012 at 6:57
  • I am using Google Projection EPSG:3857 because I am using Google Map as my base layer. What should I do with it ?
    – Shadin
    Commented Oct 7, 2012 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.