{"id":5860,"date":"2025-04-01T17:00:57","date_gmt":"2025-04-01T08:00:57","guid":{"rendered":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/system\/openlayers-openstreetmap-chouchoumokuporigon\/"},"modified":"2025-04-01T16:56:40","modified_gmt":"2025-04-01T07:56:40","slug":"openlayers-openstreetmap-chouchoumokuporigon","status":"publish","type":"post","link":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/system\/openlayers-openstreetmap-chouchoumokuporigon\/","title":{"rendered":"OpenLayers\u3092\u4f7f\u3063\u3066OpenStreetMap\u306b\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u3092\u8868\u793a\u3057\u3066\u307f\u308b(OpenLayers v6)"},"content":{"rendered":"<p>OpenLayers\u3092\u4f7f\u3063\u3066OpenStreetMap\u306b\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u3092\u66f8\u3044\u3066\u307f\u307e\u3059\u3002<br \/>\n<!-- \u3053\u3053\u306b\u8ffd\u52a0\u306e\u6587\u7ae0\u3092\u5165\u308c\u305f\u3044 --><\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#i\"><span class=\"toc_number toc_depth_1\">1<\/span> \u4f7f\u7528\u3059\u308b\u3082\u306e<\/a><ul><li><a href=\"#OpenLayers\"><span class=\"toc_number toc_depth_2\">1.1<\/span> OpenLayers<\/a><\/li><li><a href=\"#OpenStreetMapOSM\"><span class=\"toc_number toc_depth_2\">1.2<\/span> OpenStreetMap(OSM)<\/a><\/li><li><a href=\"#i-2\"><span class=\"toc_number toc_depth_2\">1.3<\/span> \u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3<\/a><\/li><\/ul><\/li><li><a href=\"#OpenLayers_v6\"><span class=\"toc_number toc_depth_1\">2<\/span> OpenLayers v6 \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/a><ul><li><a href=\"#i-3\"><span class=\"toc_number toc_depth_2\">2.1<\/span> \u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u5185\u5bb9\u306e\u78ba\u8a8d<\/a><\/li><li><a href=\"#i-4\"><span class=\"toc_number toc_depth_2\">2.2<\/span> \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066\u5730\u56f3\u3092\u8868\u793a\u3059\u308b<\/a><\/li><li><a href=\"#i-5\"><span class=\"toc_number toc_depth_2\">2.3<\/span> \u30dd\u30ea\u30b4\u30f3\u3092\u5730\u56f3\u306b\u8868\u793a\u3059\u308b<\/a><\/li><\/ul><\/li><li><a href=\"#i-6\"><span class=\"toc_number toc_depth_1\">3<\/span> \u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u3092\u5730\u56f3\u306b\u8868\u793a\u3059\u308b<\/a><ul><li><a href=\"#TerraMap_API\"><span class=\"toc_number toc_depth_2\">3.1<\/span> TerraMap API\u304b\u3089\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u3092\u53d6\u5f97\u3057\u3066\u8868\u793a\u3059\u308b<\/a><\/li><\/ul><\/li><\/ul><\/div>\n<h2><span id=\"i\">\u4f7f\u7528\u3059\u308b\u3082\u306e<\/span><\/h2>\n<p><!-- \u3053\u3053\u306b\u30ea\u30fc\u30c9\u6587\u3092\u5165\u308c\u305f\u3044 --><\/p>\n<h3><span id=\"OpenLayers\">OpenLayers<\/span><\/h3>\n<p>Web\u30b5\u30a4\u30c8\u3067\u5730\u56f3\u3092\u6271\u3046\u3068\u304d\u306b\u4fbf\u5229\u306aJavaScript\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\u52d5\u7684\u306a\u5730\u56f3\u3092\u4f7f\u3063\u305fWeb\u30da\u30fc\u30b8\u306e\u4f5c\u6210\u304c\u697d\u306b\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n2022\u5e748\u6708\u306bOpenLayers v7\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u307e\u3057\u305f\u304c\u3001OpenLayers v6\u3092\u4f7f\u7528\u3057\u305f\u4f8b\u3092\u3042\u3052\u307e\u3059\u3002<\/p>\n\r\n<div class=\"blog-card\">\r\n<a href=\"https:\/\/openlayers.org\/\" target=\"_blank\">\r\n<div class=\"blog-card-thumbnail\"><img decoding=\"async\" src=\"https:\/\/s.wordpress.com\/mshots\/v1\/https%3A%2F%2Fopenlayers.org?w=600&h=400\" width=\"600\" \/><\/div>\r\n<div class=\"blog-card-content\">\r\n<div class=\"blog-card-title\">OpenLayers - Welcome <\/div>\r\n<div class=\"blog-card-excerpt\"><\/div>\r\n<\/div>\r\n<\/a>\r\n<\/div>\n<h3><span id=\"OpenStreetMapOSM\">OpenStreetMap(OSM)<\/span><\/h3>\n<p><!-- \u3053\u3053\u306b\u30ea\u30fc\u30c9\u6587\u3092\u5165\u308c\u305f\u3044 --><\/p>\n<blockquote><p>OpenStreetMap(OSM)\u306f\u3001\u8ab0\u3067\u3082\u81ea\u7531\u306b\u5730\u56f3\u3092\u4f7f\u3048\u308b\u3088\u3046\u3001\u307f\u3093\u306a\u3067\u30aa\u30fc\u30d7\u30f3\u30c7\u30fc\u30bf\u306e\u5730\u7406\u60c5\u5831\u3092\u4f5c\u308b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3059\u3002<\/p><\/blockquote>\n<h3><span id=\"i-2\">\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3<\/span><\/h3>\n<p>\u753a\u4e01\u76ee\u3068\u306f\u884c\u653f\u754c\u306e\u4e00\u3064\u3067\u300c\u5bcc\u58eb\u898b\u753a3\u4e01\u76ee\u300d\u300c\u5e83\u5c3e1\u4e01\u76ee\u300d\u306a\u3069\u300c\u25cf\u4e01\u76ee\u300d\u3067\u8868\u308f\u3055\u308c\u308b\u884c\u653f\u533a\u753b\u306e\u3053\u3068\u3067\u3059\u3002\u884c\u653f\u754c\u306f\u4ed6\u306b\u306f\u90fd\u9053\u5e9c\u770c\u3084\u5e02\u533a\u753a\u6751\u3001\u5927\u5b57\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u306f\u753a\u4e01\u76ee\u306e\u5883\u754c\u30c7\u30fc\u30bf\u3067\u3059\u3002<br \/>\n\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u306fe-stat\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002e-stat\u3067\u306f\u5c0f\u5730\u57df\uff08\u753a\u4e01\u30fb\u5b57\u7b49\u5225\uff09\u3068\u3044\u3046\u540d\u79f0\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\ne-stat\u306e\u5c0f\u5730\u57df\uff08\u753a\u4e01\u30fb\u5b57\u7b49\u5225)\u306e\u30dd\u30ea\u30b4\u30f3\u3092\u5730\u56f3\u306b\u63cf\u753b\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u304c\u3001e-stat\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u308aShapefile\u3084KML\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30b7\u30b9\u30c6\u30e0\u306b\u53d6\u308a\u8fbc\u3093\u3060\u308a\u3059\u308b\u306e\u304c\u624b\u9593\u306a\u306e\u3067\u3001\u30de\u30c3\u30d7\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u306eTerraMap API\u3092\u4f7f\u3063\u3066\u53d6\u5f97\u3057\u305f\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u3092\u8868\u793a\u3055\u305b\u3066\u307f\u307e\u3059\u3002<br \/>\n\r\n<div class=\"blog-card\">\r\n<a href=\"https:\/\/www.mapmarketing.co.jp\/terramap-api\" target=\"_blank\">\r\n<div class=\"blog-card-thumbnail\"><img decoding=\"async\" src=\"https:\/\/www.mapmarketing.co.jp\/wp\/wp-content\/uploads\/Logo_RGB_1-1-2.png\" width=\"600\" \/><\/div>\r\n<div class=\"blog-card-content\">\r\n<div class=\"blog-card-title\">TerraMap API | \u30de\u30c3\u30d7\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u682a\u5f0f\u4f1a\u793e <\/div>\r\n<div class=\"blog-card-excerpt\">TerraMap API\u3068\u306f\u3001\u30a8\u30ea\u30a2\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u30c7\u30fc\u30bf\uff08\u7d71\u8a08\u30c7\u30fc\u30bf\u3001\u30dd\u30ea\u30b4\u30f3\u3001\u4f4f\u6240\uff09\u3092\u81ea\u793e\u3067\u7528\u610f\u305b\u305a\u306b\u81ea\u793e\u30b7\u30b9\u30c6\u30e0\u306b\u7d44\u307f\u8fbc\u307f\u305f\u3044\u65b9\u5411\u3051\u306e\u5730\u56f3\u30b7\u30b9\u30c6\u30e0\u958b\u767a\u652f\u63f4API\u3067\u3059\u3002\u5e38\u306b\u66f4\u65b0\u30fb\u6574\u5099\u3055\u308c\u305f\u30a8\u30ea\u30a2\u30de\u30fc\u2026<\/div>\r\n<\/div>\r\n<\/a>\r\n<\/div><\/p>\n<h2><span id=\"OpenLayers_v6\">OpenLayers v6 \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/span><\/h2>\n<p>OpenLayers\u306e\u516c\u5f0f\u30da\u30fc\u30b8\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u3042\u308b\u65b9\u6cd5\u3092\u30d9\u30fc\u30b9\u306b\u3001OpenStreetMap\u306b\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u3092\u63cf\u753b\u3057\u3066\u307f\u307e\u3059\u3002<br \/>\nOpenLayers v6 \u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306f\u4ee5\u4e0b\u306e\u30ea\u30f3\u30af\u304b\u3089\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002<br \/>\n\r\n<div class=\"blog-card\">\r\n<a href=\"https:\/\/openlayers.org\/en\/v6.15.1\/doc\/tutorials\/bundle.html\" target=\"_blank\">\r\n<div class=\"blog-card-thumbnail\"><img decoding=\"async\" src=\"https:\/\/s.wordpress.com\/mshots\/v1\/https%3A%2F%2Fopenlayers.org%2Fen%2Fv6.15.1%2Fdoc%2Ftutorials%2Fbundle.html?w=600&h=400\" width=\"600\" \/><\/div>\r\n<div class=\"blog-card-content\">\r\n<div class=\"blog-card-title\">OpenLayers - Basic project setup using NPM and Vite <\/div>\r\n<div class=\"blog-card-excerpt\"><\/div>\r\n<\/div>\r\n<\/a>\r\n<\/div><br \/>\n<span class=\"keyboard-key\">npx create-ol-app your-app-name<\/span><\/p>\n<h3><span id=\"i-3\">\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u5185\u5bb9\u306e\u78ba\u8a8d<\/span><\/h3>\n<p>\u6307\u5b9a\u3057\u305f\u540d\u524d\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<br \/>\nindex.html\u3084main.js\u306a\u3069\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u3067\u306fmain.js\u3092\u5909\u66f4\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h3><span id=\"i-4\">\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066\u5730\u56f3\u3092\u8868\u793a\u3059\u308b<\/span><\/h3>\n<p>\u3053\u3061\u3089\u3082\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u3042\u308b\u3088\u3046\u306b npm start \u3057\u307e\u3059\u3002\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30c8\u3084VSCode\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u306a\u3069\u304b\u3089\u5b9f\u884c\u3057\u307e\u3059\u3002<br \/>\n\u8868\u793a\u3055\u308c\u305flocalhost\u306eURL\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u5730\u56f3\u304c\u8868\u793a\u3055\u308c\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h3><span id=\"i-5\">\u30dd\u30ea\u30b4\u30f3\u3092\u5730\u56f3\u306b\u8868\u793a\u3059\u308b<\/span><\/h3>\n<p>\u5730\u56f3\u30ed\u30fc\u30c9\u6642\u306b\u30dd\u30ea\u30b4\u30f3\u3092\u8868\u793a\u3055\u305b\u3066\u307f\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306fPolygon\u3067\u306f\u306a\u304fMultiPolygon\u3067\u6307\u5b9a\u3057\u3066\u307f\u307e\u3059\u3002<br \/>\n\u5fc5\u8981\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3001VectorSource\u306bGeoJSON\u3092\u6307\u5b9a\u3057\u3066VectorLayer\u3092\u30bb\u30c3\u30c8\u3057\u307e\u3059\u3002<\/p>\n<hr \/>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>import '.\/style.css';\r\nimport {Map, View} from 'ol';\r\nimport TileLayer from 'ol\/layer\/Tile';\r\nimport OSM from 'ol\/source\/OSM';\r\nimport {fromLonLat} from 'ol\/proj';\r\nimport VectorLayer from 'ol\/layer\/Vector';\r\nimport VectorSource from 'ol\/source\/Vector';\r\nimport GeoJSON from 'ol\/format\/GeoJSON';\r\nimport Style from 'ol\/style\/Style';\r\nimport Stroke from 'ol\/style\/Stroke';\r\nimport Fill from 'ol\/style\/Fill';\r\n\r\n\/\/ \u30dd\u30ea\u30b4\u30f3\u306e\u30b9\u30bf\u30a4\u30eb\u3092\u8a2d\u5b9a\r\nconst styles = {\r\n\u3000'MultiPolygon': new Style({\r\n\u3000\u3000stroke: new Stroke({\r\n\u3000\u3000\u3000color: 'rgba(0, 0, 255, 0.8)',\r\n\u3000\u3000\u3000width: 2\r\n\u3000\u3000}),\r\n\u3000\u3000fill: new Fill({\r\n\u3000\u3000\u3000color: 'rgba(0, 0, 255, 0.3)'\r\n\u3000\u3000})\r\n\u3000})\r\n};\r\nconst styleFunction = function(feature) {\r\n\u3000return styles[feature.getGeometry().getType()];\r\n};\r\n\r\n\/\/ GeoJSON\u3067\u30dd\u30ea\u30b4\u30f3\u3092\u6e96\u5099\r\nconst geojsonObject = {\r\n\u3000\u3000\"type\": \"FeatureCollection\",\r\n\u3000\u3000\"features\": [\r\n\u3000\u3000\u3000{\r\n\u3000\u3000\u3000\u3000\"type\": \"Feature\",\r\n\u3000\u3000\u3000\u3000\"properties\": {},\r\n\u3000\u3000\u3000\u3000\"geometry\": {\r\n\u3000\u3000\u3000\u3000\"type\": \"MultiPolygon\",\r\n\u3000\u3000\u3000\u3000\"coordinates\": [\r\n\u3000\u3000\u3000\u3000\u3000[\r\n\u3000\u3000\u3000\u3000\u3000\u3000[\r\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000[139.65645236269657, 35.6703299404073],\r\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000[139.65588373440954, 35.67358963979696],\r\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000[139.66251415481307, 35.67413000490703],\r\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000[139.6632329867986, 35.67015562118215],\r\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000[139.65645236269657, 35.6703299404073]\r\n\u3000\u3000\u3000\u3000\u3000\u3000]\r\n\u3000\u3000\u3000\u3000\u3000]\r\n\u3000\u3000\u3000\u3000]\r\n\u3000\u3000\u3000}\r\n\u3000\u3000}\r\n\u3000]\r\n};\r\n\r\n\/\/ vectorSource\u306bGeoJSON\u3092\u30bb\u30c3\u30c8\r\nconst vectorSource = new VectorSource({\r\n\u3000features: new GeoJSON({featureProjection: 'EPSG:3857'}).readFeatures(geojsonObject)\r\n});\r\n\r\nconst vectorLayer = new VectorLayer({\r\n\u3000source: vectorSource,\r\n\u3000style: styleFunction\r\n});\r\n\r\nconst map = new Map({\r\n\u3000target: 'map',\r\n\u3000layers: [\r\n\u3000\u3000new TileLayer({\r\n\u3000\u3000\u3000source: new OSM()\r\n\u3000\u3000}),\r\n\u3000\u3000vectorLayer\r\n\u3000],\r\n\u3000view: new View({\r\n\u3000\u3000center: fromLonLat([139.6596281, 35.6720557]),\r\n\u3000\u3000zoom: 15\r\n\u3000})\r\n});<\/code><\/pre>\n<\/div>\n<hr \/>\n<p>\u51fa\u529b\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002\u6307\u5b9a\u3057\u305f\u30dd\u30ea\u30b4\u30f3\u304c\u5730\u56f3\u306b\u8868\u793a\u3055\u308c\u3057\u305f\u3002<br \/>\n<img decoding=\"async\" src=\"\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon01.jpg\" alt=\"\" width=\"1024\" height=\"749\" class=\"aligncenter size-full wp-image-5874\" srcset=\"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon01.jpg 1024w, https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon01-300x219.jpg 300w, https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon01-768x562.jpg 768w, https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon01-660x483.jpg 660w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<h2><span id=\"i-6\">\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u3092\u5730\u56f3\u306b\u8868\u793a\u3059\u308b<\/span><\/h2>\n<h3><span id=\"TerraMap_API\">TerraMap API\u304b\u3089\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u3092\u53d6\u5f97\u3057\u3066\u8868\u793a\u3059\u308b<\/span><\/h3>\n<p>\u4e0a\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3067GeoJSON\u3092\u6307\u5b9a\u3057\u305f\u90e8\u5206\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<br \/>\nvectorSource\u306bTerraMap API\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u308b\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30d7\u30ed\u30b0\u30e9\u30e0\u306eURL\u3092\u6307\u5b9a\u3057\u3001\u30dd\u30ea\u30b4\u30f3\u3092\u8868\u793a\u3055\u305b\u307e\u3059\u3002<br \/>\nGeoJSON\u3067\u30ec\u30b9\u30dd\u30f3\u30b9\u3055\u308c\u308b\u305f\u3081\u3001\u305d\u306e\u307e\u307evectorSource\u306b\u30bb\u30c3\u30c8\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u30b3\u30fc\u30c9\u4f8b\u3067\u306fTerraMap API\u3078\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u3064\u3044\u3066\u8a73\u7d30\u306f\u8a18\u8f09\u3057\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u6307\u5b9a\u5730\u70b9\u304b\u3089\u534a\u5f841km\u306b\u542b\u307e\u308c\u308b\u753a\u4e01\u76ee\u306e\u30dd\u30ea\u30b4\u30f3\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<hr \/>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>import '.\/style.css';\r\nimport {Map, View} from 'ol';\r\nimport TileLayer from 'ol\/layer\/Tile';\r\nimport OSM from 'ol\/source\/OSM';\r\nimport {fromLonLat} from 'ol\/proj';\r\nimport VectorLayer from 'ol\/layer\/Vector';\r\nimport VectorSource from 'ol\/source\/Vector';\r\nimport GeoJSON from 'ol\/format\/GeoJSON';\r\nimport Style from 'ol\/style\/Style';\r\nimport Stroke from 'ol\/style\/Stroke';\r\nimport Fill from 'ol\/style\/Fill';\r\n\r\n\/\/ \u30dd\u30ea\u30b4\u30f3\u306e\u30b9\u30bf\u30a4\u30eb\u3092\u8a2d\u5b9a\r\nconst styles = {\r\n\u3000'MultiPolygon': new Style({\r\n\u3000\u3000stroke: new Stroke({\r\n\u3000\u3000\u3000color: 'rgba(0, 0, 255, 0.8)',\r\n\u3000\u3000\u3000width: 2\r\n\u3000\u3000\u3000}),\r\n\u3000\u3000\u3000fill: new Fill({\r\n\u3000\u3000\u3000\u3000color: 'rgba(0, 0, 255, 0.3)'\r\n\u3000\u3000\u3000})\r\n\u3000\u3000})\r\n};\r\nconst styleFunction = function(feature) {\r\nreturn styles[feature.getGeometry().getType()];\r\n};\r\n\r\n\/\/ vectorSource\u306bTerraMap API\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u308b\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30d7\u30ed\u30b0\u30e9\u30e0\u306eURL\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\r\n\/\/ URL\u306f\u30c0\u30df\u30fc\u3067\u3059\u3002\r\nconst vectorSource = new VectorSource({\r\n\u3000url: 'https:\/\/your_domain.example.jp\/path\/to\/terramap_api_request_program',\r\n\u3000format: new GeoJSON()\r\n});\r\n\r\nconst vectorLayer = new VectorLayer({\r\n\u3000source: vectorSource,\r\n\u3000style: styleFunction\r\n});\r\n\r\nconst map = new Map({\r\n\u3000target: 'map',\r\n\u3000layers: [\r\n\u3000\u3000new TileLayer({\r\n\u3000\u3000\u3000source: new OSM()\r\n\u3000\u3000}),\r\n\u3000\u3000vectorLayer\r\n\u3000],\r\n\u3000view: new View({\r\n\u3000\u3000center: fromLonLat([139.6596281, 35.6720557]),\r\n\u3000\u3000zoom: 15\r\n\u3000})\r\n});<\/code><\/pre>\n<\/div>\n<hr \/>\n<p>\u51fa\u529b\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002\u6307\u5b9a\u5730\u70b9\u304b\u3089\u534a\u5f841km\u306b\u542b\u307e\u308c\u308b\u753a\u4e01\u76ee\u306e\u30dd\u30ea\u30b4\u30f3\u304c\u5730\u56f3\u306b\u63cf\u753b\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\n<img decoding=\"async\" src=\"\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon02.jpg\" alt=\"\" width=\"1029\" height=\"754\" class=\"aligncenter size-full wp-image-5875\" srcset=\"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon02.jpg 1029w, https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon02-300x220.jpg 300w, https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon02-1024x750.jpg 1024w, https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon02-768x563.jpg 768w, https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-content\/uploads\/2025\/03\/openlayers-openstreetmap-chouchoumokuporigon02-660x484.jpg 660w\" sizes=\"(max-width: 1029px) 100vw, 1029px\" \/><\/p>\n<div class=\"cfield\"><p><a href=\"https:\/\/www.mapmarketing.co.jp\/lp\/store-development-tool01?grid=media-erimake_bottom-cta&utm_source=mm-tips&utm_medium=referrer&utm_campaign=mm-tips-bottom-banner\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"\/mm-blog\/wp-content\/uploads\/2022\/01\/detail-bnr.png\" alt=\"\"><\/a><\/p><\/div>","protected":false},"excerpt":{"rendered":"<p>OpenLayers\u3092\u4f7f\u3063\u3066OpenStreetMap\u306b\u753a\u4e01\u76ee\u30dd\u30ea\u30b4\u30f3\u3092\u66f8\u3044\u3066\u307f\u307e\u3059\u3002 \u76ee\u6b211 \u4f7f\u7528\u3059\u308b\u3082\u306e1.1 OpenLayers1.2 OpenStreetMap(OSM)1.3 \u753a\u4e01\u76ee\u30dd\u30ea\u30b4&#8230; <a href=\"https:\/\/www.mapmarketing.co.jp\/mm-blog\/system\/openlayers-openstreetmap-chouchoumokuporigon\/\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":5875,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[171],"tags":[],"class_list":["post-5860","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-system"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/posts\/5860","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/comments?post=5860"}],"version-history":[{"count":12,"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/posts\/5860\/revisions"}],"predecessor-version":[{"id":5970,"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/posts\/5860\/revisions\/5970"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/media\/5875"}],"wp:attachment":[{"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/media?parent=5860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/categories?post=5860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mapmarketing.co.jp\/mm-blog\/wp-json\/wp\/v2\/tags?post=5860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}