[GRASS5] Even More on Projections
Frank Warmerdam
warmerda at home.com
Wed Sep 27 12:35:12 EDT 2000
Andreas Lange wrote:
>
> Hi Frank,
>
> i will try to answer some of your questions, but i must admit that i am
> not sure for some concepts in GRASS myself.
>
> In GRASS 4.x the projection was defined within the raster header and/or
> the WIND/DEFAULT_WIND files. In GRASS 5 the projection information is
> mainly in the PROJ_INFO file, but for the projections supported in GRASS
> 4.x the WIND/DEFAULT_WIND will suffice. Functions that return values
> from the PROJ_INFO file return default values if this file is missing.
Andreas,
It hasn't been my experience that G_get_projinfo() returns defaults if
PROJ_INFO is missing. Are you sure that it does? I had proposed changing
G_get_projinfo() to generate defaults from the proj/zone settig in the
WIND file if there was no PROJ_INFO file, but I didn't get any feedback
(positive or negative) on this suggestion.
This would be instead of implmenting the G_get_location_coordsys() call.
> > Currently I prepare a struct Cell_head, attempting to set the projection
> > to match that of the source file if possible. I then call G_set_window()
> > with that structure, and then G_open_raster_new(), and write the file.
> > This seems to result in a cellhd file being created with the information
> > I passed to G_set_window() whether the projection matches the location or
> > not. Am I responsible for doing validation to ensure the projection of
> > my new raster matches the location? Some commands (like r.in.dted) seem
> > to check, while others (like r.in.doq) seem to do the same as r.in.gdal.
> >
>
> I fear there is no general concept, some modules check if projections
> match, other do not. I think you should always validate matching
> projection.
As part of r.in.gdal I have implemented a projection comparison function
(though it isn't really complete) which currently just lives in with r.in.gdal,
but if folks think it is worthwhile, I would be happy to move it into libgis.a.
static int
G_compare_projections( struct Key_Value *proj_info1,
struct Key_Value *proj_units1,
struct Key_Value *proj_info2,
struct Key_Value *proj_units2 )
It returns TRUE if they appear to be the same, otherwise FALSE.
> Tom Pointdexter wrote a script "mklocation.sh" to create the directories
> for a new location. The raster modules IMHO do not create a new
> location, but i remember a script that creates a new location, imports
> the raster data and uses r.proj to transfer this to the current location
> (?).
I have tentatively implemented a location making function in C, that takes
Cell_head, proj_info and proj_units as inputs to default the projection and
extents of a new projection. Currently this is just in r.in.gdal, but
I would like to move it to libgis.a if folks think it worthwhile.
int G__make_location(
char *location_name,
struct Cell_head *wind,
struct Key_Value *proj_info,
struct Key_Value *proj_units,
FILE *report_file )
Best regards,
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerda at home.com
light and sound - activate the windows | http://members.home.com/warmerda
and watch the world go round - Rush | Geospatial Programmer for Rent
----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'
More information about the grass-dev
mailing list