Frustration setting in.. Plotting a single point...
Jeff Cotterman
jeff at BUTTEBUILT.ORG
Fri Feb 4 17:40:42 PST 2005
I'm sure this is something very simple, and I have gone through the
archives, and have copied numerous examples, the only thing I think can be
causing a problem is the huge extents of my shape file, and the point not
being converted correctly? There are two shapefiles for the US, and state
borders..
Anyway, here is my php file (which should look almost identical to the many
examples given) and my map file, any pointers would be greatly appreciated.
I have tried it with and without the setProjection also..
<?php
//Load the dynamic library.
dl('php_mapscript.so');
// create our map object
$map_file = "basic.map";
$map = ms_newMapObj($map_file);
// create a temp layer to hold our points
$point_layer = ms_newLayerObj($map);
$point_layer->set("name", "markers");
$point_layer->set("type", MS_LAYER_POINT);
$point_layer->set("status", MS_DEFAULT);
$point_layer->setProjection("proj=latlong",MS_TRUE);
// create a class and style for this layer
$point_class = ms_newClassObj($point_layer);
$point_style = ms_newStyleObj($point_class);
$point_symbol = $map->getSymbolByName("point");
$point_style->set("symbol", $point_symbol);
$point_style->set("size", 20);
// draw our image without the points
$image = $map->draw();
// initialize our point and add it to the map
$point = ms_newPointObj();
$longitude="-149.0300";
$latitude="61.5600";
$point->setXY($longitude, $latitude);
$point->draw($map, $point_layer, $image, 0, "");
// get the location for our new image
$tmp_png_file = $image->saveWebImage (MS_PNG, 0, 0, 0);
exec ("mv ".$tmp_png_file." "."/home/cotterj/test.png");
?>
--------------------------------------------
MAP
DEBUG on
EXTENT -2526068.80 3808293.58 2601312.92 930341.78
SIZE 410 240
SHAPEPATH /home/cotterj/shp/
IMAGECOLOR 255 255 255
PROJECTION
"proj=lcc"
"lat_0=18"
"lat_1=18"
"lon_0=-93"
"k_0=1"
"x_0=350000"
"y_0=150000"
"ellps=GRS80"
END
WEB
IMAGEPATH /home/cotterj/map
IMAGEURL /home/cotterj/map
END
LAYER
NAME "usa"
DATA county
STATUS DEFAULT
TYPE POLYGON
PROJECTION
"init=epsg:4269"
END
CLASS
NAME "base conus"
COLOR 255 255 255
END
END
LAYER
NAME "State Outlines"
DATA state
STATUS DEFAULT
TYPE POLYGON
PROJECTION
"init=epsg:4269"
END
CLASS
NAME "usa"
OUTLINECOLOR 102 102 102
END
END
END # end of map file
---------------------------------------------
Once again any help or things to try would be appreciated! I think I have
tried ever incarnation in the archives!
Cheers,
Jeff
More information about the MapServer-users
mailing list