[Script] WME Split POI

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.

Moderators: Unholy, bextein

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.

Re: [Script] WME Split POI

Postby Olestas » Thu Jan 21, 2016 8:07 am

Hmm.. does not seem to work.
ImageImageImageImage

GC: Latvia
Coordinator: Latvia
Country manager (Full coverage): Latvia/Lithuania/Belarus/Russia/Ukraine
Olestas
Coordinators
Coordinators
 
Posts: 5984
Joined: Wed Mar 09, 2011 7:08 pm
Location: Latvia
Has thanked: 2989 times
Been thanked: 2158 times

Re: [Script] WME Split POI

Postby Olestas » Fri Nov 06, 2015 12:13 pm

Could be useful. Thanks.
ImageImageImageImage

GC: Latvia
Coordinator: Latvia
Country manager (Full coverage): Latvia/Lithuania/Belarus/Russia/Ukraine
Olestas
Coordinators
Coordinators
 
Posts: 5984
Joined: Wed Mar 09, 2011 7:08 pm
Location: Latvia
Has thanked: 2989 times
Been thanked: 2158 times

Re: [Script] WME Split POI

Postby Gazoo4U » Wed Jan 03, 2018 8:33 pm

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);
Kelley Cook a.k.a. Gazoo4U
Image
Gazoo4U
 
Posts: 50
Joined: Sun Apr 13, 2014 1:05 am
Has thanked: 23 times
Been thanked: 33 times

Re: [Script] WME Split POI

Postby eclectice » Tue Dec 01, 2015 8:19 am

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: 20
Joined: Tue Nov 13, 2012 4:41 am
Has thanked: 1 time
Been thanked: 3 times

Re: [Script] WME Split POI

Postby bures » Fri Jul 14, 2017 7:27 am

bures wrote:OT: And what about merge POI? It would be nice.

Hi seb-d59. Do you've been thinking abou it?
ImageImage
Jirka Bureš
bures
Waze Global Champs
Waze Global Champs
 
Posts: 873
Joined: Mon Jun 27, 2011 1:38 pm
Location: Holešov
Has thanked: 524 times
Been thanked: 396 times

Re: [Script] WME Split POI

Postby bures » Fri Nov 06, 2015 12:16 pm

OT: And what about merge POI? It would be nice.
ImageImage
Jirka Bureš
bures
Waze Global Champs
Waze Global Champs
 
Posts: 873
Joined: Mon Jun 27, 2011 1:38 pm
Location: Holešov
Has thanked: 524 times
Been thanked: 396 times

Previous

Return to Addons, Extensions, and Scripts

Who is online

Users browsing this forum: AProdzilla, BenEnmen, JimboBaggins1966, MapOMatic, sketch, tonestertm