Opened 17 years ago
Last modified 8 years ago
#167 new defect
g.region: reports wrong center longitude and LL bounding box
Reported by: | hamish | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 6.4.6 |
Component: | Default | Version: | svn-develbranch6 |
Keywords: | g.region 180 | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
Hi,
if you set up a region which crosses 180 longitude, g.region -b and -l have problems calculating the center coord:
create a new location using EPSG 3112. (Australia; Lambert CC)
g.region n=1973000 s=-6188000 w=-5175000 e=4846000 res=1000 d.mon x0; d.grid -g 10 # looks ok, if you ignore that grid lines E of 180 are missing
---
g.region -b # print max LL bounding box (WGS84) north longitude: 19:37:06.913074N south longitude: 44:19:08.88403S west latitude: 69:34:08.058065E east latitude: 168:13:13.623433E center latitude: 118:53:40.840749E center longitude: 12:21:00.985478S
/general/g.region/printwindow.c:
- lat/lon swapped; "north longitude" -> "North latitude" etc.
after fixing that, the max bounding box calc still is wrong. furthest east is the bottom right corner (165W) but -b reports the value at the top right (168E). [simple a>b test too simple?] That eastern boundary value is used for the center lon calc, so the center lon is wrong as well (skewed to the west).
---
g.region -l # print lat/lon (current ellipsoid) north-west corner: long: 97:34:49.670961E lat: 20:13:08.52602N north-east corner: long: 168:13:13.623433E lat: 19:37:06.913074N south-east corner: long: 165:02:10.589072W lat: 44:19:08.88403S south-west corner: long: 69:34:08.058065E lat: 42:56:48.735964S center longitude: 42:35:00.190847E center latitude: 11:51:25.545225S rows: 8161 cols: 10021
this time it gets the box corners correct but the center longitude is wrong. it's looking around the wrong side of the world and the answer is apparently 180deg out.
also note the center lat is different to the -b version, and that with -l the NW corner's lat is bigger than the NE lat, but for -b max bounding box the more southerly 19:37N is used, not the further out 20:13N.
Hamish
Change History (3)
comment:1 by , 17 years ago
comment:2 by , 9 years ago
Milestone: | 6.4.0 → 6.4.6 |
---|
comment:3 by , 8 years ago
CPU: | → Unspecified |
---|---|
Platform: | → Unspecified |
These calculations can not be performed with longitudes wrapped to [-180, 180], fixed in trunk r70671.
g.region -l
(Print the current region in lat/long using the current ellipsoid/datum) prints the corners and now also the center of the current region projected to lat/long.
g.region -b
(Print the maximum bounding box in lat/long on WGS84) now tries to estimate the maximum bounding box based not only on the corners but also on the boundaries using the resolution of the current region. The result is a more realistic bounding box in lat/long. The reported center coordinates are the center coordinates of the lat/long box, not of the current window.
g.region -n
(Print the convergence angle (degrees CCW). The difference between the projection's grid north and true north, measured at the center coordinates of the current region.) is now using the center coordinates of the current region projected to lat/long.
Center coord via another method for comparison:
which doesn't match either -b or -l's version, but looks about right if you plot it over 'd.grid -g 10':
compare:
Hamish