How to obtain the longitude and latitude coordinate array of the whole country or a certain province and city

my purpose is to obtain an array of latitude and longitude coordinates for the whole country or a province or city, and these coordinate arrays are separated by 3 kilometers. (in other words, draw a circle with a radius of 3 km, approximately filling the whole province, city or country)

the stupid method I"ve come up with so far is recursion:

function (){ 
  const centerPoint = 
  const points = [
     centerPoint 
  ]
  for(const point of points){ () }
}

while recursively getting all the points, do the kind of collision detection in the game. If one of these branches exceeds the longitude and latitude boundary of irregular China, then the recursive branch point stops and continues to the next branch. Until all points is traversed and stopped, the coordinate array obtained should be the coordinate system of the whole country.

this method, I feel silly
is there a better and more efficient way to implement it?


geojson can be converted into planar polygon data, and then your average distribution of points can be compared with this polygon in turn.

Menu