[Mapserver-users] mapscript: convert lat/lon to map coords? Simple Q
poff
poff at sixbit.org
Thu Aug 21 23:15:50 PDT 2003
Hello all,
This is a simple question which is puzzling me.
When I draw a lat/lon value on a map, I just call setXY() and it draws in
the right place.
However it seems when I want to draw a line it's using map co-ordinates -
even if I set an extent.
It's probably something really stupid I'm doing so I hope you can help me
out!
The mapfile is simple, and the script below does output a line, but not
with lat/lon co-ords but absolute co-ords for the image.
...
# start layer lines
LAYER
NAME 'lines'
TRANSFORM FALSE
TYPE LINE
STATUS DEFAULT
CLASS
SYMBOL 'marker'
SIZE 2
COLOR 255 0 0
END
END
# end layer lines
...
Oh yes, is there are quicker (or smaller number of lines way) of adding
lines to a map?
Thank you in advance for any help,
<?php
...
$mapObj = ms_newMapObj($_SERVER["DOCUMENT_ROOT"]."/maps/plot.map");
$layerObj = $mapObj->getLayerByName("lines");
$layerObj->set("status", 1);
$minx=-125;
$miny=10;
$maxx=105;
$maxy=50;
$mapObj->setextent($minx,$miny,
$maxx,$maxy);
$imgObj=$mapObj->draw();
$shpObj = ms_newShapeObj(MS_SHAPE_LINE);
$pointObj1 = ms_newPointObj();
$pointObj1->setXY(-122.247,47.5881); // Seattle
$pointObj2 = ms_newPointObj();
$pointObj2->setXY(5.73333,45.65); // Paris
$pointObj3 = ms_newPointObj();
$pointObj3->setXY(104.917,11.55); // Phnom Pehn
$lineObj = ms_newLineObj();
$lineObj->add($pointObj1);
$lineObj->add($pointObj2);
$lineObj->add($pointObj3);
$shpObj->add($lineObj);
$shpObj->draw($mapObj, $layerObj, $imgObj, 0, "foo");
$image_url=$imgObj->saveWebImage(MS_PNG,1,1,0);
...
?>
Any other criticisms are warmly welcomed!
--
poff at sixbit.org
SDF Public Access UNIX System - http://sdf.lonestar.org
Please do not carbon copy replies to me
More information about the MapServer-users
mailing list