creating queryable shapefiles
Trond Michelsen
trondmm-mapserver at CRUSADERS.NO
Tue Mar 29 05:35:33 PST 2005
Hi.
I'm using mapserver, and I need to create a shapefile from a list of
coordinates that I have, and I need to display this layer as points,
which can be clicked on for further information about that point.
Anyway - I have made this small perl-program that generates the
shapefile, and it the layers loads fine in mapserver. Except that I
can't click on it.
--8<--
#!/usr/bin/perl
use strict;
use warnings;
use Geo::Shapelib ':constants';
my $shape = Geo::Shapelib->new();
$shape->{Shapetype} = MULTIPOINT;
$shape->{FieldNames} = ['testpoints'];
$shape->{FieldTypes} = ['String:60'];
while (<>) {
chomp;
my ($name,$x,$y) = split;
push @{$shape->{Shapes}}, {
SHPType => MULTIPOINT,
Vertices => [[$x,$y]]
};
push @{$shape->{ShapeRecords}}, [$name];
}
$shape->save('mylayer');
--8<--
names and coordinates are piped through STDIN
In the mapfile, the web- and layer-objects look like this:
WEB
TEMPLATE "printable.html"
EMPTY "/empty.html"
imagepath "/var/www/html/tmp/"
imageurl "/tmp/"
END
LAYER
name "mylayer"
data mylayer
status default
type point
CLASS
name "testpoints"
color 0 255 0
outlinecolor 0 0 0
template test.html
STYLE
color 123 123 0 # dummy color
symbol 'circle'
size 6
END
END
END
Whenever I make a query, I always get redirected to empty.html
Here's an example of the query request, as taken from the log:
GET /cgi-bin/mapserv
?mode=query
&map=/var/www/test.map
&qlayer=mylayer
&layers=
&imgext=-386503.564521+-3634774.809739+684073.545134+-2971595.143072
&imgsize=1109+687
&imgxy=628+118
(and I'm pretty sure the pointer was above the point when I clicked ;)
Any suggestions of what I'm missing to make my shapefile
clickable/queryable?
--
Trond Michelsen
More information about the MapServer-users
mailing list