-1

I used various sources of information to determine the GPS coordinates of a traffic sign, and plotted them using using plotly.express.scatter_mapbox and add_scattermapbox as follows:

enter image description here

The orange dot is a high end, "reference" measurement and the others are from different sources.

The numeric coordinates in this example are:

  • red: 51.4001213° 12.4291356°
  • purple: 51.400127° 12.429187°
  • green: 51.400106346232° 12.429278003005°
  • orange: 51.4000684461437° 12.4292323627949°

How can i calculate an area around the orange dot (e.g. 5 meter), find the coordinates which are inside this area and how do i plot that area on my map?

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
Kpol
  • 11
  • 3
  • Welcome to Stack Overflow. Please read [ask] and note well that this is **not a discussion forum**. We are not interested in conversational language; we are interested in getting straight to the question, and having it asked clearly and precisely. – Karl Knechtel Aug 31 '22 at 09:16

1 Answers1

0

Does this answer: https://gis.stackexchange.com/a/25883

This is tricky for two reasons: first, limiting the points to a circle instead of a square; second, accounting for distortions in the distance calculations.

Many GISes include capabilities that automatically and transparently handle both complications. However, the tags here suggest that a GIS-independent description of an algorithm may be desirable.

  1. To generate points uniformly, randomly, and independently within a circle of radius r around a location (x0, y0), start by generating two independent uniform random values u and v in the interval [0, 1). (This is what almost every random number generator provides you.) Compute

     w = r * sqrt(u)
     t = 2 * Pi * v
     x = w * cos(t) 
     y = w * sin(t)
    

The desired random point is at location (x+x0, y+y0).

  1. When using geographic (lat,lon) coordinates, then x0 (longitude) and y0 (latitude) will be in degrees but r will most likely be in meters (or feet or miles or some other linear measurement). First, convert the radius r into degrees as if you were located near the equator. Here, there are about 111,300 meters in a degree.

Second, after generating x and y as in step (1), adjust the x-coordinate for the shrinking of the east-west distances:

    x' = x / cos(y0)

The desired random point is at location (x'+x0, y+y0). This is an approximate procedure. For small radii (less than a few hundred kilometers) that do not extend over either pole of the earth, it will usually be so accurate you cannot detect any error even when generating tens of thousands of random points around each center (x0,y0).

s510
  • 2,271
  • 11
  • 18