1 (edited by mikejm 2021-12-06 08:52:48)

Topic: How to smooth the line for route drawing?

I have the route drawing function for Google Maps working nicely, but I notice the line that is drawn has a bit of "jitter" to it. I attached a screencap which may show it. It is simply not a perfectly smooth line, but rather a slightly wiggly/scribbly line with slight noise to its motion.

I am wondering what this jitter comes from and whether I can smooth it and how.

How does the route function return from Google API? Is it giving a discrete number of latitude/longitude pairs which this line is then the direction drawing of from one to the other?

Is there jitter because it is drawing only horizontal/vertical between the points (step ladder)? Or is there jitter from noise in Google API's results?

Could it be smoothed by interpolating or local averaging?

Which function would I want to manipulate to fix this problem if it is fixable?

Thanks.

Post's attachments

Attachment icon onlinemapsjitter.PNG 3.74 kb, 266 downloads since 2021-12-06 

Re: How to smooth the line for route drawing?

Hello.

Drawing API does not have anti-aliasing when drawing to a texture, and therefore you can see such a ladder.
It cannot be fixed.
You have two ways to work around this:
1. Use Tileset. This mode works differently and will not have ladders.
2. Use some third-party Drawing API.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.