Question about GDALDriverManager + gdal2wktraster

View: New views
3 Messages — Rating Filter:   Alert me  

Question about GDALDriverManager + gdal2wktraster

by Jorge Arévalo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have two versions of GDAL in my machine:

- GDAL 1.7.0 from SVN
- GDAL 1.7.0 with the WKT Raster driver I'm developing

Today, I've updated the wktraster code from svn. I have the revision 4256. The last one. With this revision, there is a new version of gdal2wktraster script.

I loaded this image ftp://ftp.remotesensing.org/geotiff/samples/gdal_eg/cea.tif with and old version of gdal2wktraster, that allowed GDAL to select the block size for the tiles. Then, I could load the image with default tiles of 514x15, 35 tiles.

But with the new version of the script, I have to specify the block size by hand. For example, 514x15 (or 100x100). When I try this:

gdal2wktraster.py -r cea.tif -t table_name -s 4267 -b 1 -k 514x15 -I -M -o output.sql -v

I get this error:

ERROR 7: Assertion `FALSE' failed
in file `gdaldrivermanager.cpp', line 309

Reviewing the code, I saw that the last script's instruction called is:

pixels = band.ReadAsArray(xoff, yoff, valid_read_block_size[0], valid_read_block_size[1],
                                  target_block_size[0], target_block_size[1])

That, somehow, should call the method "GDALDriverManager::RegisterDriver( GDALDriver * poDriver )" from gdalmanager.cpp. The code of the method is this:

int GDALDriverManager::RegisterDriver( GDALDriver * poDriver )
{
    CPLMutexHolderD( &hDMMutex );

/* -------------------------------------------------------------------- */
/*      If it is already registered, just return the existing           */
/*      index.                                                          */
/* -------------------------------------------------------------------- */
    if( GetDriverByName( poDriver->GetDescription() ) != NULL )
    {
        int             i;

        for( i = 0; i < nDrivers; i++ )
        {
            if( papoDrivers[i] == poDriver )
            {
                return i;
            }
        }

        CPLAssert( FALSE ); // -------> THE LINE THAT CAUSES THE CRASH *******************************************
    }
   
/* -------------------------------------------------------------------- */
/*      Otherwise grow the list to hold the new entry.                  */
/* -------------------------------------------------------------------- */
    papoDrivers = (GDALDriver **)
        VSIRealloc(papoDrivers, sizeof(GDALDriver *) * (nDrivers+1));

    papoDrivers[nDrivers] = poDriver;
    nDrivers++;

    if( poDriver->pfnCreate != NULL )
        poDriver->SetMetadataItem( GDAL_DCAP_CREATE, "YES" );
   
    if( poDriver->pfnCreateCopy != NULL )
        poDriver->SetMetadataItem( GDAL_DCAP_CREATECOPY, "YES" );

    int iResult = nDrivers - 1;

    return iResult;
}

So, basically, with the base 1.7.0 version of GDAL, I can load the TIFF file. With my version, crash in the previous method. Clearly, it's my driver's problem, but I don't know why. I have a test code to create a dataset using my driver and works... Why could the application crash when trying to list the registered drivers while loading a TIFF file? I have the TIFF driver loaded in my GDAL version.

Thanks in advance,

Best regards
Jorge

Paula Poundstone  - "I don't have a bank account because I don't know my mother's maiden name."
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Parent Message unknown Re: [gdal-dev] Question about GDALDriverManager + gdal2wktraster

by Mateusz Loskot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tamas Szekeres wrote:
> Jorge,
>
> I'm not aware much about the changes in the gdal2wktraster script, I can see
> a r4226 which may be related to the problem. Please consult with the author
> Mateusz Loskot about the possible reasons you've encountered with the
> script.

Tamas,

I believe Jorge's problem with driver registration is not related to
recent changes to the gdal2wktraster.

Though, new version of the script still needs testing with various
datasets and use cases - bugs are expected.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel
--
Mateusz Loskot
http://mateusz.loskot.net

Re: [gdal-dev] Question about GDALDriverManager + gdal2wktraster

by Jorge Arévalo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

On Sun, Jul 12, 2009 at 11:47 PM, Mateusz Loskot<mateusz@...> wrote:

> Tamas Szekeres wrote:
>> Jorge,
>>
>> I'm not aware much about the changes in the gdal2wktraster script, I can see
>> a r4226 which may be related to the problem. Please consult with the author
>> Mateusz Loskot about the possible reasons you've encountered with the
>> script.
>
> Tamas,
>
> I believe Jorge's problem with driver registration is not related to
> recent changes to the gdal2wktraster.
>
> Though, new version of the script still needs testing with various
> datasets and use cases - bugs are expected.
>
Don't worry: the problem was only an small error in my code: I was
setting the driver's name incorrectly. So, it was never found. Fixed
and working now :-)

Many thanks
Best regards

Jorge
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel