-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathManhattan Boundary Map.html
107 lines (83 loc) · 19.5 KB
/
Manhattan Boundary Map.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html>
<head>
<!-- THERE ARE THREE THINGS YOU SHOULD CHANGE:
1. The title of the page (can be the name of the current city)
2. Define the variable 'city' to be CITY, STATE
3. Define the array 'data' in function 'drawBounds()' to be a list of latitude,longitude points of the city boundary (gotten from a KML file) -->
<title>MANHATTAN</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map-canvas {
margin: 0;
padding: 0;
height: 100%;
}
</style>
<!-- WORKING API CALL WITH GEOMETRY LIBRARY (need for finding if a point is within polygon)-->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=geometry&key=AIzaSyCeGd25WDa3-bo3WdBZLNAY5uB_0EoDvN0&sensor=false"></script>
<script type="text/javascript">
// ENTER CITY NAME HERE in format "City, State" //
var city = "Manhattan, New York"
var map;
var shape;
var geocoder;
function setUp() {
geocoder = new google.maps.Geocoder();
var address = city;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker( {
map: map,
position: results[0].geometry.location
});
} else {
alert('Geocode was not successful for the following reason: '+ status);
}
});
} //function setUp
function initializeMap() {
var mapOptions = {
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}
function drawBounds() {
var data = [-74.013072,40.72142, -74.010745,40.736318, -74.010593,40.736316, -74.010465,40.73737, -74.010623,40.737371, -74.010606,40.737668, -74.010446,40.737676, -74.010444,40.737982, -74.012892,40.738129, -74.012873,40.738426, -74.010393,40.738342, -74.010338,40.738963, -74.011613,40.739046, -74.011551,40.739505, -74.012051,40.739518, -74.012057,40.739653, -74.012289,40.739655, -74.012229,40.740141, -74.011481,40.740135, -74.011416,40.740603, -74.012533,40.740666, -74.012547,40.740757, -74.012422,40.740756, -74.012398,40.740818, -74.012173,40.740789, -74.012153,40.74087, -74.009549,40.74074, -74.009467,40.74118, -74.012335,40.741529, -74.01228,40.741781, -74.009405,40.74145, -74.00935,40.74226, -74.012107,40.742581, -74.012079,40.742861, -74.009245,40.742548, -74.009166,40.742818, -74.009411,40.742847, -74.009376,40.743216, -74.011855,40.743561, -74.011845,40.743858, -74.009272,40.743611, -74.009176,40.744214, -74.011754,40.744524, -74.011694,40.744821, -74.008828,40.744535, -74.008765,40.744886, -74.009368,40.744972, -74.009333,40.745287, -74.011541,40.745486, -74.011506,40.745864, -74.009259,40.745683, -74.009169,40.746286, -74.011406,40.746575, -74.01135,40.746899, -74.009115,40.746637, -74.009008,40.747294, -74.011221,40.7476, -74.011153,40.747879, -74.008908,40.747698, -74.008774,40.748336, -74.011019,40.748572, -74.010934,40.748967, -74.009812,40.748831, -74.009675,40.74992, -74.009394,40.749882, -74.009367,40.749999, -74.009201,40.750403, -74.010753,40.751083, -74.010622,40.751244, -74.009117,40.750663, -74.008617,40.752082, -74.009454,40.752423, -74.009414,40.752522, -74.01007,40.752797, -74.009972,40.75295, -74.008511,40.752397, -74.008056,40.753528, -74.007907,40.753986, -74.007319,40.754891, -74.006455,40.756037, -74.007859,40.756634, -74.007764,40.756841, -74.006323,40.756243, -74.004881,40.758023, -74.0052,40.758152, -74.004974,40.758519, -74.007001,40.759446, -74.006468,40.760136, -74.004427,40.759298, -74.004104,40.759746, -74.004191,40.759828, -74.003999,40.760096, -74.002848,40.761555, -74.002577,40.761444, -74.000904,40.763691, -74.003094,40.764629, -74.002909,40.764906, -73.999685,40.763662, -73.99956,40.763788, -73.999181,40.764234, -74.002478,40.765614, -74.002131,40.765963, -73.99893,40.764629, -73.998734,40.764942, -73.998585,40.764968, -73.998331,40.765443, -74.001781,40.76695, -74.001516,40.767291, -73.998001,40.765801, -73.997327,40.766795, -74.000805,40.768257, -74.000576,40.768525, -73.997101,40.767063, -73.996453,40.768004, -73.999879,40.769483, -73.999667,40.769788, -73.997116,40.768712, -73.996626,40.769374, -73.999096,40.770423, -73.998799,40.770772, -73.996368,40.769787, -73.995994,40.770341, -73.998168,40.771288, -73.998014,40.771458, -73.995852,40.770529, -73.99551,40.770986, -73.997687,40.771915, -73.997589,40.772067, -73.995432,40.771157, -73.995149,40.771451, -73.995024,40.771405, -73.99487,40.771584, -73.997215,40.77255, -73.997031,40.772801, -73.994854,40.771899, -73.994533,40.772329, -73.996735,40.773267, -73.996597,40.773455, -73.994389,40.772499, -73.994231,40.772452, -73.993933,40.772864, -73.996258,40.773875, -73.996137,40.774046, -73.993625,40.77296, -73.993422,40.773157, -73.9935,40.773202, -73.993287,40.773462, -73.993178,40.773425, -73.993036,40.773613, -73.993415,40.773796, -73.992687,40.774907, -73.99248,40.774824, -73.992138,40.775262, -73.993938,40.775152, -73.993728,40.775457, -73.992481,40.775554, -73.992183,40.775957, -73.993533,40.775869, -73.993267,40.776183, -73.99195,40.776261, -73.991661,40.776663, -73.992965,40.776612, -73.992732,40.776934, -73.991361,40.77703, -73.990873,40.777747, -73.990404,40.777788, -73.990144,40.778128, -73.990491,40.778122, -73.990543,40.778474, -73.989856,40.778477, -73.989695,40.778745, -73.990051,40.778722, -73.990086,40.778929, -73.989813,40.778972, -73.989829,40.779296, -73.989229,40.779363, -73.989011,40.779676, -73.991579,40.779555, -73.991673,40.779672, -73.9891,40.779848, -73.98919,40.779975, -73.988293,40.781237, -73.988178,40.78121, -73.988026,40.781569, -73.988114,40.781614, -73.988058,40.781704, -73.987869,40.781828, -73.987323,40.78267, -73.98583,40.784918, -73.984739,40.786485, -73.983652,40.787989, -73.982378,40.789779, -73.98097,40.791731, -73.979932,40.793226, -73.978407,40.795402, -73.976853,40.797523, -73.975063,40.799993, -73.974847,40.800243, -73.974757,40.800522, -73.973666,40.802089, -73.972538,40.803772, -73.971966,40.804524, -73.971295,40.805428, -73.970527,40.806439, -73.969477,40.807898, -73.968775,40.808838, -73.968535,40.809043, -73.968161,40.809652, -73.96755,40.810646, -73.96668,40.811855, -73.966166,40.812643, -73.965585,40.813557, -73.964924,40.814722, -73.964259,40.81577, -73.96392,40.816199, -73.963282,40.816887, -73.962505,40.817709, -73.962131,40.818075, -73.961956,40.81819, -73.960696,40.819701, -73.960085,40.820389, -73.959968,40.820325, -73.95962,40.820737, -73.959197,40.821201, -73.959383,40.821302, -73.959448,40.821248, -73.959577,40.821303, -73.959338,40.821653, -73.959198,40.821598, -73.959342,40.821401, -73.959178,40.821327, -73.958612,40.821917, -73.958315,40.822229, -73.95823,40.822237, -73.958069,40.822776, -73.958307,40.822895, -73.958281,40.822968, -73.958523,40.82306, -73.958538,40.823159, -73.959602,40.823637, -73.956718,40.827872, -73.955094,40.827343, -73.954955,40.827514, -73.954435,40.827311, -73.954407,40.827473, -73.954567,40.827745, -73.954687,40.82788, -73.955351,40.828166, -73.955309,40.828256, -73.954422,40.82795, -73.954394,40.828103, -73.954235,40.828327, -73.954071,40.82847, -73.953971,40.828487, -73.954061,40.828559, -73.954041,40.828667, -73.953892,40.828801, -73.953867,40.828909, -73.953739,40.829007, -73.953332,40.829724, -73.953101,40.8301, -73.953005,40.830109, -73.952987,40.830207, -73.952916,40.83027, -73.952825,40.830422, -73.95274,40.830592, -73.952662,40.830664, -73.952622,40.830781, -73.952559,40.830915, -73.952418,40.831121, -73.952301,40.831183, -73.95183,40.831899, -73.95129,40.832534, -73.951013,40.833261, -73.950571,40.833987, -73.950282,40.83421, -73.950188,40.834434, -73.950086,40.834514, -73.950091,40.83455, -73.949775,40.835808, -73.949426,40.836886, -73.949338,40.836984, -73.949306,40.837128, -73.949297,40.837426, -73.949173,40.837794, -73.948448,40.839454, -73.947908,40.84062, -73.947812,40.841024, -73.947643,40.841347, -73.947402,40.841759, -73.947136,40.842162, -73.947139,40.842531, -73.946916,40.842737, -73.946878,40.842934, -73.946616,40.843239, -73.94647,40.843778, -73.94619,40.844487, -73.946112,40.845, -73.946417,40.845615, -73.946635,40.845896, -73.946636,40.846013, -73.946554,40.8463, -73.946626,40.846589, -73.946911,40.846817, -73.946986,40.847259, -73.94682,40.847906, -73.946792,40.848789, -73.946793,40.848915, -73.947027,40.849494, -73.947116,40.849999, -73.947231,40.850243, -73.947084,40.850611, -73.946875,40.850853, -73.946589,40.85103, -73.946265,40.851171, -73.945943,40.851223, -73.945783,40.851464, -73.945581,40.851499, -73.944706,40.851977, -73.944466,40.851948, -73.944314,40.852009, -73.944221,40.852035, -73.944095,40.852142, -73.943679,40.852301, -73.943531,40.85257, -73.943479,40.852578, -73.943339,40.852604, -73.942315,40.853414, -73.941946,40.854041, -73.94177,40.854464, -73.941421,40.854947, -73.941236,40.855341, -73.941073,40.855574, -73.940783,40.855842, -73.940582,40.856245, -73.940234,40.856575, -73.940067,40.856835, -73.939769,40.857103, -73.939481,40.857577, -73.939059,40.858069, -73.938907,40.858239, -73.938911,40.858572, -73.938674,40.858921, -73.938553,40.859046, -73.938435,40.859378, -73.938267,40.859575, -73.937932,40.85995, -73.937607,40.860235, -73.937272,40.860782, -73.937012,40.861086, -73.936355,40.862089, -73.936191,40.862429, -73.935943,40.862743, -73.935542,40.863018, -73.935415,40.86317, -73.935255,40.863466, -73.935056,40.863725, -73.934731,40.864055, -73.934444,40.864458, -73.934352,40.864646, -73.934361,40.864808, -73.934132,40.864762, -73.934026,40.864923, -73.934242,40.865015, -73.934149,40.865212, -73.933902,40.865147, -73.933874,40.86521, -73.934046,40.865319, -73.933922,40.865489, -73.933804,40.865461, -73.93357,40.865765, -73.933608,40.865792, -73.933593,40.865847, -73.933641,40.865901, -73.933544,40.866026, -73.933411,40.865989, -73.933372,40.866079, -73.933397,40.866214, -73.933354,40.866286, -73.933242,40.866447, -73.932984,40.866724, -73.93322,40.866816, -73.933169,40.866897, -73.932948,40.866859, -73.932719,40.867253, -73.932965,40.867336, -73.932906,40.867425, -73.932713,40.867397, -73.932186,40.868166, -73.932319,40.868213, -73.932122,40.868553, -73.93227,40.868609, -73.932155,40.868887, -73.932635,40.869144, -73.932267,40.869302, -73.932021,40.86948, -73.932037,40.869823, -73.932203,40.870194, -73.932099,40.870715, -73.931981,40.871047, -73.931776,40.871424, -73.931564,40.871611, -73.931312,40.872104, -73.931228,40.872572, -73.930893,40.872938, -73.930526,40.873556, -73.929952,40.874344, -73.92951,40.875078, -73.929393,40.875473, -73.929081,40.875777, -73.928829,40.87591, -73.928561,40.876276, -73.9285,40.876456, -73.928072,40.876533, -73.927598,40.876736, -73.927287,40.877012, -73.927047,40.877361, -73.926986,40.877532, -73.92687,40.877468, -73.926736,40.877502, -73.926696,40.877034, -73.926076,40.877109, -73.925411,40.877436, -73.92516,40.877326, -73.925085,40.87755, -73.924024,40.877414, -73.923302,40.877399, -73.922965,40.877179, -73.922803,40.877132, -73.922746,40.876997, -73.922527,40.876797, -73.922427,40.876435, -73.922315,40.875732, -73.922421,40.875346, -73.922557,40.875121, -73.922663,40.874807, -73.922694,40.874537, -73.922654,40.874122, -73.922334,40.87366, -73.922277,40.873434, -73.921441,40.873021, -73.920616,40.872951, -73.920496,40.873147, -73.920288,40.873344, -73.919785,40.873537, -73.919902,40.873728, -73.920373,40.873759, -73.920593,40.873833, -73.921455,40.874607, -73.921734,40.874736, -73.921894,40.874998, -73.921789,40.875195, -73.921626,40.875338, -73.920788,40.875051, -73.920023,40.874918, -73.919273,40.874731, -73.919053,40.874639, -73.918551,40.87458, -73.918156,40.87436, -73.917552,40.874336, -73.916977,40.874231, -73.916273,40.873946, -73.915596,40.873886, -73.914727,40.873733, -73.91418,40.8738, -73.912843,40.87349, -73.912152,40.873267, -73.911739,40.873255, -73.911519,40.873171, -73.911125,40.872654, -73.910839,40.871778, -73.910784,40.871417, -73.910839,40.870192, -73.911106,40.869925, -73.911049,40.869698, -73.911053,40.869285, -73.911115,40.869033, -73.911091,40.868528, -73.91124,40.868205, -73.911654,40.8682, -73.912112,40.867961, -73.912467,40.867938, -73.912913,40.867464, -73.913347,40.86672, -73.913615,40.866363, -73.915468,40.864317, -73.915668,40.864283, -73.915783,40.864392, -73.915912,40.864375, -73.91588,40.864249, -73.915624,40.864148, -73.915389,40.864101, -73.915018,40.863935, -73.915009,40.863782, -73.915282,40.863478, -73.915425,40.863326, -73.915347,40.863154, -73.915604,40.86294, -73.916971,40.861926, -73.917208,40.861965, -73.917458,40.861669, -73.917448,40.861517, -73.917533,40.861391, -73.917685,40.861339, -73.917877,40.861133, -73.917938,40.860971, -73.917895,40.860791, -73.918441,40.860283, -73.918349,40.860192, -73.918456,40.860076, -73.918352,40.860021, -73.918845,40.859521, -73.919593,40.858645, -73.920847,40.859197, -73.921454,40.860221, -73.921561,40.860258, -73.92188,40.859864, -73.921922,40.859568, -73.92164,40.859132, -73.920995,40.85827, -73.921054,40.85783, -73.92169,40.856935, -73.922077,40.856848, -73.922093,40.856722, -73.921891,40.856694, -73.922432,40.855978, -73.922212,40.855859, -73.923759,40.8539, -73.925669,40.851134, -73.927015,40.849048, -73.928191,40.847446, -73.930175,40.844366, -73.930803,40.842688, -73.931564,40.841469, -73.934671,40.83576, -73.934985,40.835484, -73.935284,40.833415, -73.935129,40.833368, -73.935208,40.832954, -73.935229,40.832225, -73.935002,40.830466, -73.93458,40.827183, -73.934643,40.827031, -73.934444,40.824461, -73.934315,40.824307, -73.934085,40.820855, -73.933901,40.818664, -73.933899,40.818061, -73.933902,40.81552, -73.934033,40.815503, -73.934117,40.812558, -73.934098,40.811153, -73.934276,40.809983, -73.934149,40.808929, -73.934067,40.808594, -73.933571,40.807788, -73.932832,40.806782, -73.932153,40.806018, -73.93155,40.805373, -73.93085,40.804691, -73.93036,40.804074, -73.929866,40.803295, -73.92937,40.802344, -73.929004,40.801476, -73.928865,40.800502, -73.928821,40.799411, -73.928852,40.79825, -73.928875,40.797016, -73.928914,40.796106, -73.929128,40.795433, -73.929419,40.794958, -73.929879,40.794511, -73.931574,40.793626, -73.932848,40.792981, -73.93382,40.792233, -73.93586,40.790657, -73.936588,40.78979, -73.936954,40.789172, -73.937267,40.788562, -73.937793,40.787468, -73.938397,40.786519, -73.939243,40.785536, -73.940147,40.784833, -73.941264,40.784257, -73.942427,40.783619, -73.943051,40.783165, -73.943485,40.782593, -73.943683,40.782144, -73.94372,40.781433, -73.943685,40.780694, -73.943594,40.780288, -73.943234,40.779456, -73.942843,40.778587, -73.942584,40.777927, -73.942396,40.777286, -73.941943,40.777147, -73.941908,40.776876, -73.942059,40.776931, -73.942042,40.776256, -73.942273,40.775664, -73.94282,40.774749, -73.943388,40.773962, -73.943954,40.773391, -73.944898,40.772562, -73.945744,40.771732, -73.94634,40.771322, -73.94744,40.770143, -73.948649,40.768794, -73.94943,40.767657, -73.950338,40.766656, -73.951212,40.765656, -73.952065,40.764672, -73.952939,40.763762, -73.95373,40.762859, -73.954804,40.761832, -73.955775,40.760922, -73.956818,40.759995, -73.958097,40.758799, -73.9585,40.758497, -73.958913,40.757942, -73.959375,40.757568, -73.959871,40.756897, -73.96024,40.756422, -73.960417,40.755974, -73.96081,40.755662, -73.961755,40.754923, -73.962404,40.754199, -73.963062,40.753403, -73.963672,40.75276, -73.964694,40.75113, -73.965635,40.750111, -73.967659,40.748219, -73.969148,40.746413, -73.969797,40.745518, -73.970451,40.744641, -73.970924,40.743951, -73.971585,40.743038, -73.972003,40.742511, -73.972293,40.741747, -73.972415,40.740587, -73.9727,40.739445, -73.972749,40.739076, -73.972717,40.7384, -73.972691,40.736805, -73.972608,40.735733, -73.973079,40.735305, -73.973383,40.735136, -73.973755,40.735004, -73.97389,40.734753, -73.973947,40.734069, -73.97386,40.732897, -73.973751,40.732085, -73.973584,40.731453, -73.973223,40.730901, -73.972785,40.730555, -73.972138,40.730125, -73.971701,40.729626, -73.971493,40.729192, -73.971532,40.72848, -73.971565,40.7274, -73.971802,40.726042, -73.972242,40.724001, -73.972876,40.721358, -73.973553,40.718706, -73.974772,40.715411, -73.976036,40.712603, -73.976521,40.71176, -73.977304,40.710956, -73.978013,40.710458, -73.980481,40.710309, -73.980495,40.710237, -73.981042,40.71017, -73.981035,40.709692, -73.981323,40.709794, -73.988173,40.709016, -73.988159,40.708791, -73.988456,40.708766, -73.988645,40.709921, -73.98997,40.709771, -73.991958,40.709446, -73.993402,40.709251, -73.997957,40.708552, -73.998885,40.70793, -73.999538,40.707529, -73.999717,40.707441, -74.000212,40.707193, -74.001056,40.706759, -74.001013,40.706669, -74.001168,40.706562, -74.000989,40.706371, -74.001476,40.706069, -74.002385,40.705653, -74.002695,40.705971, -74.003054,40.705704, -74.001907,40.704658, -74.002122,40.704525, -74.003204,40.705471, -74.003642,40.705169, -74.002449,40.704087, -74.002668,40.703926, -74.003933,40.705009, -74.004258,40.704832, -74.00454,40.704573, -74.005146,40.704245, -74.005779,40.704043, -74.006578,40.703384, -74.006977,40.703189, -74.007287,40.702966, -74.008086,40.702216, -74.008412,40.702021, -74.008573,40.702022, -74.00884,40.701818, -74.009342,40.701587, -74.010843,40.701105, -74.011078,40.701161, -74.011388,40.7011, -74.012246,40.700279, -74.01251,40.700074, -74.012596,40.700057, -74.01281,40.700275, -74.012832,40.700464, -74.013041,40.700448, -74.013014,40.6997, -74.013162,40.699683, -74.013206,40.700395, -74.013578,40.700345, -74.013605,40.700525, -74.013805,40.700617, -74.013753,40.700832, -74.013953,40.700825, -74.014162,40.700025, -74.014287,40.700053, -74.014149,40.700502, -74.014197,40.700539, -74.014574,40.700146, -74.014683,40.700201, -74.014323,40.700603, -74.014948,40.700906, -74.015143,40.700781, -74.015839,40.701255, -74.016532,40.702018, -74.017354,40.702899, -74.017605,40.703333, -74.017632,40.703793, -74.01727,40.704448, -74.017403,40.704503, -74.017325,40.704647, -74.017957,40.704562, -74.018004,40.704472, -74.018792,40.704614, -74.019261,40.705942, -74.019065,40.706904, -74.018471,40.706809, -74.018109,40.707707, -74.018773,40.707902, -74.017814,40.712245, -74.014793,40.711804, -74.01472,40.712011, -74.016281,40.712277, -74.016243,40.712528, -74.014618,40.712335, -74.014046,40.71451, -74.01345,40.716901, -74.014258,40.716989, -74.014099,40.717726, -74.016763,40.718109, -74.016623,40.718478, -74.013859,40.718157, -74.013815,40.718228, -74.013639,40.718191, -74.013605,40.718281, -74.013262,40.71826, -74.012913,40.719653, -74.013432,40.71973, -74.013397,40.719981, -74.016259,40.720357, -74.016221,40.720645, -74.012855,40.720265, -74.012794,40.720724, -74.016138,40.721149, -74.016068,40.721481, -74.013113,40.721141, -74.013072,40.72142];
//need an array of half-length
var points = new Array(data.length/2);
for (var i =0; i<points.length; i++) {
points[i]= new google.maps.LatLng(data[(i*2)+1],data[i*2]);
}
var polygonOptions = {
draggable: true,
clickable: false,
fillColor: 'blue',
fillOpacity: 0.3,
paths: points,
strokeColor: 'black',
strokeOpacity: 1.0,
strokeWeight: 0,
};
shape = new google.maps.Polygon(polygonOptions);
} //function drawBounds()
function initialize() {
setUp();
initializeMap();
drawBounds();
shape.setMap(map);
google.maps.event.addListener(map, 'click', function(event) {
var within = google.maps.geometry.poly.containsLocation(event.latLng, shape);
console.log(within);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>