Page 1 of 1

Error in VCLTee.TeeSHP

Posted: Wed Oct 28, 2015 3:10 pm
by 16570755
I am playing a little bit around with the LoadMap function because we want to extend our tool to deal with GIS data. The funtion works well but I guess there's a bug in the Code right here:

Code: Select all

  {$IFDEF CLR}
  ReadSHPHeader(ShpStream,SHPHeader);
  {$ELSE}
  ShpStream.ReadBuffer(SHPHeader,SizeOf(TSHPHeader));
  {$ENDIF}

  VerifySignature(SHPHeader.FileCode);

  {$IFDEF CLR}
  ReadSHPHeader(ShxStream,SHPHeader);
  {$ELSE}
  ShxStream.ReadBuffer(SHPHeader,SizeOf(TSHPHeader));
  {$ENDIF}

  VerifySignature(SHPHeader.FileCode);
As you may see, the code is doubled. That leads to a false record number in the following code

Code: Select all

NumRecords:=RecordCount(SHPHeader);
Is this a known issue? The resulting map Chart then mirrors that error as one can see, when you make the legend visible or just have a look at the data. There are too many data rows in the map.

Regards
Markus

Re: Error in VCLTee.TeeSHP

Posted: Fri Oct 30, 2015 12:16 pm
by yeray
Hello Markus,
Markus wrote:As you may see, the code is doubled.
Not exactly doubled. The first part loads the shp while the second part loads the shx.
Markus wrote:or just have a look at the data. There are too many data rows in the map.
Looking at the data tab in the demo, the shapes don't look doubled there:
europe.png
europe.png (157.72 KiB) Viewed 4474 times
Could you please arrange a simple example project we can run as-is to reproduce the problem here?

Thanks in advance.

Re: Error in VCLTee.TeeSHP

Posted: Sat Oct 31, 2015 12:04 pm
by 16570755
Hi Yeray,

your right! My fault! But I still have the problem that when I load a shp file, the data rows are multiple. I attached a sample project with a specific shp file, where you can see the effect. Is the shape file corrupt?

Thanks for your Support!

Regards
Markus

Re: Error in VCLTee.TeeSHP

Posted: Mon Nov 02, 2015 11:17 am
by yeray
Hello,

This shapefile has 16 records; some records have a single shape but some of them have multiple shapes. That's why there are more rows in the "Data" grid than records in the shp file.
The "Value" field on the "Data" grid represents the ZValues array used to give a color to each shape.