capacitor-community / capacitor-community/google-maps

Get length of a polyline

Open
#117 0 comments 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
161
Forks
65
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
I miss a feature to achieve my Ionic application: get the length (in meters) of a drawn polyline.
After a lot of research, I didn't find a way to do it but using iOS SDK (which I don't know use yet because I don't know swift).

**Does this feature exist in the Google Maps SDK for android and iOS? Please link the documentation for this feature.**
In JavaScript, Google gives us a function from `geometry` API which look like this:
```typescript
pathWaypoints: LatLng[] = [];
google.maps.geometry.spherical.computeLength(pathWaypoints);
```
I know that it is totally different with Swift so I think it could help to get a look at this: https://developers.google.com/maps/documentation/ios-sdk/reference/group___length_kind?hl=en

**Describe the solution you'd like**
Maybe you could give the distance inside de `.then` callback after creating a new polyline ? Like this:
```typescript
CapacitorGoogleMaps.addPolyline(options)
.then(value => {
// value.distance => shows the distance in meters
})
```

**Additional context**
I tried many others native dependencies but a lot of them are deprecated or not up to date for a while.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.