Initial position and state of map restoration in Webgis

Source: Internet
Author: User

I want to achieve an effect: when the map is arbitrarily scaled, clicking on a button will immediately return to the location where the map was initially loaded, and there is no scaling state.

How to do it. The best way is to use the home button.

<! DOCTYPE html>  

With another button is not a problem:

var mapcenter = new Point ([+], new Spatialreference ({wkid:4326}));
  Map = new Map ("map", {
    basemap: "Delorme",
    Center:mapcenter,
    maxzoom:10,  
    minzoom:1,  
    Zoom:5,
    extent:bounds,
    logo:false,
    nav:false
  });
  var HomeClick = function () {
      map.centerandzoom (mapcenter,5);  
  }  

Be sure to set the Basemap, otherwise this scaling is difficult to achieve results.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.