Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Given 2 coordinates of a bounding box, bottom left.. Expand / Collapse
Author
Message
Posted Monday, October 14, 2013 12:37 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, April 5, 2014 1:16 AM
Points: 14, Visits: 203
I have a strange one for you please..

Given 2 coordinates of a bounding box from a geography polygon, bottom left and top right, how can I find all 4 coordinates of the whole bounding box?

I know this is a strange one, but I currently have a system where only the bottom left coordinate and top right one are recorded in the db, I need to work backwards from these two points to ascertain the original 4 points of the bounding box.

I've run many Google searches but have come up blank, can am aware of the ST_Envelope command, which will give me the bounding box of a geography type, but given just two coordinates of a box, how can I get the other two (bottom right and top left).

Hope this is clear.. any help would be much appreciated. thanks!

Duncan.
Post #1504513
Posted Monday, October 14, 2013 12:58 PM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: 2 days ago @ 1:28 PM
Points: 1,461, Visits: 1,752
dburtenshaw (10/14/2013)
I have a strange one for you please..

Given 2 coordinates of a bounding box from a geography polygon, bottom left and top right, how can I find all 4 coordinates of the whole bounding box?

I know this is a strange one, but I currently have a system where only the bottom left coordinate and top right one are recorded in the db, I need to work backwards from these two points to ascertain the original 4 points of the bounding box.

I've run many Google searches but have come up blank, can am aware of the ST_Envelope command, which will give me the bounding box of a geography type, but given just two coordinates of a box, how can I get the other two (bottom right and top left).

Hope this is clear.. any help would be much appreciated. thanks!

Duncan.


The bottom left should be expressed as (MINX,MINY) and the top right as (MAXX, MAXY) so the other two can be derived (MINX, MAXY) is top left and (MAXX, MINY) is bottom right.

Post #1504517
Posted Monday, October 14, 2013 1:55 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, April 5, 2014 1:16 AM
Points: 14, Visits: 203
"The bottom left should be expressed as (MINX,MINY) and the top right as (MAXX, MAXY) so the other two can be derived (MINX, MAXY) is top left and (MAXX, MINY) is bottom right."

Thank you for your response Batgirl, that makes sense, I will have a play tomorrow.

D.
Post #1504531
Posted Monday, October 14, 2013 4:24 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, October 18, 2013 4:40 PM
Points: 70, Visits: 8


If what they're saying is true, the 4 coordinates are simply:


(MINX, MAXY) ------------ (MAXX, MAXY)
(MINX, MINY) ------------ (MAXX, MINY)



Height = ABS(MAXY - MINY)
Width = ABS(MAXX - MINX)




Post #1504569
Posted Tuesday, October 15, 2013 2:24 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 1:22 AM
Points: 32, Visits: 481
Worked a treat, thanks all for your input - my GSCE maths escaped me and I was looking for an over engineered solution..!
Post #1504644
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse