[mapserver-users] Projection question
Steve Lime
Steve.Lime at dnr.state.mn.us
Mon Nov 16 14:00:32 PST 2009
You need to define a projection at the map level (in the mapfile) and then set a projection for the point
layer (programmatically). With those in place things should work as expected.
You could also project the point in your script from lat/lon to whatever you're using and then just
draw it as you are currently...
Steve
>>> On 11/13/2009 at 2:51 PM, in message
<0F07C89515E3460593C3926E6499F830 at SkySource>, Helen Eskina
<heskina at ubitech.com> wrote:
> Hello,
>
>
>
> I have just started working with MapServer and MapScript.
>
> I would really appreciate any help!
>
>
>
> I tried to create a point on the map using GMap Demo. My point is presented
> by latlong coordinates. Below is the code.
>
> ------------------------------------------------------------
>
> $map = ms_newMapObj($map_path."mymap.map");
>
> $daLayer = ms_newLayerObj($map);
>
> $daLayer->set("type", MS_LAYER_POINT);
>
> $daLayer->set("status", MS_ON);
>
> $class = ms_newClassObj($daLayer);
>
> $style = ms_newStyleObj($class);
>
> $style->color->setRGB(255,0,0);
>
> $style->set("symbolname", "circle");
>
> $style->set("size", 10);
>
> $my_point = ms_newpointObj();
>
>
>
> $my_point->setXY(45.322500,-75.669167);
>
> $image=$map->draw();
>
> $my_point->draw( $map, $daLayer, $image, 0, "Point" );
>
>
>
> $image_url=$image->saveWebImage();
>
> -----------------------------------------------------------------------
>
> The point is shown on the map, but in the wrong place. I understand that it
> is probably because the projection is wrong.
>
>
>
> How to find out which projection is used in the map file?
>
> MAP file:
>
> MAP
>
> NAME DEMO
>
> STATUS ON
>
> #SIZE 400 300
>
> SIZE 800 600
>
> SYMBOLSET ../etc/symbols.sym
>
> EXTENT -2200000 -712631 3072800 3840000
>
> UNITS METERS
>
> SHAPEPATH "../data"
>
> IMAGECOLOR 255 255 255
>
> FONTSET ../etc/fonts.txt
>
>
>
> LAYER
>
> NAME bathymetry
>
> METADATA
>
> "DESCRIPTION" "Elevation/Bathymetry"
>
> END
>
> TYPE RASTER
>
> STATUS ON
>
> DATA bath_mapserver.tif
>
> END
>
>
>
>
>
> Thank you.
More information about the MapServer-users
mailing list