[gdal-dev] GSoC 2014 Weekly Report 11 : GDAL PostGIS Raster driver

Varun Saraf varunsaraf14 at gmail.com
Thu Aug 7 12:11:13 PDT 2014


Hello,

After Create() exists, SetProjection is called. For my given input, the
variable pszProjectionRef has a value :
PROJCS["WGS 84 / UTM zone 44N",GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32644"]]

This value is different from the value present in the
PostGIS spatial_ref_sys table which is:
PROJCS["WGS 84 / UTM zone 44N",GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],AUTHORITY["EPSG","32644"],AXIS["Easting",EAST],AXIS["Northing",NORTH]]

I found the below solution [1] to get proj4text from srtext which can be
converted to srid. Any alternate suggestions?

[1]
http://gis.stackexchange.com/questions/95831/how-can-i-get-proj4text-from-srtext

Regards,
Varun Saraf


On Tue, Aug 5, 2014 at 2:32 AM, Even Rouault <even.rouault at mines-paris.org>
wrote:

> Le lundi 04 août 2014 22:53:03, Varun Saraf a écrit :
> > Hello,
> >
> > Commenting poDriver->pfnCreateCopy doesn't seem to work. It is still
> > calling the CreateCopy() method.
>
> Check twice... How could GDAL call PostgisRasterDataset::CreateCopy() is
> nothing points to it ?
>
> > I will try doing the testing with a script
> > and get back to you.
> >
> > Regards,
> > Varun Saraf
> >
> >
> > On Tue, Aug 5, 2014 at 2:12 AM, Even Rouault <
> even.rouault at mines-paris.org>
> >
> > wrote:
> > > Le lundi 04 août 2014 22:38:20, Varun Saraf a écrit :
> > > > Hello,
> > > >
> > > > Thank you for this information. I will explicitly call Create()
> using a
> > > > script. Is the IWriteBlock method to be tested in a similar manner?
> > > > Note that pData buffer is passed to this method as an argument, which
> > > > I will have to generate and pass to it. Any suggestions how I should
> > > > generate
> > >
> > > this
> > >
> > > > pData buffer?
> > >
> > > Well, any data might do.
> > > But based on my previous note regarding the generic GDAL core
> > > CreateCopy() implementation, another possibility for your testing is to
> > > temporarily comment
> > > poDriver->pfnCreateCopy = .... and use gdal_translate.
> > >
> > > > Regards,
> > > > Varun Saraf
> > > >
> > > >
> > > > On Tue, Aug 5, 2014 at 1:44 AM, Even Rouault <
> > >
> > > even.rouault at mines-paris.org>
> > >
> > > > wrote:
> > > > > Le lundi 04 août 2014 21:38:36, Varun Saraf a écrit :
> > > > > > Hello,
> > > > > >
> > > > > > Yes, the code on the github repository is the latest state. I was
> > > > > > trying the following input queries :
> > > > > >
> > > > > > (1) Assuming that my Create() will be called.
> > > > > > gdal_translate --debug ON -of PostGISRaster ~/GSoC/ap_clip5x5.tif
> > > > > >
> > > > > >  PG:"host=localhost port=5432 user=postgres password=postgres
> > > > > >
> > > > > > dbname=test123 table=newtable"
> > > > > >
> > > > > > (2) When that did not work, I tried the following (suggested by
> my
> > > > >
> > > > > mentor,
> > > > >
> > > > > > Jorge Arevalo) which didn't work either.
> > > > > > gdal_translate --debug ON -of PostGISRaster -outsize 50% 50%
> > > > > > ~/GSoC/ap_clip5x5.tif  PG:"host=localhost port=5432 user=postgres
> > > > > > password=postgres dbname=test123 table=newtable"
> > > > >
> > > > > gdal_translate will never call Create(), but only CreateCopy().
> > > > >
> > > > > You might want to call Create() directly with a Python script for
> > > > > example, or
> > > > > a sample C/C++ code. gdalwarp will call Create() too, but gdalwarp
> > > > > can potentially rewrite existing tiles, which can complicate your
> > > > > initial coding.
> > > > >
> > > > > > QuiteDelete() method is called in both cases and the following
> > > > > > error messages are shown
> > > > > > ERROR 1: Couldn't drop the table public.newtable: ERROR:  table
> > > > >
> > > > > "newtable"
> > > > >
> > > > > > does not exist
> > > > > > ERROR 6: PostGISRasterDataset::CreateCopy() only works on source
> > > > > > datasets that are PostGISRaster
> > > > >
> > > > > Yes, as the message implies, the current CreateCopy()
> implementation
> > >
> > > only
> > >
> > > > > works when the source dataset is a postgisraster dataset itself.
> > > > > As far as the error message "Couldn't drop ...",
> > > > > PostGISRasterDataset::Delete() should probably be more silent in
> case
> > >
> > > the
> > >
> > > > > dataset doesn't exist.
> > > > >
> > > > > Note that once you have a full feature Create() implementation
> (with
> > > > > working
> > > > > IWriteBlock() of course), CreateCopy() is no longer strictly
> needed,
> > > > > since there is generic implementation in GDAL core that will
> emulate
> > > > > CreateCopy() with Create() + IWriteBlock()
> > > > >
> > > > > > I even tried calling the Create() method directly from
> > > > > > CreateCopy(),
> > > > >
> > > > > since
> > > > >
> > > > > > that is being called, but again the same error message is being
> > > > > > printed.
> > > > > >
> > > > > > Regards,
> > > > > > Varun Saraf
> > > > > >
> > > > > > On Mon, Aug 4, 2014 at 11:33 PM, Even Rouault
> > > > > > <even.rouault at mines-paris.org>
> > > > > >
> > > > > > wrote:
> > > > > > > Le lundi 04 août 2014 14:39:52, Varun Saraf a écrit :
> > > > > > > >  Hi,
> > > > > > > >
> > > > > > > > Below is my eleventh weekly report.
> > > > > > > >
> > > > > > > > *What did I do this week?*
> > > > > > > >
> > > > > > > >    - There are some issues with the calling of different
> > > > > > > >    methods. My
> > > > > > >
> > > > > > > method
> > > > > > >
> > > > > > > >    PostGISRasterDataset::Create() is not being called. Tried
> to
> > > > >
> > > > > resolve
> > > > >
> > > > > > > > that.
> > > > > > >
> > > > > > > Varun,
> > > > > > >
> > > > > > > If the code at
> > >
> > >
> https://github.com/varunsaraf/postgis_raster/blob/master/postgisrasterdat
> > >
> > > > > > > aset.cpp is the latest state, I don't see any reason why your
> > > > > > > Create() method wouldn't
> > > > > > > be called. Do you try to trigger it directly by calling
> Create()
> > > > > > > explicetely
> > > > > > > or through other more high level operations ?
> > > > > > >
> > > > > > > Even
> > > > > > >
> > > > > > > > - Fixed some small bugs and removed unnecessary variables
> that
> > >
> > > were
> > >
> > > > > > > > being used.
> > > > > > > >
> > > > > > > > *What do I plan on doing next week?*
> > > > > > > >
> > > > > > > >    - Continue with testing and bug fixing.
> > > > > > > >
> > > > > > > > *Am I blocked on anything?*
> > > > > > > >
> > > > > > > >    - No.
> > > > > > > >
> > > > > > > > Link to weekly report :
> > > > > > > > https://github.com/varunsaraf/postgis_raster/wiki/Report-11
> > > > >
> > > > > > > > Link to code repository :
> > > > > https://github.com/varunsaraf/postgis_raster
> > > > >
> > > > > > > > More details at :
> > > > > http://trac.osgeo.org/gdal/wiki/PostGIS_raster_driver
> > > > >
> > > > > > > > Regards,
> > > > > > > > Varun Saraf
> > > > > > > > Lab for Spatial Informatics
> > > > > > > > IIIT Hyderabad, India
> > > > > > >
> > > > > > > --
> > > > > > > Geospatial professional services
> > > > > > > http://even.rouault.free.fr/services.html
> > > > >
> > > > > --
> > > > > Geospatial professional services
> > > > > http://even.rouault.free.fr/services.html
> > >
> > > --
> > > Geospatial professional services
> > > http://even.rouault.free.fr/services.html
>
> --
> Geospatial professional services
> http://even.rouault.free.fr/services.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140808/3ff3faee/attachment.html>


More information about the gdal-dev mailing list