以下语言为js,所取的坐标以百度地图为准,所以需引用百度api,其它的坐标请转换后在判断即可。
1:创建中国地图边界线数组
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
function CreateChinaMapLine() { var pts = []; pt1 = new BMap.Point(124.326919, 39.841287); pts.push(pt1); pt2 = new BMap.Point(124.630475, 40.230192); pts.push(pt2); pt3 = new BMap.Point(124.980023, 40.420289); pts.push(pt3); pt4 = new BMap.Point(125.053612, 40.458947); pts.push(pt4); pt5 = new BMap.Point(125.028316, 40.520401); pts.push(pt5); pt6 = new BMap.Point(125.331871, 40.63438); pts.push(pt6); pt7 = new BMap.Point(125.456053, 40.61861); pts.push(pt7); pt8 = new BMap.Point(126.042467, 40.901897); pts.push(pt8); pt9 = new BMap.Point(126.888743, 41.73411); pts.push(pt9); pt10 = new BMap.Point(127.367072, 41.437131); pts.push(pt10); pt11 = new BMap.Point(128.148958, 41.347076); pts.push(pt11); pt12 = new BMap.Point(128.323732, 41.568524); pts.push(pt12); pt13 = new BMap.Point(128.112163, 41.961089); pts.push(pt13); pt14 = new BMap.Point(128.995233, 41.99541); pts.push(pt14); pt15 = new BMap.Point(129.418371, 42.378521); pts.push(pt15); pt16 = new BMap.Point(129.841509, 42.41943); pts.push(pt16); pt17 = new BMap.Point(130.080674, 42.90824); pts.push(pt17); pt18 = new BMap.Point(130.65099, 42.364879); pts.push(pt18); pt19 = new BMap.Point(130.503812, 42.637157); pts.push(pt19); pt20 = new BMap.Point(131.147717, 42.867653); pts.push(pt20); pt21 = new BMap.Point(131.313293, 43.366337); pts.push(pt21); pt22 = new BMap.Point(131.386882, 43.967324); pts.push(pt22); pt23 = new BMap.Point(131.202909, 44.798523); pts.push(pt23); pt24 = new BMap.Point(131.938801, 45.190155); pts.push(pt24); pt25 = new BMap.Point(133.024241, 44.916296); pts.push(pt25); pt26 = new BMap.Point(134.385641, 47.183241); pts.push(pt26); pt27 = new BMap.Point(134.845574, 47.670159); pts.push(pt27); pt28 = new BMap.Point(134.73519, 48.066299); pts.push(pt28); pt29 = new BMap.Point(135.250314, 48.434915); pts.push(pt29); pt30 = new BMap.Point(133.079433, 48.115602); pts.push(pt30); pt31 = new BMap.Point(132.453925, 47.76948); pts.push(pt31); pt32 = new BMap.Point(131.221306, 47.707427); pts.push(pt32); pt33 = new BMap.Point(130.85336, 48.078629); pts.push(pt33); pt34 = new BMap.Point(130.908552, 48.825163); pts.push(pt34); pt35 = new BMap.Point(128.093766, 49.632427); pts.push(pt35); pt36 = new BMap.Point(125.830898, 53.063643); pts.push(pt36); pt37 = new BMap.Point(123.420852, 53.60326); pts.push(pt37); pt38 = new BMap.Point(120.661258, 53.240599); pts.push(pt38); pt39 = new BMap.Point(119.906969, 52.584436); pts.push(pt39); pt40 = new BMap.Point(120.698052, 52.494695); pts.push(pt40); pt41 = new BMap.Point(120.734847, 52.05456); pts.push(pt41); pt42 = new BMap.Point(119.023898, 50.296998); pts.push(pt42); pt43 = new BMap.Point(119.263063, 50.143545); pts.push(pt43); pt44 = new BMap.Point(117.956855, 49.560675); pts.push(pt44); pt45 = new BMap.Point(116.889812, 49.858941); pts.push(pt45); pt46 = new BMap.Point(115.47322, 48.078629); pts.push(pt46); pt47 = new BMap.Point(115.988344, 47.607987); pts.push(pt47); pt48 = new BMap.Point(116.797825, 47.76948); pts.push(pt48); pt49 = new BMap.Point(117.349744, 47.520821); pts.push(pt49); pt50 = new BMap.Point(117.901663, 47.905734); pts.push(pt50); pt51 = new BMap.Point(118.508774, 47.893363); pts.push(pt51); pt52 = new BMap.Point(118.545569, 47.86861); pts.push(pt52); pt53 = new BMap.Point(119.888571, 46.843488); pts.push(pt53); pt54 = new BMap.Point(119.796585, 46.590415); pts.push(pt54); pt55 = new BMap.Point(119.005501, 46.717101); pts.push(pt55); pt56 = new BMap.Point(117.791279, 46.526961); pts.push(pt56); pt57 = new BMap.Point(117.404936, 46.310656); pts.push(pt57); pt58 = new BMap.Point(116.797825, 46.323404); pts.push(pt58); pt59 = new BMap.Point(116.282701, 45.798295); pts.push(pt59); pt60 = new BMap.Point(114.700534, 45.384961); pts.push(pt60); pt61 = new BMap.Point(113.670285, 44.759212); pts.push(pt61); pt62 = new BMap.Point(112.161707, 45.04687); pts.push(pt62); pt63 = new BMap.Point(111.444212, 44.298587); pts.push(pt63); pt64 = new BMap.Point(111.959336, 43.767669); pts.push(pt64); pt65 = new BMap.Point(110.082812, 42.569199); pts.push(pt65); pt66 = new BMap.Point(107.543985, 42.39216); pts.push(pt66); pt67 = new BMap.Point(105.115542, 41.609961); pts.push(pt67); pt68 = new BMap.Point(100.405834, 42.596391); pts.push(pt68); pt69 = new BMap.Point(96.560799, 42.772848); pts.push(pt69); pt70 = new BMap.Point(91.188788, 45.203163); pts.push(pt70); pt71 = new BMap.Point(89.992964, 47.893363); pts.push(pt71); pt72 = new BMap.Point(87.969261, 49.115857); pts.push(pt72); pt73 = new BMap.Point(86.847026, 49.055436); pts.push(pt73); pt74 = new BMap.Point(85.724791, 48.201769); pts.push(pt74); pt75 = new BMap.Point(85.301653, 47.05766); pts.push(pt75); pt76 = new BMap.Point(83.167567, 47.23339); pts.push(pt76); pt77 = new BMap.Point(82.284497, 45.52739); pts.push(pt77); pt78 = new BMap.Point(82.652442, 45.177144); pts.push(pt78); pt79 = new BMap.Point(81.769372, 45.346053); pts.push(pt79); pt80 = new BMap.Point(79.911245, 44.890145); pts.push(pt80); pt81 = new BMap.Point(80.702329, 43.20505); pts.push(pt81); pt82 = new BMap.Point(80.003232, 42.077702); pts.push(pt82); pt83 = new BMap.Point(77.096459, 41.05527); pts.push(pt83); pt84 = new BMap.Point(76.158197, 40.369298); pts.push(pt84); pt85 = new BMap.Point(75.753456, 40.594072