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
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.
-
1now I feel stupid for asking as it was quite obvious.. Thank youJoão Matos– João Matos2019年01月16日 11:12:00 +00:00Commented 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.bugmenot123– bugmenot1232019年01月16日 11:48:32 +00:00Commented 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– geozelot2019年01月16日 11:49:58 +00:00Commented Jan 16, 2019 at 11:49
-
Absolutely true but they asked about treating them as cartesian so I did that.bugmenot123– bugmenot1232019年01月16日 11:52:15 +00:00Commented Jan 16, 2019 at 11:52
-
1well, fair enough...but I'd consider a (rather comprehensive) hint about a serious mapping crime like this an experts duty...geozelot– geozelot2019年01月16日 12:05:09 +00:00Commented Jan 16, 2019 at 12:05