[Mapserver-users] perl mapscript - progress...

Junkmail Box junkmail at deathkeep.com
Mon Mar 3 22:30:04 EST 2003


> The defalt status for a layer is OFF :-)
> $layer->{'status'} = $mapscript::MS_ON;

Good thinking. Setting the status still doesn't make any points appear,
however. Is the rest of that "declare a point, set its coords, and draw
it" syntax correct?


> The point coordinates are supposed to be consistent to the rest of
> the data and the extent set in mapObj or the mapfile.

How do you mean? The extent I have in arcata.map is:
EXTENT 407375  4522866  410627 4526910
So I changed the test script to these coords:
$point->{'x'} = 408500;
$point->{'y'} = 4525000;
but still nothing is displayed.


> To debug this type of thing i use the mapObj->save() method, it's really
> useful. Dunno if perl mapscript has it, though.

Hey, now that's spiffy. This appears to be the relevant paragraph. Do you
notice anything missing?

  LAYER
    NAME "points"
    SIZEUNITS PIXELS
    STATUS ON
    TOLERANCE 3
    TOLERANCEUNITS PIXELS
    TYPE POINT
    UNITS METERS
  END


Thanks, Vinko. Step by step...

Once I get this stuff figured out and get a bit comfortable with it, I
think I'd like to write up a tutorial that illustrates some of these
basics in a friendly manner. It'd probably come in handy for other folks
(like me) who aren't GIS experts or MapServer developers. ;)




On Mon, 3 Mar 2003, Vinko Vrsalovic wrote:

> On Mon, Mar 03, 2003 at 04:09:25PM -0800, Junkmail Box wrote:
> >
> > Thanks for the help so far, especially Lowell. I can get perl-mapscript to
> > draw a map that's already defined in a .map file, which is good progress.
> > I wanted to look at the quakes demo to see what else I could learn, but
> > I'm having a devil of a time trying to figure anything out.
> >
> > Here's an attempt to draw a point on a map, that doesn't work. The
> > underlying map draws A-OK, but the point isn't drawing.
> >
> >
> > my $map = new mapscript::mapObj("arcata.map") or die "Cannot open map file\n";
> > my $img = $map->prepareImage();
> > my $layer = new mapscript::layerObj($map); $layer->{'name'} = 'points';
> > $layer->{'type'} = $mapscript::MS_LAYER_POINT;
> >
> > my $point = new mapscript::pointObj();
> > # are these supposed to be lon/lat? arcata is 124W and 41N
> > $point->{'x'} = -124; $point->{'y'} = 41;
> > $point->draw($map,$layer,$img,undef,'HERE');
> > $map->drawLabelCache($img);
> >
> > $img->saveImage("example.png",$mapscript::MS_PNG,0,0,0);
> >
> >
> > I gather from the quakes example that the pointObj's x and y are supposed
> > to be lon/lat? The perl-mapscript doc doesn't specify.
> >
> > Is there a tutorial on perl-mapscript, or is that reference the only
> > document?
>
> The defalt status for a layer is OFF :-)
>
> $layer->{'status'} = $mapscript::MS_ON;
>
> The point coordinates are supposed to be consistent to the rest of
> the data and the extent set in mapObj or the mapfile.
> If they are not you can project them. But according to the comment
> above, you should be fine with those.
>
> To debug this type of thing i use the mapObj->save() method, it's really
> useful. Dunno if perl mapscript has it, though.
>
> --
> Vinko Vrsalovic <el[|- at -|]vinko.cl>
> http://www.cprsig.cl
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>




More information about the mapserver-users mailing list