How does the "German map API" get to the administrative region? How to make an administrative plan?

Source: Internet
Author: User

What is an administrative planning diagram? How do I get the boundary contour of each administrative region? Example: Zhongqing Jiangbei District.

650) this.width=650; "src=" Http://images.cnitblog.com/i/249635/201406/031720153645210.png "style=" margin:0px; padding:0px;border:0px;width:658px; "/>

Official Category reference: Http://developer.amap.com/javascript/reference/search#Partition

650) this.width=650; "src=" Http://images.cnitblog.com/i/249635/201406/031558160369926.png "style=" margin:0px; padding:0px;border:0px;width:658px; "/>

Administrative Planning Code:

function bydistrict () {var partition = new Amap.partition ();  Creation of a new administrative planning category Partition.bydistrict (District,city,bydistricty_callback); Administrative Planning Query}

After the query to the administrative planning diagram, you need to show the data, then use the callback function:

Function bydistricty_callback (data) {        showtime (); document.getElementById ("Textuniqid") .value = data.uniqid;         var resultstr= "";           if (data.status == "E0")           {               var linenum = data.list.length; //return Total .               resultCount=lineNum;               var content= "";                for (var i=0;i<lineNum;i++) {                        content +=  "<div style=\" cursor:pointer;\ " onmouseover=openmarkertipbyid1 (this)   Onmouseout=clearbackground (This)  onclick=\ "DrawPolygon ('" +data.list[i].coords+ "', '" +data.list[i].name+ "') \ "><dl>";                       content += "<dt>" + "counties Name:" +data.list[i].name+ "<dt> County code: "+data.list[i].adcode+" </dt> "+" <dt> District-owned City area code: "+data.list[i].citycode+" </dt> ";                        content+= "</dl></div>";                }                   resultStr+=content;               }&nbsP;         else if (data.status == "E1")            {                resultStr =  "No results found!<br /> recommendation: <br />1. Make sure all words are spelled correctly. <br />2. Try different keywords. <br />3. Try a broader keyword. ";             }           else          {                resultStr=  "error message:" + Data.state+ "Please look up the error type against the api server v2.0.0  concise Cue code table";           }          document.getelementbyid ("Result "). Innerhtml = resultstr;                } 

The administrative Region diagram is a polygon, so how do you show this polygon? Use the polygon paint function:

Function drawpolygon (Arr,name) {           Mapobj.clearmap ();          var polygonarr =  New array ();          var district =  Arr.split (";");           var lnglat = new array ();           for (var e=0;e<district.length-1;e++) {               var lnglat=district[e ].split (",");               Polygonarr.push (New amap.lnglat (lnglat[0],lnglat[1));           }          polygon=new amap.polygon ({                  path:polygonarr,//Set polygon boundary path                strokecolor: "#0000ff",  //Line Color                strokeopacity:0.2, //Line Transparency                 strokeWeight:3,     //line width                 fillColor:  "#f5deb3",  //fill Color                fillopacity: 0.35//fill transparency           });         polygon.setmap (mapobj);           mapobj.setfitview ();       }

Sample Link: http://zhaoziang.com/amap/partition.html

650) this.width=650; "src=" Http://images.cnitblog.com/i/249635/201406/031720345676410.png "style=" margin:0px; padding:0px;border:0px;width:658px; "/>


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.