# How can I map a latitude/longitude on a distorted map?

```
estimate-latitude-longitude (x, y)
numerator-latitude := 0
numerator-longitude := 0
denominator := 0
for each point,
deltaX := x - point.x
deltaY := y - point.y
distSq := deltaX * deltaX + deltaY * deltaY
weight := 1 / distSq
numerator-latitude += weight * point.latitude
numerator-longitude += weight * point.longitude
denominator += weight
return (numerator-latitude / denominator, numerator-longitude / denominator)
```

Tags: mapping math maps latitude-longitude

Source: By Adam Ernst as answer to the question

This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 3.0

##### Related code-snippets:

- Difference between Math.Floor() and Math.Truncate().
- I want to solve a linear equation. How can I do that?
- A little diversion into floating point (im)precision, part 1 | 1 – 0 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 1 | 1 | 2 | 1 | 2 | 1 | 1 | 2 | 1 | 2 | 3 | 4 | A little diversion into floating point (im)precision, part 1 | 3 | 4 | 5 | 5 | 8 | 8 | 2 | 3 | 4 | 7 | 8 | 7 | 7 | 7 | 6 | 1 | 1 | 5 | 1
- In Ruby, I can map multiple arrays and values from one array to the other.
- What does the term "BODMAS" mean?
- How do you create a sparse array?
- Date arithmetic in Unix shell scripts.
- Find largest rectangle in cubic cm (middle rectangle problem)!
- Use of java.math.mathContext in AAP?
- What is the best way to round up the result of integer division?
- Where can I get a complete Math topic dependency tree for my question?
- How do I estimate the distance between two cities?
- What is the distance between two latitude-longitude points? (Haversine formula)
- Popularity is a ranking algorithm for online videos and applications.
- What are the differences between duration and video rate?