nativescript-google-maps-sdk icon indicating copy to clipboard operation
nativescript-google-maps-sdk copied to clipboard

Marker icon from url

Open learwebit opened this issue 6 years ago • 2 comments

I try a lot but not success to find a way to show icon of marker from url.

var marker = new Marker(); marker.title =‘title’; var icon = ‘http://…png’; marker.icon=icon; marker.position = mapsModule.Position.positionFromLatLng(res.lat,res.lng); map.addMarker(marker);

This does not work, Any help?

learwebit avatar Mar 15 '18 12:03 learwebit

The solution is very simple, @learwebit # you just have to perform the following:

import * as http from "http";
import { Image } from 'tns-core-modules/ui/image/image';


.....

http.getImage("URL_IMAGE").then((result) => {
        let icon = new Image();
        icon.imageSource = result;
        marker.icon = icon;
    }, (error) => {
        console.log(error);
});

nericode avatar Apr 14 '18 03:04 nericode

Is there any other way otehr than using http module?

liamcharmer avatar May 05 '21 11:05 liamcharmer