ReadPoint.pl

From Wildsong
Jump to navigationJump to search

The source

#  Testing the shapelib,
#  just trying to figure out how to use it.
use strict;
use Geo::Shapelib;
use Data::Dumper; 

# Point this at a sample point file.

my $file = '/cygdrive/c/TEMP/MyShapes/manhole';
my $shapefile = new Geo::Shapelib($file);
my $shaperef = $shapefile->get_shape(0,0);

print Dumper($shaperef);

The output

$ perl read_shapefile.pl
$VAR1 = {
         'NParts' => 0,
         'ShapeId' => 0,
         'MinBounds' => [
                          '1278761.62700578',
                          '332423.967283228',
                          '0',
                          '0'
                        ],
         'SHPType' => 1,
         'Parts' => [],
         'MaxBounds' => [
                          '1278761.62700578',
                          '332423.967283228',
                          '0',
                          '0'
                        ],
         'Vertices' => [
                         [
                           '1278761.62700578',
                           '332423.967283228',
                           '0',
                           '0'
                         ]
                       ],
         'NVertices' => 1
       };