dapriett / nativescript-google-maps-sdk

Cross Platform Google Maps SDK for Nativescript
MIT License
244 stars 163 forks source link

Marker icon #340

Closed ShyshkovOleg closed 5 years ago

ShyshkovOleg commented 5 years ago

Marker Icon Do not work NS+ Angular (tested on android). marker.icon suport only string. I've tried to conver to base64, but without a succes. Would appreciate any help.

myImageSource: ImageSource = fromFile("~/images/markergreen.png"); const icon = this.myImageSource.toBase64String("png"); marker.icon = icon;

przpl commented 5 years ago

The author closed issue without providing any solution. This code below works for me (NS 5.4).

    import { Image } from "tns-core-modules/ui/image";
    import { ImageSource } from "tns-core-modules/image-source";

    ...

    const imageSource = new ImageSource();
    imageSource.loadFromFile("~/images/icons/success.png");
    const icon = new Image();
    icon.imageSource = imageSource;

    let marker = new Marker();
    marker.icon = icon;