springmeyer / arc.js

great circle routes in javascript
http://springmeyer.github.io/arc.js/
BSD 2-Clause "Simplified" License
369 stars 69 forks source link

The arc is a straight line #28

Closed miguel-ribeiro closed 8 years ago

miguel-ribeiro commented 8 years ago

Hi, I'm using this code to do a small test, and it just displays a straight line. I notice that if I use coordinates far from each other(cross Atlantic), there is a VERY slight curve, but only just. Is there anything that I'm doing wrong? If you can put these coordinates working, could you provide the most basic example on how you did it? Thanks

//load_map.js window.onload = onLoad

function onLoad(){ var map = L.map('map').setView([32.75,-16.97], 11)

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(map);

var arc = L.Polyline.Arc([32.6936836, -16.7753468], [32.75, -16.97], { color: "red", vertices: 200, offset:10 }).addTo(map) }

//index.html

```


![mapa](https://cloud.githubusercontent.com/assets/6084480/11780671/a3859d36-a25b-11e5-87b8-380475bbc56e.JPG)
tmcw commented 8 years ago

These coordinates are very close to each other, and in the screenshot that's clear; this is definitely not crossing the atlantic. The generated arc looks correct.

miguel-ribeiro commented 8 years ago

Shouldn't the effect be the same regardless of the distance? I see some trignometric is used with a step for the number of points requested. Shouldn't it behave the same because of that?

I meant to say: i ALSO "notice that if I use coordinates far from each other(cross Atlantic), there is a VERY slight curve, but only just."

Blue line: straight Red line: arc (but only just) It is a reaaaaaly slight arc. Is it really supose to be like this? I've seen from other printscreens much more parabolical lines. I'm using [32.6936836, -16.7753468], [0, 0] image

Would there be a way to define the angle/radius ?

tmcw commented 8 years ago

This library generates great circle arcs, which are a geographically-defined arc. If you're looking for arbitrary curves for graphical purposes, you'll want to use something else.