tangrams / tangram-es

2D and 3D map renderer using OpenGL ES
MIT License
823 stars 239 forks source link

Marker not shown after Marker.setDrawable(Drawable drawable) #1817

Open rwrx opened 6 years ago

rwrx commented 6 years ago

Hello, I have updated my local Tangram ES repository to tag 0.9.3 and I have found out that when I set bitmap to Marker through https://github.com/tangrams/tangram-es/blob/8ec65a8b28eb20373e9df6163312508f9ea9c4a7/platforms/android/tangram/src/main/java/com/mapzen/tangram/Marker.java#L122 marker is not shown at all on the map. I have traced that this problem is occurring from commit 1607bec6ecb6b336719c0606b0553f00876602b0. I have tried to find out why is this happening but after several hours I didn't came to a solution. I have also set to marker style "size: auto", it still doesn't solve the problem. Could you please look at this?

rwrx commented 6 years ago

Had somebody some time to look into this already? Because this is a broken functionality in latest tagged version 0.9.3.

hjanetzek commented 6 years ago

Hi @rwrx! Could you specify the drawrule used for the Drawable markers? I've added some code for testing which shows point markers with Drawables: https://github.com/tangrams/tangram-es/compare/android-marker-demo?expand=1#diff-0114b8cdd39733d35a3ac58d1f35a4ecR207 Hope this works for you!

rwrx commented 6 years ago

Hi @hjanetzek, thank you a lot for having a look at this. I got it. It does not work when you add "sprite" to a draw rule. I took draw rule specified in that code you mentioned:

"{ style: 'points', color: 'white', size: [50px, 50px], order: 2000, collide: false }"

and added there "sprite: default-marker" rule:

"{ style: 'points', sprite: default-marker, color: 'white', size: [50px, 50px], order: 2000, collide: false }"

and this makes it not working. I am also using setStylingFromString() method. In my style yaml file I have set that default-marker this way under textures:

markers:
    url: images/default-marker.png
    filtering: mipmap
    sprites:
        default-marker: [0, 0, 90, 164]

Also I am mentioning that this worked before that 1607bec commit. So is this a bug or am I missing something that sprites as a fallback should not work in this scenario?