Highlighting changes in the KML layer

7 messages Options
Embed this post
Permalink
Adrian Popa

Highlighting changes in the KML layer

Reply Threaded More More options
Print post
Permalink
Hello everyone,

Sorry if this has already been discussed on the list (didn't really
check), but I would like to know if there is a solution (or at least a
plan to implement a feature) that  "somehow" highlights (visually) the
elements that have been loaded  through KML - in contrast to the
elements displayed previously.

I am working at a view that displays alarms on top of the map, and if
there is a large number of alarms, one more alarm coming every 2 minutes
will not catch the attention of the operator...

I need a mechanism to somehow color/animate symbols loaded through KML
which were not previously on the map. Symbols which dissapear between
layer refreshes are not important to me. At the next refresh cycle, the
highlighted symbols would no longer be highlighted (because they already
exist on the map).

I have a way to load KMLs periodically, avoiding the cache, but I'm
missing the "highlight" mechanism.

Hope I have presented my request in an understandable manner, and hope
there is a solution. Maybe a property on the KML layer indicating if an
item is new or not...

Regards,
Adrian

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
helmi03

Re: Highlighting changes in the KML layer

Reply Threaded More More options
Print post
Permalink
The idea from http://trac.openlayers.org/ticket/1259
{{{
You could create a selectStyle that could be passed to Control.SelectFeature quite easily: create a style object, read the "highlight" styles, create a FidFilter rule for every feature (or groups of features with the same style), use the according "highlight" style as symbolizer for the rule, and add the rule to the style object
}}}

helmi03.com

On Tue, Nov 3, 2009 at 12:59 AM, Adrian Popa <[hidden email]> wrote:
Hello everyone,

Sorry if this has already been discussed on the list (didn't really
check), but I would like to know if there is a solution (or at least a
plan to implement a feature) that  "somehow" highlights (visually) the
elements that have been loaded  through KML - in contrast to the
elements displayed previously.

I am working at a view that displays alarms on top of the map, and if
there is a large number of alarms, one more alarm coming every 2 minutes
will not catch the attention of the operator...

I need a mechanism to somehow color/animate symbols loaded through KML
which were not previously on the map. Symbols which dissapear between
layer refreshes are not important to me. At the next refresh cycle, the
highlighted symbols would no longer be highlighted (because they already
exist on the map).

I have a way to load KMLs periodically, avoiding the cache, but I'm
missing the "highlight" mechanism.

Hope I have presented my request in an understandable manner, and hope
there is a solution. Maybe a property on the KML layer indicating if an
item is new or not...

Regards,
Adrian

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Adrian Popa

Re: Highlighting changes in the KML layer

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Thank you for the hint. I suppose I shouldn't expect to see a working demo of what I need :)
Do you know if the patches presented in ticket 1259 are already part of openlayers (since the latest version is from january last year?)

Thanks,

helmi wrote:
The idea from http://trac.openlayers.org/ticket/1259
{{{
You could create a selectStyle that could be passed to Control.SelectFeature quite easily: create a style object, read the "highlight" styles, create a FidFilter rule for every feature (or groups of features with the same style), use the according "highlight" style as symbolizer for the rule, and add the rule to the style object
}}}

helmi03.com

On Tue, Nov 3, 2009 at 12:59 AM, Adrian Popa <[hidden email]> wrote:
Hello everyone,

Sorry if this has already been discussed on the list (didn't really
check), but I would like to know if there is a solution (or at least a
plan to implement a feature) that �"somehow" highlights (visually) the
elements that have been loaded �through KML - in contrast to the
elements displayed previously.

I am working at a view that displays alarms on top of the map, and if
there is a large number of alarms, one more alarm coming every 2 minutes
will not catch the attention of the operator...

I need a mechanism to somehow color/animate symbols loaded through KML
which were not previously on the map. Symbols which dissapear between
layer refreshes are not important to me. At the next refresh cycle, the
highlighted symbols would no longer be highlighted (because they already
exist on the map).

I have a way to load KMLs periodically, avoiding the cache, but I'm
missing the "highlight" mechanism.

Hope I have presented my request in an understandable manner, and hope
there is a solution. Maybe a property on the KML layer indicating if an
item is new or not...

Regards,
Adrian

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Roald de Wit-2

Re: Highlighting changes in the KML layer

Reply Threaded More More options
Print post
Permalink
Hi Adrian,

Adrian Popa wrote:
> Thank you for the hint. I suppose I shouldn't expect to see a working
> demo of what I need :)
> Do you know if the patches presented in ticket 1259 are already part
> of openlayers (since the latest version is from january last year?)
The patches in that ticket are part of OpenLayers since version 2.6, so,
yes!

I'm not sure if you use styling coming from the KML file or style it all
yourself. In your case I think you need to revert to the latter case.
You will need to do some magic to find out what features are new and
apply a different style to those items. There are few different ways of
doing it. One of them might be marking it's 'newness' in an attribute of
the new feature(s) and use a rule that checks that attribute in your
style map.

Regards,

Roald

>
> Thanks,
>
> helmi wrote:
>> The idea from http://trac.openlayers.org/ticket/1259
>> {{{
>> You could create a selectStyle that could be passed to
>> Control.SelectFeature quite easily: create a style object, read the
>> "highlight" styles, create a FidFilter rule for every feature (or
>> groups of features with the same style), use the according
>> "highlight" style as symbolizer for the rule, and add the rule to the
>> style object
>> }}}
>>
>> helmi03.com <http://helmi03.com>
>>
>> On Tue, Nov 3, 2009 at 12:59 AM, Adrian Popa
>> <[hidden email] <mailto:[hidden email]>>
>> wrote:
>>
>>     Hello everyone,
>>
>>     Sorry if this has already been discussed on the list (didn't really
>>     check), but I would like to know if there is a solution (or at
>>     least a
>>     plan to implement a feature) that �"somehow" highlights
>>     (visually) the
>>     elements that have been loaded �through KML - in contrast to the
>>     elements displayed previously.
>>
>>     I am working at a view that displays alarms on top of the map, and if
>>     there is a large number of alarms, one more alarm coming every 2
>>     minutes
>>     will not catch the attention of the operator...
>>
>>     I need a mechanism to somehow color/animate symbols loaded
>>     through KML
>>     which were not previously on the map. Symbols which dissapear between
>>     layer refreshes are not important to me. At the next refresh
>>     cycle, the
>>     highlighted symbols would no longer be highlighted (because they
>>     already
>>     exist on the map).
>>
>>     I have a way to load KMLs periodically, avoiding the cache, but I'm
>>     missing the "highlight" mechanism.
>>
>>     Hope I have presented my request in an understandable manner, and
>>     hope
>>     there is a solution. Maybe a property on the KML layer indicating
>>     if an
>>     item is new or not...
>>
>>     Regards,
>>     Adrian
>>
>>     _______________________________________________
>>     Users mailing list
>>     [hidden email] <mailto:[hidden email]>
>>     http://openlayers.org/mailman/listinfo/users
>>
>>
>

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Adrian Popa

Re: Highlighting changes in the KML layer

Reply Threaded More More options
Print post
Permalink
Hello Roald,

I have a question about marking items as new - I guess they are not
marked out of the box, right?
When I do the layer refresh, I just do layer.refresh({force: true}); I'm
not sure what this does internally, but perhaps I can't count on any
attributes I set - to be preserved.

Should I build the variable (hash) where I keep attributes as a
different variable? Or should I keep it in a standalone object?

Also, before I do the refresh - I suspect I need to copy the attributes
of the current objects, issue a layer refresh and then (hoping the
refresh is synchroneous) I should go through the new list and see if I
have new items. If there are, mark them as new (and mark other items as
'old').

Supposing that I do that - what would I need to do to change the aspect
(change color/make bigger) of the "new" items?

I'm afraid this will consume some memory and resources - but I guess I
will see when it's ready...

How does my plan sound like?
Regards,
Adrian

Roald de Wit wrote:

> Hi Adrian,
>
> Adrian Popa wrote:
>> Thank you for the hint. I suppose I shouldn't expect to see a working
>> demo of what I need :)
>> Do you know if the patches presented in ticket 1259 are already part
>> of openlayers (since the latest version is from january last year?)
> The patches in that ticket are part of OpenLayers since version 2.6,
> so, yes!
>
> I'm not sure if you use styling coming from the KML file or style it
> all yourself. In your case I think you need to revert to the latter
> case. You will need to do some magic to find out what features are new
> and apply a different style to those items. There are few different
> ways of doing it. One of them might be marking it's 'newness' in an
> attribute of the new feature(s) and use a rule that checks that
> attribute in your style map.
>
> Regards,
>
> Roald
>
>>
>> Thanks,
>>
>> helmi wrote:
>>> The idea from http://trac.openlayers.org/ticket/1259
>>> {{{
>>> You could create a selectStyle that could be passed to
>>> Control.SelectFeature quite easily: create a style object, read the
>>> "highlight" styles, create a FidFilter rule for every feature (or
>>> groups of features with the same style), use the according
>>> "highlight" style as symbolizer for the rule, and add the rule to
>>> the style object
>>> }}}
>>>
>>> helmi03.com <http://helmi03.com>
>>>
>>> On Tue, Nov 3, 2009 at 12:59 AM, Adrian Popa
>>> <[hidden email] <mailto:[hidden email]>>
>>> wrote:
>>>
>>>     Hello everyone,
>>>
>>>     Sorry if this has already been discussed on the list (didn't really
>>>     check), but I would like to know if there is a solution (or at
>>>     least a
>>>     plan to implement a feature) that �"somehow" highlights
>>>     (visually) the
>>>     elements that have been loaded �through KML - in contrast to the
>>>     elements displayed previously.
>>>
>>>     I am working at a view that displays alarms on top of the map,
>>> and if
>>>     there is a large number of alarms, one more alarm coming every 2
>>>     minutes
>>>     will not catch the attention of the operator...
>>>
>>>     I need a mechanism to somehow color/animate symbols loaded
>>>     through KML
>>>     which were not previously on the map. Symbols which dissapear
>>> between
>>>     layer refreshes are not important to me. At the next refresh
>>>     cycle, the
>>>     highlighted symbols would no longer be highlighted (because they
>>>     already
>>>     exist on the map).
>>>
>>>     I have a way to load KMLs periodically, avoiding the cache, but I'm
>>>     missing the "highlight" mechanism.
>>>
>>>     Hope I have presented my request in an understandable manner, and
>>>     hope
>>>     there is a solution. Maybe a property on the KML layer indicating
>>>     if an
>>>     item is new or not...
>>>
>>>     Regards,
>>>     Adrian
>>>
>>>     _______________________________________________
>>>     Users mailing list
>>>     [hidden email] <mailto:[hidden email]>
>>>     http://openlayers.org/mailman/listinfo/users
>>>
>>>
>>
>
>


--
---
Adrian Popa
NOC Division
Network Engineer
Divizia Centrul National de Operare Retea
Departament Transport IP & Metro
Compartiment IP Core & Backbone
Phone: +40 21 400 3099


_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Roald de Wit-2

Re: Highlighting changes in the KML layer

Reply Threaded More More options
Print post
Permalink
Hi Adrian,

When you refresh a layer (someone please correct me if I'm wrong here),
all your features (items) will be replaced with the new ones, therefore
you need to 'manually' keep track of your features. As you suggested,
you could, just before a refresh, store all features (or feature.ids) in
some array, then refresh and compare the new feature list with the old one.

The refresh is usually not synchronous, but that does not need to be a
problem: you can register for events ('beforefeaturesadded' for example)
and call your compare function with the list of new features. You can
then loop through them and mark the new ones as new (for example by
saying: feature.attributes.isNew = true). Make sure that the compare
function itself returns true.

Have a look at what's possible with styling in OpenLayes (it's a bit of
a read): http://docs.openlayers.org/library/feature_styling.html

So, yes, your plan sounds good!

Regards, Roald


Adrian Popa wrote:

> Hello Roald,
>
> I have a question about marking items as new - I guess they are not
> marked out of the box, right?
> When I do the layer refresh, I just do layer.refresh({force: true}); I'm
> not sure what this does internally, but perhaps I can't count on any
> attributes I set - to be preserved.
>
> Should I build the variable (hash) where I keep attributes as a
> different variable? Or should I keep it in a standalone object?
>
> Also, before I do the refresh - I suspect I need to copy the attributes
> of the current objects, issue a layer refresh and then (hoping the
> refresh is synchroneous) I should go through the new list and see if I
> have new items. If there are, mark them as new (and mark other items as
> 'old').
>
> Supposing that I do that - what would I need to do to change the aspect
> (change color/make bigger) of the "new" items?
>
> I'm afraid this will consume some memory and resources - but I guess I
> will see when it's ready...
>
> How does my plan sound like?
> Regards,
> Adrian
>
> Roald de Wit wrote:
>  
>> Hi Adrian,
>>
>> Adrian Popa wrote:
>>    
>>> Thank you for the hint. I suppose I shouldn't expect to see a working
>>> demo of what I need :)
>>> Do you know if the patches presented in ticket 1259 are already part
>>> of openlayers (since the latest version is from january last year?)
>>>      
>> The patches in that ticket are part of OpenLayers since version 2.6,
>> so, yes!
>>
>> I'm not sure if you use styling coming from the KML file or style it
>> all yourself. In your case I think you need to revert to the latter
>> case. You will need to do some magic to find out what features are new
>> and apply a different style to those items. There are few different
>> ways of doing it. One of them might be marking it's 'newness' in an
>> attribute of the new feature(s) and use a rule that checks that
>> attribute in your style map.
>>
>> Regards,
>>
>> Roald
>>
>>    
>>> Thanks,
>>>
>>> helmi wrote:
>>>      
>>>> The idea from http://trac.openlayers.org/ticket/1259
>>>> {{{
>>>> You could create a selectStyle that could be passed to
>>>> Control.SelectFeature quite easily: create a style object, read the
>>>> "highlight" styles, create a FidFilter rule for every feature (or
>>>> groups of features with the same style), use the according
>>>> "highlight" style as symbolizer for the rule, and add the rule to
>>>> the style object
>>>> }}}
>>>>
>>>> helmi03.com <http://helmi03.com>
>>>>
>>>> On Tue, Nov 3, 2009 at 12:59 AM, Adrian Popa
>>>> <[hidden email] <mailto:[hidden email]>>
>>>> wrote:
>>>>
>>>>     Hello everyone,
>>>>
>>>>     Sorry if this has already been discussed on the list (didn't really
>>>>     check), but I would like to know if there is a solution (or at
>>>>     least a
>>>>     plan to implement a feature) that �"somehow" highlights
>>>>     (visually) the
>>>>     elements that have been loaded �through KML - in contrast to the
>>>>     elements displayed previously.
>>>>
>>>>     I am working at a view that displays alarms on top of the map,
>>>> and if
>>>>     there is a large number of alarms, one more alarm coming every 2
>>>>     minutes
>>>>     will not catch the attention of the operator...
>>>>
>>>>     I need a mechanism to somehow color/animate symbols loaded
>>>>     through KML
>>>>     which were not previously on the map. Symbols which dissapear
>>>> between
>>>>     layer refreshes are not important to me. At the next refresh
>>>>     cycle, the
>>>>     highlighted symbols would no longer be highlighted (because they
>>>>     already
>>>>     exist on the map).
>>>>
>>>>     I have a way to load KMLs periodically, avoiding the cache, but I'm
>>>>     missing the "highlight" mechanism.
>>>>
>>>>     Hope I have presented my request in an understandable manner, and
>>>>     hope
>>>>     there is a solution. Maybe a property on the KML layer indicating
>>>>     if an
>>>>     item is new or not...
>>>>
>>>>     Regards,
>>>>     Adrian
>>>>
>>>>     _______________________________________________
>>>>     Users mailing list
>>>>     [hidden email] <mailto:[hidden email]>
>>>>     http://openlayers.org/mailman/listinfo/users
>>>>
>>>>
>>>>        
>>    
>
>
>  

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Adrian Popa

Re: Highlighting changes in the KML layer

Reply Threaded More More options
Print post
Permalink
Thanks Roald,

I will read on and give it a go. I will post my solution when it's ready
(I estimate in about ~1month).

Regards,
Adrian

Roald de Wit wrote:

> Hi Adrian,
>
> When you refresh a layer (someone please correct me if I'm wrong
> here), all your features (items) will be replaced with the new ones,
> therefore you need to 'manually' keep track of your features. As you
> suggested, you could, just before a refresh, store all features (or
> feature.ids) in some array, then refresh and compare the new feature
> list with the old one.
>
> The refresh is usually not synchronous, but that does not need to be a
> problem: you can register for events ('beforefeaturesadded' for
> example) and call your compare function with the list of new features.
> You can then loop through them and mark the new ones as new (for
> example by saying: feature.attributes.isNew = true). Make sure that
> the compare function itself returns true.
>
> Have a look at what's possible with styling in OpenLayes (it's a bit
> of a read): http://docs.openlayers.org/library/feature_styling.html
>
> So, yes, your plan sounds good!
>
> Regards, Roald
>
>
> Adrian Popa wrote:
>> Hello Roald,
>>
>> I have a question about marking items as new - I guess they are not
>> marked out of the box, right?
>> When I do the layer refresh, I just do layer.refresh({force: true});
>> I'm not sure what this does internally, but perhaps I can't count on
>> any attributes I set - to be preserved.
>>
>> Should I build the variable (hash) where I keep attributes as a
>> different variable? Or should I keep it in a standalone object?
>>
>> Also, before I do the refresh - I suspect I need to copy the
>> attributes of the current objects, issue a layer refresh and then
>> (hoping the refresh is synchroneous) I should go through the new list
>> and see if I have new items. If there are, mark them as new (and mark
>> other items as 'old').
>>
>> Supposing that I do that - what would I need to do to change the
>> aspect (change color/make bigger) of the "new" items?
>>
>> I'm afraid this will consume some memory and resources - but I guess
>> I will see when it's ready...
>>
>> How does my plan sound like?
>> Regards,
>> Adrian
>>
>> Roald de Wit wrote:
>>  
>>> Hi Adrian,
>>>
>>> Adrian Popa wrote:
>>>    
>>>> Thank you for the hint. I suppose I shouldn't expect to see a
>>>> working demo of what I need :)
>>>> Do you know if the patches presented in ticket 1259 are already
>>>> part of openlayers (since the latest version is from january last
>>>> year?)
>>>>      
>>> The patches in that ticket are part of OpenLayers since version 2.6,
>>> so, yes!
>>>
>>> I'm not sure if you use styling coming from the KML file or style it
>>> all yourself. In your case I think you need to revert to the latter
>>> case. You will need to do some magic to find out what features are
>>> new and apply a different style to those items. There are few
>>> different ways of doing it. One of them might be marking it's
>>> 'newness' in an attribute of the new feature(s) and use a rule that
>>> checks that attribute in your style map.
>>>
>>> Regards,
>>>
>>> Roald
>>>
>>>    
>>>> Thanks,
>>>>
>>>> helmi wrote:
>>>>      
>>>>> The idea from http://trac.openlayers.org/ticket/1259
>>>>> {{{
>>>>> You could create a selectStyle that could be passed to
>>>>> Control.SelectFeature quite easily: create a style object, read
>>>>> the "highlight" styles, create a FidFilter rule for every feature
>>>>> (or groups of features with the same style), use the according
>>>>> "highlight" style as symbolizer for the rule, and add the rule to
>>>>> the style object
>>>>> }}}
>>>>>
>>>>> helmi03.com <http://helmi03.com>
>>>>>
>>>>> On Tue, Nov 3, 2009 at 12:59 AM, Adrian Popa
>>>>> <[hidden email]
>>>>> <mailto:[hidden email]>> wrote:
>>>>>
>>>>>     Hello everyone,
>>>>>
>>>>>     Sorry if this has already been discussed on the list (didn't
>>>>> really
>>>>>     check), but I would like to know if there is a solution (or at
>>>>>     least a
>>>>>     plan to implement a feature) that �"somehow" highlights
>>>>>     (visually) the
>>>>>     elements that have been loaded �through KML - in contrast to the
>>>>>     elements displayed previously.
>>>>>
>>>>>     I am working at a view that displays alarms on top of the map,
>>>>> and if
>>>>>     there is a large number of alarms, one more alarm coming every 2
>>>>>     minutes
>>>>>     will not catch the attention of the operator...
>>>>>
>>>>>     I need a mechanism to somehow color/animate symbols loaded
>>>>>     through KML
>>>>>     which were not previously on the map. Symbols which dissapear
>>>>> between
>>>>>     layer refreshes are not important to me. At the next refresh
>>>>>     cycle, the
>>>>>     highlighted symbols would no longer be highlighted (because they
>>>>>     already
>>>>>     exist on the map).
>>>>>
>>>>>     I have a way to load KMLs periodically, avoiding the cache,
>>>>> but I'm
>>>>>     missing the "highlight" mechanism.
>>>>>
>>>>>     Hope I have presented my request in an understandable manner, and
>>>>>     hope
>>>>>     there is a solution. Maybe a property on the KML layer indicating
>>>>>     if an
>>>>>     item is new or not...
>>>>>
>>>>>     Regards,
>>>>>     Adrian
>>>>>
>>>>>     _______________________________________________
>>>>>     Users mailing list
>>>>>     [hidden email] <mailto:[hidden email]>
>>>>>     http://openlayers.org/mailman/listinfo/users
>>>>>
>>>>>
>>>>>        
>>>    
>>
>>
>>  
>
>


_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users