nativescript-google-maps-sdk
nativescript-google-maps-sdk copied to clipboard
Marker icon from url
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?
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);
});
Is there any other way otehr than using http module?