JS creates a two-dimensional latitude and longitude array corresponding to the display area based on the visible region

Source: Internet
Author: User
Tags array definition

This article is mainly to share under the map region based on the creation of two-dimensional latitude and longitude array, the need for friends can come to reference

After the last article, based on the map area, the corresponding point of the display area is calculated.

Changes in Latitude: XY page display, from left to right dimension is added such as: 106, 107, from top to bottom longitude is reduced such as:->29

When you create it, you need to determine where to start, and attach the following code:

functionGetsizepointsdata (latmin,latmax,lngmin,lngmax,lngstep,latstep) {//The minimum longitude, maximum longitude, minimum dimension, maximum dimension of the area, how many squares to draw in the dimension, how many squares to draw in longitude                                  varviewareamappoints=NewArray (); varLngvalue = (lngmax-lngmin)/lngstep;varLatvalue = (latmax-latmin)/latstep; for(vark=0;k<latstep;k++) {Viewareamappoints[k]=NewArray ();  for(varj=0;j<lngstep;j++) {Viewareamappoints[k][j]= {Drawids:[],count:0,lng:lngmin + j*lngvalue,lat:latmax-k*Latvalue}; }          } }

What's the use of this? Read the previous article: Main ideas: Area data deduplication + JavaScript show tens of thousands of data instance code at once

JS two-dimensional array definition and initialization of three ways to summarize, you can refer to: http://www.jb51.net/article/47528.htm, not moved

JS creates a two-dimensional latitude and longitude array corresponding to the display area based on the visible region

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.