Go to the source code of this file.
◆ ShpReadUsage()
void ShpReadUsage |
( |
void |
| ) |
|
Definition at line 16 of file ShpRead.cpp.
19 _printf0_(
" This module reads shapefiles and converts them to matlab/python structures\n");
23 _printf0_(
" filexp file name of exp file to be written\n");
◆ WRAPPER()
WRAPPER |
( |
ShpRead_python |
| ) |
|
Definition at line 28 of file ShpRead.cpp.
36 #ifndef _HAVE_SHAPELIB_ //only works if shapelib library has been compiled in.
37 _error_(
"Shapelib not available! Cannot carry out shp file translation!");
48 SHPHandle hSHP = SHPOpen( filename,
"rb" );
49 if(!hSHP)
_error_(
"Error opening shp/shx files.");
52 int nShapeType,nEntities;
54 SHPGetInfo( hSHP, &nEntities, &nShapeType, adfMinBound, adfMaxBound );
55 _printf_(
"Shapefile Type: "<<SHPTypeName(nShapeType)<<
" number of Shapes: "<< nEntities<<
"\n\n");
61 for(
int i=0; i<nEntities;i++ ){
63 SHPObject* psShape = SHPReadObject(hSHP,i);
64 _printf_(
"Shape #"<<i<<
" ("<<SHPTypeName(psShape->nSHPType)<<
") nVertices="<<psShape->nVertices<<
", nParts="<<psShape->nParts<<
"\n");
68 switch(psShape->nSHPType){
70 contour=
new Contour<double>(0,psShape->nVertices,psShape->padfX,psShape->padfY,
false);
73 _printf_(
"Shape type "<<SHPTypeName(psShape->nSHPType)<<
"not supported yet, skipping...\n");
78 SHPDestroyObject(psShape);
86 xDelete<char>(filename);