Error reading from OGR: Unhandled Exception... Access violation reading location 0x00000000

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Error reading from OGR: Unhandled Exception... Access violation reading location 0x00000000

taibc
Hi friends,

I am trying to use OGR classes on VS2010 to read and write from file as the link:
http://gdal.org/ogr/ogr_apitut.html 

But I got an error, please see attached screenshot for details.



Do you know this error ?

Thanks and regards,

Tai
Reply | Threaded
Open this post in threaded view
|

Re: Error reading from OGR: Unhandled Exception... Access violation reading location 0x00000000

Mateusz Loskot
On 16 July 2012 10:10, taibc <[hidden email]> wrote:
> I am trying to use OGR classes on VS2010 to read and write from file as the
> link:
> http://gdal.org/ogr/ogr_apitut.html
>
> But I got an error, please see attached screenshot for details.
>
> http://osgeo-org.1560.n6.nabble.com/file/n4988534/error.png

Your pointer poLayer is NULL.
Perhaps the layer you want could not be found by given name
and this call returns NULL:

poLayer = poDS->GetLayerByName(...)

Just check:

if( poLayer == NULL )
{
    printf( "Layer not found.\n" );
    exit( 1 );
}

> Do you know this error ?

http://en.wikipedia.org/wiki/Segmentation_fault#Segmentation.2C_page_fault.2C_and_access_violation

I'd recommend you to get a good C/C++ book.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Error reading from OGR: Unhandled Exception... Access violation reading location 0x00000000

Dmitry Baryshnikov
In reply to this post by taibc
16.07.2012 13:10, taibc пишет:

> Hi friends,
>
> I am trying to use OGR classes on VS2010 to read and write from file as the
> link:
> http://gdal.org/ogr/ogr_apitut.html
>
> But I got an error, please see attached screenshot for details.
>
> http://osgeo-org.1560.n6.nabble.com/file/n4988534/error.png
>
> Do you know this error ?
>
> Thanks and regards,
>
> Tai
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Error-reading-from-OGR-Unhandled-Exception-Access-violation-reading-location-0x00000000-tp4988534.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
You poLayer pointer is NULL. Use const char* err = CPLGetLastErrorMsg();
to check error

Best regards,
Dmitry

_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Error reading from OGR: Unhandled Exception... Access violation reading location 0x00000000

taibc
Yes, thank you.

I have another question: When reading the files (.dgn, or .shp), why only have one layer (I used the function GetLayerCount()) ?

I check these file on Microstation or ArcCatalog, they have many layers.

Thanks and regards,

Tai
Reply | Threaded
Open this post in threaded view
|

Re: Error reading from OGR: Unhandled Exception... Access violation reading location 0x00000000

Dmitry Baryshnikov
16.07.2012 14:42, taibc пишет:

> Yes, thank you.
>
> I have another question: When reading the files (.dgn, or .shp), why only
> have* one layer* (I used the function GetLayerCount()) ?
>
> I check these file on Microstation or ArcCatalog, they have many layers.
>
> Thanks and regards,
>
> Tai
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Error-reading-from-OGR-Unhandled-Exception-Access-violation-reading-location-0x00000000-tp4988534p4988552.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
http://gdal.org/ogr/drv_dgn.html
http://gdal.org/ogr/drv_shapefile.html

Best regards,
Dmitry

_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev