Gold Map Base Settings

Source: Internet
Author: User

1. Quoting the German map

<!DOCTYPE HTML><HTML><Head><Metaname= "Viewport"content= "initial-scale=1.0, User-scalable=no" ><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><title>Hello, World</title><styletype= "Text/css">HTML{Height:100%}Body{Height:100%;margin:0px;padding:0px}#container{Height:100%}</style><Scripttype= "Text/javascript"src= "http://webapi.amap.com/maps?v=1.1&key=< user key>"></Script>   <Scripttype= "Text/javascript">    functionInitialize () {varMapobj= NewAmap.map ("Container"); //Create a Map instance container that's where you create the ID.        var Point= NewAmap.lnglat (116.404, 39.915); //Create point coordinatesMapobj.setcenter (point);//Set Map Center point coordinates    }</Script></Head>  <Bodyonload= "Initialize ()">      <DivID= "Container"></Div></Body></HTML>

Properties and methods for 2.MAPOBJ

Property

Level:        // set map zoom levels Center:New Amap.lnglat (116.3974 39.90923), // set Map center point doubleclickzoom:true,    
   
    // 
    Double click to enlarge map 
    Scrollwheel:
    true       
    // 
    mouse wheel zoom map              
   

Method

AddControl Setting controls

Mapobj.plugin (["Amap.toolbar","Amap.overview","Amap.scale"],function () {//plug-in with insertToolbar=NewAmap.toolbar ();//instantiating plug-instoolbar.autoposition=false;//Loading the tool barMapobj.addcontrol (toolbar); Overview=NewAmap.overview ();//Loading Eagle EyeMapobj.addcontrol (Overview); Scale=NewAmap.scale ();//Load Scale barMapobj.addcontrol (scale); }); 

Panby setting moves by Pixel point

    var x = document.getElementById ("x"). value;     var y = document.getElementById ("y"). Value;    Mapobj.panby (parseint (x), parseint (y));

SetBounds Setting the map view level

    varSWX = document.getElementById ("SWX"). Value; varSwy = document.getElementById ("Swy"). Value; varnex= document.getElementById ("NEX"). Value; varNey = document.getElementById ("Ney"). Value; varSW =NewAmap.lnglat (Swx,swy); varNE =NewAmap.lnglat (Nex,ney); Mapobj.setbounds (NewAmap.bounds (Sw,ne));

Setzoom zoom Level

    var z = document.getElementById ("zoom"). Value;    Mapobj.setzoom (z);

SetStatus state settings (both can be set in the instantiation operation)

Mapobj.setstatus ({zoomenable:true});   // Allow scaling         Mapobj.setstatus ({zoomenable:false// do not allow scaling
Mapobj.setstatus ({dragenable:true}); //mapobj.setstatus ({dragenable:false});  // do not allow zooming 
Mapobj.setstatus ({keyboardenable:true}); //  mapobj.setstatus ({keyboardenable:false});  // do not allow keyboard operation
Mapobj.setstatus ({jogenable:true}); // allow drag easing effect mapobj.setstatus ({jogenable:false});  // drag easing effect not allowed
Mapobj.setstatus ({continuouszoomenable:true}); // allows scaling of the continuous effect mapobj.setstatus ({continuouszoomenable:false});  // scaling continuous effects is not allowed
Mapobj.setstatus ({doubleclickzoom:true}); // allow double-click to enlarge map Mapobj.setstatus ({doubleclickzoom:false});  // do not allow double-click to enlarge map
Mapobj.setstatus ({scrollwheel:true}); // allows the mouse wheel to scale the map mapobj.setstatus ({scrollwheel:false});  // do not allow the mouse wheel to scale the map

Setcity setting up a map to load a city

var z = document.getElementById ("City"). Value;mapobj.setcity (z);

SetCenter Setting the Map center point

    var lng = document.getElementById ("LNG"). value;     var lat = document.getElementById ("lat"). Value;    Mapobj.setcenter (new Amap.lnglat (Lng,lat));

Gold Map Base Settings

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.