1

I have latitude and longitude of two points making the midline of a rectangle. Now I want to determine coordinates of 4 vertices of that rectangle. I know how to calculate on plane geometry by using line equation. But on geographic geometry, I'm new. I already read how to calculate one unit of latitude and longitude decimal degree but I'm still confused how to add them to a given point to calculate wanted points. My problem is like this:

Given:

  • Broadth of rectangle
  • Coordinates of two points making the midline, distance between these two points are equal to the width

Result: Coordinates of 4 vertices of rectangle

For example: The given midline has two points:

A (10.767008,106.665884) B (10.767715,106.667151) 

Broadth is 4-metre long

All I could do now is to calculate the width of rectangle from those two points. How can I use width and height to calculate 4 vertices of this rectangle?

All of my calculated cases are on small scale (part of one street of a city) so I think altitude can be excluded

4
  • 1
    Might I ask what software and/or code language you are working in? Nonetheless, I see a solution that would include euclidean calculations (perpendicular line off midline endpoints A and B) and geodesic distance (account for curvature of the planet). You may not need a geodesic distance if your dealing with smaller areas, in which case you could simply calculate the perpendicular lines, get the coordinates of the endpoints of the perpendicular lines, then construct a polygon with the coordinates. Commented Oct 18, 2016 at 20:06
  • If the midline is the center line of a street and the two endpoints are at intersections, I would call the midline the length. What you're calling the breadth, I would use width. I agree with @evv_gis, If you're working with small rectangles (and particularly since the data's relatively near the equator, treat them as Euclidean. Commented Oct 18, 2016 at 23:00
  • @evv_gis Actually I'm not truly working with GIS. I utilize data I get from a GIS in Java Commented Oct 19, 2016 at 1:33
  • @evv_gis I also think of perpendicular line equation to solve it. Then I get stuck. I can calculate one unit of latitude decimal degree, and one unit of longitude decimal degree. But mapping these two on diagonal to calculate a new point from a given point confuses me Commented Oct 19, 2016 at 1:43

1 Answer 1

2

Being that you are dealing with such a small spatial area, we can get the four coordinate pairs using a couple of Euclidean equations. Unfortunately, GIS.SE doesn't support LaTeX equations, so I am going to assume you know basic geometry equations like slope, point-slope form, and the euclidean distance formula.

To better illustrate what is being done, refer to this image:

enter image description here

The goal is to find the coordinates of r, s, t, and u.

First, let's state the givens.

A (lat: 10.767008, lng: 106.665884) B (lat: 10.767715, lng: 106.667151) r-s, t-u = 4 metres or roughly .000036036 decimal degrees at this latitude 

(if you need a more accurate way of determining this, there are plenty of posts on the subject)

Second, calculate the perpendicular slope of line A-B, we call it M.

Similar to slope equation, however with perpendicular slope your numerator is:

x_1 - x_2 

And your denomimator is:

y_2 - y_1 

This means:

M = (106.665884 - 106.667151)/(10.767715 - 10.767008) M = -1.7920792 

Third, we write out our equations for our segments, solving for the y coordinates:

y_r = M(x_r - 106.667151) + 10.767715 y_s = M(x_s - 106.667151) + 10.767715 y_t = M(x_t - 106.665884) + 10.767008 y_u = M(x_u - 106.665884) + 10.767008 

Fourth, accounting for slope being positive or negative, we then write out the equations solving for the x coordinate of our unknown points. If the slope is negative, the x coordinate of s and u will be the result of the negative difference. If positive, the x coordinate of s and u will be the positive sum. Since our slope is negative, that means:

x_s = 106.667151 - (0.000018018 / sqrt(1 + (-1.7920792)^2)) x_s = 106.667139 x_r = 106.667151 + (0.000018018 / sqrt(1 + (-1.7920792)^2)) x_r = 106.667163 x_t = 106.665884 + (0.000018018 / sqrt(1 + (-1.7920792)^2)) x_t = 106.665896 x_u = 106.665884 - (0.000018018 / sqrt(1 + (-1.7920792)^2)) x_u = 106.665872 

Fifth, now that we have our x coordinates, we can plug the values back into our segment equations and get our y coordinates.

y_r = -1.7920792 * (106.667163 - 106.667151) + 10.767715 y_r = 10.7676935 y_s = -1.7920792 * (106.667139 - 106.667151) + 10.767715 y_s = 10.7677365 y_t = -1.7920792 * (106.665896 - 106.665884) + 10.767008 y_t = 10.7669865 y_u = -1.7920792 * (106.665872 - 106.665884) + 10.767008 y_u = 10.7670295 

So the coordinates to create your polygon would be:

r (lat: 10.7676935, lng: 106.667163) s (lat: 10.7677365, lng: 106.667139) t (lat: 10.7669865, lng: 106.665896) u (lat: 10.7670295, lng: 106.665872) 

Understand, they may be slightly off due to the assumption of metre to decimal degree length at this latitude, and values were rounded off.

3
  • Thank you very much. Actually, I came up with solution this morning, and your answer assures that I found the right one Commented Oct 19, 2016 at 6:52
  • How do you arrive at Step 4 eqs. Commented Sep 17, 2017 at 10:40
  • Step 4: From the Pythagorean theorem: Δx^2 + Δy^2 = d^2 and from the definition of slope: Δy = Δx * M. Substituting we get: Δx^2 + (MΔx)^2 = Δx^2 (1+M^2) = d^2, dividing by (1+M^2) and taking square root gives the used formula. Here d is half of broadth in degrees. Commented May 27, 2021 at 7:37

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.