abhash
abhash

Reputation: 253

Leaflet.js with OneMap: Marker and Polygon Issue

I am using onemap leaflet library to use leaflet.js with onemap

I am able to plot Singapore map in a SAPUI5 flexbox control. However, marker and polygon are not visible on the map. There is no error while adding a polygon but it does not appear on map. I have used following code to add polygon:

var latlngs = [
    [103.908057506263, 1.30981613450459],
    [103.908215431086, 1.30910851741726],
    [103.908429273653, 1.30850269384475],
    [103.908535156551, 1.30825745789562]
];
var polygon = L.polygon(latlngs, {
    color: 'red'
});

polygon.addTo(map);

While adding a marker, I am getting following error:

Couldn't autodetect L.Icon.Default.imagePath, set it manually.

I need to draw polygon and show some markers. Please help.

Upvotes: 0

Views: 928

Answers (1)

kai
kai

Reputation: 11

You need to set the marker images default path using:

L.Icon.Default.imagePath = './images'

This will point to the correct folder for default markers.

Upvotes: 1

Related Questions