dayjournal memo

Total 974 articles!!

Leaflet #019 – 重ねるレイヤの表示

Yasunori Kirimoto's avatar

Leafletで重ねるレイヤの表示をするためには下記のように記述します。

index.html


<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Leaflet Sample</title>

<script src="./Library/leaflet-0.7.3/leaflet.js"></script>
<link href="./Library/leaflet-0.7.3/leaflet.css" rel="stylesheet"/>

<script src="http://maps.google.com/maps/api/js?sensor=false&amp;amp;region=JP"></script>
<script src="./plugin/leaflet-plugins-master/layer/tile/Google.js"></script>
<script src="./plugin/leaflet-omnivore-master/leaflet-omnivore.min.js"></script>

<link href="./css/stylesheet.css" rel="stylesheet"/>

</head>
<body>

<div id="map"></div>

<script src="./js/script.js"></script>

</body>
</html>

stylesheet.css


html, body {
height: 100%;
padding: 0;
margin: 0;
}

#map {
z-index: 0;
height: 100%;
}

sample_pol.kml


<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document><Folder><name>sample</name>
<Placemark>
<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<ExtendedData><SchemaData schemaUrl="#sample">
<SimpleData name="A27_007">お茶の水小学校</SimpleData>
</SchemaData></ExtendedData>
<Polygon><altitudeMode>relativeToGround</altitudeMode><outerBoundaryIs><LinearRing><altitudeMode>relativeToGround</altitudeMode><coordinates>139.758827,35.690154 139.758691,35.690186 139.758682,35.690186 139.758242,35.690171 139.758137,35.690198 139.757348,35.690263 139.757306,35.690196 139.756243,35.690564 139.755698,35.691785 139.755685,35.691814 139.755813,35.691861 139.75574,35.692014 139.756133,35.692022 139.756225,35.692624 139.756229,35.692749 139.755947,35.692754 139.755883,35.693032 139.755837,35.693222 139.755788,35.693429 139.755739,35.693573 139.755668,35.69371 139.755522,35.69382 139.75534,35.693885 139.754962,35.693991 139.75437,35.694125 139.754364,35.694127 139.75416,35.694181 139.754077,35.694204 139.753749,35.694343 139.753592,35.69444 139.753306,35.694648 139.753185,35.694762 139.753,35.694975 139.752942,35.695098 139.752823,35.695364 139.752777,35.695563 139.752773,35.695649 139.752772,35.695661 139.752653,35.696283 139.752562,35.696799 139.752569,35.696802 139.752528,35.696895 139.752349,35.697904 139.752364,35.697901 139.752289,35.698341 139.75222,35.698751 139.752208,35.698766 139.752199,35.698778 139.752144,35.698893 139.75203,35.699082 139.751746,35.699602 139.751416,35.700203 139.751272,35.70046 139.751119,35.70075 139.750987,35.700977 139.750741,35.701437 139.750754,35.701572 139.750787,35.701942 139.750819,35.702331 139.750846,35.702629 139.750847,35.702638 139.750849,35.702654 139.751988,35.702569 139.75283,35.702505 139.75412,35.702365 139.755323,35.702116 139.755485,35.702082 139.755598,35.702059 139.755889,35.701999 139.757194,35.701719 139.757618,35.701699 139.758484,35.70166 139.758616,35.701659 139.760648,35.701637 139.761296,35.701587 139.761816,35.701459 139.761851,35.701443 139.762245,35.701258 139.762284,35.701221 139.762546,35.700975 139.762908,35.700634 139.763453,35.700326 139.763601,35.700284 139.764557,35.700009 139.765629,35.699738 139.765631,35.699718 139.765679,35.699103 139.765949,35.698127 139.765692,35.697408 139.765081,35.696063 139.76516,35.695618 139.765059,35.695601 139.765116,35.695335 139.765178,35.695046 139.76517,35.694933 139.765245,35.694583 139.765325,35.694185 139.765319,35.694143 139.765267,35.693835 139.765132,35.693838 139.765067,35.693584 139.76505,35.693575 139.764938,35.693046 139.76486,35.69273 139.764811,35.692447 139.764799,35.692434 139.764707,35.691944 139.764647,35.691632 139.76463,35.691545 139.764552,35.691215 139.764521,35.690916 139.764488,35.690879 139.76444,35.690593 139.764361,35.690229 139.764341,35.690137 139.764372,35.690077 139.764202,35.689267 139.763964,35.689393 139.763737,35.689547 139.763506,35.689753 139.763331,35.689893 139.763178,35.690042 139.763148,35.690072 139.763023,35.690135 139.762812,35.690199 139.762291,35.690318 139.76205,35.690378 139.761847,35.690475 139.761575,35.690743 139.761205,35.691044 139.760952,35.69118 139.760695,35.68918 139.760663,35.689219 139.759997,35.689342 139.759924,35.689814 139.75989,35.689843 139.759771,35.689943 139.758827,35.690154</coordinates></LinearRing></outerBoundaryIs></Polygon>
</Placemark>
<Placemark>
<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<ExtendedData><SchemaData schemaUrl="#sample">
<SimpleData name="A27_007">富士見小学校</SimpleData>
</SchemaData></ExtendedData>
<Polygon><altitudeMode>relativeToGround</altitudeMode><outerBoundaryIs><LinearRing><altitudeMode>relativeToGround</altitudeMode><coordinates>139.746034,35.703017 139.746464,35.703119 139.746705,35.703174 139.746708,35.703171 139.746767,35.703124 139.748014,35.703159 139.74906,35.703124 139.74972,35.703031 139.750321,35.702774 139.750527,35.702725 139.750809,35.702657 139.750849,35.702654 139.750847,35.702638 139.750846,35.702629 139.750819,35.702331 139.750787,35.701942 139.750754,35.701572 139.750741,35.701437 139.750987,35.700977 139.751119,35.70075 139.751272,35.70046 139.751416,35.700203 139.751746,35.699602 139.75203,35.699082 139.752144,35.698893 139.752199,35.698778 139.752208,35.698766 139.75222,35.698751 139.752289,35.698341 139.752364,35.697901 139.752349,35.697904 139.752528,35.696895 139.752569,35.696802 139.752562,35.696799 139.752653,35.696283 139.752772,35.695661 139.752773,35.695649 139.752777,35.695563 139.752823,35.695364 139.752942,35.695098 139.753,35.694975 139.753185,35.694762 139.753306,35.694648 139.753592,35.69444 139.753749,35.694343 139.754077,35.694204 139.75416,35.694181 139.754364,35.694127 139.75437,35.694125 139.754962,35.693991 139.75534,35.693885 139.755522,35.69382 139.755668,35.69371 139.755739,35.693573 139.755788,35.693429 139.755837,35.693222 139.755883,35.693032 139.755947,35.692754 139.756229,35.692749 139.756225,35.692624 139.756133,35.692022 139.75574,35.692014 139.755813,35.691861 139.755685,35.691814 139.755698,35.691785 139.756243,35.690564 139.756228,35.690569 139.754787,35.689967 139.754453,35.689842 139.753651,35.689413 139.7526,35.688878 139.75209,35.689496 139.751292,35.689294 139.750481,35.688886 139.749501,35.688409 139.748615,35.688122 139.748023,35.687953 139.747229,35.687885 139.74641,35.687816 139.745416,35.687908 139.745442,35.688083 139.745165,35.688127 139.745382,35.689023 139.745579,35.689038 139.745931,35.689186 139.746421,35.689295 139.746779,35.689362 139.747037,35.689421 139.747734,35.689548 139.747955,35.689881 139.747671,35.690305 139.747572,35.690519 139.74742,35.690891 139.747341,35.691015 139.747226,35.691113 139.74718,35.691262 139.747135,35.691282 139.747162,35.691278 139.747119,35.691457 139.747125,35.691625 139.747165,35.691692 139.747375,35.691931 139.747567,35.692126 139.74767,35.692234 139.747694,35.692482 139.747697,35.692885 139.747695,35.69326 139.747675,35.693684 139.747624,35.693976 139.747581,35.694319 139.749042,35.694681 139.749016,35.694683 139.748868,35.695017 139.747325,35.694573 139.747222,35.694543 139.746494,35.694334 139.745263,35.693985 139.744956,35.69492 139.744156,35.694701 139.743816,35.695823 139.743542,35.695748 139.742133,35.695354 139.741946,35.695299 139.741418,35.69512 139.741071,35.695013 139.739995,35.69467 139.739936,35.694794 139.739994,35.694867 139.739745,35.69498 139.739234,35.695223 139.739338,35.695373 139.739348,35.695387 139.739978,35.696292 139.741437,35.698162 139.74145,35.698181 139.741543,35.69831 139.741601,35.698391 139.742053,35.698922 139.742177,35.699067 139.742704,35.699686 139.742815,35.699787 139.742924,35.699886 139.743032,35.700013 139.743041,35.700024 139.743206,35.700218 139.743213,35.700226 139.743464,35.700521 139.743538,35.700611 139.743605,35.700692 139.743732,35.700846 139.744119,35.701274 139.743724,35.701598 139.743686,35.701629 139.743841,35.701769 139.743874,35.701799 139.743913,35.701835 139.744023,35.701934 139.744128,35.702029 139.744299,35.702158 139.744306,35.702163 139.744458,35.702293 139.744475,35.702308 139.744579,35.702317 139.744683,35.702241 139.744739,35.702253 139.744786,35.702277 139.744973,35.702374 139.744991,35.702383 139.745033,35.702404 139.745092,35.702434 139.745123,35.702451 139.745259,35.702521 139.74526,35.702521 139.745391,35.702588 139.745412,35.702602 139.745536,35.702681 139.745635,35.702744 139.745867,35.702911 139.745981,35.702993 139.745989,35.702998 139.746004,35.70301 139.746034,35.703017</coordinates></LinearRing></outerBoundaryIs></Polygon>
</Placemark>
<Placemark>
<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<ExtendedData><SchemaData schemaUrl="#sample">
<SimpleData name="A27_007">千代田小学校</SimpleData>
</SchemaData></ExtendedData>
<Polygon><altitudeMode>relativeToGround</altitudeMode><outerBoundaryIs><LinearRing><altitudeMode>relativeToGround</altitudeMode><coordinates>139.772441,35.689887 139.771122,35.689405 139.771099,35.689396 139.770428,35.689103 139.769953,35.689037 139.769279,35.688845 139.768479,35.688512 139.7684,35.688494 139.768191,35.688445 139.768279,35.68822 139.768554,35.687853 139.769066,35.687445 139.769879,35.686537 139.770066,35.686362 139.770354,35.685954 139.770591,35.685112 139.770741,35.684729 139.770897,35.68449 139.770991,35.684346 139.770992,35.684331 139.770993,35.68432 139.771016,35.684012 139.770466,35.682796 139.770266,35.682437 139.770004,35.681804 139.769066,35.680596 139.768951,35.680414 139.767804,35.678596 139.767116,35.677338 139.766541,35.676413 139.766104,35.675837 139.765609,35.675185 139.764965,35.674336 139.764942,35.674305 139.764382,35.673518 139.764254,35.673338 139.764079,35.673163 139.763717,35.672963 139.763454,35.672871 139.762914,35.672773 139.762492,35.672696 139.761867,35.672546 139.761367,35.672346 139.761129,35.672097 139.761057,35.671978 139.760967,35.67183 139.760792,35.671763 139.76043,35.671697 139.760183,35.671692 139.759635,35.67168 139.759455,35.67123 139.758942,35.67028 139.758792,35.669905 139.758555,35.669688 139.758043,35.668922 139.758023,35.668741 139.758018,35.668697 139.758021,35.668684 139.757952,35.668705 139.757905,35.668719 139.756961,35.669009 139.756917,35.669022 139.756872,35.669036 139.756626,35.669112 139.755648,35.669447 139.755495,35.6695 139.755409,35.669529 139.755288,35.669571 139.754313,35.669905 139.752863,35.670262 139.752138,35.670386 139.752002,35.670409 139.75194,35.67042 139.752016,35.670567 139.752045,35.670625 139.7529,35.672064 139.752887,35.672102 139.753917,35.673727 139.755887,35.676868 139.755966,35.67685 139.755878,35.676728 139.757597,35.676014 139.75935,35.675296 139.759635,35.67504 139.759674,35.675212 139.759793,35.675658 139.760097,35.676413 139.76046,35.677445 139.760567,35.677724 139.760864,35.67852 139.760969,35.678838 139.761322,35.679857 139.761701,35.680919 139.762134,35.682204 139.762567,35.68356 139.762698,35.684134 139.760255,35.684458 139.76054,35.685321 139.760821,35.685283 139.760928,35.685664 139.760984,35.685654 139.761001,35.685716 139.761405,35.687228 139.761369,35.687295 139.760947,35.688444 139.760832,35.68876 139.760695,35.68918 139.760952,35.69118 139.761205,35.691044 139.761575,35.690743 139.761847,35.690475 139.76205,35.690378 139.762291,35.690318 139.762812,35.690199 139.763023,35.690135 139.763148,35.690072 139.763178,35.690042 139.763331,35.689893 139.763506,35.689753 139.763737,35.689547 139.763964,35.689393 139.764202,35.689267 139.764372,35.690077 139.764341,35.690137 139.764361,35.690229 139.76444,35.690593 139.764488,35.690879 139.764521,35.690916 139.764552,35.691215 139.76463,35.691545 139.764647,35.691632 139.764707,35.691944 139.764799,35.692434 139.764811,35.692447 139.76486,35.69273 139.764938,35.693046 139.76505,35.693575 139.765067,35.693584 139.765132,35.693838 139.765267,35.693835 139.765975,35.694033 139.766004,35.694039 139.766428,35.694127 139.766967,35.694282 139.767452,35.694438 139.767763,35.694561 139.768362,35.694799 139.768371,35.694804 139.768819,35.694987 139.768825,35.69499 139.769309,35.695127 139.770338,35.695323 139.770756,35.696565 139.770787,35.696641 139.770849,35.69679 139.770967,35.69707 139.770971,35.697067 139.771684,35.696996 139.771964,35.696979 139.772461,35.696966 139.772688,35.696967 139.772687,35.696951 139.772815,35.69695 139.773693,35.696943 139.774429,35.696934 139.774812,35.696914 139.775355,35.69691 139.775355,35.696757 139.775641,35.69642 139.775972,35.695578 139.776306,35.694532 139.777103,35.692591 139.777551,35.691853 139.777607,35.691734 139.777518,35.691702 139.776677,35.691406 139.776638,35.691392 139.776618,35.691385 139.776554,35.691363 139.776082,35.691196 139.776009,35.691169 139.775288,35.690899 139.775239,35.69088 139.775108,35.690831 139.775104,35.690829 139.774952,35.690773 139.774902,35.690754 139.774528,35.690614 139.773941,35.690418 139.77389,35.690401 139.773846,35.690387 139.773237,35.690183 139.773216,35.69017 139.772441,35.689887</coordinates></LinearRing></outerBoundaryIs></Polygon>
</Placemark>
<Placemark>
<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<ExtendedData><SchemaData schemaUrl="#sample">
<SimpleData name="A27_007">九段小学校</SimpleData>
</SchemaData></ExtendedData>
<Polygon><altitudeMode>relativeToGround</altitudeMode><outerBoundaryIs><LinearRing><altitudeMode>relativeToGround</altitudeMode><coordinates>139.737612,35.693268 139.737791,35.693441 139.737831,35.693525 139.737831,35.693526 139.737834,35.693529 139.738223,35.693953 139.738864,35.694692 139.739077,35.694997 139.739079,35.695001 139.739214,35.695194 139.739234,35.695223 139.739745,35.69498 139.739994,35.694867 139.739936,35.694794 139.739995,35.69467 139.741071,35.695013 139.741418,35.69512 139.741946,35.695299 139.742133,35.695354 139.743542,35.695748 139.743816,35.695823 139.744156,35.694701 139.744956,35.69492 139.745263,35.693985 139.746494,35.694334 139.747222,35.694543 139.747325,35.694573 139.748868,35.695017 139.749016,35.694683 139.749042,35.694681 139.747581,35.694319 139.747624,35.693976 139.747675,35.693684 139.747695,35.69326 139.747697,35.692885 139.747694,35.692482 139.74767,35.692234 139.747567,35.692126 139.747375,35.691931 139.747165,35.691692 139.747125,35.691625 139.747119,35.691457 139.747162,35.691278 139.747135,35.691282 139.74718,35.691262 139.747226,35.691113 139.747341,35.691015 139.74742,35.690891 139.747572,35.690519 139.747671,35.690305 139.747955,35.689881 139.747734,35.689548 139.747037,35.689421 139.746779,35.689362 139.746421,35.689295 139.745931,35.689186 139.745579,35.689038 139.745382,35.689023 139.745189,35.689018 139.744796,35.688933 139.744452,35.688846 139.743696,35.688649 139.74226,35.688237 139.742509,35.688857 139.74277,35.689505 139.741583,35.689174 139.741002,35.689017 139.740373,35.688787 139.738741,35.688223 139.738711,35.688211 139.738539,35.688597 139.738405,35.688548 139.738303,35.688769 139.738417,35.688816 139.738244,35.689177 139.737977,35.689074 139.737711,35.689652 139.737299,35.689512 139.737051,35.689981 139.736716,35.690611 139.736395,35.69118 139.736211,35.691126 139.736145,35.691113 139.736047,35.691118 139.73594,35.691146 139.735797,35.691282 139.735455,35.691766 139.735709,35.691897 139.73584,35.691964 139.736074,35.692084 139.736139,35.692117 139.736151,35.692124 139.73628,35.69219 139.736724,35.692505 139.736999,35.692734 139.737003,35.692737 139.737567,35.693225 139.737583,35.69324 139.737612,35.693268</coordinates></LinearRing></outerBoundaryIs></Polygon>
</Placemark>
<Placemark>
<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<ExtendedData><SchemaData schemaUrl="#sample">
<SimpleData name="A27_007">麹町小学校</SimpleData>
</SchemaData></ExtendedData>
<Polygon><altitudeMode>relativeToGround</altitudeMode><outerBoundaryIs><LinearRing><altitudeMode>relativeToGround</altitudeMode><coordinates>139.749202,35.670783 139.749191,35.670781 139.749128,35.670728 139.749111,35.670713 139.748931,35.670559 139.748861,35.670499 139.748846,35.670485 139.74817,35.669905 139.748143,35.669884 139.747799,35.669617 139.747664,35.669609 139.747642,35.669614 139.747638,35.669615 139.747476,35.669656 139.747209,35.669905 139.746986,35.670059 139.746973,35.670267 139.746959,35.670505 139.746768,35.670509 139.746644,35.670468 139.746255,35.670513 139.746228,35.670516 139.746115,35.670536 139.745982,35.670559 139.745373,35.670667 139.745343,35.670672 139.745298,35.670993 139.745214,35.671004 139.74512,35.67102 139.744999,35.67104 139.744131,35.671186 139.743654,35.67125 139.743627,35.671259 139.743448,35.671321 139.743359,35.67136 139.743335,35.671371 139.743203,35.67143 139.743167,35.671451 139.743157,35.671457 139.742926,35.671599 139.742652,35.671767 139.742579,35.671811 139.742573,35.671815 139.742283,35.671996 139.741718,35.672368 139.741612,35.672438 139.741475,35.672513 139.741383,35.672563 139.741282,35.672624 139.740906,35.672851 139.740184,35.673285 139.740017,35.673386 139.739896,35.673458 139.739449,35.673753 139.739363,35.673814 139.739278,35.673873 139.739222,35.673911 139.739068,35.674019 139.739058,35.674026 139.738979,35.674178 139.738899,35.674332 139.73876,35.674598 139.738744,35.674664 139.738695,35.674871 139.738674,35.674936 139.738602,35.675157 139.738508,35.675349 139.738488,35.675387 139.738472,35.675418 139.738451,35.675456 139.738309,35.675766 139.738212,35.675941 139.738115,35.676068 139.737869,35.676391 139.737523,35.676874 139.737406,35.677293 139.737219,35.678022 139.737183,35.67809 139.737173,35.67811 139.737125,35.678201 139.737026,35.678391 139.737024,35.678393 139.736994,35.67845 139.736981,35.678474 139.737,35.678491 139.737582,35.678542 139.738521,35.678612 139.738395,35.679545 139.738374,35.679674 139.738331,35.680176 139.738308,35.680626 139.7383,35.680736 139.738299,35.68075 139.738227,35.682256 139.738219,35.682525 139.738195,35.682961 139.738122,35.682958 139.736989,35.682917 139.736913,35.682914 139.736857,35.682928 139.736621,35.682952 139.736418,35.682898 139.73616,35.682764 139.735947,35.682599 139.735788,35.682495 139.735614,35.682408 139.735241,35.682317 139.735225,35.682627 139.735285,35.683059 139.735362,35.683595 139.735362,35.683614 139.735203,35.683638 139.735258,35.683953 139.735266,35.68401 139.735092,35.684025 139.73513,35.684425 139.735142,35.684558 139.735142,35.684564 139.735133,35.684583 139.73578,35.684673 139.73537,35.685635 139.738453,35.686801 139.738429,35.686838 139.738405,35.686881 139.737867,35.687881 139.738711,35.688211 139.738741,35.688223 139.740373,35.688787 139.741002,35.689017 139.741583,35.689174 139.74277,35.689505 139.742509,35.688857 139.74226,35.688237 139.743696,35.688649 139.744452,35.688846 139.744796,35.688933 139.745189,35.689018 139.745382,35.689023 139.745165,35.688127 139.745442,35.688083 139.745416,35.687908 139.74641,35.687816 139.747229,35.687885 139.748023,35.687953 139.748615,35.688122 139.749501,35.688409 139.750481,35.688886 139.751292,35.689294 139.75209,35.689496 139.7526,35.688878 139.753651,35.689413 139.754453,35.689842 139.754787,35.689967 139.756228,35.690569 139.756243,35.690564 139.757306,35.690196 139.757348,35.690263 139.758137,35.690198 139.758242,35.690171 139.758682,35.690186 139.758691,35.690186 139.758827,35.690154 139.759771,35.689943 139.75989,35.689843 139.759924,35.689814 139.759997,35.689342 139.760663,35.689219 139.760695,35.68918 139.760832,35.68876 139.760947,35.688444 139.761369,35.687295 139.761405,35.687228 139.761001,35.685716 139.760984,35.685654 139.760928,35.685664 139.760821,35.685283 139.76054,35.685321 139.760255,35.684458 139.762698,35.684134 139.762567,35.68356 139.762134,35.682204 139.761701,35.680919 139.761322,35.679857 139.760969,35.678838 139.760864,35.67852 139.760567,35.677724 139.76046,35.677445 139.760097,35.676413 139.759793,35.675658 139.759674,35.675212 139.759635,35.67504 139.75935,35.675296 139.757597,35.676014 139.755878,35.676728 139.755966,35.67685 139.755887,35.676868 139.753917,35.673727 139.752887,35.672102 139.7529,35.672064 139.752045,35.670625 139.752016,35.670567 139.75194,35.67042 139.751836,35.670438 139.751129,35.670559 139.750067,35.670806 139.749958,35.670831 139.749808,35.670831 139.749781,35.670831 139.749759,35.670831 139.749524,35.670831 139.749513,35.670831 139.74924,35.670789 139.749202,35.670783</coordinates></LinearRing></outerBoundaryIs></Polygon>
</Placemark>
<Placemark>
<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<ExtendedData><SchemaData schemaUrl="#sample">
<SimpleData name="A27_007">泰明小学校</SimpleData>
</SchemaData></ExtendedData>
<Polygon><altitudeMode>relativeToGround</altitudeMode><outerBoundaryIs><LinearRing><altitudeMode>relativeToGround</altitudeMode><coordinates>139.76641,35.670148 139.766589,35.669996 139.766592,35.670011 139.766967,35.669688 139.76703,35.669633 139.767065,35.669589 139.767499,35.66922 139.767823,35.66895 139.768084,35.668722 139.768376,35.668471 139.767736,35.667936 139.767524,35.667644 139.767473,35.667463 139.767452,35.667299 139.767426,35.667203 139.767421,35.666929 139.767385,35.666781 139.767253,35.666614 139.76699,35.666409 139.765969,35.665617 139.765955,35.665619 139.765841,35.665518 139.765409,35.665047 139.764941,35.664538 139.764712,35.664294 139.764713,35.664289 139.763872,35.663535 139.763697,35.663396 139.763459,35.663247 139.763364,35.663313 139.762947,35.663603 139.76265,35.663796 139.762717,35.663931 139.762842,35.664448 139.762845,35.665364 139.762703,35.666017 139.762369,35.666522 139.762132,35.66688 139.761419,35.667301 139.760134,35.667638 139.759231,35.667848 139.758064,35.668665 139.758065,35.66867 139.758021,35.668684 139.758018,35.668697 139.758023,35.668741 139.758043,35.668922 139.758555,35.669688 139.758792,35.669905 139.758942,35.67028 139.759455,35.67123 139.759635,35.67168 139.760183,35.671692 139.76043,35.671697 139.760792,35.671763 139.760967,35.67183 139.761057,35.671978 139.761129,35.672097 139.761367,35.672346 139.761867,35.672546 139.762492,35.672696 139.762914,35.672773 139.763454,35.672871 139.763717,35.672963 139.764079,35.673163 139.764254,35.673338 139.764382,35.673518 139.764942,35.674305 139.764965,35.674336 139.765609,35.675185 139.766104,35.675837 139.766148,35.675822 139.766213,35.675906 139.7677,35.675466 139.768187,35.675325 139.768644,35.675313 139.76911,35.67519 139.769107,35.675207 139.77035,35.674798 139.768879,35.673082 139.768137,35.672065 139.767291,35.671083 139.76641,35.670148</coordinates></LinearRing></outerBoundaryIs></Polygon>
</Placemark>
</Folder>
<Schema name="sample" id="sample">
<SimpleField name="A27_007" type="string"></SimpleField>
</Schema>
</Document></kml>

script.js


var t_std = new L.tileLayer('http://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png', {
attribution: "<a href='http://www.gsi.go.jp/kikakuchousei/kikakuchousei40182.html' target='_blank'>国土地理院</a>"
});

var t_pale = new L.tileLayer('http://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png', {
attribution: "<a href='http://www.gsi.go.jp/kikakuchousei/kikakuchousei40182.html' target='_blank'>国土地理院</a>"
});

var t_ort = new L.tileLayer('http://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg', {
attribution: "<a href='http://www.gsi.go.jp/kikakuchousei/kikakuchousei40182.html' target='_blank'>国土地理院</a>"
});

var o_std = new L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&amp;copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
});

var g_roadmap = new L.Google('ROADMAP');

var g_satellite = new L.Google('SATELLITE');

var g_hybrid = new L.Google('HYBRID');

var map = L.map('map', {
center: [35.6831925, 139.7511307],
zoom: 13,
zoomControl: false,
layers: [t_pale]
});

var Map_KML_Style = {
"color": '#34495e',
"weight": 2,
"opacity": 1.0,
"fillColor": "#FDC44F",
"fillOpacity": 0.2
};

var Map_KML_Property = L.geoJson(null, {
style: Map_KML_Style 
}).addTo(map);

var Map_KML = omnivore.kml('./files/sample_pol.kml', null, Map_KML_Property);

var Map_BaseLayer = {
"地理院地図 標準": t_std,
"地理院地図 淡色": t_pale,
"地理院地図 オルソ": t_ort,
"OpenStreetMap 標準": o_std,
"GoogleMap 標準": g_roadmap,
"GoogleMap オルソ": g_satellite,
"GoogleMap ハイブリッド": g_hybrid
};

var Map_OverLayer = {
"KML": Map_KML
};

L.control.scale({ imperial: false, maxWidth: 300 }).addTo(map);

L.control.layers(Map_BaseLayer, Map_OverLayer, { collapsed: false }).addTo(map);

index.htmlを実行すると下記のようにブラウザで表示されます。 ※「この地図は、国土地理院長の承認を得て、同院発行の電子地形図(タイル)を複製したものである。 (承認番号 平27情複、 第224号)」 ※国土数値情報(小学校区データ)を使用

leaflet_019_01


表示させるレイヤを変更したい場合: var Map_OverLayer~の格納している変数名を変更します。 L.control.layers~の第2引数にON/OFF用のレイヤ変数を記述します。


var Map_OverLayer = {
"GeoJSON": Map_GeoJSON
};

L.control.layers(Map_BaseLayer, Map_OverLayer, { collapsed: false }).addTo(map);


book

Q&A