[GRASS-dev] [bug #5454] (grass) ps.map scaling not correct when projection units are feet

Hamish hamish_nospam at yahoo.com
Mon Jan 29 21:16:46 EST 2007


Request Tracker wrote:
> this bug's URL: http://intevation.de/rt/webrt?serial_num=5454
> ---------------------------------------------------------------------
> 
> Subject: ps.map scaling not correct when projection units are feet
> 
> Platform: GNU/Linux/x86
> grass obtained from: CVS
> grass binary for platform: Compiled from Sources
> GRASS Version: CVS HEAD  20070127 at 04:18  UTC
> 
> Noticed a strange anomaly in ps.map output when working in a State
> Plane Coordinate System with coordinates in feet.  Specifying any
> scale in ps.map gives manifestly incorrect scaling.  The scalebar
> produced also bears no obvious relationship to the scale of the map.
> 
> To reproduce:  create a location in New Mexico State Plane
> Coordinates, Central Zone, NAD83 (EPSG number 2258).  The result will
> have a PROJ_INFO file like this: name: Transverse Mercator
> proj: tmerc
> datum: nad83
> towgs84: 0.000,0.000,0.000
> ellps: grs80
> lat_0: 31
> lon_0: -106.25
> k: 0.999900
> x_0: 500000.0001016001
> y_0: 0
> no_defs: defined
> 
> and a PROJ_UNITS file of:
> unit: US survey foot
> units: US survey foots

foots?            ^^^^^^^


> meters: 0.3048006096012192
> 
> 
> Set the region to something arbitrary, for example:
> 
> > g.region -p
> projection: 99 (Transverse Mercator)
> zone:       0
> datum:      nad83
> ellipsoid:  grs80
> north:      1485814.68884
> south:      1485263.50884
> west:       1525396.34529
> east:       1526171.30805
> nsres:      0.61310345
> ewres:      0.61310345
> rows:       899
> cols:       1264
> cells:      1136336
> 
> 
> Now use the following ps.map file to generate postscript:
> 
> paper a0
> end
> scalebar f
>  where 1.5 1.5 
>  length 500
>  height .25
>  segment 5
>  numbers 2
>  fontsize 12
> end
> mapinfo 
>   where 11.5 15
>   fontsize 12
> end
> grid 100
>   color black
>   numbers 2
> end

note you need one more "end" to finish the command list.

I moved scalebar & info into the middle of the page:
paper a0
 end
scalebar f
 where 15.5 25.5 
 length 500
 height .25
 segment 5
 numbers 1
 fontsize 12
 end
mapinfo 
 where 11.5 27
 fontsize 12
 end
grid 100
 color black
 numbers 2
 end
end


> This should display a 100 foot grid and nothing else, and should have
> a scale bar with 100 foot markings that match the grid size.

yep.

> For the region specified above, ps.map will select "1:982" as the
> scale.  Now try tinkering with the scale by adding scale commands to
> the ps.map file.  Even selecting "1:982" will give completely
> different results than leaving the scale out altogether.  As you
> change scale, the scalebar will not change size to reflect the change
> in the map grid.

G63> g.region -e
north-south extent: 551.180000
east-west extent:   774.962760
# looks ok (feet)

A0 paper is 33.07" x 46.77", uses a 1" margin (ps/ps.map/paper.h)

so for width, 31.07" => 774.962760' (9299.55") which is 1:299  :-/

1m / 1' = 3.28

1:299 * 3.28= 1:982 !

So it's a units problem, it's assuming meters when it is really feet.

I also see the explicit scale=1:982 making something different than
the automatic "1:982" when units=feet.
explicit scale=1:982 on the command line makes the graph box correct
but the scalebar is wrong. If 1:982 is figured automatically, both
scalebar and map box are wrong.


> I dug around a little in the source code, but couldn't find an obvious
> reason for why this is happening.  I thought it might be that the
> G_database_units_to_meters function might be returning the wrong
> value, but I haven't actually tried to debug so I'm not ready to say
> that's it.
> 
> I do not see the same behavior in a UTM location (where units are in
> meters).  

checks out for me too. ps.map works perfectly when units=meters.



more soon.

Hamish




More information about the grass-dev mailing list