-1

enter image description hereAm using here map. I have a list of objects which has all the latitude and longitude of a particular region from a map as below

//Texas points

let list = [
  { lat: 36.5098, lng: -103.0559 },
  { lat: 32.0456, lng: -103.0559 },
  { lat: 32.0456, lng: -106.6103 },
  { lat: 30.827, lng: -105.385 },
  { lat: 29.631, lng: -104.4622 },
  { lat: 29.018, lng: -103.1878 },
  { lat: 29.898, lng: -102.3528 },
  { lat: 27.3525, lng: -99.5403 },
  { lat: 25.9106, lng: -97.2943 },
  { lat: 28.3933, lng: -96.5692 },
  { lat: 29.6994, lng: -93.8665 },
  { lat: 33.5523, lng: -94.0423 },
  { lat: 34.5897, lng: -99.9969 },
  { lat: 36.4848, lng: -99.9969 },
  { lat: 36.5098, lng: -103.0559 },
  { lat: 33.3507, lng: -98.283 },
  { lat: 32.4281, lng: -94.8553 },
  { lat: 26.8358, lng: -98.0853 },
  { lat: 30.9512, lng: -98.5247 },
  { lat: 31.4773, lng: -105.2484 }
];

Is there a way to find out the boundary points from the above list. Any ideas how to approach this. Thanks in advance.

AkRoy
  • 343
  • 4
  • 10
  • Please go read [ask]. This is not a “here’s my requirement, please do my work for me” site. – CBroe Jan 13 '21 at 11:18
  • @CBroe I just need a way about how to approach this? – AkRoy Jan 13 '21 at 11:21
  • can you please clarify boundary points? Do you mean 4 extreme corners? – Milind Barve Jan 13 '21 at 12:29
  • @Milind Barve Boundary points means all the longest points from the center. or the latitude and longitude makes a point. all the points which will make the boundary as you can see in the image attached. The main purpose is to highlight a region. The boundary is not fixed but it is all the extreme points from the list. – AkRoy Jan 13 '21 at 13:10
  • is there a way to find out all the extreme points from the above list? – AkRoy Jan 13 '21 at 13:12
  • We can find extreme points representing a rectangle by determining (minimum_lat,minimum_long), (minimum_lat,maximum_long), (maximum_lat, minimum_long), ( maximum_lat, maximum_long). But I am still not clear if all points representing boundary are given, what more you need? – Milind Barve Jan 14 '21 at 16:12
  • I have all the boundary points and all the internal points of a region. – AkRoy Jan 15 '21 at 06:28
  • I have all the boundary points and all the internal points of a region. So do you have any idea how can i differentiate between them – AkRoy Jan 15 '21 at 06:43
  • @MilindBarve Now am able to find the center point of the region from the var list above. ref here https://stackoverflow.com/questions/37885798/how-to-calculate-the-midpoint-of-several-geolocations-in-python – AkRoy Jan 15 '21 at 13:47

1 Answers1

0
function addPolygonToMap(map) {
  let str = [];
  for (let i = 0; i < list.length; i++) {
    str.push(parseFloat(list[i].lat));
    str.push(parseFloat(list[i].lng));
    str.push(0);
  }

  var geoStrip = new H.geo.Strip([...str], "values lat lng alt");
  map.addObject(
    new H.map.Polygon(geoStrip, {
      style: {
        fillColor: "red",
        strokeColor: "#829",
        lineWidth: 4
      }
    })
  );

}
AkRoy
  • 343
  • 4
  • 10