WME OpenMaps

Add additional layer containing maps that are released as open data to Waze Map Editor

目前為 2015-10-24 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name WME OpenMaps
  3. // @namespace http://www.tomputtemans.com/
  4. // @description Add additional layer containing maps that are released as open data to Waze Map Editor
  5. // @include https://www.waze.com/*/editor/*
  6. // @include https://www.waze.com/editor/*
  7. // @include https://editor-beta.waze.com/*
  8. // @version 1.0
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. function omInit() {
  14. // Check initialisation
  15. if (typeof Waze == 'undefined' || typeof Waze.map == 'undefined') {
  16. setTimeout(omInit, 660);
  17. log('Waze object unavailable, map still loading');
  18. return;
  19. }
  20. log('OM initated');
  21.  
  22. var geopunt = new OL.Layer.WMS('Geopunt GRB',
  23. 'https://grb.agiv.be/geodiensten/raadpleegdiensten/GRB/wms',
  24. { layers: "GRB_Basiskaart" }
  25. );
  26. Waze.map.addLayer(geopunt);
  27. Waze.map.events.register('zoomend', null, function() {
  28. geopunt.redraw();
  29. });
  30. }
  31.  
  32.  
  33. function log(message) {
  34. if (typeof message === 'string') {
  35. console.log('OM: ' + message);
  36. } else {
  37. console.log('OM', message);
  38. }
  39. }
  40.  
  41. // attempt to bootstrap after about a second
  42. log('OM bootstrap set');
  43. setTimeout(omInit, 1020);
  44. })();