[Mapserver-users] Mapserver and flash (fixed, but new problem)
Yewondwossen Assefa
assefa at dmsolutions.ca
Thu Aug 21 13:20:17 PDT 2003
The attributes values should only be separated by a comma
("SWFDUMPATTRIBUTES" "State_Name,Pop1999").
I am going to check if it is possible to have a better error report if
something invalid is given (Bigt 415 in mapserver bug list)
Later,
Geoffrey Rowland wrote:
> Okay, I finally figured out how to get the attribute data from the SWF
> file by using Element. I understand much better now.
>
> However, I am running into a new problem.
> I am using phpmapscript to generate the SWF file...
>
> here is a section of my .map file
>
> LAYER
> NAME states
> METADATA
> "DESCRIPTION" "States"
> "RESULT_FIELDS" "State_Name"
> "SWFDUMPATTRIBUTES" "State_Name"
> END
> TYPE POLYGON
> STATUS ON
> DATA states
>
> if i use that, it works fine.
>
> *however* , if i change it ever so slightly to include the population
> data in the SWFDUMPATTRIBUTES, it fails and says "failed to render
> layer"....this is what causes that error
>
> LAYER
> NAME states
> METADATA
> "DESCRIPTION" "States"
> "RESULT_FIELDS" "State_Name,Pop1999"
> "SWFDUMPATTRIBUTES" "State_Name Pop1999"
> END
> TYPE POLYGON
> STATUS ON
> DATA states
>
>
> just adding the Pop1999 field (which contains the population data in the
> attribute table).
>
> Here is the entire .map file, maybe I am doing something wrong
>
> #
> # Start of map file
> #
> NAME "Pop"
> STATUS ON
> SIZE 600 600
> EXTENT -178.227822 18.913826 -66.949831 71.38269
> UNITS dd
> SHAPEPATH "data"
> IMAGECOLOR 255 255 255
>
>
> #IMAGETYPE PNG
>
> OUTPUTFORMAT
> NAME swf
> MIMETYPE "application/x-shockwave-flash"
> DRIVER swf
> IMAGEMODE PC256
> FORMATOPTION "OUTPUT_MOVIE=MULTIPLE"
> END
>
> WEB
> HEADER us_header.html
> TEMPLATE temp.html
> FOOTER us_footer.html
> LOG wnvmapserver.log
> MINSCALE 1
> MAXSCALE 36335600
> IMAGEPATH "d:/Inetpub/maptest/swf/"
> IMAGEURL "http://192.168.100.10/maptest/swf/"
> METADATA
> WMS_TITLE "United States Data"
> WMS_ABSTRACT "This is a demonstration of using Mapserver ."
> WMS_ACCESSCONSTRAINTS none
>
> WMS_SRS "EPSG:4269"
> END # End Metadata
> END # End Web
>
> QUERYMAP
> SIZE 200 200
> STATUS ON
> STYLE HILITE
> COLOR 255 0 0
> END
>
>
> #
> # Start of legend
> #
> LEGEND
> KEYSIZE 18 12
> LABEL
> TYPE BITMAP
> SIZE MEDIUM
> COLOR 0 0 89
> END
> STATUS ON
> END
>
> #
> # Start of scalebar
> #
> SCALEBAR
> IMAGECOLOR 255 255 255
> LABEL
> COLOR 255 255 255
> SIZE tiny END
> STYLE 1
> SIZE 80 2
> COLOR 255 255 255
> UNITS MILES
> INTERVALS 1
> TRANSPARENT TRUE
> STATUS TRUE
> END
>
>
>
>
> LAYER
> NAME states
> METADATA
> "DESCRIPTION" "States"
> "RESULT_FIELDS" "State_Name"
> "SWFDUMPATTRIBUTES" "State_Name"
> END
> TYPE POLYGON
> STATUS ON
> DATA states
>
>
> CLASSITEM 'Pop1999'
> NAME Pop1999
> TEMPLATE us_pop.html
> CLASS
> EXPRESSION ([Pop1999] > 0 and [Pop1999] < 2135252)
> COLOR 254 240 217
> OUTLINECOLOR 128 128 128
> END
>
> CLASS
> EXPRESSION ([Pop1999] > 2135251 and [Pop1999] < 4970311)
> COLOR 253 212 158
> OUTLINECOLOR 128 128 128
> END
>
> CLASS
> EXPRESSION ([Pop1999] > 4970310 and [Pop1999] < 9866640)
> COLOR 253 187 132
> OUTLINECOLOR 128 128 128
> END
>
> CLASS
> EXPRESSION ([Pop1999] > 9866639 and [Pop1999] < 20127338)
> COLOR 252 141 89
> OUTLINECOLOR 128 128 128
> END
>
> CLASS
> EXPRESSION ([Pop1999] > 20127337 )
> COLOR 227 74 51
> OUTLINECOLOR 128 128 128
> END
>
>
>
> END # end class
>
> END # end layer
>
>
> END # end Map File
>
>
> see anything wrong?
>
> Thanks,
> Geoff
>
> Geoffrey Rowland wrote:
>
>> Okay, Thanks, I have made the function ElementSelected and can get the
>> LayerID,ShapeID, and Event.
>>
>> But I'm still at a loss how to get the SWFDUMPATTRIBUTES then? lets
>> say my attribute is called Name. how do I get the value using
>> ActionScript?
>>
>> Here is what I have so far (just doing this as a test)
>>
>> onClipEvent (load) {
>> loadMovieNum("state_layer_0.swf",1);
>> } onClipEvent(mouseDown) {
>> _level1.ElementSelected = function(lid,sid,ev){
>> trace("The Layer id is : " + lid);
>> trace("The Shape id is : " + sid);
>> trace("The event was : " + ev);
>> }
>> _level1.ElementSelected(LayerId,ShapeId,Event, Name)
>> }
>>
>> Thanks,
>> Geoff
>>
>> Yewondwossen Assefa wrote:
>>
>>> The way to do it is to use at a layer level a metadata called
>>> SWFDUMPATTRIBUTES. The value used for this metadata are the names of
>>> the attributes you want to export to the swf file. Please refer to
>>> section "How to configure the map file to export attributes" and
>>> "Events and Highlights" in the document
>>> http://www2.dmsolutions.ca/mapserver/dl/FlashMapserverUserDoc.html
>>>
>>> Once the attributes are exported to the swf file, when the user
>>> clicks on these objects, there is a mouse event which is triggered
>>> and makes an Action Script call to: _root.ElementSelecetd(LayerId,
>>> ShapeId, Event). The Flash application who want to receive these
>>> events should define the function ElementSelected and use the
>>> information receive to do actions like retrieving the attribute
>>> values from the specific SWF for the specified shape and display it.
>>>
>>>
>>> Later,
>>>
>>> Geoffrey Rowland wrote:
>>>
>>>> I was playing around with this a bit the other day. Is there a way
>>>> to identify features in the swf file? for example if I am
>>>> displaying a county layer (from a shapefile), and I want to get the
>>>> names of the counties....is that possible using the swf output?
>>>>
>>>> Thanks,
>>>> Geoff
>>>>
>>>>
>>>> William A. Bronsema, C.E.T. wrote:
>>>>
>>>>> Lars-Göran,
>>>>>
>>>>> It is fairly easy to view the SWF output using actionscript. Set
>>>>> the outputformat in the map file to the following:
>>>>>
>>>>> OUTPUTFORMAT
>>>>> NAME swf
>>>>> MIMETYPE "application/x-shockwave-flash"
>>>>> DRIVER swf
>>>>> IMAGEMODE PC256
>>>>>
>>>>> # the following line is used to output all layers in one swf
>>>>> FORMATOPTION "OUTPUT_MOVIE=SINGLE"
>>>>>
>>>>> # the following line is used to output all layers individually
>>>>> #FORMATOPTION "OUTPUT_MOVIE=MULTIPLE"
>>>>> END
>>>>>
>>>>>
>>>>> After mapserver has generated the temp swf file(s) you can use the
>>>>> "loadMovie" actionscript function to load the swf file into a
>>>>> pre-existing container. For example, create a new swf file with a
>>>>> movie clip called "clip1" and add the following line in actionscript:
>>>>>
>>>>> loadMovie ( "http://url/to/swf/mymap.swf", "clip1" );
>>>>>
>>>>> I use PHP and php_mapscript to help manage the files on the fly and
>>>>> Flash to manage my actionscript.
>>>>>
>>>>> I hope this quick overview helps.
>>>>>
>>>>> Regards,
>>>>> Bill
>>>>>
>>>>> Lars-goran Edholm wrote:
>>>>>
>>>>>> Hi!
>>>>>> Does anybody have an example of using Mapserver with swf vector
>>>>>> output.
>>>>>> How do i use the swf-actionscript file to view the layers?
>>>>>>
>>>>>>
>>>>>> Mvh
>>>>>> Lars-Göran Edholm tel 026/24 14 36
>>>>>> 1:e byggnadsinspektör
>>>>>> Bygg- och miljökontoret
>>>>>> 811 80 Sandviken
>>>>>> lars-goran.edholm at sandviken.se
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mapserver-users mailing list
>>>>>> Mapserver-users at lists.gis.umn.edu
>>>>>> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst
Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/
Phone: (613) 565-5056 (ext 14)
Fax: (613) 565-0925
----------------------------------------------------------------
More information about the MapServer-users
mailing list