0

I have tracking device on our company vehicles. It records and track all vehicles movements.

Also for every stops for more than 5 minutes it record the current location Lat, Long as "stop" the problem is that the even for 1 place (eg. our company) the Lat,Long of the stop is different because of place of vehicle parking spot changes

Also if there is a car traffic on the road it'll record a lot of locations

Now I have a record of almost 5000 stops locations that are duplicated but with little difference on lat and long (within 1 year)

This an example of one place (our warehouse)

This an example of one place

and this is an example of parking the car around office building

enter image description here

Now that I have clustered the points using Google Maps API, (still I need to modify the cluster to include many near points)

My Question:

What I need to do is to clean my data so all clustered points (Lat, Long) with have the same values.

How can I do that with my large set of data?

I should have at least about 400 client and company locations that are duplicated in the same location with the same Lat and Long.

Plus random traffic location on the road.

It doesn't matter what programming language or software I use just guide me to the point and I will continue the job.

Actually I have tested QGIS Software before (simple quick use)

enter image description here

this is the main request for my question

My current HTML JS Google maps script:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>locations</title>
    <style>
      /* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
      #map {
        height: 100%;
      }
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>

      function initMap() {

        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 3,
          center: {lat: 21.46213, lng: 39.18646}
        });

        // Create an array of alphabetical characters used to label the markers.
        var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';


        // Add some markers to the map.
        // Note: The code uses the JavaScript Array.prototype.map() method to
        // create an array of markers based on a given "locations" array.
        // The map() method here has nothing to do with the Google Maps API.
        var markers = locations.map(function(location, i) {
          return new google.maps.Marker({
            position: location,
            label: labels[i % labels.length],
            title: locations[i].info + ", lat: " + locations[i].lat + ", lng: " + locations[i].lng
          })      ;
        });

        // Add a marker clusterer to manage the markers.
        var markerCluster = new MarkerClusterer(map, markers,
            {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
      }
      var locations =  [

      {
    lat: 21.46213,
    lng: 39.18646,
    info: "Jiddah, Umm Al Quraa, Saudi Arabia"
  },
  {
    lat: 21.4621,
    lng: 39.18647,
    info: "Jiddah, Umm Al Quraa, Saudi Arabia"
  }
// List Of Locations 
 ]
    </script>
    <script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js">
    </script>
    <script async defer
    src="https://maps.googleapis.com/maps/api/js?key=_APIKEY_&callback=initMap">
    </script>
  </body>
</html>
2
  • @PolyGeo I I need to do is to clean my data so all clustered points (Lat, Long) with have the same values so later I calculate from the timestamp how many time and how long car has stopped in this location. Jan 11, 2020 at 11:45
  • 1
    I suspect you're going to have a TL;DR issue with this question. Folks here want to be able to glance at a question to determine if they have the relevant skills, then give a second quick read to determine the problem. Far too many questions are a single paragraph, but this runs on for a dozen, which hides the actual question from view.
    – Vince
    Jan 11, 2020 at 13:05

1 Answer 1

0
google.maps.event.addListener(gmap, 'zoom_changed', function() {
            var zoomLevel = gmap.getZoom();
            var sizeGrid = markerCluster.getGridSize();
            if (zoomLevel > 22) {
                markerCluster.setGridSize(0);
            } else if (zoomLevel > 21) {
                markerCluster.setGridSize(10);
            } else if(zoomLevel > 17){
                markerCluster.setGridSize(20);
            }else{
                markerCluster.setGridSize(30);
            }
        })
1
  • Hi anwarfandi_ and welcom on GIS, While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value. Jun 3, 2021 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.