|
| 1 | +#!/usr/bin/perl |
| 2 | + |
| 3 | +use XBase; |
| 4 | +use mapscript; |
| 5 | + |
| 6 | +sub clean() { |
| 7 | + my ($file) = @_; |
| 8 | + |
| 9 | + foreach $extension ('.shp', '.shx', '.dbf', '.qix') { |
| 10 | + unlink $file.$extension; |
| 11 | + } |
| 12 | +} |
| 13 | + |
| 14 | +&clean('airports'); |
| 15 | + |
| 16 | +$shapefile = new shapefileObj("airports", 1) or die("Error creating shapefile airports."); |
| 17 | +$table = XBase->create("name" => "airports", |
| 18 | + "field_names" => ["NAME", "LAT", "LON", "ELEVATION", "QUADNAME"], |
| 19 | + "field_types" => ["C", "N", "N", "N", "C"], |
| 20 | + "field_lengths" => [64, 12, 12, 12, 32], |
| 21 | + "field_decimals" => [0, 4, 4, 4, 0]) or die XBase->errstr; |
| 22 | + |
| 23 | +$point = new pointObj(); |
| 24 | + |
| 25 | +$point->{x} = 451306.0000; |
| 26 | +$point->{y} = 5291930.0000; |
| 27 | +$shapefile->addPoint($point); |
| 28 | +$table->set_record(0, 'Bigfork Municipal Airport', 47.7789, -93.6500, 1343.0000, 'Effie'); |
| 29 | + |
| 30 | +$point->{x} = 469137.0000; |
| 31 | +$point->{y} = 5271647.0000; |
| 32 | +$shapefile->addPoint($point); |
| 33 | +$table->set_record(1, 'Bolduc Seaplane Base', 47.5975, -93.4106, 1325.0000, 'Balsam Lake'); |
| 34 | + |
| 35 | +$point->{x} = 434634.0000; |
| 36 | +$point->{y} = 5267578.0000; |
| 37 | +$shapefile->addPoint($point); |
| 38 | +$table->set_record(2, 'Bowstring Municipal Airport', 47.5583, -93.8689, 1372.0000, 'Jessie Lake'); |
| 39 | + |
| 40 | +$point->{x} = 454146.0000; |
| 41 | +$point->{y} = 5274617.0000; |
| 42 | +$shapefile->addPoint($point); |
| 43 | +$table->set_record(3, 'Burns Lake Seaplane Base', 47.6233, -93.6103, 1357.0000, 'Clubhouse Lake'); |
| 44 | + |
| 45 | +$point->{x} = 495913.0000; |
| 46 | +$point->{y} = 5279532.0000; |
| 47 | +$shapefile->addPoint($point); |
| 48 | +$table->set_record(4, 'Christenson Point Seaplane Base', 47.6692, -93.0544, 1372.0000, 'Side Lake'); |
| 49 | + |
| 50 | +$point->{x} = 439581.0000; |
| 51 | +$point->{y} = 5244617.0000; |
| 52 | +$shapefile->addPoint($point); |
| 53 | +$table->set_record(5, 'Deer River Municipal Airport', 47.3522, -93.8000, 1311.0000, 'Deer River'); |
| 54 | + |
| 55 | +$point->{x} = 493040.0000; |
| 56 | +$point->{y} = 5230604.0000; |
| 57 | +$shapefile->addPoint($point); |
| 58 | +$table->set_record(6, 'Gospel Ranch Airport', 47.2289, -93.0919, 1394.0000, 'Floodwood Lake'); |
| 59 | + |
| 60 | +$point->{x} = 461401.0000; |
| 61 | +$point->{y} = 5228719.0000; |
| 62 | +$shapefile->addPoint($point); |
| 63 | +$table->set_record(7, 'Grand Rapids-Itasca County/Gordon Newstrom Field', 47.2108, -93.5097, 1355.0000, 'Grand Rapids'); |
| 64 | + |
| 65 | +$point->{x} = 455305.0000; |
| 66 | +$point->{y} = 5240463.0000; |
| 67 | +$shapefile->addPoint($point); |
| 68 | +$table->set_record(8, 'Richter Ranch Airport', 47.3161, -93.5914, 1340.0000, 'Cohasset East'); |
| 69 | + |
| 70 | +$point->{x} = 471043.0000; |
| 71 | +$point->{y} = 5251664.0000; |
| 72 | +$shapefile->addPoint($point); |
| 73 | +$table->set_record(9, 'Shaughnessy Seaplane Base', 47.4178, -93.3839, 1300.0000, 'Lawrence Lake West'); |
| 74 | + |
| 75 | +$point->{x} = 496393.0000; |
| 76 | +$point->{y} = 5280458.0000; |
| 77 | +$shapefile->addPoint($point); |
| 78 | +$table->set_record(10, 'Sixberrys Landing Seaplane Base', 47.6775, -93.0481, 1372.0000, 'Side Lake'); |
| 79 | + |
| 80 | +$point->{x} = 444049.0000; |
| 81 | +$point->{y} = 5277360.0000; |
| 82 | +$shapefile->addPoint($point); |
| 83 | +$table->set_record(11, 'Snells Seaplane Base', 47.6472, -93.7450, 1351.0000, 'Bigfork'); |
| 84 | + |
| 85 | +$table->close(); # save the files |
| 86 | +undef $shapefile; |
| 87 | + |
| 88 | +exit 0; |
0 commit comments