[Script] WME Street View Availability (2.1.1)

WME userscript that shows where you can expect to find Street View imagery. The information provided is quite basic, but this is all that is readily available to show.
Additionally, this script shows the month on which this Street View imagery was acquired.

How to use

Whenever you drag the Street View marker in the map editor, blue lines indicating where Street View imagery is available will appear. It is also possible to bring up these lines with the keyboard shortcut Shift+T.

If you wish to modify how transparent the lines are, you can use this bookmarklet with version 0.3 to change your preference (default: 100% visible):

javascript:localStorage.WME_StreetViewAvailability=JSON.stringify({opacity:prompt('Give a percentage between 0 and 100',100)/100});W.map.getLayersByName('Street View')[0].setOpacity(JSON.parse(localStorage.WME_StreetViewAvailability).opacity);

Installation instructions
> TL;DR: install as most other WME userscripts from Greasy Fork: INSTALL USERSCRIPT

Userscripts are snippets of code that are executed after the loading of certain webpages. This script does this after the loading of the Waze Map Editor. In order to run userscripts in your browser, you are adviced to use Firefox or Google Chrome.

You will need to install an add-on that manages userscripts for this to work. There’s TamperMonkey for Firefox and Chrome.

These add-ons will be visible in the browser with an additional button that is visible to the right of the address bar. Through this button it will be possible to maintain any userscripts you install.

For WME Street View Availability, you should be able to install the script at Greasy Fork. There will be a big green install button which you will have to press to install the script.
When installing userscripts always pay attention to the site(s) on which the script runs. This script only runs on Waze.com, so other sites will not be affected in any way.

After installing a userscript, you will be able to find it working on the site(s) specified. Do note that if you had the page open before installing the userscript, you will first need to refresh the page.

TamperMonkey will occasionally check for new versions of these scripts. You will get a notification when a new version has been found and installed.

Feedback and suggestions
Any issues found can be reported in this forum or directly on the GitHub project page.

2 Likes

This is awesome! Thank you!!! :smiley: :smiley: :smiley:

Wow… just works :smiley:

Great script!

Thanks! I’ve been trying to think of things I could do to improve it further, but the code is very concise right now and I don’t think any additional features are really necessary.

I could make sure the layer is placed exactly on top of the roads layer, but I can’t say I’ve encountered any issues with that myself so far. The loading of the script could produce less noise in the console, but that’s not really an issue, I’d say. The only thing I’ve noticed myself is that the availability layer disappears once you pan the map so the street view marker moves out of sight. But fixing those kinds of things will take me longer than what it’s worth.

This is just great, thanks for coming up with it!

Is there any chance the relative age of the available SV could be reflected in the lines? Maybe thickness or transparency, or color, or…? This could make looking for the most recent imagery in a given location apparent before dropping the lens.

Sadly enough I don’t receive that sort of information from that service. All I get are images like this one containing those lines. I can’t infer any additional information from that, I’m afraid. I’ve been trying to adjust the style, but none of those attempts succeeded.

Note: I’ve just released version 0.2 of the script. There are no functional changes in this release.
I’ve added a script icon and instead of getting all the images from the same server at Google, the script now randomly chooses one of the four servers available to distribute the requests.

Thank you for trying! As a personal preference, it would be great if the opacity could be reduced even just slightly, but it’s fine as-is too.

The opacity is something I can change. I’m personally happy with the opacity, but if you want to, you can experiment with this yourself with this bookmarklet:

javascript:Waze.map.getLayersByName('Street View')[0].setOpacity(prompt('Give a value between 0 and 100', 100) / 100);

It’ll allow you to enter a value between 0 and 100 (percent) to change the opacity of the layer. I don’t think anything under 80% is desirable though.

I’ve just released version 0.3. This version makes it possible to set the opacity of the lines to any value you want and stores it over sessions. As I think not too many people will be using this option, I just created a simple bookmarklet for this instead of adding it to the settings menu:

javascript:localStorage.WME_StreetViewAvailability=JSON.stringify({opacity:prompt('Give a percentage between 0 and 100',100)/100});Waze.map.getLayersByName('Street View')[0].setOpacity(JSON.parse(localStorage.WME_StreetViewAvailability).opacity);

Wow … just it works.

It’s a great script thank you very much, it helps a lot in the time to look SV available.

Besides, it helps to find 360 photos on the map. They are highlihted with blue dot.

I’ve also encountered some orange dots. I think those are 360° photos of places. Or maybe they’re standalone photos, while the blue ones are somewhat connected like street view.

Excellent, nice job!

Excellent!!! tested and approved :wink:

Perfect, it helps a lot to edit before I had to look up the road had street view.

it is a very good script

i wonder if it too much to ask.

is it possible to check street view availability without having street view window open?

currently my work around is to right click the street view button on chrome, click inspect,

and change this one

<div class="street-view-control" data-original-title="" title="" style="display: block;"></div>

and set the display to none…

by doing that i am able to browse the map with this script on without having the street view window open.

An alternative solution would be this bookmarklet that toggles the visibility of the layer:

javascript:(function(){var l = Waze.map.getLayersByName('Street View Availability')[0]; l.setVisibility(!l.getVisibility());})();

As a more permanent solution I could make it so that the layer gets shown in the list of layers in the dropdown menu in the top right, but then I’ll need to think about what should happen when the street view window is closed. Do I hide the layer again? Do I keep it open because it was opened manually in the layers box? I’ll also need to make sure the layer is visible again when you refresh the window.
But all that isn’t that difficult any more. I’ve done that in other scripts before.

gees, Tom…

you are the best

thank you for the bookmarklet. it works like a charm

I modified your code, adding a little button to control visibility :smiley: ;

//...
    if (typeof Waze === 'undefined' || typeof Waze.map === 'undefined') {
      setTimeout(init, 660);
      log('Waze object unavailable, map still loading');
      return;
    }
/* start */
      var userBox = document.getElementById('user-box');      
      if (userBox == null) {
          setTimeout(init, 400);
          log('User Box unavailable, retrying in 400ms');
          
      } else {
          try {
          var sheet = document.styleSheets[0];
          if (!sheet){
              sheet=document.createElement("style");
              document.head.appendChild(sheet);
              sheet = sheet.sheet;
          }
              sheet.insertRule('#SVAvailabilityControl {background: blue; color: white; cursor: default; font-weight: bold; padding: 0px 3px; position: absolute; right: 5px; top: 5px;}', sheet.cssRules?sheet.cssRules.length:0);
              sheet.insertRule('#SVAvailabilityControl.visible {background: darkblue;}', sheet.cssRules?sheet.cssRules.length:0);
          } catch(s) {console.error("WME Street View Availability could not register styles", s);}
          var btnSVA = document.createElement('DIV');
          btnSVA.innerHTML = "SVA";
          btnSVA.title = "WME Street View Availability Control";
          btnSVA.id = "SVAvailabilityControl";
          btnSVA.onclick = function(){
              var l = Waze.map.getLayersByName('Street View Availability')[0]; 
              l.setVisibility(!l.getVisibility());
              btnSVA.className = l.getVisibility()?"visible":"";
          };
          userBox.appendChild(btnSVA);
      }
/* end */
    var tilelayerServers = [
      'https://mts0.google.com/mapslt',
      'https://mts1.google.com/mapslt',
      'https://mts2.google.com/mapslt',
      'https://mts3.google.com/mapslt'
    ];
//...