Giter VIP home page Giter VIP logo

arc.js's People

Contributors

blaine-foreflight avatar frewsxcv avatar jgravois avatar malaretv avatar matiassingers avatar matt-glover avatar springmeyer avatar tmcw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arc.js's Issues

Support for Decimal Precision

Is it possible to provide decimal precision as an option to generator.Arc? I'm working on optimizing a workflow that requires drawing a lot of lines. One of the optimizations I am making is to limit the precision of coordinate values (suggested by MapBox under the section Cleaning up your data https://docs.mapbox.com/help/troubleshooting/working-with-large-geojson-data/).

Trimming the precision at the same time that the coordinates are generated would save me the trouble of having to iterate through the coordinates after

Thanks

Problem with the polylines in the right direction!

Try to click on Canada first and then click on Australia, but not in the right side, click on the left side of the map. So, you have the closest distance from Canada to Australia, the route that an airplane follows, and check what happened to the line! The line stops and goes back!

Support meta information attributed to each LineString

It would be nice if the third argument in GreatCircle() had an option to pass in information that's attributed to each LineString. Simply passing "Some name" against a large .csv file just adds this value to the entire file and not a single unique line. for .csv files that have more than just lat long values but other information attributed to it - it would be awesome to retain this in the newly created geojson file.

Demo site hits javascript error with Safari

I just noticed that the demo site works for me in Chrome, but not Safari (on a Mac).

One point is able to be plotted, but not a second (so no arc is drawn). The error in the console is:

Error: Invalid LatLng object: (NaN, NaN)

Screen Shot 2022-07-08 at 8 04 06 PM

Don't have time to debug this right now, so just filing the ticket as a reminder in case I find time in the future to debug, or others do.

arcGenerator.Arc(100,{offset:10}),how do i set these two argument?

very close line,for example [114.376688,30.4619172],[113.844623,30.237268],i use arcGenerator.Arc(100,{offset:10}) to produce a line, it seem like a straight line, it has not arc, so how do i set these two argument that i can produce a arc line?
I am waiting for your reply,please.

Arcs go way beyond the map

While developing something that looks like an airline routes map with Leaflet.Arc plugin (that wraps arc.js), I noticed that certain arcs (e.g. Seattle - Abu Dhabi) seriously overflow the edges of the map. This makes perfect sense in a 3D Context where that line would go near the North Pole and would be geometrically correct. However, in a 2D context, I'd imagine it would make sense for arcs to stay within latitude bounds. Is that something worth considering?

screen shot 2016-12-03 at 2 47 56 pm

Problem with polylines near north pole

If you click on Kentucky first and then click on China, the greater circle crosses the north pole, but the line is rendered across the top of the map and crosses itself.

Do you know of an algorithm that would render the polyline as more of an arc?

I would be more than happy to address the issue but I do not know where to start looking.

Example data: https://gist.github.com/2895824

Fix Leaflet inclusion

Currently the demo page is broken because the Leaflet master API has GeoJSON class changed slightly (addGeoJSON method renamed to addData). The page includes Leaflet like this:

<script src="https://raw.github.com/CloudMade/Leaflet/master/dist/leaflet.js"></script>

This is an extremely bad practice as your code is always prone to breaking, as master branch is an in-progress development version. You should either link to stable version (e.g. with Leaflet CDN http://leaflet.cloudmade.com/download.html), or put the master version files into your repo and update manually.

Add option to not cross dateline

Though great circle lines are defined by being the shortest distance between two points, I think this library could also allow users to draw geodesic lines.

I suggest adding a boolean property in Arc options called shortestPath. Default will be true and will produce normal great circle lines. False will draw a line from start point to end point in a west to east direction.

First and last points sometimes in wrong place

Seen on a Galaxy Tab 2 using the android browser, chrome on same device and all other browsers tested on other platforms all okay. Below is a line from Washington to London to flight path, the line is from the aircraft position to London as it fly's along the great circle path.

More than 50% of the time all looks good and the points are correct.

Longitudes for a bad line :-

-45.90075610539107
-64.1077399463533
-62.775115272399255
-61.415123196700044
-60.02749558462086
-58.61204288779067
-57.168663375242126
-55.69735253809121
-54.19821252306159
-52.67146142295045
-51.1174422253593
-49.53663119602385
-47.92964545146531
-46.29724945923666
-44.64036019464593
-42.96005068239715
-41.257551661831606
-39.53425113678797
-37.79169160642204
-36.03156482183506
-34.255703974406906
-32.4660732937163
-30.66475511328782
-28.853934547652727
-27.035882010135403
-25.212933882695825
-23.38747172226428
-21.561900447766607
-19.738625994600138
-17.92003294585486
-16.108462650563627
-14.30619231863985
-12.515415541315736
-10.738224627543923
-8.976595074748827
-7.232372410997091
-5.507261559897495
-3.802818794048498
-2.1204462618961593
-23.826829224833478

The arc is a straight line

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


     <script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
     <!-- <script src="http://cdn.leafletjs.com/leaflet-1.0.0-b1/leaflet.js"></script>   I tested with both files-->

     <script src='http://api.mapbox.com/mapbox.js/plugins/arc.js/v0.1.0/arc.js'></script>
     <script src='Leaflet.Arc.js'></script>
     <script src="load_map.js"></script>
</head>
<body>
    <div id="map"></div>
</body>

mapa

NaN error when start and end co-ordinates are the same

Hi,

My name is Phil Lee, I'm a student at Brighton University studying Digital Games Production. My final year project is based on geolocation data visualisations. Your API is awesome just wanted to inform you of an error I have found.

I have noticed that if any of the start and end co-ordinates in a data set are exactly the same then 'leaflet-src.js' throws the error 'Uncaught Error: Invalid LatLng object: (NaN, NaN)'. I'm assuming this hasn't been noticed as most geolocation data sets do not have start and end co-ordinates that are exactly the same. For my use case I'll will strip out all the duplicates but it is a shame to see the whole data set fail on an uncaught error, especially with a data set of 30,000+. I would be interested to hear if you take any action on this.

Regards,
Phil Lee
[email protected] or [email protected]
Trainee Web Developer BBC News
Student at University Brighton

Publish updated version?

The version of this on npm isn't up-to-date with cross-dateline polylines - could you push an updated tag?

Add option for non-breaking lines

On https://www.mapbox.com/mapbox.js/example/v1.0.0/cross-date-line/ you'll notice the comment:

The coordinate -233.9 is technically invalid but Leaflet permits it because it can imply the direction of wrapping - to wrap in a direction, you can add or subtract 360 from the desired end coordinate

It would be nice if arc.js could generate lines with coordinates like that. If this is something you'd accept in a pull request let me know, I could possibly take a look at it but I can make no promises, my js is very weak.

Thanks,
Cody

Upside Down Arc

Currently, I do not see any way to perform an upside down arc. I have tried passing in a negative value to the constructor of the Arc prototype function, yet it just makes it a straight line. Is there any functionality for this currently?

Update version

Right now this package uses version 0.1.0, which is a bit out of date. I suggest updating the version so that the newer version will be available on NPM.

generator.Arc() is not as described in README

In README, it is said:

> line
{ properties: { name: 'Seattle to DC' },
  coords: 
   [ [ -122, 48.00000000000001 ],
     [ -112.06161978373486, 47.7241672604096 ],
     [ -102.38404317022653, 46.60813199882492 ],
     [ -93.22718895342909, 44.716217302635705 ],
     [ -84.74823988299501, 42.14415510795357 ],
     [ -77, 38.99999999999999 ] ],
  length: 6 }

This is not the case. There is a geometries object which is an array with one member which is an object containing cords and length properties as described above.

Dunno if the problem is in README or in the implementation.

Ability to color arcs?

Hi,

I was looking around to see if there is a way to color arcs in arc options, but I couldn't find it. Have I just missed it or would I be messing around with the js myself?

Thanks!

Making multiline strings to address international date line

@springmeyer

I want to ping you on the international date line issue and see if there is a possible solution by using MultiLineStrings. Is it possible to create multiline strings when an arc crosses the date line?

Another issue with breaking into two lines is the gap that is formed between the two points that cross the date line. Is it also possible to create two points, along the arc, that would be just offset from the date line? So when the line is broken, create two points, at -179.99 and +179.99 at the appropriate latitude?

Example of a line: https://gist.github.com/39ab121a3e225c516885

Denver to Kuala-Lumpur with GreatCircle

Hello!

I found one annoying issue (or unwanted feature) with GreatCircle.Arc().

For example if I want to draw route (with leaflet) from Denver to Kuala-Lumpur ([39.740009, -104.992297] to [3.104769, 101.691994]) with 25 points: new arc.GreatCircle(from, to, properties).Arc(25)
I get this picture:

arc-25

But if I try to increase points amount (up to 30 or more) then I get this one:
new arc.GreatCircle(from, to, properties).Arc(30)
arc-30

Incorrect README (or incorrect package.json ;-))

Instead of:
$ npm install --save arc.js

README.md should read:
$ npm install --save arc

Alternatively, should you want to remain consistent with Bower, package.json name should be called arc.js and republished on NPM.

Thanks for the lib !

Add license information to the README and repository

I would like to use arc.js to draw a great circle on a map. To be able to use this in our project I need to know if the license your are releasing this under gives me the right to do that.

Please add the license to the github repository and mention the license in the README.

If have haven't decided yet on a license I am happy to help with that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.