1

Let's say I have a square whose vertices are defined by coordinates in latitude/longitude format. I want to represent this square (and which ever shapes it contains, also defined as latitude/longitude) in a Cartesian graphic, such that the left-bottom vertex corresponds to point (0,0).

If this is possible, then how?

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Jan 16, 2019 at 10:57

1 Answer 1

1

Yes, you need to identify that corner (if it is oriented parallel to the axes it will be the minimum longitude and minimum latitude of all the coordinate values), calculate its deltas to the origin and then shift all coordinates by those values.

For example if you had the square

'POLYGON ((49 39, 51 39, 51 41, 49 41, 49 39))'

it would result in

'POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))'

because you substracted 49 from all x values and 39 from all y values.

answered Jan 16, 2019 at 11:05
6
  • 1
    now I feel stupid for asking as it was quite obvious.. Thank you Commented Jan 16, 2019 at 11:12
  • Don't! You probably want to project the data btw, if it is in geographic coordinates and you want to move everything to the same place. Commented Jan 16, 2019 at 11:48
  • 3
    ...this is very dangerous! neither are those polygons squares, nor do they represent the same area; geographic coordinates describe positions on a sphere(oid), cartesian geometry doesn't work here! Commented Jan 16, 2019 at 11:49
  • Absolutely true but they asked about treating them as cartesian so I did that. Commented Jan 16, 2019 at 11:52
  • 1
    well, fair enough...but I'd consider a (rather comprehensive) hint about a serious mapping crime like this an experts duty... Commented Jan 16, 2019 at 12:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.