dump.pl

来自「Welcome to MS4W, the no fuss installer f」· PL 代码 · 共 42 行

PL
42
字号
#!/usr/bin/perluse mapscript;use Getopt::Long;%types = ( '1' => 'point',	   '3' => 'arc',	   '5' => 'polygon',	   '8' => 'multipoint'	 );&GetOptions("file=s", \$file);if(!$file) {  print "Syntax: dump.pl -file=[filename]\n";  exit 0;}$shapefile = new mapscript::shapefileObj($file, -1) or die "Unable to open shapefile $file";print "Shapefile opened (type=". $types{$shapefile->{type}} .") with ".$shapefile->{numshapes} ." shape(s)\n";$shape = new mapscript::shapeObj(-1);for($i=0; $i<$shapefile->{numshapes}; $i++) {        $shapefile->get($i, $shape);    print "Shape $i has ". $shape->{numlines} ." part(s) - ";    printf "bounds (%f,%f) (%f,%f)\n", $shape->{bounds}->{minx}, $shape->{bounds}->{miny}, $shape->{bounds}->{maxx}, $shape->{bounds}->{maxy};    for($j=0; $j<$shape->{numlines}; $j++) {        $part = $shape->get($j);        print "Part $j has ". $part->{numpoints} ." point(s)\n";        for($k=0; $k<$part->{numpoints}; $k++) {            $point = $part->get($k);            print "$k: ". $point->{x} .", ". $point->{y} ."\n";        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?