[gdal-dev] Reading the points from shp file

Djordje Spasic issworld2000 at yahoo.com
Mon Jan 11 02:11:06 PST 2016


Thank you for the reply Mr. Flannigan,

Sadly I have no knowledge of Perl.
If its "Geo::ShapeFile" module uses the same C# GDAL bindings (or is based on them), then I might try to take a look at your Perl code.
If not, then I guess I can not make use of it.

I respect the intention to help, though.

Kind regards,
Djordje Spasic

      From: Mike Flannigan <mikeflan at att.net>
 To: gdal-dev at lists.osgeo.org 
Cc: issworld2000 at yahoo.com
 Sent: Monday, January 11, 2016 3:11 AM
 Subject: Re: [gdal-dev] Reading the points from shp file
   

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



  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160111/33abdb22/attachment.html>


More information about the gdal-dev mailing list