Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map Not getting refreshed after changing dynamic map profile #1182

Open
sreedeeplal opened this issue Feb 6, 2018 · 0 comments
Open

Map Not getting refreshed after changing dynamic map profile #1182

sreedeeplal opened this issue Feb 6, 2018 · 0 comments

Comments

@sreedeeplal
Copy link

sreedeeplal commented Feb 6, 2018

I would like to set map profile dynamically out of the map components.
Step 1- I created the map profile in our xserver - Success
Step 2 - Getting the profile Db successfully - Success

Step 3 - I injected the new profile value into existing defined layers, value changes but the map is not getting refreshed.

Please verify the code

$scope.getMapProfile = getMapProfile;

    $scope.getMapProfile();
    function getMapProfile() {
        apiService.get('/api/mapprofile/getmapprofile', $scope.data,
         getMapProfileSucceded,
        getMapProfileFailed);
    }

    function getMapProfileSucceded(result) {

        if (result.data != null) {
            mapprofile = result.data.Profile;
        }
    
     $scope.definedLayers.ptvclassic.url = mapUrl + 'services/rest/XMap/tile/{z}/{x}/{y}?size={tileSize}&storedProfile=' + mapprofile;
     $scope.layers.baselayers.ptvclassic = $scope.definedLayers.ptvclassic;
     leafletData.getMap().then(function (map) {
         setTimeout(function () {
             map.invalidateSize();// invalidateSize show undefind 
             map._resetView(map.getCenter(), map.getZoom(), true);
         }, 200);
     });
    }`

`$scope.definedLayers = {
ptvclassic: {
name: 'PTV xMap Classic',
url: mapUrl + 'services/rest/XMap/tile/{z}/{x}/{y}?size={tileSize}&storedProfile=' + mapprofile,

            type: 'xyz',
            layerOptions: {
                showOnSelector: true,
                minZoom: 3,
                maxZoom: 19,
                opacity: 1
            }
        }

};
`

` angular.extend($scope, {
center: {
lat: 49.42855,
lng: 9.42181,
zoom: $scope.zoomLevel
},
defaults: { maxZoom: 17, zoomAnimation: false, fadeAnimation: false, zoomControl: false },
events: {

        },
        controls: {
            custom: [customZoom, focusOnSelectCtrl],
            draw: {
                draw: {
                    polyline: false,
                    marker: false
                }
            },
            scale: { position: "bottomleft" }
        },
        layers: {
            baselayers: {
                ptvclassic: $scope.definedLayers.ptvclassic
               
            }
            
        }
    });`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant