/usr/share/doc/libmapscript-perl/examples/distanceToPoint.pl is in libmapscript-perl 6.4.1-5+deb8u3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #!/usr/bin/perl
#
# Script : distanceToPoint.pl
#
# Purpose: Returns distance between a shape and a point
#
# $Id$
#
use strict;
use warnings;
use POSIX;
use XBase;
use mapscript;
use Getopt::Long;
use File::Copy;
my ($infile, $infile_shpid, $x, $y, $distance);
GetOptions("infile=s", \$infile, "infile_shpid=s", \$infile_shpid, "x=s", \$x, "y=s", \$y);
if(!$infile or !$infile_shpid or !$x or !$y) {
print "Usage: $0 --infile=[filename] --infile_shpid=[shpid] --x=[x] --y=[y]\n";
exit 0;
}
# open the first input shapefile
my $inshpf = new mapscript::shapefileObj($infile, -1) or die "Unable to open shapefile $infile.";
my $inshape = $inshpf->getShape($infile_shpid);
my $inpt = new mapscript::pointObj($x, $y);
$distance = $inshape->distanceToPoint($inpt);
undef $inshpf;
print "Distance between shape $infile/$infile_shpid and point $x $y is $distance\n";
|