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.

So, I'm trying to draw curved lines in my application which is based on a Leaflet map.

As far as I know Leaflet does not support drawing curved lines at the moment, so my question is really more about how to best get some curved line funtionality in there.

The problem is made more difficult because my code will have to be IE-8 compatible, which means that pure SVG is no solution. (Leaflet actually does a fall-back to VML if it detects that no SVG support is present...)

So one possibility would be to myself write some leaflet extension code based on SVG with its own fallback to VML. This would be a hell of a lot of work. :/

Does anyone have a better proposition?

share|improve this question
    
Just now realized that I never accepted an answer. I picked the one by @dobrych because Raphaël seems to be a very nice library and provides a nice VML fallback. I might look into the arc.js as well. –  fgysin Nov 11 '13 at 8:07
add comment

3 Answers 3

up vote 2 down vote accepted

Considering IE8 support requirement, we don't have many options on the table. I can only recall one SVG lib that has VML fallback — Raphaël.js So you can try this Raphaël layer plugin implementation for Leaflet. https://github.com/dynmeth/RaphaelLayer I didn't try plugin myself, but successfully used Raphaël. Hope you can find a use of it.

Here is the working example (picture links to demo) http://visualizingurbanfutures.com/2012/09/06/maps-with-raphael-js/

If not IE8 requirement, I would go to use D3 for any vectors in web GIS.

share|improve this answer
add comment

You can use the arc.js plugin for leaflet to draw curved lines.

share|improve this answer
add comment

Making your own custom layer is probably one solution to solve that issue. But yes, i agree it would be a hell lot of work. Another option would be to draw your own curves (bezier, b-spline or something like that) based on the geographic coordinates. I have no idea if that looks nice, but I could imagine that the result would not be too bad and it is definetly a lot faster achieved. There is plenty of JS scripts for such algorithms around. It might be worth considering to project your data into something like UTM for the calculation.

If you find smth. out please let us know...

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.