<div class="osm_error_msg"><p><strong style="color:red">[OSM-Plugin-Error]:file_color_list invalid: ../../../../sorabji/wp-content/uploads/osm_maps/jul_30_2020_7_51_35_am.kml</strong></p></div>

{"id":25574,"date":"2020-08-12T19:29:45","date_gmt":"2020-08-12T23:29:45","guid":{"rendered":"https:\/\/wsbj.com\/sorabji\/?p=25574"},"modified":"2020-08-12T20:30:44","modified_gmt":"2020-08-13T00:30:44","slug":"cracked-the-code","status":"publish","type":"post","link":"https:\/\/wsbj.com\/sorabji\/2020\/08\/12\/cracked-the-code.html","title":{"rendered":"Cracked the Code."},"content":{"rendered":"<p>So this is how you get individual .KML maps into WordPress&#8217;s OSM plugin. Far from intuitive but I&#8217;ll take it. I managed to create a map like this once on <a href=\"http:\/\/www.payphone-project.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">the Payphone site<\/a> but one day it crapped out and I never figured out why.<\/p>\n<p>This is my wander from July 30, when I walked from home to Hell&#8217;s Kitchen looking for PRAY. I want the purple tracker line to be less fat but I&#8217;ll get to that some other time.<\/p>\n<p>Another thing the OSM plugin does not seem to do is calculate mileage. This one was all of 16.54 miles.<\/p>\n<link rel='stylesheet' id='all-css-3270287fb3d5c6901d09b0fcc3a6447f' href='https:\/\/wsbj.com\/sorabji\/wp-content\/boost-cache\/static\/a9a1e5338e.min.css' type='text\/css' media='all' \/>\n<script data-jetpack-boost=\"ignore\" type='text\/javascript' src='https:\/\/wsbj.com\/sorabji\/wp-content\/boost-cache\/static\/17ddee82e5.min.js'><\/script>\n<script data-jetpack-boost=\"ignore\" id=\"jquery-core-js\" src=\"https:\/\/wsbj.com\/sorabji\/wp-includes\/js\/jquery\/jquery.min.js?ver=3.7.1\"><\/script>\n<script data-jetpack-boost=\"ignore\" id=\"osm-map-startup-js-extra\">\nvar translations = {\"openlayer\":\"open layer\",\"openlayerAtStartup\":\"open layer at startup\",\"generateLink\":\"link to this map with opened layers\",\"shortDescription\":\"short description\",\"generatedShortCode\":\"to get a text control link paste this code in your wordpress editor\",\"closeLayer\":\"close layer\",\"cantGenerateLink\":\"put this string in the existing map short code to control this map\"};\n\/\/# sourceURL=osm-map-startup-js-extra\n<\/script>\n<script data-jetpack-boost=\"ignore\" type='text\/javascript' src='https:\/\/wsbj.com\/sorabji\/wp-content\/boost-cache\/static\/3a08fd3e94.min.js'><\/script>\n\n        <div id=\"map_ol3js_1\"\n       class=\"osm-map-container undefined\"\n             data-map_name=\"undefined\"\n             data-map=\"map_ol3js_1\"\n             data-autoshow=\"no\"\n             style=\"width:100%;\n                    max-width:100%;\n                    height:450px;\n                    display:block;\n                    overflow:hidden;\n                    border:2px solid grey;\n                    position: relative;\">\n          <div id=\"map_ol3js_1_popup\" class=\"ol-popup\">\n            <a href=\"#\" id=\"map_ol3js_1_popup-closer\" class=\"ol-popup-closer\"><\/a>\n            <div id=\"map_ol3js_1_popup-content\"><\/div>\n          <\/div>\n        <\/div>\n    <script data-jetpack-boost=\"ignore\" type=\"text\/javascript\">\n\t\t\t  vectorM['map_ol3js_1'] = [];\n\t        \n        var raster = getTileLayer(\"osm\",\"NoKey\");\t\t\t\n\n\t\t\t  var map_ol3js_1 = new ol.Map({\n\t\t\t\tinteractions: ol.interaction.defaults.defaults({mouseWheelZoom:true}),\n\t\t\t\tlayers: [raster],\n\t\t\t\ttarget: \"map_ol3js_1\",\n\t\t\t\tview: new ol.View({\n\t\t\t\t  center: ol.proj.transform([6.378,58.213], \"EPSG:4326\", \"EPSG:3857\"),\n\t\t\t\t  zoom: 9\n\t\t\t\t})\n\t\t\t  });\n\t\t\t  \n    var style_map_ol3js_1_0 = {\n      \"Point\": [new ol.style.Style({\n\n          image: new ol.style.Icon({\n            anchor: [0.5, 41],\n            anchorXUnits: \"fraction\",\n            anchorYUnits: \"pixels\",\n            opacity: 0.75,\n            src: \"https:\/\/wsbj.com\/sorabji\/wp-content\/plugins\/osm\/icons\/mic_blue_pinother_02.png\"\n          })\n      })],\n\n      \"LineString\": [new ol.style.Style({\n        stroke: new ol.style.Stroke({\n          color: \"blue\",\n          width: 8\n        })\n      })],\n      \"MultiLineString\": [new ol.style.Style({\n        stroke: new ol.style.Stroke({\n          color: \"blue\",\n          width: 4\n        })\n      })]\n    };\n\t\t  vectorL0 = new ol.layer.Vector({\n\n\t\t\tsource: new ol.source.Vector({\n\t\t  url:\"..\/..\/..\/..\/sorabji\/wp-content\/uploads\/osm_maps\/Jul_30_2020_7_51_35_AM.kml\",\n\t\t\t  format: new ol.format.KML({ showPointNames: false})\n\t\t\t}),\n         zIndex: 92\n\t\t  });map_ol3js_1.addLayer(vectorL0);\n      var extension1 = ol.extent.createEmpty();\n      var curZoom1 = map_ol3js_1.getView().getZoom();\n\n      map_ol3js_1.getLayers().forEach(function(layer){\n         if(!layer.get(\"id\")) {     \n            layer.once(\"change\", function(e){\n               ol.extent.extend(extension1, (layer.getSource().getExtent()));\n               map_ol3js_1.getView().fit(extension1, {padding: [50, 50, 50, 50]});\n            });\n         }\n      });\n\n    \naddControls2Map(map_ol3js_1,0,0,3,0,5,6,7,1,1);\nosm_addPopupClickhandler(map_ol3js_1,  \"map_ol3js_1\"); \nosm_addMouseHover(map_ol3js_1); <\/script>\n","protected":false},"excerpt":{"rendered":"<p>So this is how you get individual .KML maps into WordPress&#8217;s OSM plugin. Far from intuitive but I&#8217;ll take it. I managed to create a map like this once on the Payphone site but one day it crapped out and I never figured out why. This is my wander from July 30, when I walked [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":25599,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[2,18],"tags":[],"class_list":["post-25574","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-181-2","category-maps","et-has-post-format-content","et_post_format-et-post-format-standard"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/wsbj.com\/sorabji\/wp-content\/uploads\/2020\/08\/Screenshot_20200730-165139_Geo-Tracker-1-scaled.jpg?fit=2560%2C1245&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paumAn-6Eu","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/posts\/25574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/comments?post=25574"}],"version-history":[{"count":26,"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/posts\/25574\/revisions"}],"predecessor-version":[{"id":28291,"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/posts\/25574\/revisions\/28291"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/media\/25599"}],"wp:attachment":[{"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/media?parent=25574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/categories?post=25574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wsbj.com\/sorabji\/wp-json\/wp\/v2\/tags?post=25574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}