I have a dataset with coordinates from all letterboxes in a certain area. I want to have all the letterboxes in a maximum of 500m away for everyone. So if there is a place without a letterbox nearby, I want to place there a letterbox (or more than one if it is needed).

I have tried a few options, like placing a radius around the existing letterboxes and then calculate a new point for a new mailbox at the place where are no mailboxes yet.

The other options was to convert de coordinates to meters and calculate the distance with the nearest mailbox. If the distance is bigger then 1000m I want to place a new mailbox between the two point.

Which one of the two options would be the best? And does anyone have an example code?

There's a lot left out in your requirements. For example I can't tell what coordinate system you use. Also, what defines best?

Anyhow I was on a team on a GPS tracking system which we built from almost scratch (we didn't launch satellites but used an off the shelf GPS module connected to our custom board.)

To find the usual distance using lat and long we use the Haversine function. I see https://www.google.com/search?&q=distance+gps+haversine has many discussions and on my search there is code for Python and most languages.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.