[Shapelib] RE: Problem using shapelib
Brian Peschel
brianp at mail.occinc.com
Thu Jun 17 09:33:21 PDT 2004
Is this function in ArcView? Or is it some external program? Any ideas
if this is a problem in ArcView or in ShapeLib?
Brian
>
>Date: Thu, 17 Jun 2004 10:22:09 +1000
>From: "David A Allen" <David.A1 at bigpond.com>
>Subject: RE: [Shapelib] Problem using shapelib
>To: "'Shapelib Development'" <shapelib at lists.maptools.org>
>Message-ID: <000801c45401$21b30f60$0aa736cb at David>
>Content-Type: text/plain; charset="us-ascii"
>
>Brian
>
>I have encountered this type of problem in ArcView and found that there
>is a function there that can remake a shapefile from a shapefile - this
>rectified the problem I had but is hardly a production solution.
>
>Regard David Allen
>
>_______________________
>David Allen - Research PhD Candidate specializing in
>electrical conductivity imaging of groundwater.
>National Centre for Groundwater Management
>University of Technology - Sydney
>Email David.A1 at bigpond.com
>mobile 0418 964 097
>phone/fax +61 2 63323895 (ring before sending any fax)
>70 Morrisset St Bathurst NSW 2795 Australia.
>
>
>-----Original Message-----
>From: shapelib-bounces at lists.maptools.org
>[mailto:shapelib-bounces at lists.maptools.org] On Behalf Of Brian Peschel
>Sent: Tuesday, 15 June 2004 1:46 AM
>To: shapelib at lists.maptools.org
>Subject: [Shapelib] Problem using shapelib
>
>
>I am having problems with ArcView and shapefiles I am creating with
>shapelib (linux RH 8.0)
>
>I am creating the shape files
> shpHandle = SHPCreate(tname.c_str(), SHPT_POLYGON);
>
>and then adding the points
> SHPGetInfo(shpHandle, NULL, &shapeType, NULL, NULL);
> panParts[0] = 1;
> // Loop and add each point
> padfX[verticesCount] = convertedPoint.x();
> padfY[verticesCount] = convertedPoint.y();
> verticesCount++;
> // end loop
> psObject = SHPCreateObject(shapeType, -1, 1, panParts, NULL,
>verticesCount, padfX, padfY, NULL, NULL );
>
>I then add the first point again since it is a polygon the first and
>last point apparently need to be the same (I have also tried not
>rewritting the final point).
> padfX[verticesCount] = padfX[0];
> padfY[verticesCount] = padfY[0];
> verticesCount++;
>
>This is a single ring polygon. If I call SHPRewindObject it reorders my
>
>points and the first/last point are no longer the same (so I am not
>calling it). I then write and destroy the objects.
>
> psObject = SHPCreateObject(shapeType, -1, 1, panParts, NULL,
>verticesCount, padfX, padfY, NULL, NULL );
> SHPWriteObject(shpHandle, -1, psObject);
> SHPDestroyObject(psObject);
>
>If I load these files into ArcView, they appear to be okay until you use
>
>them when the last point gets dropped off. If you use this shapechecker
>
>(http://www.geocities.com/SiliconValley/Haven/2295/useful.html scroll
>down to 'Shapefile Checker' - first hit in google
>http://www.google.com/search?hl=en&ie=UTF-8&q=shapefile+checker&btnG=Goo
>gle+Search
>) in debug mode you can see it is confused about the last point (and
>complains about the record size).
>
>I am really lost at this point. Any thoughts would be helpful. Thanks
>in advance.
>Brian
>
>
More information about the Shapelib
mailing list