Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

Post Reply
Forum rules
Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

DO NOT START a new thread unless it is about a new idea. Keep discussion of existing tools within the main thread for that tool.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

[Script] WME Split POI

Post by
This script Add a button to allow you to split or cut a POI into two, with copy of the features.

His usage is limited to this POI categories:
--> Natural Features - Sea/Lake/Pool - River/Stream - Forest/Grove - Canal.

1 - Create a new segment through the POI from side to side.
Attention: only 2 points of intersection with the contour of the POI.
2 - Select POI and click the button "Split POI".
3 - Check the change, delete the new segment and save.
CutPoi.jpg
 
SplitButton.jpg
 

DOWNLOAD: from GreasyFork.org.
'''Compatible with Chrome (Tampermonkey) and Firefox (Greasemonkey)'''

Update v1.7:
- Support for all subcategories "Natural Features" (Island, Sea/Lake/Pool, River/Stream, Forest/Grove, Farm, Canal, Swamp / Marsh, Dam)
 
Last edited by seb-d59 on Sat Sep 17, 2016 6:02 am, edited 1 time in total.

Post by AndyLaode
is it possible to split Map Comment also? I want to duplicate map comment
AndyLaode
Posts: 808
Has thanked: 13 times
Been thanked: 241 times
andylaode (andylaode@outlook.com)
okay, mate, see you on the road and on the map too, cheers

Post by bures
OT: And what about merge POI? It would be nice.
bures
Waze Global Champs
Waze Global Champs
Posts: 993
Has thanked: 288 times
Been thanked: 345 times

Post by bures
bures wrote:OT: And what about merge POI? It would be nice.
Hi seb-d59. Do you've been thinking abou it?
bures
Waze Global Champs
Waze Global Champs
Posts: 993
Has thanked: 288 times
Been thanked: 345 times

Post by eclectice
I am unable to use this script...it doesn't work

I was trying to cut into two segments for Sungai Gabai river with a split segment somewhere in the middle of the map view but I couldn't.

https://www.waze.com/editor/?env=row&lo ... 56.2844627
eclectice
Localizers
Localizers
Posts: 21
Has thanked: 1 time
Been thanked: 1 time

Post by Gazoo4U
seb-d59 wrote:Update v1.7:
- Support for all subcategories "Natural Features" (Island, Sea/Lake/Pool, River/Stream, Forest/Grove, Farm, Canal, Swamp / Marsh, Dam)
Nice Script.

I've modified it to allow "Parking Lots" too. Many editors (*cough* Waze paid services *cough*) have added "parking lots" which actually encompass multiple real parking lots.

I'm pretty sure these changes should do the trick...

Code: Select all

--- /tmp/splitpoi.orig  2018-01-03 15:01:14.075473900 -0500
+++ /tmp/splitpoi       2018-01-03 15:11:11.577573400 -0500
@@ -235,7 +235,7 @@
                if (!attributes.geometry.hasOwnProperty("components"))
                  return;

-               if (!((attributes.categories == "NATURAL_FEATURES" ) || (attributes.categories == "ISLAND" ) || (attributes.categories == "SEA_LAKE_POOL") || (attributes.categories == "RIVER_STREAM" ) || (attributes.categories == "FOREST_GROVE") || (attributes.categories == "FARM" ) || (attributes.categories == "CANAL" ) || (attributes.categories == "SWAMP_MARSH" ) || (attributes.categories == "DAM" )))
+               if (!((attributes.categories == "NATURAL_FEATURES" ) || (attributes.categories == "ISLAND" ) || (attributes.categories == "SEA_LAKE_POOL") || (attributes.categories == "RIVER_STREAM" ) || (attributes.categories == "FOREST_GROVE") || (attributes.categories == "FARM" ) || (attributes.categories == "CANAL" ) || (attributes.categories == "SWAMP_MARSH" ) || (attributes.categories == "DAM" ) || (attributes.categories == "PARKING_LOT" )))
                  return;
                log("selectionManager",selectionManager);

@@ -254,14 +254,14 @@
         item=getId("landmark-edit-general");

         var attSection = getElementsByClassName("attributes-form side-panel-section", item);
-        var btnResidential = getElementsByClassName("btn-link toggle-residential",item);
-        var parent1 = btnResidential[0].parentNode;
+        var extProviders = getElementsByClassName("external-providers-view");
+        var parent1 = extProviders[0].parentNode;
         var parent = parent1.parentNode;
         var WMESP_Controle=document.createElement('Div');

         WMESP_Controle.id="WMESP-Controle";
-        WMESP_Controle.innerHTML+='<br><input type="button" id="_btnSplitPOI" class="action-button waze-btn waze-btn-white" value="Split POI"><br>';
-                   attSection[0].insertBefore(WMESP_Controle, parent);
+        WMESP_Controle.innerHTML+='<br><input type="button" id="_btnSplitPOI" class="action-button waze-btn waze-btn-white" value="Split POI"><br><br>';
+                   attSection[0].insertBefore(WMESP_Controle, parent.nextSibling); // nextSibling makes this effectively an "insertAfter"
         getId("_btnSplitPOI").onclick=SplitPOI;
     }

@@ -425,6 +425,7 @@
     clonePoiAttr.aliases = poi.attributes.aliases;
     clonePoiAttr.approved = poi.attributes.approved;
     clonePoiAttr.categories = poi.attributes.categories;
+    clonePoiAttr.categoryAttributes = poi.attributes.categoryAttributes;
     clonePoiAttr.description = poi.attributes.description;
     clonePoiAttr.externalProviderIDs = poi.attributes.externalProviderIDs;
     clonePoiAttr.houseNumber = poi.attributes.houseNumber;
@@ -446,33 +447,18 @@
     // copie du nom et mise à jour du nouveau poi

     var street = wazeModel.streets.objects[poi.attributes.streetID];
-    streetName = street.name;
+    var streetName = street.name;
+    var streetEmpty = street.isEmpty
     var cityID = street.cityID;
     var city = wazeModel.cities.objects[cityID];
+    var cityEmpty = city.attributes.isEmpty
     var stateID = wazeModel.cities.objects[cityID].attributes.stateID;
     var state = wazeModel.states.objects[stateID];
     var countryID = wazeModel.cities.objects[cityID].attributes.countryID;
     var country = wazeModel.countries.objects[countryID];
-
-    if (!street.isEmpty || !city.attributes.isEmpty){ // nok
-       var newAtts = { emptyStreet: true, stateID: stateID, countryID: countryID, cityName: city.attributes.name, streetName: streetName, emptyCity: true };
-      log ('Natural feature POI: no street name and city');
-      wazeModel.actionManager.add(new WazeActionUpdateFeatureAddress(poi, newAtts));
-               }
-               var street = wazeModel.streets.objects[clonePoi.attributes.streetID];
-    streetName = street.name;
-    var cityID = street.cityID;
-    var city = wazeModel.cities.objects[cityID];
-    var stateID = wazeModel.cities.objects[cityID].attributes.stateID;
-    var state = wazeModel.states.objects[stateID];
-    var countryID = wazeModel.cities.objects[cityID].attributes.countryID;
-    var country = wazeModel.countries.objects[countryID];
-
-    if (!street.isEmpty || !city.attributes.isEmpty){ // nok
-       var newAtts = { emptyStreet: true, stateID: stateID, countryID: countryID, cityName: city.attributes.name, streetName: streetName, emptyCity: true };
-      log ('Natural feature POI: no street name and city');
-      wazeModel.actionManager.add(new WazeActionUpdateFeatureAddress(clonePoi, newAtts));
-               }
+
+    var newAtts = { emptyStreet: streetEmpty, stateID: stateID, countryID: countryID, cityName: city.attributes.name, streetName: streetName, emptyCity: cityEmpty };
+    wazeModel.actionManager.add(new WazeActionUpdateFeatureAddress(clonePoi, newAtts));

     //log('wazeModel.actionManager = ',wazeModel.actionManager);
Gazoo4U
Posts: 50
Has thanked: 21 times
Been thanked: 33 times

Post by Horizon911
Thanks for a very practical script! A bit tricky to find it but it does its the great job. It's a shame the WME does not have this capability by default.
But I noticed one small issue:
Sometimes while splitting POIs (especially if working in low zoom levels like 0, 1, 2), WME seems to mistakenly detect an overlap (or some other issue, perhaps) and creates PUR. (Disregarding POI's lock level.) I avoid that by renaming the new POI prior an attempt to save them. (I thought that unique name could be automatically assigned by the script... e.g. by adding some universal sufix, like "(split)" or "(part)" or st. like that.)

Thanks
Horizon911
Posts: 492
Has thanked: 256 times
Been thanked: 23 times

Post by Horizon911
Hello again,
I understood that button's visibility is restricted to certain POI categories only. If it's necessary, then I've got some feature requests, if possible:
1. It would be good to have supported "Park" category.
2. It would be helping to have better handled situations, when POI has got 2 categories at the same time. For example: I've got a POI, which is "Park" as well as "Forest/Grove". Currently, the script hides Split POI button, unless user removes all 'unsupported' categories.
Horizon911
Posts: 492
Has thanked: 256 times
Been thanked: 23 times

Post by jm6087
Can you add Parking Lots to the script? They have to be split fairly often and after each update I have to edit the script to make it work.

Thanks
jm6087
Waze Global Champs
Waze Global Champs
Posts: 6889
Answers: 9
Has thanked: 688 times
Been thanked: 2182 times
Thanks,
John
US Global Champ
SCR Wiki
https://storage.googleapis.com/wazeoped ... writer.png
[
https://i.ibb.co/ZNbYyt5/RIPIain.png R.I.P. Iainhouse - Oct 21st 2021

Post by MaximKiev
Hello,

Thank you for the script. Unfortunately the button doesn't appear in POI. Mac, Chrome, Tampermonkey, category: Sea/Lake/Pool.
Снимок экрана 2020-04-08 в 10.53.35.png
(208.07 KiB) Downloaded 140 times
MaximKiev
Coordinators
Coordinators
Posts: 977
Has thanked: 161 times
Been thanked: 71 times
Community Coordinator for Morocco 🇲🇦
Country Manager: Morocco + Western Sahara

Post by moweez
MaximKiev wrote:Hello,

Thank you for the script. Unfortunately the button doesn't appear in POI. Mac, Chrome, Tampermonkey, category: Sea/Lake/Pool.
Снимок экрана 2020-04-08 в 10.53.35.png
I encountered the same, but disabling all other scripts helped... So it seems to be an interaction. Don't know yet which script interferes.
moweez
Global Champ Mentor
Global Champ Mentor
Posts: 1243
Has thanked: 504 times
Been thanked: 515 times