D bindings for Shapefile C Library

Craig Dillabaugh craig.dillabaugh at gmail.com
Wed Jan 29 19:53:43 PST 2014


On Wednesday, 29 January 2014 at 05:26:31 UTC, Suliman wrote:
> Big thanks! Could you provide simple example of usage this lib. 
> I
> have not experience in usage bindings, but I would like to try 
> to
> write some tiny app to working with shp files.

Not sure what sort of help you need, and what platform?

First thing I would suggest though is to get your hands on some 
Shapefile data.  You can get some free stuff here (there is lots 
of free Shapefile data floating around out there):

http://download.geofabrik.de/

Note that a Shapefile is actually a collection of files (.shp, 
.shx, .dbf, .prj) sharing the same base name. You need all the 
files in the same location and then if you access 'building' the 
library will need the files building.shp, building.shx, 
building.dbf (I think the .prj is optional).

To actually build The Shapefile library you can download it form 
here:

http://shapelib.maptools.org/

I build an static library on linux ( libshp.a ) and then, because 
I was lazy and libshp is small I just copied that into my test 
directory and built a test program with the following command:

dmd -gc shapetest.d shapefil.d libshp.a

Where shapetest.d is my test program, shapefil.d is my binding, 
and libshp.a is the library.

My shapetest.d is currently a bit of a mess, but I can put it on 
gitHub in a day or two if you would like.




More information about the Digitalmars-d-announce mailing list