[OpenLayers-Users] Vector layer and multiple symbolizers
Xavier Mamano (jorix)
xavier.mamano at gmail.com
Thu Feb 7 11:50:24 PST 2013
Hi Yves,
Yes, oops!
On 'featuresremoved' must be clone the features...
and to remove consider the original id oops!...
I did not think this problem...
much work for the processor :(
Regards,
Xavier
Yves G wrote
> Hi again
>
> apparently, using this strategy is not working because, sharing the
> features between the parent and slaves layers has side effects in the
> rendering process as you can see here
> http://jsfiddle.net/jLEYS/6/(comment/comment lines 68,69 to see what i
> d expect) :(
>
> Regards
> Yves.
>
>
>
> 2013/2/7 Yves Gillet <
> ygillet@
> >
>
>> Hi Xavier
>>
>> thanks for your solution using other layers, I'll give it a try.
>> I thought about it also at a first place but I was afraid of the
>> performance overhead to have potentially 4 more layers (of about 1000
>> features each) to achieve that.
>> After digging in the source code, another (more complicated) solution
>> would have been to create a custom renderer which can create symbols
>> compositions,
>> for example in my case a svg renderer which could attach multiple child
>> nodes to the feature node rendered.
>> I havent yet figured how to do that, but maybe it could be a nice feature
>> for openlayers and I may experiment with it if I have more time :)
>>
>> Regards
>> Yves
>>
>>
>> 2013/2/6 Xavier Mamano (jorix) <
> xavier.mamano@
> >
>>
>> Hi Yves,
>>>
>>> It's not pretty, but could create a slave layer as:
>>>
>>> var mySlaveLayer = new OpenLayers.Layer.Vector("slave", {
>>> displayInLayerSwitcher: false,
>>> style: myOtherStyle
>>> });
>>> myLayer.events.on({
>>> 'featuresadded': function(evt) {
>>> mySlaveLayer.addFeatures(evt.features.slice());
>>> },
>>> 'featuresremoved': function(evt) {
>>> mySlaveLayer.removeFeatures(evt.features.slice());
>>> },
>>> 'visibilitychanged': ....
>>> });
>>>
>>> with two layers be sufficient, the numbers can be labels.
>>>
>>> You have a few hours of work for adjust this...
>>>
>>> Regards,
>>>
>>> Xavier Mamano
>>>
>>>
>>> Yves G wrote
>>> > Hi there,
>>> > thanks for your input.
>>> >
>>> > But if you look my image mockup of what I m trying to display , I want
>>> to
>>> > style the station along with some of its attributes (sort of symbols
>>> > composition, not just the point one) .
>>> > I'd be glad if you could update my example here
>>> > http://jsfiddle.net/jLEYS/3/ to
>>> > show me how I could achieve that using the StyleMap
>>> >
>>> > Regards,
>>> > Yves
>>> >
>>> >
>>> >
>>> > 2013/2/5 Sergeant_york <
>>>
>>> > electronicpanda@
>>>
>>> > >
>>> >
>>> >> var style = new OpenLayers.Style({
>>> >> externalGraphic: '${graphicFunction}',
>>> >> graphicYOffset: '${graphicYOffsetFunction}',
>>> >> graphicXOffset: '${graphicXOffsetFunction}',
>>> >> /* etc... */
>>> >> }, {
>>> >> context: {
>>> >> graphicFunction: function(feature) {
>>> >> if(feature.attributes.type=='bike') return '/bike.png';
>>> >> else if(feature.attributes.type=='hospital') return
>>> >> '/hospital.png';
>>> >> /*etc...*/
>>> >> },
>>> >> graphicYOffsetFunction: function(feature){
>>> >> if(feature.attributes.type=='bike') return 10;
>>> >> else if(feature.attributes.type=='hospital') return -10;
>>> >> /*etc...*/
>>> >> }, /*etc...*/
>>> >> }
>>> >> });
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://osgeo-org.1560.n6.nabble.com/Vector-layer-and-multiple-symbolizers-tp5032127p5032322.html
>>> >> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>> >> _______________________________________________
>>> >> Users mailing list
>>> >>
>>>
>>> > Users at .osgeo
>>>
>>> >> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>> >>
>>> >
>>> > _______________________________________________
>>> > Users mailing list
>>>
>>> > Users at .osgeo
>>>
>>> > http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://osgeo-org.1560.n6.nabble.com/Vector-layer-and-multiple-symbolizers-tp5032127p5032582.html
>>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>> _______________________________________________
>>> Users mailing list
>>>
> Users at .osgeo
>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>
>>
>>
>
> _______________________________________________
> Users mailing list
> Users at .osgeo
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Vector-layer-and-multiple-symbolizers-tp5032127p5032892.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list