Page 1 of 5

[Script] WME Split POI

Posted: Mon Nov 02, 2015 4:47 pm
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)
 

Re: [Script] WME Split POI

Posted: Mon Jul 17, 2023 12:31 am
by age4670
Thanks for the update, but the script seems to be deleting one half, rather than splitting.
 

Re: [Script] WME Split POI

Posted: Thu Apr 09, 2020 9:53 am
by AndyLaode
is it possible to split Map Comment also? I want to duplicate map comment

Re: [Script] WME Split POI

Posted: Fri Nov 06, 2015 12:16 pm
by bures
OT: And what about merge POI? It would be nice.

Re: [Script] WME Split POI

Posted: Fri Jul 14, 2017 7:27 am
by bures
bures wrote:OT: And what about merge POI? It would be nice.
Hi seb-d59. Do you've been thinking abou it?

Re: [Script] WME Split POI

Posted: Fri Mar 24, 2023 6:05 pm
by drslump34
De nouveau HS ou j'ai loupé un truc ?

Re: [Script] WME Split POI

Posted: Tue Dec 01, 2015 8:19 am
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

Re: [Script] WME Split POI

Posted: Sat Jul 15, 2023 12:36 am
by Frantzisko
Because there is no solution yet from @Sebiseba, I created the following fork to patch the incompatibility issues and added the Other category:
https://greasyfork.org/en/scripts/47086 ... t-poi-mod/

All credits to @Sebiseba for the effort of creating this script.

Feel free to share your feedback.
 

Re: [Script] WME Split POI

Posted: Wed Jan 03, 2018 8:33 pm
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);

Re: [Script] WME Split POI

Posted: Thu Jan 14, 2021 6:55 pm
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

Re: [Script] WME Split POI

Posted: Fri Jan 15, 2021 7:10 pm
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.