Search code examples
androidgisandroid-maps-v2google-polyline

Split polyline in google maps android api


Hello I'm implementing a GIS tool in android and I'm adding a feature to split a polyline by clicking on it, on it's splitting position.

What I have done so far that i checking if the user's clicking coordinate lays on the polyline by using the PolyUtil.isLocationOnPath after that I'm looking for the nearest polyline coordinate with the clicking coordinate. After getting the nearest coordinate I'm taking out all the polyine coordinates from the starting point to the nearest coordinate that i found earlier and also adding the clicking coordinate at the last. By this process im able to get a segment of the polyine but its not accurate because if a polyine have less points in it, it becomes difficult to split it.

So what are the other options that can be apply ? I have searched but couldn't find any tool or lib for this purpose.


Solution

  • Finally i got it done by using spatialite-android where i can perform special gis queries. For my case this query helped me.