דלג לתוכן הראשי

התמקדות לגאומטריה שצוירה על המפה

פונקציה זו מבצעת התמקדות במפה לתיחום הציור שבוצע עליה (מלבן, עיגול, מצולע).


govmap.zoomToDrawing()

התמקדות לציור:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="https://www.govmap.gov.il/govmap/api/govmap.api.js" defer onload="initGovMap()"></script>
<script type="text/javascript">
function initGovMap() {
govmap.createMap('map', {
token: 'YOUR_API_TOKEN',
layers: ["GASSTATIONS","PARCEL_HOKS", "KSHTANN_ASSETS", "bus_stops", "PARCEL_ALL"],
showXY: true,
identifyOnClick: true,
isEmbeddedToggle: false,
background: "1",
layersMode: 1,
zoomButtons:false
});
}
function showExample(){
// start draw mode
govmap.draw(govmap.drawType.Circle).progress(function (response) {
// wait 3 seconds and zoom to the drawn circle
setTimeout(() => govmap.zoomToDrawing(), 3000);
});
}
</script>
</head>
<body>
<div id="map" style="width:600px;height:600px;"></div>
<button onClick="showExample()">Show Example</button>
</body>
</html>