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 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.

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

Your Answer

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

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