Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm a newbie in OpenLayers. Can you help me with this:

Is it possible to assign color not to the whole linestring, but to different segments?

share|improve this question
1  
i think it is not possible. but you can separate them different segments for defining new colors to all segments... vectorLayer.features[x].geometry.components will give you to all segments... –  Aragon Aug 9 '12 at 8:53
add comment

2 Answers

Bad news: it's not possible. You will have to break up your lines and assign different styles to each of them as suggested by @Aragon.

share|improve this answer
add comment

All GIS tools treat a set of connected nodes do not having same start and end nodes as a single linestring unless you break it explicitly as mentioned by @unicoletti. And openlayers is not an expecption in this case. ofcourse you can do it using some code to break up every node and visualize on web or whatever.

But this creates problem and GIS tools will not consider it as a single valid linestring. Only a big answer is to hack into OL code and consider each line as a set of two nodes which are drawn individually. or create a different layer with you line broken into set of two nodes.

Hope this helps

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.