{"id":1232,"date":"2019-04-13T00:13:53","date_gmt":"2019-04-12T22:13:53","guid":{"rendered":"https:\/\/hannes.enjoys.it\/blog\/?p=1232"},"modified":"2019-04-13T00:14:46","modified_gmt":"2019-04-12T22:14:46","slug":"open-layers-view-tracker","status":"publish","type":"post","link":"https:\/\/hannes.enjoys.it\/blog\/2019\/04\/open-layers-view-tracker\/","title":{"rendered":"Open Layers View Tracker"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I built this last year for some research and then swiftly forgot about releasing it to the public. Here it is now:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/gitlab.com\/Hannes42\/OpenLayersViewTracker\">https:\/\/gitlab.com\/Hannes42\/OpenLayersViewTracker<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Try it online: <a href=\"https:\/\/hannes42.gitlab.io\/OpenLayersViewTracker\/\">https:\/\/hannes42.gitlab.io\/OpenLayersViewTracker\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some awful but working JavaScript code to track a website user&#8217;s interaction with a Open Layers map. You can use this to do awesome user studies and experiments.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\nRuns client-side\n<\/li><li>\nYou will get a polygon of each &#8220;view&#8221;!\n<\/li><li>\nYou can look at them in the browser!\n<\/li><li>\nThere are also timestamps! Hyperaccurate in milliseconds since unix epoch!\n<\/li><li>\nAnd a GeoJSON export!\n<\/li><li>\nThis works with rotated views!\n<\/li><li>\nWritten for Open Layers 4 using some version of JSTS, see the libs\/ directory. No idea if it works with the latest versions or if Open Layers changed their API again.\n<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Please do some funky research with it and tell me about your experiences! Apart from that, you are on your own.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There is a QGIS project with example data included. Check out the Atlas setup in the Print Layout!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\nScreenshot from a browser session<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"\/Hannes42\/OpenLayersViewTracker\/raw\/master\/docs\/screenshot.jpg?raw=true\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"500\" src=\"https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/screenshot-700x500.jpg\" alt=\"\" class=\"wp-image-1234\" srcset=\"https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/screenshot-700x500.jpg 700w, https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/screenshot-250x178.jpg 250w, https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/screenshot-768x548.jpg 768w, https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/screenshot-120x86.jpg 120w, https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/screenshot.jpg 1122w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\nResulting GeoJSON in QGIS<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"\/Hannes42\/OpenLayersViewTracker\/raw\/master\/docs\/qgis%20atlas%20example.jpg?raw=true\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"527\" src=\"https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/qgis-atlas-example-700x527.jpg\" alt=\"\" class=\"wp-image-1235\" srcset=\"https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/qgis-atlas-example-700x527.jpg 700w, https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/qgis-atlas-example-250x188.jpg 250w, https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/qgis-atlas-example-768x578.jpg 768w, https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/qgis-atlas-example-120x90.jpg 120w, https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/qgis-atlas-example.jpg 1089w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So if Time Manager supports the timestamp format you could interactively scroll around. I did not try, that plugin is so finicky.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"424\" style=\"aspect-ratio: 600 \/ 424;\" width=\"600\" controls src=\"https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/out2.mp4\"><\/video><figcaption>Replaying what I looked at in a Open Layers web map, using QGIS Atlas<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I built this last year for some research and then swiftly forgot about releasing it to the public. Here it is now: https:\/\/gitlab.com\/Hannes42\/OpenLayersViewTracker Try it online: https:\/\/hannes42.gitlab.io\/OpenLayersViewTracker\/ Some awful but working JavaScript code to track a website user&#8217;s interaction with a Open Layers map. You can use this to do awesome user studies and experiments. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,29,31],"tags":[],"class_list":["post-1232","post","type-post","status-publish","format-standard","hentry","category-cartography","category-gis","category-qgis"],"_links":{"self":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/comments?post=1232"}],"version-history":[{"count":3,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1232\/revisions"}],"predecessor-version":[{"id":1238,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1232\/revisions\/1238"}],"wp:attachment":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/media?parent=1232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/categories?post=1232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/tags?post=1232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}