is it possible to work with shp files in delphi?

8

I would like to put together an application that would have the function of a GIS (QGIS for example), instead of developing a plugin that depend on it for the software to work, generate in% with an executable independent.

I already have an ugly script in Delphi and R The Python. opens the contour of the map, and the person opens the script and generates some points based on a geostatistical calculation.

So in the beginning the initial functions should be something like reading the file Qgis polygon and display on the screen, and from that generate the points taking into account the map conditions.

I think this would depend on some library, I could not find an example, are there? Is it possible?

    
asked by anonymous 09.12.2015 / 13:22

1 answer

6

Friend, the search was great and I got great results!

Today there are already solutions for this, so I analyzed several and several and ended up finding several solutions, however, you need a greater effort to reach the level you want!

Currently the files are not summarized only in .SHP , updated today:

SHP: The graphical data
SHX: The index
DBF: Attribute data

The easiest solution today is the ShapeLib library (% with% &% with%).

I'm not sure of the version of Delphi on that has been modified, but I assure you of Delphi 2009 the Default is ShpAPI129.pas , so in library call functions you need to change:

Function SHPOpen (pszShapeFile: PChar; pszAccess: PChar): SHPHandle; cdecl; external LibName name '_SHPOpen';

//para:

Function SHPOpen (pszShapeFile: PAnsiChar; pszAccess: PAnsiChar): SHPHandle; cdecl; external LibName name '_SHPOpen';


//observe a mudança do PChar para PAnsiChar

If you do not make the above change, the function return will be shapelib.dll . In the Delphi 7 version it works without the conversion!

Here's a stopped project, but several tools and examples are still available: CartoVCL

In English, but super useful to increase knowledge: Delphi Gis Wiki

Abandoned topic in a forum on the subject: PointInShapefile and shape fill with Delphi

    
13.12.2015 / 14:24