How To Draw A Plot Plan Using Gps Coordinates
Working with a law department that has a network of License Plate Recognition cameras prepare up to tape the plate image and plate info to a MySQL database for a express time. If an Amber Alert (child abduction) is triggered they would like to be able to query the database and get a listing of what cameras spotted the plate and so plot those cameras showing the route on a google map. I take the latitude and longitude of each photographic camera and can generate a map, but it only shows the cameras not the road taken.
I accept a script that will pull the data from the database and create an assortment for the java script to use. For now to test I have only added the array to the script. I have been trying everything I can think of from mode-points (which is what I think I demand) to driving directions and cannot observe a adept example for plotting points on a road using the coordinates of a camera in an intersection. Hither is what I have so far:
<!DOCTYPE html> <html lang="en"> <caput> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=one.0"> <meta http-equiv="X-UA-Compatible" content="ie=border"> <championship>My Google Map</title> <style> #map{ height:500px; width:750px; } </manner> </head> <body> <h1>My Google Map</h1> <div id="map"></div> <script> function initMap(){ // Map options var options = { zoom:12, center:{lat:40.355048,lng:-79.835499} } // New map var map = new google.maps.Map(certificate.getElementById('map'), options); // Heed for click on map google.maps.event.addListener(map, 'click', function(upshot){ // Add marker addMarker({coords:event.latLng}); }); // Assortment of markers var markers = [ { coords:{lat:40.337629,lng:-79.808826}, iconImage:'http://52.15.229.165/nconf/google_images/cctv-32YelW.png', content:'<h1>LINCOLN WAY Westward @ 48 2017/12/22 17:49</h1>' }, { coords:{lat:40.337385,lng:-79.809023}, iconImage:'http://52.15.229.165/nconf/google_images/cctv-32YelS.png', content:'<h1>48 Due south @ LINCOLN WAY 2017/12/22 17:53</h1>' }, { coords:{lat:40.355048,lng:-79.835499}, iconImage:'http://52.xv.229.165/nconf/google_images/cctv-32YelE.png', content:'<h1>Rt. 148 East @ Hartman 2017/12/22 20:14</h1>' }, { coords:{lat:40.384877,lng:-79.824477}, iconImage:'http://52.15.229.165/nconf/google_images/cctv-32YelW.png', content:'<h1>Rt.30 West @ Warren Dr. 2017/12/22 twenty:22</h1>' }, { coords:{lat:40.384488,lng:-79.824129}, iconImage:'http://52.xv.229.165/nconf/google_images/cctv-32YelE.png', content:'<h1>Rt. thirty East @ Warren Dr. 2017/12/22 21:29</h1>' }, { coords:{lat:40.355285,lng:-79.834959}, iconImage:'http://52.15.229.165/nconf/google_images/cctv-32YelW.png', content:'<h1>Rt. 148 West @ Hartman 2017/12/22 21:38</h1>' }, { coords:{lat:twoscore.355048,lng:-79.835499}, iconImage:'http://52.15.229.165/nconf/google_images/cctv-32YelE.png', content:'<h1>Rt. 148 East @ Hartman 2017/12/22 21:46</h1>' }, { coords:{lat:40.337385,lng:-79.809023}, iconImage:'http://52.fifteen.229.165/nconf/google_images/cctv-32YelS.png', content:'<h1>48 South @ LINCOLN Mode 2017/12/22 22:19</h1>' } ]; // Loop through markers for(var i = 0;i < markers.length;i++){ // Add mark addMarker(markers[i]); } // Add together Marker Function function addMarker(props){ var marking = new google.maps.Marker({ position:props.coords, map:map, icon:props.iconImage }); // Check for customicon if(props.iconImage){ // Set up icon image marking.setIcon(props.iconImage); } // Check content if(props.content){ var infoWindow = new google.maps.InfoWindow({ content:props.content }); marker.addListener('click', part(){ infoWindow.open(map, mark); }); } var request = { travelMode: google.maps.TravelMode.DRIVING }; if (i == 0) request.origin = props.coords; else if (i == markers.length - 1) asking.destination = props.coords; else { if (props.coords) asking.waypoints({ location:props.coords, stopover: true }); } } } </script> <script async defer src="https://maps.googleapis.com/maps/api/js?fundamental=JAVASCRIPTAPIKEY&callback=initMap"> </script> </trunk> </html> Source: https://stackoverflow.com/questions/48050756/using-google-maps-javascript-api-to-plot-a-the-path-taken-using-coordinates
Posted by: galelecought.blogspot.com

0 Response to "How To Draw A Plot Plan Using Gps Coordinates"
Post a Comment