Server IP : 80.241.246.6 / Your IP : 216.73.216.188 Web Server : Apache/2.4.25 (Debian) System : Linux kharagauli 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64 User : www-data ( 33) PHP Version : 7.0.33-0+deb9u12 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/kharagauli_new/Citizens_feedback/admin/pages/ |
Upload File : |
<div><button onClick="savePoly()">save</button></div> <style> div#map { height: 80vh; } img[src='img/spotlight-poi2.png'] {width: 27px!important; height: 43px!important} </style> <?php $fn='../pages/poligon.data'; if(isset($_GET['savePolygon'])) if(isset($_POST['data'])){ $data=$post['data']; file_put_contents($fn,$data); } ?> <!--Google Maps Start--> <div id="map" class="h-100" style="position: fixed!important; overflow: hidden; top: 0; width: 100%;"></div> <!--Google Maps End--> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script> var ctrlSelected = false; window.onkeydown = function(e) { ctrlSelected = ((e.keyIdentifier == 'Control') || (e.ctrlKey == true)); } window.onkeyup = function(e) { ctrlSelected = false; } var data=<?php if(file_exists($fn)) echo file_get_contents($fn); else echo '[]'; ?>; var poly=false; var markers={}; var markerscount=0; function savePoly(){ var pp=[]; $.each(markers,function(i,e){ pp.push({lat:e.position.lat(),lng:e.position.lng()}); }); pp=JSON.stringify(pp); event.preventDefault(); var newForm = jQuery('<form>', { 'action': '?Action=Poly&savePolygon=1', 'method': 'post' }).append(jQuery('<input>', { 'name': 'data', 'value': pp, 'type': 'hidden' })); $('body').append(newForm); newForm.submit(); } function createStartMarker(pos){ const marker = new google.maps.Marker({ position: pos, map: map, icon: new google.maps.MarkerImage( 'img/spotlight-poi2.png', // URL new google.maps.Size( 27, 43), // (width,height) new google.maps.Point( 0, 0 ), // The origin point (x,y) new google.maps.Point( 13, 44 ) // The anchor point (x,y) ), draggable: true, /*zIndex: 100,*/ }); google.maps.event.addListener(marker, 'dragend', function() { drawPoly(markers); }) google.maps.event.addListener(marker, 'click', function(evt){ if(ctrlSelected){ num=this.num; this.setMap(null); delete (markers[num]); drawPoly(markers); } }); marker.num='m'+(markerscount++); markers[marker.num]=marker; } function drawPoly(markers){ if(poly) poly.setMap(null); var path=[]; $.each(markers,function(i,e){ path.push(e.position); }) poly = new google.maps.Polygon({ map: map, path: path, strokeColor: "#FF0000", strokeOpacity: 0.8, strokeWeight: 2, fillColor: "#FF0000", fillOpacity: 0.35 }); } var bounds; var map; function initMap() { const Georgia = { lat: 42.2688452, lng: 43.8634849 }; map = new google.maps.Map(document.getElementById('map'), { mapTypeControl: true, center: Georgia, zoom: 7, fullscreenControl: true, }); map.addListener("click", (e) => { if(ctrlSelected){ createStartMarker(e.latLng); drawPoly(markers); } }); if(data.length>0){ bounds = new google.maps.LatLngBounds(); $.each(data,function(i,e){ createStartMarker(e); bounds.extend(e); }) drawPoly(markers); map.fitBounds(bounds); } } </script> <!--<script src="https://cdn.klokantech.com/maptilerlayer/v1/index.js"></script> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBwMDgpU09Sbtra3nFcdTlgkiNuT-4cZwg&libraries=geometry®ion=GE&language=ka&callback=initMap"></script>--> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=geometry®ion=GE&language=ka&callback=initMap"></script>