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?

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.

  • 1
    now I feel stupid for asking as it was quite obvious.. Thank you – João Matos Jan 16 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. – bugmenot123 Jan 16 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! – ThingumaBob Jan 16 at 11:49
  • Absolutely true but they asked about treating them as cartesian so I did that. – bugmenot123 Jan 16 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... – ThingumaBob Jan 16 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.