[gdal-dev] Reading the points from shp file

Mike Flannigan mikeflan at att.net
Sun Jan 10 18:11:07 PST 2016


I can't help with the ironpython problem you are
having, but I have a couple of Perl scripts that
strip data from shp files.  They are not likely
to do what you want, but I could try it if you
want me to.

One of them says this:

# This program extracts data from shp and shx files
# and places the data into the $outfile.  Place both
# the .shp and .shx file in the C:/Copy directory.
# The output file is also created in the same directory.

I can also send the files if you run Perl.  They use
the Geo::ShapeFile module.


Mike


On 1/10/2016 2:00 PM, gdal-dev-request at lists.osgeo.org wrote:
> 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



More information about the gdal-dev mailing list