Rectangle
Rectangle
Create a rectangle to display on the map.
new fatosmap.maps.Rectangle({ option });
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Rectangle</title>
</head>
<body>
<div style="height: 100vh">
<div id="app"></div>
</div>
<button style="position: absolute; float: top; top: 50px; left: 50px;" onclick="rectangleAPI()">Rectangle API</button>
<script type="text/javascript" src="https://maps.fatos.biz/dist/fatosmap-gl.js"></script>
<script>
const LatLng = {lat: 37.482901, lng: 126.896038};
const mapInstance = new fatosmap.maps.Map(
document.getElementById("app"),
{
zoom: 14.5,
center: LatLng,
maxZoom: 20,
minZoom: 2,
key: 'YOUR_API_KEY',
}
);
function rectangleAPI() {
new fatosmap.maps.Rectangle({
map : mapInstance,
circleStyle : {
color: '#fff',
radius: 4.5,
strokeColor: '#F2AF4E',
strokeWidth: 4
},
rectangleStyle : {
lineColor: '#1bcdc1',
lineWidth: 5,
dashLineColor: '#a5a5a5',
dashLineWidth: 4,
dashArray: [3,2],
fillColor: '#1bcdc1',
fillOpacity: 0.3,
textColor: '#F2AF4E',
textSize: 18,
textHaloColor: '#fff',
textHaloWidth: 5,
overlap: true,
placement: true,
},
callback : getData,
});
}
function getData(bounds) {
console.log('GetData ::', bounds)
}
</script>
</body>
</html>
Last updated