WME Data Store

Store objects when panning the map to compile lists for export (i.e. cities, places, segments)

2014-09-30 기준 버전입니다. 최신 버전을 확인하세요.

// ==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.4.4
// @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.replace(/,/g, '.');
    return noCommaString;
}

function epsg900913to4326(init900913){
    var transformedTo4326 = init900913.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));
    return transformedTo4326;
}


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"];

    if(locale == 'en'){
        var editorVersion = 'https://www.waze.com/editor/';
    }
    else{
        var 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','Brand','Lock','PrimaryCategory','Type','PublicOrPrivate'
                     ,'CreateDateTime','CreatedByName','CreatedByRank','UpdateDateTime','UpdatedByName','UpdatedByRank','Permalink'
                    ];
    try{
        var currentVenues = Waze.model.venues.additionalInfo.clone();
        for(i=0; i<currentVenues.length; i++)
      	{
            var venueID = currentVenues[i].attributes.id;
            var venueName = replaceCommas(currentVenues[i].attributes.name);
            if(currentVenues[i].attributes.geometry.CLASS_NAME == 'OpenLayers.Geometry.Point'){var venueType = 'Point'}else{var venueType = 'Area'}
            var venueLockRank = currentVenues[i].attributes.lockRank + 1;
            var venueBrand = currentVenues[i].attributes.brand;
            var venuePrimaryCategory = currentVenues[i].attributes.categories[0];
            var venueResidential = ((currentVenues[i].attributes.residential == false) ? 'Public' : 'Private');
            var venueCreatedOn = new Date(parseInt(currentVenues[i].attributes.createdOn));
            var venueCreatedByUserObj = Waze.model.users.get(currentVenues[i].attributes.createdBy);
            var venueCreatedByName = venueCreatedByUserObj.userName;
            var venueCreatedByRank = venueCreatedByUserObj.rank + 1;
            var venueUpdatedOn = ((currentVenues[i].attributes.updatedOn == null) ? "" : new Date(parseInt(currentVenues[i].attributes.updatedOn)));
            var venueUpdatedByUserObj = ((currentVenues[i].attributes.updatedOn == null) ? "" : Waze.model.users.get(currentVenues[i].attributes.updatedBy));
            var venueUpdatedByName = ((venueUpdatedByUserObj == "") ? "" : replaceCommas(venueUpdatedByUserObj.userName));
            var venueUpdatedByRank = ((currentVenues[i].attributes.updatedOn == 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;
            
            venueData.push('\n'+venueID,venueName,venueBrand,venueLockRank,venuePrimaryCategory,venueType,venueResidential
                           ,venueCreatedOn,venueCreatedByName,venueCreatedByRank,venueUpdatedOn,venueUpdatedByName,venueUpdatedByRank,venuePermalink
                          );
      	} 
    }
    catch(e){
        console.log('WME Data Store: unable to process venue list, ' + e);
    }  
    
    
    //Segments    
    //if(zoom >= 4){
        var segmentData = ['SegmentID','CountryName','StateName','CityName','PrimaryStreetName','RoadType','RoadTypeName'
                           ,'FwdToll','ReverseToll','FwdDirection','ReverseDirection','Elevation','Rank','LengthInMeters'
                           ,'CreateDateTime','CreatedByName','CreatedByRank','UpdateDateTime','UpdatedByName','UpdatedByRank','Permalink'
                          ];
        try{
            var currentSegments = Waze.model.segments.additionalInfo.clone();
            var statsSegMaxUpdate = '';
            var statsDistinctEditors = {};
            //var statsSegRoadTypeCount = [];

            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 = ((primaryStreetObj.name == null) ? "" : replaceCommas(primaryStreetObj.name));
                var segCityObj = Waze.model.cities.get(primaryStreetObj.cityID);
                var segCityName = ((segCityObj.name == null) ? "" : replaceCommas(segCityObj.name));
                var segStateObj = Waze.model.states.get(segCityObj.stateID);
                var segStateName = ((segStateObj.name == null) ? "" : replaceCommas(segStateObj.name));
                var segCountryObj = Waze.model.countries.get(segCityObj.countryID);
                var segCountryName = ((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 = replaceCommas(segCreatedByUserObj.userName);
                var segCreatedByRank = 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 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));
                   }

                var num = currentSegments[i].attributes.updatedBy;
    			statsDistinctEditors[num] = statsDistinctEditors[num]+1 || 1;
                
                
            } //end FOR
            
            var statsSegmentCount = currentSegments.length;
                
                console.log('WME Data Store: max update = ' + new Date(parseInt(statsSegMaxUpdate)) + ' by ' + statsSegMaxUpdateUser
                            + ', segment count = ' + statsSegmentCount + ', distinct editors = ' + JSON.stringify(statsDistinctEditors));
            
        }
        catch(e){
            console.log('WME Data Store: unable to process segment list, ' + e);
        }  
    //}

    
    //Export div
    divJDS = document.createElement('div');
    divJDS.id = 'divJDS';
    divJDS.style.position = 'absolute';
    divJDS.style.bottom = '35px';
    divJDS.style.left = '425px';
    divJDS.style.text = 'white';
    divJDS.style.backgroundColor = 'transparent';
    divJDS.style.borderWidth = '2px';
    divJDS.style.borderStyle = 'groove';
    divJDS.style.boxShadow = '1px 1px 1px Grey';
    divJDS.style.padding = '1px';
    divJDS.style.color = '#F8F8F8';
    divJDS.innerHTML = '';
    iconJDS = document.createElement('img');
    iconJDS.id = 'iconJDS';
    iconJDS.src= 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAhCAYAAABa+rIoAAAKRGlDQ1BJQ0MgUHJvZmlsZQAASA2dlndUFNcXx9/MbC+0XZYiZem9twWkLr1IlSYKy+4CS1nWZRewN0QFIoqICFYkKGLAaCgSK6JYCAgW7AEJIkoMRhEVlczGHPX3Oyf5/U7eH3c+8333nnfn3vvOGQAoASECYQ6sAEC2UCKO9PdmxsUnMPG9AAZEgAM2AHC4uaLQKL9ogK5AXzYzF3WS8V8LAuD1LYBaAK5bBIQzmX/p/+9DkSsSSwCAwtEAOx4/l4tyIcpZ+RKRTJ9EmZ6SKWMYI2MxmiDKqjJO+8Tmf/p8Yk8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EzVTkVdix4lSt5HsnEgnGCa77dSW3upbx5HfQSeEvQV6eno20InztVmtKaRvobSuIUb23m9Lr0J/EtZsKnwv0uXT/e79NkP9f2jmhlrw/9Q7Mr7+z3gPtdYjDe4fchU8ZIQ6BUwAAAAASUVORK5CYII=';
    divJDS.appendChild(iconJDS);
    document.body.appendChild(divJDS);
    

	//Export Cities link -- move to function later
    var a = divJDS.appendChild(
        document.createElement('a')
    );
    a.id = 'divJDS_' + 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
    var a = divJDS.appendChild(
        document.createElement('a')
    );
    a.id = 'divJDS_' + 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
    var a = divJDS.appendChild(
        document.createElement('a')
    );
    a.id = 'divJDS_' + 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
    canvasJDS = document.createElement('canvas');
    canvasJDS.id = 'canvasJDS';
    canvasJDS.width = '400';
    canvasJDS.height = '400';
    canvasJDS.style.visibility = 'hidden';
    canvasJDS.style.position = 'absolute';
    canvasJDS.style.bottom = '60px';
    canvasJDS.style.left = '425px';
    document.body.appendChild(canvasJDS);
    
    Waze.map.events.register("mergeend", Waze.map, getWMEData);
    Waze.map.events.register("moveend", Waze.map, getWMEData);
    Waze.map.events.register("zoomend", Waze.map, getWMEData);
     
}

bootstrapDS();