0

I am interacting with a google map using openlayers3. On pinch zoom, the map throws an exception : Uncaught TypeError: Cannot read property 'x' of undefined

I am using Google Maps API 3.2 and OpenLayers 3.0.0.

EDIT

I notice the map is losing zoom property on pinch zoom: googleMap.getZoom() now returns undefined. Thus the exception is thrown.

  • could you share your code, so people can see where the problem is ? – Hicham Zouarhi Jul 18 '16 at 7:38
0

The problem is in calling panTo on google maps instead I used setCenter().

openLayersView.on('change:center', function() {
        var center = ol.proj.transform(openLayersView.getCenter(), EPSG_3857, EPSG_4326);
        //googleMap.panTo(new google.maps.LatLng(center[1], center[0])); <-- causes the exception
        googleMap.setCenter(new google.maps.LatLng(center[1], center[0]));
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.