2

I need to draw a big line that can overlap itself. I am using this doc:

https://carto.com/docs/carto-engine/mobile-sdk/getting-started/#add-a-line

And I need the line to have a opacity of 0.3. So far so good; I have a line that is almost transparent. The problem is that when the line overlaps itself, the alpha in the overlapping area is 0.6 (because you see the line over itself)

image of the problem

Is it possible to keep the alpha consistent, even if the line cross with itself?

EDIT: As suggested, I tried to do it with a BufferOp using NTS and making a polygon with the result. Unfortunately, when I make a few lines and the geometry starts being complex this happens:

complex polygon complex polygon 2

I tried making a complex polygon without BufferOp and sometimes the same thing happens. Any suggestions?

EDIT: I Opened an issue with the polygon malformation problem as I understand it is a different problem.

1

This is a known issue in the SDK: https://github.com/CartoDB/mobile-sdk/issues/151 . There is no simple to fix in SDK without performance issues, but we consider this in the next development plans. Current workaround would be not to use transparency in lines, or generate a polygon from the line using buffering: JTS library may help with this.

UPDATE: SDK update 4.1.3 allows to set transparency of whole layer, instead of individual lines. This should fix the issue

  • Thanks for the reply. With simple lines it works great, but when I make five or six lines with a complex geometry as a result, something strange happens. I'll edit the question with an image of the problem. – dcollado Jan 27 '18 at 12:02

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.