5

Is it possible to use an image locally store on the device as the marker icon? I can use a URL and it works, but when I try to use a local image it won't load. How should I reference the image? This is a multiplatform application so I can't use device specific paths like Android file:///android:asset/

map.addMarker({
    'position': new plugin.google.maps.LatLng(13.7579507,100.5643353),
    'title': 'Fortune Town',
    'icon': '../templates/icon2.png'
}, function(marker) {
    marker.showInfoWindow();
});

I am using Ionic Framework (which uses AngularJS) and Apache Cordova with the Google Maps plugin from https://github.com/wf9a5m75/phonegap-googlemaps-plugin/

wf9a5m75
  • 6,100
  • 3
  • 25
  • 59
momo
  • 3,404
  • 6
  • 37
  • 66

2 Answers2

12

It doesn't make too much sense but this is what worked:

'icon': 'www/templates/icon2.png'
momo
  • 3,404
  • 6
  • 37
  • 66
  • 3
    Hi momo, thank you for using my plugin. Yes, this is correct answer for this plugin. https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Marker#simple-icon – wf9a5m75 Oct 27 '14 at 16:14
  • Hey, thanks to you for writing the plugin, Katsumata :-) I could use a longer documentation though ;-P – momo Oct 28 '14 at 02:31
0

Use a storage plugin, like Cordova Storage, and pull it from there, or a local database. http://docs.phonegap.com/en/1.2.0/phonegap_storage_storage.md.html Capturing and storing a picture taken with the Camera into a local database / PhoneGap / Cordova / iOS

Community
  • 1
  • 1
Olivercodes
  • 1,048
  • 5
  • 17