As I fight to convert areas from old mapping standard roads to FC mapping standards,
I was wondering how difficult it would be to ‘recolor’ the roads on the map so that
the colors ‘match’ the US FC maps colors for the equivalent types of WAZE map types.
objective: make the WAZE map, if properly configured, MATCH the FC map. That way, a quick glance at an area should show which segments need to be fixed.
optionally add ‘grey scale density variations’ to the ‘white types’ so that they are easy to distinguish from each other ‘at a glance’.
Not sure if this would be best done as options in Color Highlights or a separate extension.
It would not account for US and state highways, although this could be programmed in for each state too.
Believe, though, that if I knew how to write one of these things, I would be all over this.
Given sketch’s comments, I’m not sure I’m ready to entirely take this on, but there are a couple caveats I’d mention before going further with it.
Highlights merely overlays a colour, with a degree of transparency. I don’t believe we can recolour the roads – though we might be able to put some colour overtop to get it close to the FC map colours. Alternatively, we don’t set transparency, and it blocks out street names…
I’m also assuming you mean that it basically colours the Waze map to match the colour scheme on the FC map, let’s start with one state – if you get me the colours (in HTML #xxxxxx format), I can look at making something simple (it would be a separate script) that adds that overlay. Once we have it working for one state, we could look at expanding it out.
Oh, some other hurdles: it’s not a 1:1 match from type to class; a Waze Freeway can be in FC either Interstate or Other Freeway, for example. Also, some states color rural classes differently than urban (others use the same colors, but dashed lines, which is no big deal).
Without further ado, here are the colors for two sample states – Louisiana and Michigan
Louisiana
Freeway: #007aff (Interstate) and #ffba00 (Fwy/Exp)
Major Highway: #ff3511 (Principal Arterial)
Minor Highway: #39ad00 (Minor Arterial)
Primary Street: #be3eec (Major Collector) and #ffff3e (Minor Collector)
Michigan
Freeway: #1474fb (Interstate) and #a821e3 (Other Freeway)
Major Highway: #f73723 (Other Principal Arterial)
Minor Highway: #885a46 (Minor Arterial)
Primary Street: #fda929 (Major Collector) and #3da61c (Minor Collector)
Not sure what to do about FW and PS; maybe two alternating colors?
Is WMECH open-source? I imagine it shouldn’t be terribly difficult to modify it for this purpose. Not saying you should, of course, as it would be useless to you But I wouldn’t mind at least taking a look at it. I have very little idea what I’m doing, but I adapt quickly
There’s no licence on my code, so you’re free make a copy of it if you wish (as many other people have).
However, the way my script adds the colour is rather hacky and out-dated, as it modifies existing invisible line objects that WME created for hovering and selecting. The better (proper) method would be to create a completely new layer (which appears in the layer selection panel), and draw new line objects for all of your roads. This is how Validator highlights roads, which is much neater than my hacky method. (I looked at changing WMECH to use it’s own layer, but it was too much work).
Have a look at my Route Checker script for some simple code that adds line objects to a layer.
There’s a lot to do to make this script work for FC though:
Create a new OL.Layer.Vector during initialisation
Iterate through Waze.segments.objects and extract the geometry.components from each
Figure out the appropriate segment colour for the segment by reading attributes.roadType
Create a new OL.Geometry.LineString and add it to the layer
Add listeners for mergeend and zoomend events and add new segments to the layer
Add labels to some of the segments, but not all of them. Maybe based on length and zoom Tip: explore the properties of an object by selecting something in the editor, and typing this line into the developer console. You’ll want to look at the attributes and the geometry:
Ah, well that’s outside of my pay grade I didn’t realize WMECH highlights went away when the road layer went away. I agree the best way would be to show highlights with the road layer off, like Validator does. Thanks!
I’m going to take this opportunity to get a little defensive at this comment.
I offered to look into this, in addition to everything else I’m doing in the Waze ecosystem. That includes being the only active Global Champ for a country larger than the US, and one of only a half-dozen country managers for said country. We’re trying to build the community, and that is taking most of my Waze-cycles.
I don’t mind doing stuff like this – but it’s my “fun” time. AND… coding in JavaScript is about as enjoyable for me as pulling fingernails out… that said, the product of this type of work tends to be rewarding – it takes 1000 failures to get one partial success.
Seems to be working pretty well. Of course, now that the hard part is over, the tedious part is next — adding the right colors per state!
One weird thing I noticed: if you sit in one spot and activate/deactivate the script (using the sidebar checkbox), it doesn’t do anything with ramps unless you (1) mouse over them or (2) zoom the map. All the other types show/hide with the checkbox. Odd!
I’ve noticed the same thing as sketch regarding the ramps. Also, a selected segment looses its’ blue color just leaving the geometry nodes and the underlying color. This happens whether checkbox is selected or not.
Thank you for this script. I am sure that when a few kinks are worked out and some of us are educated in the proper use, it will be very useful!
I am currently trying to figure out how to get it to work and how to use it.
When I activate or deactivate the roads flash briefly with the highlight colors but go back to ‘default’ immediately.
If I turn off roads and activate/deactivate I get a brief glimpse of the FC’d colored segments.
Am I missing some magic words or arcane gestures?
When active, selected segments disappear except for their end points.
When active, ‘shift-r’ no longer toggles the roads layer. It must be turned on and off with the cursor.
Actions change when I pick a different ‘left bar function’ (like I go to ‘Me’ and go back to FC) or I alt tab to the forum window and then back to WME.
Now it is ‘flashing’ FC roads and the ‘shift-r’ is working.
Flashing continues even when I uncheck the FC roads enable box.
I probably should have mentioned that the most straightforward way to use this is actually to disable the road layer – the underlying colours will cause confusion.
At the moment, I’d recommend only using this to verify things – due to it’s lack of coexistence with WMECH and some of these bugs, it really isn’t something to leave enabled all the time.
Perhaps Timbones and I can work out a way to collaborate together into WMECH, and perhaps just have this functionality built-in to that script…