Wrapping the date line options
There might be situations where you do not want your map ends at -180 or +180 longitude degrees as you are working in that area and need a continuous map. For example, imagine a map where on the left you can see the end of Russia and at the right Alaska, as shown in the following screenshot:
This property is a common attribute from base class OpenLayers.Layer
and is called the wrapDateLine
.
How to do it...
To wrap the date line options, perform the following steps:
Create an HTML file and add the OpenLayers dependency.
In the beginning, we have put a checkbox to activate/deactivate the wrap data line feature, as follows:
Wrap date line: <input dojoType="dijit.form.CheckBox" checked onChange="wrapDateLine" /> <br/>
Note
Do not worry about the
dojoType="dijit.form.CheckBox"
attribute, it is because the Dojo Toolkit (http://dojotoolkit.org) is used in the sample.Think of it as a normal HTML input element.
Next, we have added the
DOM
element used to render the...