Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Polyline Feature for android #220

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Timileyin105
Copy link

@Timileyin105 Timileyin105 commented May 13, 2023

Added Polyline Feature for android

usage

  CapacitorGoogleMaps.addPolyline ({
        mapId: this.currentMapId,
        path: [], // polyline path
        preferences: {
            color:  '#ffff', // line color
            width: 7, // line width
            isGeodesic: true
        }
   })

i have tested this to work
i added the remove polyline also but this doesnt seem to work for me, not sure why, i make another pull if i am able to fix and when i also do for ios
thanks

@WynOwen72
Copy link

@Timileyin105 Thank you for doing this. Is there an idiot proof way of importing your code? TIA

@Timileyin105
Copy link
Author

@Timileyin105
Copy link
Author

@WynOwen72 didn't hear any update from you
were you able to install and use it ?

CapacitorGoogleMaps.addPolyline ({
        mapId: this.currentMapId,
        path: [], // polyline path
        preferences: {
            color:  '#ffff', // line color
            width: 7, // line width
            isGeodesic: true
        }
 })

@WynOwen72
Copy link

Good morning, it installed OK. Today's plan is to try and implement it in a basic form and then integrated it in my app.

Grazie.

@Timileyin105
Copy link
Author

Alright, i will be done soon with the android app i'm using the map on so soon i will working on the ios to also make use of it

@WynOwen72
Copy link

I'm getting an error. Maybe it is a silly mistake from me:

My code:
`const showpolyline = () => {
if ( exampleMapId.value != null){
const coordinates = [
{ lat: -34.367, lng: 150.644 },
{ lat: -34.368, lng: 150.644 },
{ lat: -34.369, lng: 150.644 },
];

CapacitorGoogleMaps.addPolyline ({
    mapId:  exampleMapId.value,
    path: coordinates, // polyline path
    preferences: {
        color:  '#ffff', // line color
        width: 7, // line width
        isGeodesic: true
    }

})}
else { console.log('No mapid')}
}`
Error:
image

@Timileyin105
Copy link
Author

hello @WynOwen72 if you check the LatLng interface
image
what was used there wasnt lat & lng but latitude and longitude
so this should be

const coordinates = [
    { latitude: -34.367, longitude: 150.644 },
    { latitude: -34.368, longitude: 150.644 },
    { latitude: -34.369, longitude: 150.644 }
];

image

@WynOwen72
Copy link

@Timileyin105 I can confirm it works.
Screenshot_1684944778

@Timileyin105
Copy link
Author

@WynOwen72 OK, happy coding

@szymusu
Copy link

szymusu commented Jun 22, 2023

Hi @Timileyin105 good work, works fine for me on Android but fails to build on iOS.

I created a new capacitor app using commands:

npm init @capacitor/app
npm install

than added iOS platform:

npm install @capacitor/ios
npx cap add ios

added your package:

npm install https://github.com/Timileyin105/capacitor-native-google-map.git

but when I try to run:
npm run build
npx cap sync
npx cap run ios

I get these errors:

/Users/marcin/Code/polyline_test/polyline/node_modules/@capacitor-community/google-maps/ios/Plugin/Plugin.swift:345:33:
error: extra arguments at positions #2, #3 in call
self.addPolyline([
^
/Users/marcin/Code/polyline_test/polyline/node_modules/@capacitor-community/google-maps/ios/Plugin/Plugin.swift:333:16:
note: 'addPolyline' declared here
@objc func addPolyline(_ call: CAPPluginCall) {
^
/Users/marcin/Code/polyline_test/polyline/node_modules/@capacitor-community/google-maps/ios/Plugin/Plugin.swift:345:34:
error: cannot convert value of type '[String : Any]' to expected argument type 'CAPPluginCall'
self.addPolyline([
^
/Users/marcin/Code/polyline_test/polyline/node_modules/@capacitor-community/google-maps/ios/Plugin/Plugin.swift:359:42:
error: value of type 'CapacitorGoogleMaps' has no member 'customPolylines'
if let customPolyline = self.customPolylines[polylineId] {
~~~~ ^~~~~~~~~~~~~~~

can someone help?
is that a configuration fault on my part? or a legitimate issue?
simulator: iPhone 14 Pro iOS 16.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants