Git Product home page Git Product logo

wme-image-overlays's Introduction

WME Image Overlays

This userscript augments the Waze Map Editor by adding the capability to overlay a local image onto the map. This makes it possible to accurately draw roads that aren't available yet on satellite imagery.

How to use

Image Overlays Interface

The script adds a new tab where you can add new images to the map and find the current list of images already on the map. When adding a new image, you can choose a local file or paste an image from your clipboard. Once you've properly aligned the image and pinned it to the map, it will be stored locally on your computer for future use.

Installation instructions

TL;DR: install as most other WME userscripts from its Greasy Fork page: INSTALL IMAGE OVERLAYS

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 is 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 Image Overlays, 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 at the GitHub project page or in this forum thread.

wme-image-overlays's People

Contributors

dbsooner avatar glodenox avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dbsooner

wme-image-overlays's Issues

Sort images in a specified way

A suggestion was made to provide a system to sort the images alphabetically. While this is possible, I think it would make more sense to just always sort them alphabetically. People will generally not add images in a specified order, so that seems like a safe thing to do.

If we do want to go in the direction of more functions, it would be possible to sort the images in several ways that I can think of straight away:

  • By date added
  • By name
  • By distance from current position
  • By size (big to small, small to big)

But all that probably requires several changes to the UI, partially also to surface some data that isn't shown at the moment.

Waze Editor bug? (this.setLayerZIndex is not a function)

vendor-93d30041d65a17892c34.js:1 Uncaught TypeError: this.setLayerZIndex is not a function
    at t.setLayerIndex (vendor-93d30041d65a17892c34.js:1)
    at HTMLImageElement.eval (userscript.html?id=919394a0-b527-4027-844c-2ad4bb8addeb:781)

And the "formatted" code from vendor.js:

        setLayerIndex: function(e, t) {
            var n = this.getLayerIndex(e);
            if (t < 0 ? t = 0 : t > this.layers.length && (t = this.layers.length),
            n != t) {
                this.layers.splice(n, 1),
                this.layers.splice(t, 0, e);
                for (var r = 0, i = this.layers.length; r < i; r++)
                    this.setLayerZIndex(this.layers[r], r); << Broken
                this.events.triggerEvent("changelayer", {
                    layer: e,
                    property: "order"
                }),
                this.allOverlays && (0 === t ? this.setBaseLayer(e) : this.baseLayer !== this.layers[0] && this.setBaseLayer(this.layers[0]))
            }
        },

Images tend to disappear once you've added several

Due to the way IndexedDB tries to prevent websites from filling one's hard disk with binary data, it may sometimes occur that images get removed without any user interaction.

For this reason it would be better to store the image location and metadata in Local Storage instead and have a reference to the image blob in IndexedDB. This allows the user to restore the image again later on should IndexedDB decide to remove an image.

An investigation should be made to see whether it is possible to receive a notification or some indication on when and why an image gets removed as usually this should require an IndexedDB instance that takes up a decent percentage of the disk storage space (based on the documentation, at least).

Support more image formats

Images stored in the formats ECW and TIFF can store their geographical data. It would be nice if we could extract such information from those image formats and display them as well. Sadly enough these image formats are not supported by browsers, so displaying these would be very complicated.

Allow fast hiding of the image while it is being added

While working with the opacity during the addition of an image can get you very far, some users also want to be able to temporarily hide the image. It is probably best to add a button to the controls that allows you to quickly toggle this.

Show a warning when certain types of map layers are located "above" the image

It sometimes happens that other userscripts add map layers that are positioned above the image. This can be solved by adjusting the parent layer of that image, but this is not always as easy to see for the user.

An event listener could be added to the "layeradded" event of the map which will check whether any such layers are located above the currently active image. If so, it could show a small warning message in the tab indicating this potential issue and how to solve this.

Allow export of one or more overlays

By allowing an export, it becomes possible to share overlays and allows people to make a backup of their configuration (which apparently isn't a bad idea as the IndexedDB doesn't seem to be too stable in some browsers).

Don't move the map if the image is overlay already visible at the current location

It is not needed to move and zoom the map if the image overlay is already visible in the viewport whenever the overlay is activated.

Consider adding a crosshairs button as well that only shows up whenever people hover over the image entry. Perhaps just hide all action buttons until that happens. Might be a bit impractical on mobile devices though (also listen to :activeevent?)

Allow turning certain colours transparent when inserting image

It should be possible to allow users to remove certain colours so those areas become transparent. By using a canvas element instead of a regular img tag, this might indeed be possible. See https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Pixel_manipulation_with_canvas

Things to consider: this can currently already be done with external image editing software. Implementing this is not trivial, especially from a UX standpoint. This would also certainly require a way to undo changes while editing and the odds are high that once this gets added, other features will be requested that are already available within image editing software.

Allow adjusting the anchor point when editing an overlay image

Currently all modifications you make to the image overlay are calculated from the centre of the image. It would be practical if you could adjust this so you would lock one corner so all edits happen from that corner. I'll have to whip out the goniometric calculations again to also support rotated images, as the rotation is currently applied as the last step and not actually accounted for in the extent.

Maybe release in two phases: one without support for rotated images (but with a message saying so if rotation mod 90 != 0) and a second phase with the full support.

Support URL input for images

As an alternative to storing images in the IndexedDB, it would also be possible to accept an URL to the image and use that to display the image. This requires less storage, but might result in problems later should the image get removed at its source location.

Allow resizing with drag handles

Instead of working with buttons, it would be nicer if it was possible to stretch and move overlays with dragging handles. This should be possible with OpenLayers controls.

Support mass export and import

It would be nice to able to export more than one layer at a time. Ideally, this would be in a zip file (see https://github.com/Touffy/client-zip maybe), but otherwise it could be a huge JSON as well.

Preferably, make it possible for people to select which layers to export instead of just all of them. That would allow people to share projects with multiple images amongst each other.

Add an indication if an image was never exported

Probably something to be made optional, but it is probably a best practice to always have an export of all mapped images. Maybe it would be an idea to show a small warning icon if a mapped image was never exported? And also show this icon again if changes were made locally?

Obviously, this should not be shown if a user imported the mapped image.

The main purpose of this feature would be to have a backup of all mapped images in case you accidentally clear the cache or if your browser data becomes corrupted.

Data sources notification message might not display completely on small screens

Due to the absolute styling applied to the warning message about the permitted data sources, the scrollbar style of the sidebar isn't doing its thing whenever the contents overflow. This causes the accept button to be invisible until people zoom out. A simple addition of scroll:auto to this message will probably fix this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.