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

Custom icon marker in SVG #15

Open
Snowbases opened this issue Aug 28, 2020 · 10 comments
Open

Custom icon marker in SVG #15

Snowbases opened this issue Aug 28, 2020 · 10 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Snowbases
Copy link

Hi, this plugin looks great for Capacitor, but I wonder if we can add custom icon in marker as an SVG in the map? because the quality won't be losing than PNG

@hemangsk
Copy link
Contributor

Hey @Snowbases, glad you find it useful. The package uses UIImage on swift https://github.com/hemangsk/capacitor-googlemaps-native/blob/master/ios/Plugin/Plugin.swift#L79 , therefore only .jpg and .png files can be used for custom markers currently.

@hemangsk hemangsk added enhancement New feature or request help wanted Extra attention is needed labels Aug 28, 2020
@Snowbases
Copy link
Author

@hemangsk just doing some workaround in Android, this one marker is using vector assets in drawable. ref here

@hemangsk
Copy link
Contributor

Looking great @Snowbases! Thanks for your work, it looks like a neat workaround.

/me looks forward to an MR from @Snowbases 😄

@jimibilibob
Copy link

hi, I've been trying to use a png as marker's icon, but it's not working. I'd like to know if there exists any example. I'd really appreciate your help.

@gbrits
Copy link
Collaborator

gbrits commented Apr 8, 2021

I am busy working on adding image (url) support to Android, will send a PR when ready

@gbrits
Copy link
Collaborator

gbrits commented Apr 8, 2021

Ok so I got this working but it drastically slows down the load time of the map... so maybe it's not a great idea. :\ Looks like using SVG / reference is better for Android compared to iOS

@jimibilibob
Copy link

Thank's @gbrits , I appreciate your quick response.

@ChiKaLiO
Copy link

ChiKaLiO commented May 20, 2021

Hey @Snowbases, glad you find it useful. The package uses UIImage on swift https://github.com/hemangsk/capacitor-googlemaps-native/blob/master/ios/Plugin/Plugin.swift#L79 , therefore only .jpg and .png files can be used for custom markers currently.

even png not working or me

`CapacitorGoogleMaps.addMarker({
        latitude: coordinates.coords.latitude,
        longitude: coordinates.coords.longitude,
        title: "My Location",
        snippet: "Custom Snippet",
        url: "https://cdn.shopify.com/s/files/1/1215/4044/products/cyanvis_5S_lean_G1010B_legend_800x.png"
      });`

@tafelnl tafelnl mentioned this issue Jun 17, 2021
@tafelnl
Copy link
Member

tafelnl commented Jul 13, 2021

@ChiKaLiO To point you in the right direction, in this package they implemented it already. You could specifically take a look at setIcon. It is important that the icon will be set in combination with the use of a AsyncTask on Android. In that package they extended the class to AsyncLoadImage. For iOS you could also take a look at that package, to see how they've done it there.

@MyTek
Copy link

MyTek commented Oct 24, 2023

any word on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants