cordova-plugin-googlemaps: Custom marker icon link does not work

Hello !

I saved a custom marker image in my www/assets/icon directory. When using : <img src="./assets/icon/custom_marker_32.png"/> it shows correctly. But when I’m using the same link in an “addMarker” :

this.map.addMarker({
      position: new GoogleMapsLatLng(item.geocode_lat_GPS, item.geocode_lng_GPS),
      icon: {
        url: "./assets/icon/custom_marker_32.png"
      },
      markerClick: () => {
        this.showDetails(item, false)
      }
    })

or even :

this.map.addMarker({
      position: new GoogleMapsLatLng(item.geocode_lat_GPS, item.geocode_lng_GPS),
      icon: "./assets/icon/custom_marker_32.png",
      markerClick: () => {
        this.showDetails(item, false)
      }
    })

None of both works. It only works with an HTTP link but i cannot use it like this in my project.

I saw this issue : https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1342 But none of the solutions work.

I’m using Google Maps Cordova in Ionic 2 framework on iOS 10 (iPhone 7) (simulating with IonicView app).

Does anyone successed to use local url ? Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 39 (16 by maintainers)

Most upvoted comments

@Julieng50 I fixed the issue related to the iOS path, you can use this line if you want

this.assetsPath = this.platform.is('ios') ? 'www/assets/' : 'file:///android_asset/www/assets/';