[mapserver-users] Flash + mapserver usage q.

Jan Hartmann jhart at frw.uva.nl
Fri Aug 9 08:25:55 EDT 2002


Alex Rice wrote:

> I have seen mention on this list of:

> 1) using Ming libs to output SWF maps on the server side w/ mapserver.
> 2) using Flash interface to present JPEGs or whatever bitmaps
> produced by mapserver.

> However, has anyone worked on writing a Flash movie that will
> render on the client side a map + navigation interface from a WML
> session or GML stream coming from mapserver? I think current
> Flash versions have built in HTTP, javscript and XML parsing.
> Seems like this would be a nice solution.

It IS a nice solution. Actually, you already can do something like that with
PHP MapScript: read out the coordinate values from a Shapeobject and send
them back in ASCII to Flash in any format you like. This could be XML or GMS
or SVG, but a comma-delimited string of ASCII numbers works just as well (eg
"coords=x1,y1,x2,y2,x3,y3 .. "). Within Flash you then use

movieclip.loadvariables(MapScriptPHPurl, POST),

This will call the url and when it returns, the variable "coords" will be
available in the movieclip, filled with the list of coordinates. You can
extract those with string.split(). If you prefer to generate XML, you can of
course use the XML object in Flash, but for this simple scenario I would
regard that as overkill.

I'm not sure if this kind of output will be available in MapServer3.7. As
said, it can be done from PHP, but it would be nice if Shapeobjects could be
returned directly from MapServer as ASCII strings, in XML or whatever.

One final remark: Shapeobjects are different before and after the call to
$map->draw(). Before, they contain world-coordinates, afterwards transformed
pixel coordinates. Moreover, some sort of pruning seems to take place,
eliminating duplicate pixels I think (some one knows what happens exactly
here?). This is a very nice feature, so even if you only need ASCII output
for Flash, call $map->draw() beforehand all the same.

Regards,

Jan

Jan Hartmann
Department of Geography
University of Amsterdam
jhart at frw.uva.nl






More information about the mapserver-users mailing list