[gdal-dev] GSoC 2014 Weekly Report 11 : GDAL PostGIS Raster driver
Jorge Arevalo
jorgearevalo at libregis.org
Fri Aug 8 01:26:27 PDT 2014
On Thu, Aug 7, 2014 at 10:28 PM, Even Rouault <even.rouault at spatialys.com>
wrote:
> Le jeudi 07 août 2014 22:26:07, Varun Saraf a écrit :
> > Hello,
> >
> > Thanks. I will use that.
> >
> > When the PostGISRasterDataset::SetProjection method returns, a
> segmentation
> > fault is being shown. The methods I have made changes to IWriteBlock,
> > IRasterIO are not being called. What is the following flow of methods
> that
> > are called? What could be the issue?
>
> You're in the best position to know ;-) More seriously without looking at
> the
> code, I can only suggest you attaching a debugger or running Valgrind to
> identify the flaw. (assuming you are developing on Linux)
>
Hello,
First of all, I will take guilt for my mistake: as Even said,
gdal_translate will always call CreateCopy, as stated at
http://www.gdal.org/classGDALDriver.html#a2c897da2a6e25169cccc49ef48797ce1.
My (wrong) assumption was that if you force a modification with regard to
the source raster (like providing a different outsize), gdal_translate will
avoid CreateCopy. My fault.
Default implementation of CreateCopy will call Create at the end, but as
PostGIS Raster driver provides its own implementation of CreateCopy, this
doesn't happen. Quick fix, as also Even suggested, avoid the PostGIS Raster
implementation of CreateCopy.
Varun, about the use of FetchSRSId, I think is a good idea too. The problem
is your WKT representation of the SRS is a bit different from the
representation stored in PostGIS (btw, where does your WKT representation
come from?). Well, both of them have the authority code 32644. You just
need a method to get this SRID from the WKT.
One way to do it was the query in PostGIS Raster implementation of
SetProjection (
http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/postgisraster/postgisrasterdataset.cpp#L3024),
but it doesn't work for you (again, the PostGIS WKT representation is a bit
different, so, the query doesn't return a value).
Another way is, like Even suggested, to reuse OGRPGDataSource::FetchSRSId
(Even, correct me if this isn't what you meant). You just need to build an
instance of OGRSpatialReference from your WKT string (
http://www.gdal.org/classOGRSpatialReference.html#a10e93344649a380d75b9925ad53d86ac),
and then call FetchSRSId using a pointer to that instance as argument
(check the method:
http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp#L1931
).
Don't hesitate to reuse this method and change
PostGISRasterDataset::SetProjection if needed.
Oh, and +1 to use a debugger (I suggest ddd) and valgrind to check memory
problems.
Best regards (and thanks, Even)
Jorge
>
> >
> > Regards,
> > Varun Saraf
> >
> >
> > On Fri, Aug 8, 2014 at 1:22 AM, Even Rouault <even.rouault at spatialys.com
> >
> >
> > wrote:
> > > Le jeudi 07 août 2014 21:26:31, Varun Saraf a écrit :
> > >
> > >
> http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/postgisraster/postgis
> > > ra
> > >
> > > > sterdataset.cpp#L3024
> > >
> > > I suggested you to look at OGRPGDataSource::FetchSRSId() (
> > >
> > >
> http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/pg/ogrpgdat
> > > asource.cpp )
> > > . It contains everything you need. You could/should actually reuse it
> > > directly
> > > in PostgisRaster.
> > >
> > > --
> > > Spatialys - Geospatial professional services
> > > http://www.spatialys.com
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
--
Jorge Arevalo
Freelance developer
http://about.me/jorgeas80
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140808/a37b071a/attachment-0001.html>
More information about the gdal-dev
mailing list