[FWTools] Starting with FWTool
Faizan Tayyab
faizantayyab at yahoo.com
Tue Mar 18 13:10:12 EDT 2008
Hi,
Thanks for the help. I am trying to do the following:
map = ogr.Open( str, update = 0 )
where str holds the complete path but
I get the following error:
Traceback (most recent call last):
File "C:\Python24\My Programs\GISI.py", line 39, in
OnOpen
x.f(dialog.GetPath())
File "C:\Python24\My Programs\GISI.py", line 7, in f
map = ogr.Open( str, update = 0 )
File "C:\Python24\Lib\site-packages\osgeo\ogr.py",
line 3092, in Open
return _ogr.Open(*args, **kwargs)
TypeError: in method 'Open', argument 1 of type 'char
const *'
If i hard code the file path liek
c:\something\somthing\.... then it works fine.
Can anyone tell me why the ogr.open doesnt like
variable holding a string as parameter.
--- Frank Warmerdam <warmerdam at pobox.com> wrote:
> Faizan Tayyab wrote:
> > Hi,
> >
> > Can anyone provide me with python code (OGR) for
> > reading the geometry of a polygon shapefile. I am
> able
> > to obtain the geomerty reference but am unsure how
> to
> > read the geometry. I am planning to use matplotlib
> to
> > visualize the geometry.
> >
> > Anyone already done this????
>
> Faizan,
>
> I'm not aware of a direct example, but:
>
>
>
http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/vec_tr.py
>
> has logic to walk through any kind of geometry that
> might be helpful.
>
> Basically, a polygon geometry will consist of a top
> level object that
> contains one or more rings accessed using
> geom.GetGeometryRef(). Each
> ring will contain 3 or more points accessed using
> GetX(), and GetY().
>
> Best regards,
> --
>
---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up | Frank
> Warmerdam, warmerdam at pobox.com
> light and sound - activate the windows |
> http://pobox.com/~warmerdam
> and watch the world go round - Rush | President
> OSGeo, http://osgeo.org
>
>
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
More information about the FWTools
mailing list