[gdal-dev] Reading the points from shp file

Djordje Spasic issworld2000 at yahoo.com
Sat Jan 9 12:56:26 PST 2016


Hello,

I am trying to read the point geometry from .shp file in ironpython 2.7, by using C# gdal bindings (downloaded from gisinternals).
There is a tutorial on how this can be done on gdal.org, but it's in C, C++ and Python languages, with which I am not familiar with (I am familiar with python, but the syntax is completely different from C# gdal bindings syntax).

I googled a bit, and found the ogrinfo C# file example by Tamas Szekeres, which helped me to replicate what I want in ironpython, but only partly.
What I need is to get the points of each line and polygon from .shp file.I checked the Ogr.Geometry class, but I still do not understand how to do it.I tried using Ogr.Geometry.GetX/Y/Z method:


feat = layer.GetNextFeature()
geom = feat.GetGeometryRef()
sub_geom = geom.GetGeometryRef(i)
print sub_geom.GetX(i), sub_geom.GetY(i), sub_geom.GetZ(i)


But it is not working. I can read only 47 points in this way, while the .shp file has much more points than those 47.

I would be very grateful for any kind of advice.

Thank you in advance.

Kind regards,
Djordje Spasic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160109/7858f134/attachment.html>


More information about the gdal-dev mailing list