tangram icon indicating copy to clipboard operation
tangram copied to clipboard

Label collision error on not rendered tile

Open michaelhornak opened this issue 7 years ago • 5 comments
trafficstars

TANGRAM VERSION:

v0.14.2

ENVIRONMENT:

Its happening in all major browsers.

TO REPRODUCE THE ISSUE, FOLLOW THESE STEPS:

I am afraid, I wont be able to reproduce this issue on a live example, but I will try to describe it. This is the error that happens: Tangram v0.14.2 [error]: Error for style group 'collision' for tile kne_label/18/145372/90245/18 canBePlaced. TypeError: Cannot read property 'layout' of undefined.

It brokes in function canBePlaced:

canBePlaced: function canBePlaced(object, tile) {
        var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;

        var label = object.label;  --> this is null
        var layout = object.label.layout; --> this is undefined 
        ....

The function expect, there is always object.label, but but in some special case, object label is null, and then it throws 'cannot read property 'layout' of undefined.

We are displaying simple polygons with text label in the cetroid which is separate geometry. We have clickable functionality on polygons so when you click a polygon in map, it is highlighted programaticaly trough config and scene (basicaly just enabling different style for the same geometry filtered by the clicked id of polygon). The described error happens when you pan too quick and click in the map where there is still no tile data loaded. In this case canBePlaced function get null label.

Maybe its very specific error bound only to our functionality, but anyway I wanted to log it here, if someone else will experiece it. I have fixed it in our app by modifing tangram canBePlacecd by returning the function if label is null. For us its basicaly enoug, but It would be nice if you evaluate it as relevant issue and fix this case it in the library. Thanks.

michaelhornak avatar Nov 27 '17 14:11 michaelhornak

Thank you for the report - it definitely sounds like a bug, as that property should never be missing as far as I'm aware of. But in order to debug, it would be very helpful to have a working example.

Do you have an example scene and map location you can post that exhibits this issue? If you prefer, you could send privately as well.

bcamper avatar Nov 27 '17 14:11 bcamper

hi, I have managed to create a simplified demo example of the issue. You will have to pan around qucikly while clicking in the map for triggering highlight of the polygon.

http://tangram_error.ai-maps.com/

michaelhornak avatar Nov 30 '17 15:11 michaelhornak

we have also jumped to another error, which is throwing sometimes in Firefox browser when you work (move, pan, zoom) with map example I posted...It seems to be leaflet error but maybe it has some connection to tangram.

firefox_error

Its failing in this leaflet function:

// Returns the element's class.
function getClass(el) {
	return el.className.baseVal === undefined ? el.className : el.className.baseVal;
}```

michaelhornak avatar Dec 04 '17 10:12 michaelhornak

and one last issue related to my map example, sometimes we experience missing tiles, its mostly 1-3 tiles of whole viewoport that are just blank with no data rendered. But when you zoomin/zoomout or clik for feature info, the missing tiles get reloaded fine. There is no error or warning from tangram in this case, so we are not sure if its tile service source problem, or something in tangram...have you ever experiened something like this?

michaelhornak avatar Dec 04 '17 10:12 michaelhornak

Thanks, we'll take a look as soon as we can.

bcamper avatar Dec 04 '17 14:12 bcamper