1

I'm currently writing code which checks if coordinates are proper. I'm basically asking which check I need to do:

For longitude:

  • A: -180 <= LONGITUDE <= 180
  • B: -180 <= LONGITUDE < 180
  • C: -180 < LONGITUDE <= 180
  • D: -180 < LONGITUDE < 180

For LATITUDE:

  • a: -90 <= LATITUDE <= 90
  • b: -90 <= LATITUDE < 90
  • c: -90 < LATITUDE <= 90
  • d: -90 < LATITUDE < 90

Please give a reference or a good explanation.

Vince
  • 20,017
  • 15
  • 45
  • 64
Martin Thoma
  • 287
  • 1
  • 3
  • 9
  • 3
    Excuse me, but explanation of what? – Taras Aug 11 '20 at 07:51
  • Any decent world map will likely have latitude and longitude markings, there's a reference. There are occasions when working over the international date line a 0-360 system is used but most common 0 longitude is around Greenwich and ranges -180 to 180. Latitude systems don't vary AFAIK, they're -90 to 90. Don't worry about coordinates falling precisely on the edge, in practice it's very uncommon to have a point at a precise integer value and there's really not much at 180 to generate a point from or at either pole. If you do fall outside range what is your plan? – Michael Stimson Aug 11 '20 at 07:51
  • 1
    @Taras: the implied question is to know which A, B, C or D filter use for longitude and latitude, and give a reference with the answer. To formulate the question in an other way : are coordinates (-180, -90) and (180, 90) exists ? – J. Monticolo Aug 11 '20 at 08:05
  • @Taras I want to know if A, B, C, or D is correct for longitude and if a, b, c, or d is correct for latitude. If Aa is correct, then (long=-180, lat=-90) would be a valid coordinate. Now, I understand that those would be at the poles and thus nothing is there. Still, I want to know if the coordinates themselves are valid. – Martin Thoma Aug 11 '20 at 08:16
  • I'm almost certain that the extreme values are ok and that longitude=180 is the same as longitude=-180 ... but I'm not completely certain. Is there a standard which defines this? – Martin Thoma Aug 11 '20 at 08:19
  • I suppose this question was partially asked but not on GIS SE. Additionally you may check these sources Latitude, Longitude and Coordinate System Grids and Latitude-Longitude Map. – Taras Aug 11 '20 at 08:29
  • I think the only problem is filtering the longitude, because of its arbitrary zero value and the fact, that it describes the angle inside a circle, based on trigonometic values, which repeats along a sine wave. So, is 185° allowed? Yes and no! It depends on your data source (what values do you expect to get) and application (what are going to do with that values), not on a general rule. – Andreas Müller Aug 11 '20 at 08:44
  • 1
    If you apply a blanket range limit on longitude you're likely to break something down the line when a perfectly valid Pacific-centered dataset comes along, or where Siberia extends past 180E. Unnecessary range checks are landmines left behind in code to mess up someone, maybe even yourself, long after you'll remember it was there. 90 and -90 are valid latitudes, so the answers are E (none of the above) and A – Vince Aug 11 '20 at 13:13
  • "where Siberia extends past 180E" - could you give a reference for that? That is super interesting; I was certain this would not be possible – Martin Thoma Aug 11 '20 at 17:43

0 Answers0