Hi Paul,
in the header of GPJ_osr_to_grass there is a parameter
OGRSpatialReferenceH *hSRS:
int GPJ_osr_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo,
struct Key_Value **projunits, OGRSpatialReferenceH *hSRS,
int interacti)
but in the body it is used as OGRSpatialReferenceH not OGRSpatialReferenceH*,
for example OSRMorphFromESRI( hSRS ) which is defined as
OGRErr OSRMorphFromESRI( OGRSpatialReferenceH hSRS )
The parameter should be changed to OGRSpatialReferenceH hSRS
or should it be used in the body as *hSRS? It seems that in GRASS
is the function called with OGRSpatialReferenceH*.
How can it work on Linux? On Windows it either crashes if
the parameter is passed as (void **) OGRSpatialReferenceH or
does not work if passed as OGRSpatialReferenceH*.
Radim
Hello Radim
On Fri, 27 Jan 2006, Radim Blazek wrote:
[...]
but in the body it is used as OGRSpatialReferenceH not OGRSpatialReferenceH*,
for example OSRMorphFromESRI( hSRS ) which is defined as
OGRErr OSRMorphFromESRI( OGRSpatialReferenceH hSRS )
The parameter should be changed to OGRSpatialReferenceH hSRS
or should it be used in the body as *hSRS? It seems that in GRASS
is the function called with OGRSpatialReferenceH*.
How can it work on Linux? On Windows it either crashes if
the parameter is passed as (void **) OGRSpatialReferenceH or
does not work if passed as OGRSpatialReferenceH*.
Yes I think there is a bug there. I remember not totally understanding it when I was writing it and being confused by the abstraction in the OGR function definitions. I think the OSRMorphFromESRI() function might be a problem, as it changes the contents of the OGRSpatialReferenceH structure. All
the other function calls just read from it, but it writes to it. Could you try the attached patch which creates a copy of the OGRSpatialReferenceH structure only for use in the GPJ_osr_to_grass() function, and see if it fixes the problem or changes anything? I am still not 100% sure what is wrong.
Paul
(attachments)
convert.patch (1.33 KB)
There was also another bug involved (G_asprintf, BTW
use G_store to make a copy of a string; BTW2 asprintf was never
used on Linux).
I have submited some fixes to QGIS and GRASS. It seems
that QGIS+GRASS now work on Windows and Linux
if both are in HEAD. Unfortunately QGIS HEAD does not
work with old version of GRASS (not fixed, 6.0.x).
I'll have to use GRASS_VERSION_MAJOR/GRASS_VERSION_MINOR.
Radim
On 1/27/06, Paul Kelly <paul-grass@stjohnspoint.co.uk> wrote:
Hello Radim
On Fri, 27 Jan 2006, Radim Blazek wrote:
[...]
> but in the body it is used as OGRSpatialReferenceH not OGRSpatialReferenceH*,
> for example OSRMorphFromESRI( hSRS ) which is defined as
> OGRErr OSRMorphFromESRI( OGRSpatialReferenceH hSRS )
>
> The parameter should be changed to OGRSpatialReferenceH hSRS
> or should it be used in the body as *hSRS? It seems that in GRASS
> is the function called with OGRSpatialReferenceH*.
> How can it work on Linux? On Windows it either crashes if
> the parameter is passed as (void **) OGRSpatialReferenceH or
> does not work if passed as OGRSpatialReferenceH*.
Yes I think there is a bug there. I remember not totally understanding it
when I was writing it and being confused by the abstraction in the OGR
function definitions. I think the OSRMorphFromESRI() function might be a
problem, as it changes the contents of the OGRSpatialReferenceH structure. All
the other function calls just read from it, but it writes to it. Could you
try the attached patch which creates a copy of the OGRSpatialReferenceH
structure only for use in the GPJ_osr_to_grass() function, and see if it
fixes the problem or changes anything? I am still not 100% sure what is
wrong.
Paul
On Fri, Jan 27, 2006 at 07:30:10PM +0100, Radim Blazek wrote:
There was also another bug involved (G_asprintf, BTW
use G_store to make a copy of a string; BTW2 asprintf was never
used on Linux).
I have submited some fixes to QGIS and GRASS.
Now g.region doesn't compile (I used configure):
make[1]: Entering directory `/home/neteler/soft/61grass_cvsexp/general/g.region/cmd'
gcc -Wl,--export-dynamic -L/home/neteler/soft/61grass_cvsexp/dist.i686-pc-linux-gnu/lib -Wl,-rpath-link,/home/neteler/soft/61grass_cvsexp/dist.i686-pc-linux-gnu/lib -I/usr/local/include -DPACKAGE=\""grassmods"\" -o /home/neteler/soft/61grass_cvsexp/dist.i686-pc-linux-gnu/bin/g.region OBJ.i686-pc-linux-gnu/adjust.o OBJ.i686-pc-linux-gnu/main.o OBJ.i686-pc-linux-gnu/printwindow.o OBJ.i686-pc-linux-gnu/zoom.o -lgrass_vect -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase -L/usr/local/lib -lgdal -lgrass_g3d -lgrass_gproj -lproj -L/usr/local/lib -lgdal -lgrass_gis -lgrass_datetime -lz -lgrass_datetime -lm -lz
/home/neteler/soft/61grass_cvsexp/dist.i686-pc-linux-gnu/lib/libgrass_gproj.so: undefined reference to `G_asprintf'
collect2: ld returned 1 exit status
make[1]: *** [/home/neteler/soft/61grass_cvsexp/dist.i686-pc-linux-gnu/bin/g.region] Fehler 1
make[1]: Leaving directory `/home/neteler/soft/61grass_cvsexp/general/g.region/cmd'
[neteler@dandre g.region]$ nm /home/neteler/soft/61grass_cvsexp/dist.i686-pc-linux-gnu/lib/libgrass_gis.so | grep G_asprintf
-> not defined
[neteler@dandre g.region]$ grep ASPR ../../include/config.h
#define HAVE_ASPRINTF 1
[neteler@dandre g.region]$
Something seems to be missing in lib/gis/asprintf.c
Markus