I'm using Gmap.Get great mapping tools to develop an enterprise software. How to calculate center of polygon in Gmap.Net using polygon points?
Use following code to calculate center of polygon in Gmap.Net:
Private Function CalculateCenterOfPolygon(polyPoints As List(Of PointLatLng)) As PointLatLng
Dim centerPoint As New PointLatLng()
Dim sum As Integer = 0
Dim Lat As Double = 0
Dim Lng As Double = 0
For Each point As PointLatLng In polyPoints
sum += 1
Lat += point.Lat
Lng += point.Lng
Next
Lat = Lat / sum
Lng = Lng / sum
centerPoint.Lat = Lat
centerPoint.Lng = Lng
Return centerPoint
End Function