[gdal-dev] OGR API for ESRI Shapefile writer
Hi All, I was trying to create a shapefile using the code below: It looks like though the fieldnames are getting created but the values (I tried just one row) are not getting created: OGRRegisterAll(); OGRSFDriver *poDriver = OGRSFDriverRegistrar::GetRegistrar()-GetDriverByName(ESRI Shapefile); OGRDataSource *poDS = poDriver-CreateDataSource(point_out.shp, 0); OGRLayer *poLayer = poDS-CreateLayer(point_out, 0, wkbPoint, 0); OGRFieldDefn oField1(Longitude, OFTReal); OGRFieldDefn oField2(Latitude, OFTReal); OGRFieldDefn oField3(Speed, OFTReal); if(poLayer-CreateField(oField1) != OGRERR_NONE) { std::cout creation of Longitude failed std::endl; exit(1); } if(poLayer-CreateField(oField2) != OGRERR_NONE) { std::cout creation of Latitude failed std::endl; exit(1); } if(poLayer-CreateField(oField3) != OGRERR_NONE) { std::cout creation of Speed failed std::endl; exit(1); } OGRFeature *poFeature = OGRFeature::CreateFeature( poLayer-GetLayerDefn() ); poFeature-SetField(Longitude, 1.1); poFeature-SetField(Latitude, 2.2); poFeature-SetField(Speed, 3.3); if( poLayer-CreateFeature( poFeature ) != OGRERR_NONE ) { std::cout Failed to create feature in shapefile std::endl; exit( 1 ); } OGRFeature::DestroyFeature( poFeature ); Am I missing something basic here ? Thanks, Chandra ** This communication contains information which is confidential and may also be legally privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), disclosure, copying, distribution, or other use of, or action taken or omitted to be taken in reliance upon, this communication or the information in it is prohibited and maybe unlawful. If you have received this communication in error please notify the sender by return email, delete it from your system and destroy any copies. ** ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
RE: [gdal-dev] OGR API for ESRI Shapefile writer
-Original Message- From: Even Rouault [mailto:even.roua...@mines-paris.org] Almost perfect, but you've made a classical error : you've just forgotten to properly close the dataset with OGRDataSource::DestroyDataSource( poDS ); Quoting http://gdal.org/ogr/ogr_apitut.html: Finally we need to close down the datasource in order to ensure headers are written out in an orderly way and all resources are recovered. [Chandra ] It worked like a magic! It was my fault that I didn't read the tutorial completely :( though it was hardly 2-3 pages and complete in all sense. Thanks a lot Even! Regards, Chandra ** This communication contains information which is confidential and may also be legally privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), disclosure, copying, distribution, or other use of, or action taken or omitted to be taken in reliance upon, this communication or the information in it is prohibited and maybe unlawful. If you have received this communication in error please notify the sender by return email, delete it from your system and destroy any copies. ** ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
RE: [gdal-dev] Errors in compiling GDAL on a 64bits Linux
/afs/isis.unc.edu/pkg/oracle-1020/client//lib/libexpat.so: could not read symbols: File in wrong format collect2: ld returned 1 exit status make[1]: *** [libgdal.la] Error 1 [Chandra ] it looks like it is getting linked against 32-bit libexpat.so Can you check the same by file path-to-libexpat/libexpat.so and let me know the result of the same ? ** This communication contains information which is confidential and may also be legally privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), disclosure, copying, distribution, or other use of, or action taken or omitted to be taken in reliance upon, this communication or the information in it is prohibited and maybe unlawful. If you have received this communication in error please notify the sender by return email, delete it from your system and destroy any copies. ** ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] hdf5 to esri shape-file converter
Hi, I was looking for a converter tool to convert a given hdf5 file (.mh5) to esri shape-files(.shp) and vice versa. Does anyone has any idea about the same? Does anyone see any utility in developing this(if it doesn't exists already somewhere)? Thanks, Chandra ** This communication contains information which is confidential and may also be legally privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), disclosure, copying, distribution, or other use of, or action taken or omitted to be taken in reliance upon, this communication or the information in it is prohibited and maybe unlawful. If you have received this communication in error please notify the sender by return email, delete it from your system and destroy any copies. ** ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
RE: [gdal-dev] hdf5 to esri shape-file converter
Steffen, Hi Chandra, I was looking for a converter tool to convert a given hdf5 file (.mh5) to esri shape-files(.shp) and vice versa. GDAL supports reading of HDF5 raster data. [Chandra ] this is really cool news for me. But Shape files are vector data. The process to convert from raster to vector data is called Vectorization. And Vectorization is not a straightforward thing. See e.g http://en.wikipedia.org/wiki/Vectorization_(computer_graphics) Thanks for the info. It is very useful for me. But HDF5 can actually many different things: Are you talking about HDF5 files with raster or vector data? [Chandra ] I have hdf files holding vector data only(basically longitude, latitude, speed etc). Do you think that it will easier now to convert it to shape files? I thought that just inspecting the hdf-file to grab the vector data somehow will be really cool if it holds that and the same can be converted to shape files using ogr api. May be it is not that cool :( Many a thanks, Chandra ** This communication contains information which is confidential and may also be legally privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), disclosure, copying, distribution, or other use of, or action taken or omitted to be taken in reliance upon, this communication or the information in it is prohibited and maybe unlawful. If you have received this communication in error please notify the sender by return email, delete it from your system and destroy any copies. ** ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev