Marker with Pixelated image, Google maps Native Ionic 2

1

When I place a Large image as a marker I can not resize it and it looks very large on the map, and when I place a small one it looks pixelated, Help!

There is some way to resize an image with good resolution.

let icon = 'www/assets/images/car3.png';
let position: GoogleMapsLatLng = new GoogleMapsLatLng(0,0);
let markerOptions: GoogleMapsMarkerOptions = {
  position: position,
  icon:icon
};
    
asked by Antonio Sierra Hurtado 13.03.2017 в 22:41
source

1 answer

0

In pure and simple google maps API, the definition of an icon could be as you have it:

let iconimg = 'www/assets/images/car3.png';

let markerOptions = {
   position:position,
   icon: iconimg
};

But that's just a short way to declare:

let iconimg = 'www/assets/images/car3.png';

let markerOptions = {
   position:position,
   icon: {
           url: iconimg,
           size: new google.Maps.Size(24,24),
           scaledSize: new google.Maps.Size(32,32)
         }
};

And that allows you to play with the final size of your icon without having to change the image.

Now you just have to find how to adapt that code to Ionic.

    
answered by 14.03.2017 в 10:16