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.

Hi i want to display multiple lines between two coordinates. i will pass no of lines and color of the line, it has to display like below image.

please see the below image.this is my previous post enter image description here

share|improve this question
1  
Did you want Geodesic lines? –  CaptDragon Mar 14 '12 at 19:18
1  
You mean you will pass two coordinates and color of the line? Intead of "i will pass no of lines and color of the line"? –  CaptDragon Mar 14 '12 at 19:52

1 Answer 1

up vote 10 down vote accepted

This demo takes in two coordinates and a color and will create a Geodesic line between them.

DEMO LINK

enter image description here

You can add lines by entering information into the form, OR programmatically like so:

//Taj Mahal to Venice (San Marco)
AddLineProgrammatically(new OpenLayers.LonLat(78.0447, 27.17461), new OpenLayers.LonLat(12.34014, 45.43338), "#006633");
//Roman Coliseum to Mecca
AddLineProgrammatically(new OpenLayers.LonLat(12.49249, 41.89014), new OpenLayers.LonLat(39.8261238221, 21.4225222672), "#feadc8");
// Mecca to Statue of Liberty
AddLineProgrammatically(new OpenLayers.LonLat(39.8261238221, 21.4225222672), new OpenLayers.LonLat(-74.04457, 40.68927), "#3366cc");

This demo is based off of Mr. Wippermann great circle example.

Update per comment:

Simply comment out this line: vectorLayer.addFeatures([pointFeature, pointFeature2]); in the AddLine and AddLineProgrammatically functions if you don't want the markers.

enter image description here

share|improve this answer
    
Did I answer your question? –  CaptDragon Mar 28 '12 at 15:55
    
A small modification, now i dont want to display markers, will add markers through the markers layer. So i need only lines from this vector layer. Can u help me? –  Ramesh Kotha Apr 6 '12 at 13:42
    
simply comment out this line: vectorLayer.addFeatures([pointFeature, pointFeature2]); in the AddLine and AddLineProgrammatically functions. –  CaptDragon Apr 6 '12 at 14:38
    
thank you very much... –  Ramesh Kotha Apr 6 '12 at 14:47
    
hi one more small modification, i want remove all lines on an event. how to do that... –  Ramesh Kotha Apr 10 '12 at 17:52

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.