Sadid Khan
Sadid Khan

Reputation: 1985

modify polygon in android google map api

I started Google map in android few days age. I am doing some basic things like set marker on tap, draw line between two marker etc.

Here users can draw polygon with tapping on the device. Now i want to edit the shape. I goggled it but didn't find any helpful solution for android.

I found some resource on google map java script API like user-editable-shapes in javascript

I want to do the same in android. How to Edit or Modify polygon in Google Map Android API

It will be helpful if u provide some resource.

Upvotes: 1

Views: 3072

Answers (1)

Caleb Pourchot
Caleb Pourchot

Reputation: 93

It looks to me like you have to replace all the points at once with setPoints on the polygon object.

https://developers.google.com/android/reference/com/google/android/gms/maps/model/Polygon.html#setPoints(java.util.List)

I'm currently trying to do the same thing in Xamarin. I mock up an edit mode when the user clicks on the polygon by changing its stroke color and then adding custom markers to each vertex. I'm holding a selected vertex which will move to the user's next click on the map and update the polygon.

Upvotes: 2

Related Questions