Original Street View colors without Google API Key
Street View is a good tool, which can be incorporated into your own interactive maps like Leaflet or OpenLayers. Unfortunately, since 2018 Google hasn’t served it for free. In turn, the Google Maps products can’t be set up properly, because you can see the “For development purposes only” information along with the poor quality of the map and Street View. Maps appear darker than usual and Street View is displayed on a negative scale. The current pricing for Google Maps can be found here. Maybe it’s not a huge amount to pay, but if you don’t want to do it, you probably won’t need to. In this short post, I would like to show you how to get over (at least partially) the negative scale of the Street View. You will still see the message “For development purposes only”, but your Street View won’t be negative anymore.
The issue lies in the CSS code included in the Street View implementation. In the OpenLayers example, this implementation includes 2 files, the .js and the .css one, which look pretty much like this:
<link rel="stylesheet" href="ol-street-view.css" /> <script src="ol-street-view.js"></script>
and our alteration can be done in the .css file.
We should find the section, which defines our Street View panorama toggleable on our map. Next, just adding the filter argument and invert function should solve our problem.
#ol-street-view--panorama {
display: none;
background-color: #555555 !important;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
-o-user-select: none;
/*-webkit-filter: invert(1);*/
filter: invert(1);
}
.ol-street-view--activated #ol-street-view--panorama {
position: relative;
width: 100%;
height: 100%;
display: block;
border-bottom: 3px solid #222222;
/*-webkit-filter: invert(1);*/
filter: invert(1);
}
On the other hand, all the Street View options will be negative this time (Zoom, compass, address) but it’s only a minor thing. The landscape captured by the Street View camera won’t be negative anymore.
Mariusz Krukar
Links:
- https://www.plugandplaydesign.co.uk/google-maps-for-development-purposes-only-error/
- https://developers.google.com/maps/documentation/javascript/streetview
- https://www.adoclib.com/blog/google-maps-shows-for-development-purposes-only.html
- https://tsh.io/blog/time-of-transition-what-are-the-google-maps-api-alternatives/
- https://www.eliassonmarketing.com/google-maps-api-what-you-need-to-know/
- Street View – coding library example – negative view
- Google Street View with negative colors – standalone version
- Google Maps Platforrms FAQ
- https://mapsplatform.google.com/pricing/
- https://rapidapi.com/blog/how-to-get-google-maps-api-key-free-tutorial/
- https://github.com/GastonZalba/ol-street-view
- https://gist.github.com/crofty/2197042
- https://mapsplatform.google.com/pricing/
- https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/invert()
Forums:
- https://stackoverflow.com/questions/13325798/invert-colors-of-an-image-in-css-or-javascript
- Py4u.net: Google Maps shows “For development purposes only”
- Support.ruckuswireless.com: Dashboard cannot load Google map correctly – Google Map API key
Youtube: