// ==UserScript==
// @name WME Data Store
// @author davielde
// @description Store objects when panning the map to compile lists for export (i.e. cities, places, segments)
// @include https://www.waze.com/editor/*
// @include https://www.waze.com/*/editor/*
// @include https://editor-beta.waze.com/*
// @version 0.6.0
// @grant none
// @namespace https://greasyfork.org/users/5252
// ==/UserScript==
function bootstrapDS()
{
var bGreasemonkeyServiceDefined = false;
try {
bGreasemonkeyServiceDefined = (typeof Components.interfaces.gmIGreasemonkeyService === "object");
}
catch (err) { /* Ignore */ }
if (typeof unsafeWindow === "undefined" || ! bGreasemonkeyServiceDefined) {
unsafeWindow = ( function () {
var dummyElem = document.createElement('p');
dummyElem.setAttribute('onclick', 'return window;');
return dummyElem.onclick();
}) ();
}
setTimeout(initializeDS, 2000);
}
function replaceCommas(commaString){
var noCommaString = "";
(commaString == null ? "" : noCommaString = commaString.replace(/,/g, '.')); //commas with period
var fullyFilteredString = noCommaString.replace(/[\n\r]/g, ' '); //new lines and carriage returns with space
return fullyFilteredString;
}
function epsg900913to4326(init900913){
var transformedTo4326 = init900913.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));
return transformedTo4326;
}
function showWDSCanvas(){
var canvasWDS = document.getElementById('canvasWDS');
canvasWDS.style.visibility = 'visible';
}
function hideWDSCanvas(){
var canvasWDS = document.getElementById('canvasWDS');
canvasWDS.style.visibility = 'hidden';
}
function fillWDSCanvas(segmentStats,segObj){
var currentUser = Waze.loginManager.user.userName;
var segmentUserProportion = Math.round(((segmentStats.segmentCount == 0 ? 0 : segmentStats.editorCountTemp[currentUser] / segmentStats.segmentCount) * 100)*10)/10;
console.log('WME Data Store: filling canvas with new data');
var canvasWDS = document.getElementById('canvasWDS');
canvasWDS.style.backgroundColor = 'Transparent';
var ctx=canvasWDS.getContext("2d");
ctx.rect(0, 0, canvasWDS.width, canvasWDS.height);
var canvasWDSBackground = ctx.createRadialGradient(250, 40, 5, 250, 60, 400);
canvasWDSBackground.addColorStop(0, 'White');
canvasWDSBackground.addColorStop(1, 'LightBlue');
ctx.fillStyle = canvasWDSBackground;
ctx.fill();
ctx.fillText("",10,50);
ctx.font="10px Arial";
ctx.fillStyle = 'Black';
ctx.fillText('Last Segment Update: ' + segmentStats.lastSegmentUpdate,10,50);
ctx.fillText('Last Segment Updated By: ' + segmentStats.lastSegmentUpdateUser,10,70);
ctx.fillText('Segment Count: ' + segmentStats.segmentCount,10,90);
ctx.fillText('Segment Updates by ' + currentUser + ': ' + segmentStats.editorCountTemp[currentUser] + ' (' + segmentUserProportion + '%)',10,110);
}
function getWMEData(){
var locale = I18n.locale;
var zoom = Waze.map.zoom;
var cityLabel = I18n.translations[locale].layers.name.cities;
var venueLabel = I18n.translations[locale].layers.name.landmarks;
var segmentLabel = I18n.translations[locale].layers.name.segments;
var venueImageBucketUrl = Waze.Config.venues.image_bucket_url;
var editorVersion = '';
if(locale == 'en' && Waze.Config.api_base == "/Descartes-beta/app"){
editorVersion = 'https://editor-beta.waze.com/editor/';
}
else if(locale == 'en'){
editorVersion = 'https://www.waze.com/editor/';
}
else if(Waze.Config.api_base == "/Descartes-beta/app"){
editorVersion = 'https://editor-beta.waze.com/' + locale + '/editor/';
}
else{
editorVersion = 'https://www.waze.com/' + locale + '/editor/';
}
var editorCode = Waze.location.code;
var center900913 = Waze.map.getCenter();
var center4326 = epsg900913to4326(center900913);
console.log('WME Data Store: new execution');
//Cities
var cityData = ['CountryID','Country','StateID','State','CityID',
'CityName','CityEnglishName','IsEmpty','Permalink'
];
try{
var currentCities = Waze.model.cities.additionalInfo.clone();
for(i=0; i<currentCities.length; i++)
{
var stateObj = Waze.model.states.get(currentCities[i].stateID);
var stateName = replaceCommas(stateObj.name);
var countryObj = Waze.model.countries.get(currentCities[i].countryID);
var countryName = replaceCommas(countryObj.name);
var cityPermalink = editorVersion + '?env=' + editorCode + '&lon=' + center4326.lon + '&lat=' + center4326.lat +'&zoom=0';
cityData.push('\n'+currentCities[i].countryID,countryName,currentCities[i].stateID,stateName,
currentCities[i].id,currentCities[i].name,currentCities[i].englishName,currentCities[i].isEmpty,cityPermalink
);
}
}
catch(e){
console.log('WME Data Store: unable to process city list, ' + e);
}
//Places
var venueData = ['PlaceID','PlaceName','FirstAltName','Brand','Lock','PrimaryCategory','Type','PublicOrPrivate','PlaceApproved',
'Description','Phone','Website','UpdateRequestCount','CountryName','StateName','CityName','StreetName','HouseNumber','NumHours','NumServices',
'CreateDateTime','CreatedByName','CreatedByRank','UpdateDateTime','UpdatedByName','UpdatedByRank','Permalink',
'ImageCount','PrimaryImageThumbnail','ImageApproved','ImageUserName','ImageUserRank','ImageDateTime'
];
try{
var currentVenues = Waze.model.venues.additionalInfo.clone();
var wdsVenueDataObj = {};
var wdsVenueDataArray = [];
if(currentVenues.length>0){
for(i=0; i<currentVenues.length; i++)
{
var venueType = '';
var venueID = currentVenues[i].attributes.id;
var venueName = ((typeof currentVenues[i].attributes.name == 'undefined' || currentVenues[i].attributes.name == null) ? "" :replaceCommas(currentVenues[i].attributes.name));
if(currentVenues[i].attributes.geometry.CLASS_NAME == 'OpenLayers.Geometry.Point'){venueType = 'Point';}else{venueType = 'Area';}
var venueLockRank = currentVenues[i].attributes.lockRank + 1;
var venueApproved = currentVenues[i].attributes.approved;
var venueDescription = ((typeof currentVenues[i].attributes.description == 'undefined' || currentVenues[i].attributes.description == null) ? "" : replaceCommas(currentVenues[i].attributes.description.substring(0,100))); //limit to 100 characters
var venueUpdateRequest = ((currentVenues[i].attributes.venueUpdateRequests[0] == null) ? 0 : currentVenues[i].attributes.venueUpdateRequests.length);
var venueBrand = currentVenues[i].attributes.brand;
var venuePrimaryCategory = currentVenues[i].attributes.categories[0];
var venueResidential = ((currentVenues[i].attributes.residential == false) ? 'Public' : 'Private');
var venuePhoneNumber = currentVenues[i].attributes.phone;
var venueWebsite = currentVenues[i].attributes.url;
var venueNumAlternateNames = currentVenues[i].attributes.aliases.length;
var venueFirstAlternateName = currentVenues[i].attributes.aliases[0];
var venueNumHours = currentVenues[i].attributes.openingHours.length;
var venueNumServices = currentVenues[i].attributes.services.length;
var venueAddressNumber = ((typeof currentVenues[i].attributes.houseNumber == 'undefined') ? "" : currentVenues[i].attributes.houseNumber);
var venueStreetObj = ((typeof currentVenues[i].attributes.streetID == 'undefined' || currentVenues[i].attributes.streetID == null) ? "" : Waze.model.streets.get(currentVenues[i].attributes.streetID));
var venueStreetName = ((typeof venueStreetObj == 'undefined' || currentVenues[i].attributes.streetID == null) ? "" : replaceCommas(venueStreetObj.name));
var venueCityObj = ((venueStreetObj == null) ? null : Waze.model.cities.get(venueStreetObj.cityID));
var venueCityName = ((typeof venueCityObj == 'undefined' || venueCityObj == null) ? "" : replaceCommas(venueCityObj.name));
var venueStateObj = ((venueCityObj == null) ? null : Waze.model.states.get(venueCityObj.stateID));
var venueStateName = ((typeof venueStateObj == 'undefined' || venueStateObj == null) ? "" : replaceCommas(venueStateObj.name));
var venueCountryObj = ((venueStateObj == null) ? null : Waze.model.countries.get(venueCityObj.countryID));
var venueCountryName = ((typeof venueCountryObj == 'undefined' || venueCountryObj == null) ? "" : replaceCommas(venueCountryObj.name));
var venueCreatedOn = new Date(parseInt(currentVenues[i].attributes.createdOn));
var venueCreatedByUserObj = Waze.model.users.get(currentVenues[i].attributes.createdBy);
var venueCreatedByName = ((typeof venueCreatedByUserObj == 'undefined' || venueCreatedByUserObj == null) ? "" : venueCreatedByUserObj.userName);
var venueCreatedByRank = ((typeof venueCreatedByUserObj == 'undefined' || venueCreatedByUserObj == null) ? "" : venueCreatedByUserObj.rank + 1);
var venueUpdatedOn = ((typeof currentVenues[i].attributes.updatedOn == 'undefined' || currentVenues[i].attributes.updatedOn == null) ? "" : new Date(parseInt(currentVenues[i].attributes.updatedOn)));
var venueUpdatedByUserObj = ((typeof currentVenues[i].attributes.updatedOn == 'undefined' || currentVenues[i].attributes.updatedOn == null) ? null : Waze.model.users.get(currentVenues[i].attributes.updatedBy));
var venueUpdatedByName = ((typeof venueUpdatedByUserObj == 'undefined' || venueUpdatedByUserObj == null) ? "" : replaceCommas(venueUpdatedByUserObj.userName));
var venueUpdatedByRank = ((typeof venueUpdatedByUserObj == 'undefined' || venueUpdatedByUserObj == null) ? "" : venueUpdatedByUserObj.rank + 1);
var venueCentroid = epsg900913to4326(currentVenues[i].attributes.geometry.getCentroid());
var venuePermalink = editorVersion + '?env=' + editorCode + '&lon=' + venueCentroid.x + '&lat=' + venueCentroid.y +'&zoom=6&venues=' + venueID;
var venueImage = ((currentVenues[i].attributes.images[0] == null) ? 0 : currentVenues[i].attributes.images.length);
var venuePrimaryImageID = ((currentVenues[i].attributes.images[0] == null) ? null : currentVenues[i].attributes.images[0].attributes.id);
var venuePrimaryImageApproved = ((currentVenues[i].attributes.images[0] == null) ? null : currentVenues[i].attributes.images[0].attributes.approved);
var venuePrimaryImageLink = ((currentVenues[i].attributes.images[0] == null) ? "" : venueImageBucketUrl + 'thumbs/thumb347_' + venuePrimaryImageID);
var venuePrimaryImageUserObj = ((currentVenues[i].attributes.images[0] == null) ? null : Waze.model.users.get(currentVenues[i].attributes.images[0].attributes.creatorUserId));
var venuePrimaryImageUserName = ((venuePrimaryImageUserObj == null) ? "" : replaceCommas(venuePrimaryImageUserObj.userName));
var venuePrimaryImageUserRank = ((venuePrimaryImageUserObj == null) ? "" : venuePrimaryImageUserObj.rank + 1);
var venuePrimaryImageDateTime = ((currentVenues[i].attributes.images[0] == null) ? "" : new Date(parseInt(currentVenues[i].attributes.images[0].attributes.date)));
venueData.push('\n'+venueID,venueName,venueFirstAlternateName,venueBrand,venueLockRank,venuePrimaryCategory,venueType,venueResidential,venueApproved,
venueDescription,venuePhoneNumber,venueWebsite,venueUpdateRequest,venueCountryName,venueStateName,venueCityName,venueStreetName,venueAddressNumber,venueNumHours,venueNumServices,
venueCreatedOn,venueCreatedByName,venueCreatedByRank,venueUpdatedOn,venueUpdatedByName,venueUpdatedByRank,venuePermalink,
venueImage,venuePrimaryImageLink,venuePrimaryImageApproved,venuePrimaryImageUserName,venuePrimaryImageUserRank,venuePrimaryImageDateTime
);
}
//console.log('WME Data Store: ' + JSON.stringify(wdsVenueDataArray));
}
}
catch(e){
console.log('WME Data Store: unable to process venue list, ' + e);
}
//Segments
var segmentData = ['SegmentID','CountryName','StateName','CityName','PrimaryStreetName','RoadType','RoadTypeName',
'FwdToll','ReverseToll','FwdDirection','ReverseDirection','Elevation','Rank','LengthInMeters',
'CreateDateTime','CreatedByName','CreatedByRank','UpdateDateTime','UpdatedByName','UpdatedByRank','Permalink'
];
if(zoom >= 3){
try{
var currentSegments = Waze.model.segments.additionalInfo.clone();
var statsSegMaxUpdate = '';
var statsDistinctEditors = {};
var wdsSegmentDataObj = {};
var wdsSegmentDataArray = [];
//var statsSegRoadTypeCount = [];
if(currentSegments.length>0){
for(i=0; i<currentSegments.length; i++)
{
var segmentID = currentSegments[i].attributes.id;
var primaryStreetObj = Waze.model.streets.get(currentSegments[i].attributes.primaryStreetID);
var primaryStreetName = ((typeof primaryStreetObj == 'undefined' || primaryStreetObj.name == null) ? "" : replaceCommas(primaryStreetObj.name));
var segCityObj = ((primaryStreetObj == null) ? null : Waze.model.cities.get(primaryStreetObj.cityID));
var segCityName = ((typeof segCityObj == 'undefined' || segCityObj.name == null) ? "" : replaceCommas(segCityObj.name));
var segStateObj = ((segCityObj == null) ? null : Waze.model.states.get(segCityObj.stateID));
var segStateName = ((typeof segStateObj == 'undefined' || segStateObj.name == null) ? "" : replaceCommas(segStateObj.name));
var segCountryObj = ((segStateObj == null) ? null : Waze.model.countries.get(segCityObj.countryID));
var segCountryName = ((typeof segCountryObj == 'undefined' || segCountryObj.name == null) ? "" : replaceCommas(segCountryObj.name));
var segRoadType = currentSegments[i].attributes.roadType;
var segRoadTypeName = I18n.translations[locale].segment.road_types[segRoadType];
var segCreatedOn = new Date(parseInt(currentSegments[i].attributes.createdOn));
var segCreatedByUserObj = Waze.model.users.get(currentSegments[i].attributes.createdBy);
var segCreatedByName = ((segCreatedByUserObj == null) ? "" : replaceCommas(segCreatedByUserObj.userName));
var segCreatedByRank = ((segCreatedByUserObj == null) ? "" : segCreatedByUserObj.rank + 1);
var segUpdatedOn = ((currentSegments[i].attributes.updatedOn == null) ? "" : new Date(parseInt(currentSegments[i].attributes.updatedOn))); //segments with no updates will throw errors
var segUpdatedByUserObj = ((currentSegments[i].attributes.updatedOn == null) ? "" : Waze.model.users.get(currentSegments[i].attributes.updatedBy));
var segUpdatedByName = ((segUpdatedByUserObj == "") ? "" : replaceCommas(segUpdatedByUserObj.userName));
var segUpdatedByRank = ((currentSegments[i].attributes.updatedOn == null) ? "" : segUpdatedByUserObj.rank + 1);
var segFwdToll = currentSegments[i].attributes.fwdToll;
var segRevToll = currentSegments[i].attributes.revToll;
var segFwdDirection = currentSegments[i].attributes.fwdDirection;
var segRevDirection = currentSegments[i].attributes.revDirection;
var segElevation = currentSegments[i].attributes.level;
var segRank = currentSegments[i].attributes.lockRank + 1;
var segLength = currentSegments[i].attributes.length;
var segCentroid = epsg900913to4326(currentSegments[i].geometry.getCentroid());
var segPermalink = editorVersion + '?env=' + editorCode + '&lon=' + segCentroid.x + '&lat=' + segCentroid.y +'&zoom=5&segments=' + segmentID;
segmentData.push('\n'+segmentID,segCountryName,segStateName,segCityName,primaryStreetName,segRoadType,segRoadTypeName,
segFwdToll,segRevToll,segFwdDirection,segRevDirection,segElevation,segRank,segLength,
segCreatedOn,segCreatedByName,segCreatedByRank,segUpdatedOn,segUpdatedByName,segUpdatedByRank,segPermalink
);
//basic last segment update stats
if(currentSegments[i].attributes.updatedOn > statsSegMaxUpdate){
statsSegMaxUpdate = currentSegments[i].attributes.updatedOn;
var statsSegMaxUpdateUserObj = ((currentSegments[i].attributes.updatedOn == null) ? "" : Waze.model.users.get(currentSegments[i].attributes.updatedBy));
var statsSegMaxUpdateUser = ((statsSegMaxUpdateUserObj == "") ? "" : replaceCommas(statsSegMaxUpdateUserObj.userName));
}
//updates by editor
statsDistinctEditors[segUpdatedByName] = statsDistinctEditors[segUpdatedByName]+1 || 1;
} //end FOR
//console.log('WME Data Store: ' + JSON.stringify(wdsSegmentDataArray));
}
//total segment count in context
var statsSegmentCount = currentSegments.length;
var coreSegStats = {lastSegmentUpdate: new Date(parseInt(statsSegMaxUpdate)),
lastSegmentUpdateUser: statsSegMaxUpdateUser,
segmentCount: statsSegmentCount,
editorSegmentCount: statsDistinctEditors,
editorCountTemp: statsDistinctEditors
};
if(currentSegments.length>0){
fillWDSCanvas(coreSegStats);
}
}
catch(e){
console.log('WME Data Store: unable to process segment list, ' + e);
}
}
//Export div
divWDS = document.createElement('div');
divWDS.id = 'divWDS';
divWDS.style.position = 'absolute';
divWDS.style.bottom = '35px';
divWDS.style.left = '425px';
divWDS.style.text = 'white';
divWDS.style.backgroundColor = 'transparent';
divWDS.style.borderWidth = '2px';
divWDS.style.borderStyle = 'groove';
divWDS.style.boxShadow = '1px 1px 1px Grey';
divWDS.style.padding = '1px';
divWDS.style.color = '#F8F8F8';
divWDS.innerHTML = '';
iconWDS = document.createElement('img');
iconWDS.id = 'iconWDS';
iconWDS.src= 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAhCAYAAABa+rIoAAAKRGlDQ1BJQ0MgUHJvZmlsZQAASA2dlndUFNcXx9/MbC+0XZYiZem9twWkLr1IlSYKy+4CS1nWZRewN0QFIoqICFYkKGLAaCgSK6JYCAgW7AEJIkoMRhEVlczGHPX3Oyf5/U7eH3c+8333nnfn3vvOGQAoASECYQ6sAEC2UCKO9PdmxsUnMPG9AAZEgAM2AHC4uaLQKL9ogK5AXzYzF3WS8V8LAuD1LYBaAK5bBIQzmX/p/+9DkSsSSwCAwtEAOx4/l4tyIcpZ+RKRTJ9EmZ6SKWMYI2MxmiDKqjJO+8Tmf/p8Yk8Z87KFPNRHlrOIl82TcRfKG/OkfJSREJSL8gT8fJRvoKyfJc0WoPwGZXo2n5MLAIYi0yV8bjrK1ihTxNGRbJTnAkCgpH3FKV+xhF+A5gkAO0e0RCxIS5cwjbkmTBtnZxYzgJ+fxZdILMI53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CYII=';
divWDS.appendChild(iconWDS);
document.body.appendChild(divWDS);
iconWDS.addEventListener('mouseover',showWDSCanvas);
iconWDS.addEventListener('mouseout',hideWDSCanvas);
//Export Cities link -- move to function later
var a = divWDS.appendChild(
document.createElement('a')
);
a.id = 'divWDS_' + cityLabel + '_' + center4326.lon + '_' + center4326.lat;
a.download = cityLabel + '_' + center4326.lon + '_' + center4326.lat + '.csv';
a.href = 'data:text/csv;base64,' + btoa(cityData);
a.style.color = '#F8F8F8';
a.innerHTML = cityLabel + ' ';
//Export Places link -- move to function later
a = divWDS.appendChild(
document.createElement('a')
);
a.id = 'divWDS_' + venueLabel + '_' + '_' + center4326.lon + '_' + center4326.lat;
a.download = venueLabel + '_' + center4326.lon + '_' + center4326.lat + '.csv';
a.href = 'data:text/csv;base64,' + btoa(venueData);
a.style.color = '#F8F8F8';
a.innerHTML = venueLabel + ' ';
//Export Segments link -- move to function later
a = divWDS.appendChild(
document.createElement('a')
);
a.id = 'divWDS_' + segmentLabel + '_' + center4326.lon + '_' + center4326.lat;
a.download = segmentLabel + '_' + center4326.lon + '_' + center4326.lat + '.csv';
a.href = 'data:text/csv;base64,' + btoa(segmentData);
a.style.color = '#F8F8F8';
a.innerHTML = segmentLabel + ' ';
}
function initializeDS()
{
//Canvas
canvasWDS = document.createElement('canvas');
canvasWDS.id = 'canvasWDS';
canvasWDS.width = '400';
canvasWDS.height = '400';
canvasWDS.style.visibility = 'hidden';
canvasWDS.style.position = 'absolute';
canvasWDS.style.bottom = '70px';
canvasWDS.style.left = '425px';
canvasWDS.style.borderWidth = '2px';
canvasWDS.style.borderStyle = 'ridge';
canvasWDS.style.borderRadius = '5px';
document.body.appendChild(canvasWDS);
Waze.map.events.register("mergeend", Waze.map, getWMEData);
Waze.map.events.register("moveend", Waze.map, getWMEData);
Waze.map.events.register("zoomend", Waze.map, getWMEData);
window.setInterval(getWMEData,30000);
}
bootstrapDS();