[Geomoose-users] Auto-refreshing

Brent Fraser bfraser at geoanalytic.com
Mon Oct 29 08:48:32 PDT 2012


Matej,

You need to:
1.  Add a script reference to your gemoose.html:
     <script type="text/javascript" 
src="extensions/AnimateLayers.js"></script>

2. Create an animation object (in your geomoose.html is ok):

     <script type="text/javascript">
         var WeatherLayersAnimator = new AnimateLayersExtension([
                 'iastate/nexrad-n0r',
                 'iastate/nexrad-n0r-900913-m05m',
                 'iastate/nexrad-n0r-900913-m10m',
                 'iastate/nexrad-n0r-900913-m15m',
                 'iastate/nexrad-n0r-900913-m20m',
                 'iastate/nexrad-n0r-900913-m25m',
                 'iastate/nexrad-n0r-900913-m30m',
                 'iastate/nexrad-n0r-900913-m35m'
             ], 1000);
     </script>

The above object uses Geomoose's 'mapsource/layer' syntax.


3. Add the mapsource to your mapbook:

     <map-source name="iastate" type="wms" tiled="false" 
projection="EPSG:900913" width="512" height="512">
<url>http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi</url>
         <layer name="nexrad-n0r"/>
         <param name="format" value="image/jpeg"/>
         <param name="TRANSPARENT" value="TRUE"/>
     </map-source>


4.  Add a layer the animation to your mapbook:
         <layer title="Weather Radar" src="iastate/nexrad-n0r" 
status="off" legend="false"/>

or add a tool to stop/start the animation:

     <tool name="animate_layers" title="Toggle Animation" 
type="javascript" selectable="false">
         ImageLayersAnimator.toggle_animation();
     </tool>


Best Regards,
Brent Fraser

On 10/29/2012 3:10 AM, Matej Mailing wrote:
> Hi,
>
> I have " <script type="text/javascript"
> src="extensions/AnimateLayers.js"></script> " added in the html file.
>
> Any ideas are very welcome.
>
> Thanks,
> Matej
>
> 2012/10/27 Jim Klassen <klassen.js at gmail.com>:
>> Jumping in at the middle of the conversation here... Did you enable the AnimateLayers Extension.  (at a minimum it will need a script tag added/uncommented in geomoose.html and/or geomoose_dev.html)
>>
>>
>>
>> On Oct 27, 2012, at 12:53, Matej Mailing <mailing at tam.si> wrote:
>>
>>> Sorry for another post in this topic, but I have problems to enable
>>> the "Refresh" button in the layer list. When adding the refresh="true"
>>> to the layer, the button doesn't show up. I also can't find any of
>>> those in the example mapbook.xml file. Is this feature still
>>> supported?
>>>
>>> Thanks,
>>> Matej
>>>
>>> 2012/10/27 Matej Mailing <mailing at tam.si>:
>>>> Hi,
>>>>
>>>> thanks for sending it. I have found out that the
>>>> AnimateLayersExtension is already in the extensions directory, but was
>>>> unaware of its meaning.
>>>>
>>>> How do I define the layers to animate? Do I have to edit the
>>>> AnimateLayersExtension by hand (which I don't want)? Should I add
>>>> something at the layer's definition in the mapbook.xml and if so,
>>>> what?
>>>>
>>>> Thanks a lot for clarification,
>>>> Matej
>>>>
>>>>
>>>>
>>>> 2012/10/23 Brian Fischer <bfischer at houstoneng.com>:
>>>>> We have an old GM 2.2 web app that animated through some weather radar.  Here is the code that was used for that.  Not idea if this would work in GM 2.6 or not.
>>>>>
>>>>> <tool name="animate_layers" title="Weather Radar" type="javascript" selectable="false">
>>>>>                         WeatherLayersAnimator.toggle_animation();
>>>>>                 </tool>
>>>>>
>>>>> AnimateLayersExtension = new OpenLayers.Class(GeoMOOSE.UX.Extension, {
>>>>>         current_layer: -1,
>>>>>         is_animating: false,
>>>>>         layers_to_animate: [],
>>>>>         interval_id: -1,
>>>>>         interval_delay: 1000,
>>>>>
>>>>>         animate: function() {
>>>>>                 this.is_animating = true;
>>>>>                 /* go to the 0th frame */
>>>>>                 this.current_layer = -1;
>>>>>                 this.next_frame(this);
>>>>>
>>>>>                 /* because of scoping rules with setInterval, we need to pass the class back to the function */
>>>>>                 /* Also, this function variable thing is done because IE doesn't properly implement setInterval */
>>>>>                 var instance = this;
>>>>>                 var my_func = function() {
>>>>>                         instance.next_frame(instance);
>>>>>                 }
>>>>>                 this.interval_id = window.setInterval(my_func, this.interval_delay, this);
>>>>>         },
>>>>>
>>>>>         stop_animate: function() {
>>>>>                 clearInterval(this.interval_id);
>>>>>                 this.is_animating = false;
>>>>>         },
>>>>>
>>>>>         toggle_animation: function () {
>>>>>                 if(this.is_animating) {
>>>>>                         this.stop_animate();
>>>>>                 } else {
>>>>>                         this.animate();
>>>>>                 }
>>>>>
>>>>>         },
>>>>>
>>>>>         next_frame: function(instance) {
>>>>>                 instance.current_layer+=1;
>>>>>                 if(instance.current_layer >= instance.layers_to_animate.length) {
>>>>>                         instance.current_layer = 0;
>>>>>                 }
>>>>>
>>>>>                 for(var i = 0; i < instance.layers_to_animate.length; i++) {
>>>>>                         if(i != instance.current_layer) {
>>>>>                                 GeoMOOSE.changeLayerVisibility(instance.layers_to_animate[i], false);
>>>>>                         }
>>>>>                 }
>>>>>                 GeoMOOSE.changeLayerVisibility(instance.layers_to_animate[instance.current_layer], true);
>>>>>         },
>>>>>
>>>>>         load: function() {
>>>>>         },
>>>>>
>>>>>         initialize: function(layers,delay) {
>>>>>                 this.layers_to_animate = layers;
>>>>>                 if(delay) {
>>>>>                         this.interval_delay = delay;
>>>>>                 }
>>>>>         },
>>>>>
>>>>>         CLASS_NAME: "AnimateLayersExtension"
>>>>> });
>>>>>
>>>>> GeoMOOSE.UX.register('AnimateLayersExtension');
>>>>>
>>>>> Brian Fischer, CFM
>>>>> Principal | GIS Project Manager
>>>>> Houston Engineering, Inc.
>>>>> O 763.493.4522 | D 763.493.6664 | M 763.229.2734
>>>>>
>>>>> -----Original Message-----
>>>>> From: Matej Mailing [mailto:mailing at tam.si]
>>>>> Sent: Tuesday, October 23, 2012 1:21 PM
>>>>> To: Brian Fischer
>>>>> Cc: GeoMOOSE Users List
>>>>> Subject: Re: [Geomoose-users] Auto-refreshing
>>>>>
>>>>> Guys, I am really lost here. Some snippets or pointers in the right direction will be very welcome :-)
>>>>>
>>>>> Thanks,
>>>>> Matej
>>>>>
>>>>> 2012/10/22 Matej Mailing <mailing at tam.si>:
>>>>>> Brian, I can't find anything useful in 2.2. Can you send me some
>>>>>> snippet from your working app?
>>>>>>
>>>>>> Thanks a lot,
>>>>>> Matej
>>>>>>
>>>>>> 2012/10/18 Brian Fischer <bfischer at houstoneng.com>:
>>>>>>> I don't believe this was carried over.  You would likely need to write an extension to do this.  There is example code in GM 2.2 I believe.  I have used it once for some weather radar layers.
>>>>>>>
>>>>>>> Brian Fischer, CFM
>>>>>>> Principal | GIS Project Manager
>>>>>>> Houston Engineering, Inc.
>>>>>>> O 763.493.4522 | D 763.493.6664 | M 763.229.2734
>>>>>>>
>>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: geomoose-users-bounces at lists.osgeo.org
>>>>>>> [mailto:geomoose-users-bounces at lists.osgeo.org] On Behalf Of Matej
>>>>>>> Mailing
>>>>>>> Sent: Wednesday, October 17, 2012 5:02 AM
>>>>>>> To: GeoMOOSE Users List
>>>>>>> Subject: [Geomoose-users] Auto-refreshing
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> if I rembember correctly from 1.X versions that there was a way to turn on and off the auto-refreshing of the specific layers on the specified interval. Is this possible in 2.6?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Matej
>>>>>>> _______________________________________________
>>>>>>> Geomoose-users mailing list
>>>>>>> Geomoose-users at lists.osgeo.org
>>>>>>> http://lists.osgeo.org/mailman/listinfo/geomoose-users
>>> _______________________________________________
>>> Geomoose-users mailing list
>>> Geomoose-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/geomoose-users
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geomoose-users
>




More information about the Geomoose-users mailing list