[Mapserver-users] SWF problem

GIRAUD Pierre pierre.giraud3 at free.fr
Sun May 9 13:04:37 EDT 2004


--------------090904060408050504020502
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Just try to output your map in multiple movies ("OUTPUT_MOVIE=MULTIPLE").
I expect this will not return fatal error but one swf for each layer in 
your mapfile. Hope this works.
I don't even know why single output crashes. Is it due to ming library 
or mapserver ?

If you are able with this method to generate movies, you'll just have to 
redefined your Flash app to load each movie individualy.
I didn't work on this a lot but I think this might be a good way to 
built a flash interface. I mean, layers may be hidden or shown 
individualy easily and other great stuffs could be imagined.

It would also be great to have examples or experience returns from 
people who succesfully explored this mapserver output possibility.

Regards.

Pierre GIRAUD

Hau Lu a écrit:

> Dear List user:
>  
>     I'm trying to use Mapserver (using the Windows binary 
> ms402_png_pg.zip provided on the mapserver download site which should 
> support SWF output) to output swf files that I can load from a Flash 
> app ( using loadMovie(..) function).
>  
>  
> part of my php code looks like this:
>  
> ......Initialize $map object
>  
> $map->selectOutputFormat("SWF");
> $image = $map->draw();
> $image_url=$map->saveWebImage(); // error occurs here
>  
> .....output the $image_url var to Flash app
>  
> and the map file looks like this (it's actually one of the example map 
> files from the tutorial):
>  
> MAP
> IMAGETYPE JPEG
> INTERLACE OFF
> EXTENT         201621.496941 -294488.284025 1425518.020722 498254.511514
> SIZE           400 300
> SHAPEPATH      "data"
> IMAGECOLOR     255 255 255
>  
> OUTPUTFORMAT
>  NAME swf
>  MIMETYPE "application/x-shockwave-flash"
>  DRIVER swf
>  IMAGEMODE PC256
>  FORMATOPTION "OUTPUT_MOVIE=SINGLE"
> END
>  
> WEB
>  IMAGEPATH "C:/Apache/htdocs/tmp/"
>  IMAGEURL "/tmp/"
>  MAXSCALE 150000000
>  MINSCALE 200
> END
>  
> PROJECTION
>   "proj=laea"
>   "ellps=clrk66"
>   "lat_0=45"
>   "lon_0=-100"
> END
>  
> # Start of LAYER DEFINITIONS ---------------------------------------------
> LAYER # States polygon layer begins here
>   NAME         states_poly
>   DATA         states_ugl
>   STATUS       DEFAULT
>   TYPE         POLYGON
>  
>   PROJECTION
>     "init=epsg:4326"
>   END
>  
>   CLASS
>     COLOR      232 232 232
>   END
> END # States polygon layer ends here
>  
> LAYER # States line layer begins here
>   NAME         states_line
>   DATA         states_ugl
>   STATUS       DEFAULT
>   TYPE         LINE
>  
>   PROJECTION
>     "init=epsg:4326"
>   END
>  
>   CLASS
>     COLOR 32 32 32
>   END
> END # States line layer ends here
> # End of LAYER DEFINITIONS -------------------------------
>  
> END # end of map file
>  
> I get the following error :
>     "PHP Fatal error:  Failed writing image to 
> C:/Apache/htdocs/tmp/108411324937081.swf ....."
> when the Flash app tries to call the php program, the SWF file is 
> created with properly content (viewable in a stanalone flash player) 
> in the designated directory but the PHP program just stopped without 
> responding to the Flash app. Using the same code, I can output JPEG 
> images to the Flash app without any problem. I've also tried to output 
> the SWF from mapserv.exe using CGI calls but that also failed.
> Searching through the list archive, I found some people having the 
> same problem that I have but there's no answer. I've read the user doc 
> at 
> http://www2.dmsolutions.ca/mapserver/dl/FlashMapserverUserDoc.html but 
> don't have a clue on what I did wrong, can anybody give me a hand here?
>  
> Best Regards,
>  
> Hau



--------------090904060408050504020502
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
Just try to output your map in multiple movies ("OUTPUT_MOVIE=MULTIPLE").<br>
I expect this will not return fatal error but one swf for each layer in your
mapfile. Hope this works.<br>
I don't even know why single output crashes. Is it due to ming library or
mapserver ?<br>
<br>
If you are able with this method to generate movies, you'll just have to
redefined your Flash app to load each movie individualy.<br>
I didn't work on this a lot but I think this might be a good way to built
a flash interface. I mean, layers may be hidden or shown individualy easily
and other great stuffs could be imagined.<br>
<br>
It would also be great to have examples or experience returns from people
who succesfully explored this mapserver output possibility.<br>
<br>
Regards.<br>
<br>
Pierre GIRAUD<br>
<br>
Hau Lu a &eacute;crit:<br>
<blockquote type="cite" cite="mid200405091503.XAA20722 at msr38.hinet.net">  
  <meta http-equiv="Content-Type" content="text/html; ">
 
  <meta content="MSHTML 6.00.2800.1400" name="GENERATOR">
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">Dear List
 user:</span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">&nbsp;&nbsp;&nbsp;  I'm
trying to use Mapserver (using the Windows binary ms402_png_pg.zip provided
 on the mapserver download site which should support SWF output) to output
swf  files that I can load from a Flash app ( using loadMovie(..)  function).</span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">part of
my php code  looks like this:</span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">......Initialize
$map  object</span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">$map-&gt;selectOutputFormat("SWF");</span></font><font
 face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"><br>
$image =  $map-&gt;draw();<br>
$image_url=$map-&gt;saveWebImage(); // error occurs  here</span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">.....output
the  $image_url var to Flash app</span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">and the
map file  looks like this (it's actually one of the example map files from
the  tutorial):</span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">MAP<br>
IMAGETYPE  JPEG<br>
INTERLACE OFF<br>
EXTENT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  201621.496941 -294488.284025 1425518.020722  498254.511514<br>
SIZE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  400 300<br>
SHAPEPATH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  "data"<br>
IMAGECOLOR&nbsp;&nbsp;&nbsp;&nbsp; 255 255 255</span></font></div>
 
  <div>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">OUTPUTFORMAT
 <br>
&nbsp;NAME swf <br>
&nbsp;MIMETYPE "application/x-shockwave-flash"  <br>
&nbsp;DRIVER swf <br>
&nbsp;IMAGEMODE PC256 <br>
&nbsp;FORMATOPTION  "OUTPUT_MOVIE=SINGLE" <br>
END </span></font></div>
 
  <div>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">WEB<br>
&nbsp;IMAGEPATH  "C:/Apache/htdocs/tmp/"<br>
&nbsp;IMAGEURL "/tmp/"<br>
&nbsp;MAXSCALE  150000000<br>
&nbsp;MINSCALE 200<br>
END</span></font></div>
 
  <div>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">PROJECTION<br>
&nbsp;  "proj=laea"<br>
&nbsp; "ellps=clrk66"<br>
&nbsp; "lat_0=45"<br>
&nbsp;  "lon_0=-100"<br>
END</span></font></div>
 
  <div>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"># Start
of LAYER  DEFINITIONS ---------------------------------------------<br>
LAYER # States  polygon layer begins here<br>
&nbsp;  NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; states_poly<br>
&nbsp;  DATA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; states_ugl<br>
&nbsp;  STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEFAULT<br>
&nbsp;  TYPE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; POLYGON</span></font></div>
 
  <div>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">&nbsp;  PROJECTION<br>
&nbsp;&nbsp;&nbsp; "init=epsg:4326"<br>
&nbsp;  END</span></font></div>
 
  <div>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">&nbsp;  CLASS<br>
&nbsp;&nbsp;&nbsp; COLOR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 232 232  232<br>
&nbsp; END<br>
END # States polygon layer ends here</span></font></div>
 
  <div>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">LAYER
# States line  layer begins here<br>
&nbsp; NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  states_line<br>
&nbsp; DATA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  states_ugl<br>
&nbsp; STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  DEFAULT<br>
&nbsp; TYPE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  LINE</span></font></div>
 
  <div>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">&nbsp;  PROJECTION<br>
&nbsp;&nbsp;&nbsp; "init=epsg:4326"<br>
&nbsp;  END</span></font></div>
 
  <div>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">&nbsp;  CLASS<br>
&nbsp;&nbsp;&nbsp; COLOR 32 32 32<br>
&nbsp; END<br>
END # States line  layer ends here<br>
# End of LAYER DEFINITIONS  -------------------------------</span></font></div>
 
  <div>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">END #
end of map  file<br>
  </span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font><font
 face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">I get
the following  error :</span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">&nbsp;&nbsp;&nbsp;  "</span></font><font
 face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"><font size="3"><font
 size="2">PHP Fatal error:&nbsp; Failed writing image to  C:/Apache/htdocs/tmp/108411324937081.swf
.....</font></font><font size="2">"</font></span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font><font
 face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"><font size="2">when
the Flash app  tries to call the php program, the SWF file is created with
properly content  (viewable in a stanalone flash player) in the designated
directory but the PHP  program just stopped without responding to the Flash
app. Using the same code, I  can output JPEG images to the Flash app without
any problem. I've also tried to  output the SWF from mapserv.exe using CGI
calls but that also  failed.</font></span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font><font
 face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"><font size="2">Searching
through  the list archive, I&nbsp;found some people having the same problem that
I have  but there's no answer. I've read the user doc at <a
 href="http://www2.dmsolutions.ca/mapserver/dl/FlashMapserverUserDoc.html">http://www2.dmsolutions.ca/mapserver/dl/FlashMapserverUserDoc.html</a>&nbsp;but
 don't have a clue on what I did wrong, can anybody give me a hand  here?</font></span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">Best  Regards,</span></font></div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004"></span></font>&nbsp;</div>
 
  <div><font face="&#26032;&#32048;&#26126;&#39636;" size="2"><span class="212195413-09052004">Hau</span></font></div>
</blockquote>
<br>
</body>
</html>

--------------090904060408050504020502--





More information about the mapserver-users mailing list