I am using wrapDateLine properties for OpenLayers.Layer.WMS for handling dateline issues. The problem with wrapDateLine is that I am getting the same polygon repetitively around the wrapped map as a user selects a desired polygon around dateline. Is there any way to select the polygon around dateline in a single wrapped map and avoiding repetitions? My OpenLayers.Layer.WMS constructor is as:

var I = new OpenLayers.Layer.MapServer("region", "http://localhost/cgi-bin/mapserv?map=/home/public_html/test1.map",{poly='Bermuda', layers: 'myregion', format:'image/png'}, 
    {wrapDateLine: true}

e.g. Bermuda in my example is in dateline and if I use wrapDateLine:true, I get complete polygon of Bermuda but it is repeated (wrapped). I want complete polygon of Bermuda but no repetition. Is there any other way for it?

I see that there are options like OpenLayers.Bounds() and layer.adjustBounds(). I am not sure if it works in my problem.

  • can you post a picture? I'm having trouble visualizing this, especially as Bermuda is no where near the date line.
    – Ian Turton
    Mar 9, 2011 at 18:57
  • @iant I am just taking Bermuda as an example. In my shape file, the red colored polygon is Aleutian Island that is at two corners of the map. I want it to be displayed as a complete polygon. I find that wrapDateLine works but it wrap the map and gives the polygon repetitively.![my image][1] [1]: i.imgur.com/P2OD0.png
    – tester
    Mar 9, 2011 at 20:29
  • 1
    The image you posted looks perfectly fine to me. You'd rather have the red polygon as a whole on either eastern or western border? Wouldn't that be more confusing?
    – underdark
    Mar 10, 2011 at 13:49
  • @underdark: The user wants to see a single polygon rather than at two ends. wrapDateLine: true works well for getting a single polygon but my concern is it wraps the map not only for once but infinitely. I am looking for a way to get a single polygon for displaying required polygon.
    – tester
    Mar 10, 2011 at 17:13
  • Similar question: gis.stackexchange.com/questions/7064/…
    – CaptDragon
    Mar 10, 2011 at 17:47


Browse other questions tagged or ask your own question.