[OpenLayers-Users] WMSGetFeatureInfo does not return feature beyond wrapdateline

Phil Scadden p.scadden at gns.cri.nz
Tue Feb 4 17:17:34 PST 2014


welcome to that little circle of hell reserved for those who work with 
maps on the dateline. The only way things get work is when your map also 
includes north or south pole. Chances are this is just the beginning of 
your fun.

Firstly, just check the diagnosis of the problem. use the NET tab in the 
debugger (firebug or chrome) to inspect the call being actually made to 
the server.  Chances are the coordinates for the one on the wrong side 
of the dateline are positive no.s larger than maxExtent, instead of 
negative.

I cant remember precisely what the wrapDateline:true does in the 
constructor for map and layers, but you might try it.
This little function is also a great help:
function wrapDateline(geom,extent) {
     for (var i=0, len=geom.components.length; i<len; i++) {
         var component = geom.components[i];
         for (var j=0, lenj=component.components.length; j<lenj; j++) {
             var pt = component.components[j];
             while (pt.x < extent.left) {
                 pt.x +=  extent.getWidth();
             }

             //shift left?
             while (pt.x > extent.right) {
                 pt.x -= extent.getWidth();
             }
         }

     }
     geom.bounds = null;
     return geom;
}

However, if you want to make polygon selects across the dateline, then 
geoserver wont handle it one hit - you have to intercept and break the 
selection into an OR filter for the geometry on both side. it just goes 
on and on.

We have started using a completely different pattern. Firstly, the URL 
for servers is changed instead to a proxy servlet.  The basic 
interaction is:
GET or POST request goes to proxy.
   preprocessing by proxy
   send onto server
  postprocess response from server
send response back to user.

The whitelist proxy that you are using for WFS is model to start from, 
but you probably want to change to a jsp so can use java rather than 
python or whatever.

Numerous advantages. Proxy hides your server and you can inspect every 
interaction with it. You can process problems like the dateline - fix 
coordinates so inside maxentent; split  search polygons (all the power 
of JTS if you want it). "Join" tables from desparate servers (eg a 
public one and an internal one) to create virtual views etc, support 
SRSs that supported on native public servers.

Finally, there is bug in 2.13.1 vector layer on dateline which make 
selections of groups of feature around the dateline behave oddly when 
dateline is moved from one side of screen centre to the other. Currently 
have patch for one-half of the problem underway. We will post a full 
patch when we have it tested.  I think there are others in our patched 
set for 180 lines that arent in OL (eg you might check measuring area of 
polygon that crosses line) mostly because I havent figured out how to do 
pull request with GIT. (and extremely complicated maintaining OL version 
locally with SVN while master is on GIT).

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.



More information about the Users mailing list