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