Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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>
share|improve this question
    
Which version of Geoserver are you using btw? –  R.K. Oct 7 '12 at 7:12
    
GeoServer version 2.1.2 –  Shadin Oct 7 '12 at 7:21
    
In Google Chrome, there is a very very few features appear on the map. but in FireFox, nothing at all. –  Shadin Oct 7 '12 at 7:30
add comment

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
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 Oct 9 '12 at 6:06
add comment

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.

share|improve this answer
    
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 Oct 7 '12 at 6:16
    
Can you post a pastebin of the Firebug request response in ? –  R.K. Oct 7 '12 at 6:27
    
just edited my post. Many Thanks. –  Shadin Oct 7 '12 at 6:45
    
Got it. Why do you want to remove the BBOX strategy btw? –  R.K. Oct 7 '12 at 6:48
    
I want to load all layer features once at the beginning, not read new features when the viewport changes. –  Shadin Oct 7 '12 at 6:57
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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