[mapserver-users] imagemaps using php mapscript?

Steve Lime Steve.Lime at dnr.state.mn.us
Mon Mar 30 16:07:50 EDT 2009


Templates will operate on all layers that have results. You have to do a
query of some sort
before running the results through the template though. I don't see
that in your script.

Steve

>>> On 3/28/2009 at 3:08 PM, in message
<BAY117-W55B4DA5351F121A30B3AB3F98F0 at phx.gbl>, "P. R.M."
<romero619 at hotmail.com> wrote:

> thanks, but that didnt help much.
> I have this:
>  
>   $map = ms_newMapObj("/data/www/html/test/test.map");
>   $img=$map->draw();
> 
>   $tmparray["img_url"] = $img->saveWebImage();
>  
>   # remove '/data/www/html' directory prefix 
>   # from the resulting url string
> 
>   $tmparray["img_url"] = 
> substr($tmparray["img_url"],14,strlen($tmparray["img_url"]));
> 
>   $html=$map->processquerytemplate($tmparray);
>   echo $html;
> 
> However, the processquerytemplate() function is not processing the
data in 
> my points layer.
> the imagemap html tags are empty, even though the points from my
points 
> layer are correctly being drawn on the map image.
>  
> Here's the relevant sections of my mapfile, including my points
layer:
>  
>  OUTPUTFORMAT
>     NAME 'html'
>     DRIVER 'TEMPLATE'
>     MIMETYPE 'text/html'
>    FORMATOPTION 'FILE=/data/www/html/test/testmap.html'
>   END
>   QUERYMAP
>     STATUS ON
>     STYLE NORMAL
>   END
>   WEB
>    QUERYFORMAT 'html'  
>     LOG "/data/www/html/test/mslog"
>     IMAGEPATH "/data/www/html/images/mapserver/tmp/"
>     IMAGEURL "/data/www/html/images/mapserver/tmp/"
>     MAXSCALE 15500000
>   END
> LAYER
>   NAME "mypoints"
>   STATUS DEFAULT
>     CONNECTIONTYPE OGR
>     CONNECTION "test.ovf"
>     DATA "mypoints"
>   TYPE POINT
>   TEMPLATE "/data/www/html/test/testmap.html"
>     CLASS 
>        NAME "None"
>     STYLE
>         SYMBOL 'arrow'
>      ANGLE [ADIR]
>            SIZE [MAG]
>     END
>     END
> END
>  
> the documentation says that the processquerytemplate() function
apparently 
> only processes at the mapobject layer, so it doesnt seem to process
each 
> layer. Is this correct?
>  
> How can I process the html template file using the points in my
points 
> layer?
>  
> Please help,
> Thanks,
> P.Romero
> ________________________________
>> Date: Sat, 28 Mar 2009 21:29:35 +0200
>> Subject: Re: [mapserver-users] imagemaps using php mapscript?
>> From: iacovlev.pavel at gmail.com 
>> To: romero619 at hotmail.com 
>>
>> $image = $map->draw();
>>
>> ob_start();
>> $image->saveimage('');
>> $image = imagecreatefromstring(ob_get_contents());
>> $contents = ob_get_contents();
>> ob_end_clean();
>>
>> imagepng($image);
>>
>>
>> 2009/3/28 P.Romero>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> How can this example:
>>
>>
>>
>> http://mapserver.org/output/imagemaps.html?highlight=imagemap 
>>
>>
>>
>>
>>
>>
>>
>>
>> be implemented using php mapscript?
>>
>>
>>
>>
>>
>>
>>
>> More specifically, how can the html output for the imagemap
>> be separated from the imageobject, and stored into a php variable?
>>
>>
>>
>>
>>
>>
>>
>> Im hoping for something like….
>>
>>
>>
>>
>>
>>
>>
>> $map = ms_newMapObj("mymapfile.map");
>>
>>
>>
>> $map_img=$img=$map->draw();
>>
>>
>>
>> $imagemap_html=$map->get_html_output();
>>
>>
>>
>>
>>
>>
>>
>> ...and then I can separately handle the image & html
>> output.
>>
>>
>>
>>
>>
>>
>>
>> Is this possible?
>>
>>
>>
>>
>>
>>
>>
>> Please help,
>>
>>
>>
>>
>>
>>
>>
>> Thanks,
>>
>>
>>
>> P.Romero
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>>
>> mapserver-users mailing list
>>
>> mapserver-users at lists.osgeo.org 
>>
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users 
>>
>>
>>
>>
>>
>> --
>> http://iap.md, The future is open
> _________________________________________________________________
> Express your personality in color! Preview and select themes for
Hotmail®.
>
http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_MSGTX_

>
WL_HM_express_032009#colortheme______________________________________________
> _
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org 
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list