<div dir="ltr">Hi <div><br></div><div style>Just a final conclusion.</div><div style><br></div><div style>I use the graticule to display the grid on map</div><div style><br></div><div style><a href="http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Control/Graticule-js.html">http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Control/Graticule-js.html</a><br>
</div><div style><br></div><div style>and restrict the display area on the map</div><div style><br></div><div style><br></div><div style><div>maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),</div><div>restrictedExtent: new OpenLayers.Bounds(-180, -90, 180, 90)</div>
<div><br></div><div><br></div><div><br></div><div style>So here is the final one.</div><div style><br></div><div style><br></div><div style><br></div><div style><br></div><div style><div>map = new OpenLayers.Map( 'map', {</div>
<div>                    controls: [</div><div><span class="" style="white-space:pre">                                            </span>graticuleCtl,</div><div>                        new OpenLayers.Control.PanZoom(),</div><div>                        new OpenLayers.Control.EditingToolbar(vlayer)</div>
<div>                    ],</div><div>                    zoomOffset:14,</div><div>                    maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),</div><div><span class="" style="white-space:pre">                                        </span>restrictedExtent: new OpenLayers.Bounds(-180, -90, 180, 90)</div>
<div>                });</div><div>                </div><div>                var nav = new OpenLayers.Control.NavigationHistory();</div><div>                // parent control must be added to the map</div><div>                map.addControl(nav);</div>
<div><br></div><div>                </div><div>                map.events.register('zoomend', map, function(e){</div><div><span class="" style="white-space:pre">                                    </span>if(map.getZoom()<3){</div><div><span class="" style="white-space:pre">                                            </span>//map.zoomTo(3);</div>
<div><span class="" style="white-space:pre">                                            </span>nav.previousTrigger();</div><div><span class="" style="white-space:pre">                                     </span>}</div><div><span class="" style="white-space:pre">                          </span>});</div><div><br>
</div><div><br></div><div><br></div><div style>Hope this will help others.</div><div style><br></div><div style><br></div><div style>Regards,</div><div style>Hua Jie</div></div></div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Tue, Mar 12, 2013 at 3:47 PM, 杨华杰 <span dir="ltr"><<a href="mailto:yhjhoo@gmail.com" target="_blank">yhjhoo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">It's a solution but not perfect, user still able to draw outside of the range.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 12, 2013 at 8:14 AM, Sergeant_york <span dir="ltr"><<a href="mailto:electronicpanda@gmail.com" target="_blank">electronicpanda@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If your problem is not being able to restrict people to draw outside of<br>
defined borders, there is a much more easier solution by the way (inside of<br>
drawing borders =) )<br>
<br>
You can restrict OpenLayers.Map object's extent:<br>
<br>
<a href="http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html" target="_blank">http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html</a><br>
restrictedExtent        {<OpenLayers.Bounds>|Array} If provided as an array, the<br>
array should consist of four values (left, bottom, right, top).<br>
<br>
<br>
Code can be like that:<br>
<br>
map.setOptions({restrictedExtent: map.getMaxExtent()});<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/display-a-border-at-the-end-of-the-world-tp5039296p5039794.html" target="_blank">http://osgeo-org.1560.n6.nabble.com/display-a-border-at-the-end-of-the-world-tp5039296p5039794.html</a><br>


<div><div>Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>