Astroquery JPL Horizons Python - python

I'd like to ask if anyone knows how can i get list of all objects that are in the Solar system. I mean all planets and their natural satellites. Or first 400 objects that are the closest to the barycenter of the solar system. The only thing i can get are planets and not exactly planets but their barycenters, so these aren't even correct coordinates.

So my husband is a planetary astronomer who studies moons of the outer planets (and Pluto). I thought he'd be able to tell me the answer right off. His response was "It's complicated, there is no central repository."
Most astronomers use the SPICE Toolkit and its Python wrapper. This toolkit has built within it databases for many of the objects that astronomers are interested it.
You can also find the ephemeris of most bodies at JPL Horizons. He has only used it to get one ephemeris at a time, but it may have the ability to generate multiple ephemerides.
Information about minor planets (Pluto, Ceres, Pallus, etc) can be found at the Minor Planet Center.

Related

How to find Planet Position using skyfield

I want to find planet position using skyfield in the form of
Ecliptic longitude,latitude, speed and distance in geocentric
You will probably want to go ahead and read the Skyfield documentation — have you made it very far yet, or are you still at the beginning? One of its earliest sections is its Examples:
https://rhodesmill.org/skyfield/examples.html
By searching that web page for concepts you are interested in, you can sometimes skip reading the full documentation — for example, try searching for the phrase “ecliptic longitude” and you’ll find an example where it’s computed for the Moon.
I'm not sure that you realize that you're asking a very difficult question. The motions of the planets are not simple ellipses. How much precision do you need? Are you asking for a program that will work for this year, for this decade, for this century?
A good introduction can be found here. For more information, you really need to take a course on planetary dynamics. I believe that NASA has some Fortran code (the SPICE kernel) that is used for their spacecraft.

How to snap coordinates to road and calculate distance

maybe somebody knows something, since I am not able to find anything that makes sense to me.
I have a dataset positions (lon, lat) and I want to snap them to the nearest road and calculate the distance between them.
So far I discovered OSM, however I can't find a working example on how to use the API using python.
If any of you could help, I am thankful for ever little detail.
Will try to find it out by myself in the meantime and publish the answer if successful (couldn't find any similar question so maybe it will help someone in the future)
Welcome! OSM is a wonderful resource, but is essentially a raw dataset that you have to download and do your own processing on. There are a number of ways to do this, if you need a relatively small extract of the data (as opposed to the full planet file) the Overpass API is the place to look. Overpass turbo (docs) is a useful tool to help with this API.
Once you have the road network data you need, you can use a library like Shapely to snap your points to the road network geometry, and then either calculate the distance between them (if you need "as the crow flies" distance), or split the road geometry by the snapped points and calculate the length of the line. If you need real-world distance that takes the curvature of the earth into consideration (as opposed to the distance as it appears on a projected map), you can use something like Geopy.
You may also want to look into the Map Matching API from Mapbox (full disclosure, I work there), which takes a set of coordinates, snaps them to the road network, and returns the snapped geometry as well as information about the route, including distance.
You might use KDTree of sklearn for this. You fill an array with coordinates of candidate roads (I downloaded this from openstreetmap). Then use KDTree to make a tree of this array. Finally, use KDTree.query(your_point, k=1) to get the nearest point of the tree (which is the nearest node of the coordinate roads). Since searching the tree is very fast (essentially log(N) for N points that form the tree), you can query lots of points.

Turtlebot scans a known environment looking for object - Strategy for exploration

Turtlebot exploration using a pregenerated map
I am working on the exploration strategy of a turtlebot that is supposed to navigate a known environment (with the help of a pre-built map) and searches for an object (e.g. a red ball).
The map has been generated using gmapping and now I am trying to implement a strategy for exploring the known map. Although generating random points on the map and then performing a 360° scan at these points is an option, I am not too enthusiastic about this method, since it does not guarantee that the object will be located if it exists.
What I would like to have is a set of points, such that after visiting all these points and performing a 360° scan at each of those points, the entire accessible/visible area of the map is covered by the robot.
I felt that the art gallery algorithm (described here: http://cs.smith.edu/~orourke/books/ArtGalleryTheorems/Art_Gallery_Full_Book.pdf) also achieves something similar, and hence tried to implement it in my scenario.
The art gallery problem requires polygons and I am finding it quite difficult to generate polygons from maps generated by gmapping on the real robot (although for simpler maps it's possible).
I have tried using the triangle module in Python to create convex hulls of clusters of objects, but that is not too useful in noisy environment like the one linked below. (I converted the .pgm file into a .png by plotting only obstacle points)
obstacle points
Note: My turtlebot does not have a laser scanner. It just has a Asus Xtion Pro Live.
I would really appreciate some help regarding the following:
Is there an easier way of exploring a known map with a turtlebot
(preferably some package in ROS)?
If the art gallery algorithm is a viable option, then how should I obtain accurate polygons from the scan-points of the obstacles?
Thank you in advance.

Map of all points below a certain time of travel?

My question is very simple and can be understood in one line:
Is there a way, tool, etc. using Google Maps to get an overlay of all surface which is below a certain time of travel?
I hope the question is clear, but I coulnd't find anything related on the web.
If you have any information, I'll take it!
Here is what I mean illustrated by an example:
I search for a new place to live. I know the precise address of my office.
I would in this case be able to overlay on Google Maps the surface which is under a certain time of travel (let's say 30 minuts by car).
We would have a long surface colored around motorways (because you get faster), and colors around roads.
I think you are looking for something like Mapnificient: it shows you areas you can reach with public transportation in a given time (video).
A similar site with even more options is How Far Can I Travel. Here you can choose between inputting your speed of travel and a travel time OR a distance. Optionally, you can also specify how accurate you want the results to be.
Now, how to create such examples yourself? See this related question where the accepted answer explains step-by-step, how you can get travel time data from the Google Maps API.
Finally, for $8.75, you can buy the article Stata utilities for geocoding and generating travel time and travel distance information by Adam Ozimek and Daniel Miles that describes traveltime, a command that uses Google Maps to provide spatial information for data.
The traveltime command takes latitude and longitude information and
finds travel distances between points, as well as the time it would
take to travel that distance by either driving, walking, or using
public transportation.
Other than the ones in #BioGeek answer, here are some more:
Nokia Here Maps API can give you the exact shape of the output. They call it time-based isoline. See here: Requesting a time based isoline
For travel times under 10 minutes, Isoscope is available at this address.
Also this looks promising: Route360
Update:
Route360 can be used for free in the following places:
Africa
Austria
Australia and New Zealand
British Isles
British Columbia
Czech Republic
Denmark
France
Germany
Italy
Malaysia, Singapore, and Brunei
Mexico
Norway
Portugal
Spain
Sweden
Switzerland
USA
I think you are looking for the Google Distance Matrix API. It returns not routes, but duration and distance for each pair of origin and destination. It has a usage limit of 100 elements per 10 seconds.
So you can make an educated guess about the distance that matches the desired time of travel, choose six or eight equally distributed points on a circle of that radius, and query the corresponding durations. Then refine the distances according to the results and calculate intermediary points. This way you can get a (quite rough) map in a few iterations.
I don't think there is a simple way of doing this, but here's an idea:
You'd need to first get the long/lat coordinates of your start position. You will then need to work out say, 50 coordinates around that start position that are say, 1 kilometer away from it (the answer here can help). You'd then need to traverse around each of these points and ask for the driving time to get there from your start position using Google Driving Directions API.
You'd then need to traverse the points again to find the points that are below the time of travel allowed (e.g. 30 mins in your question), move these points another kilometer or so away (in the same direction that the point originally moved from the start position) and repeat the driving time request until all are above the time of travel allowed. Finally you end up with 50 coordinates which you can plot onto a Google Maps image as a polygon using the Google Javascript API for mapping polygons.
This method requires a lot of requests to Google so you'll need to think about Google's limit on the number of requests you can do a day.
You can use the GraphHopper Directions API - this API part is also open source.
As we've added public transit and this feature recently it currently does not work together. But this is planned and until then you can enjoy road network isochrones :)
Disclaimer: I'm one of the GraphHopper founders.
You can draw a circle around your current position and check for a road at an angle every X degrees.
Another idea is to use a contour plot and isolines.

Distance by sea calculator, intermediate coordinates?

How do I calculate distance between 2 coordinates by sea? I also want to be able to draw a route between the two coordinates.
Only solution I found so far is to split a map into pixels, identify each pixel as LAND or SEA and then try to find the path using A* algorithm. Then transform pixels to relative coordinates.
There are some software packages I could buy but none have online extensions. A service that calculates distances between sea ports and plots the path on a map is searates.com
Beware of the fact that maps can distort distances. For example, in a Mercator projections segments far away from the equator represent less actual distance than segments near the equator of equal length. If you just assign uniform cost to your pixels/squares/etc, you will end up with non-optimal routing and erroneous distance calculations.
If you project a grid on your map (pixels being just one particular grid out of many possible ones) and search for the optimal path using A*, all you need to do to get the search algorithm to behave properly is set the edge weight according to the real distance along the surface of the sphere (earth) and not the distance on the map.
Beware that simply saying "sea or not-sea" is not enough to determine navigability. There are also issues of depth, traffic routing (e.g. shipping traffic thought the English Channel is split into lanes) and political considerations (territorial waters etc). You also want to add routes manually for channels that are too small to show up on the map (Panama, Suez) and adjust their cost to cover for any overhead incurred.
Pretty much you'll need to split the sea into pixels and do something like A*. You could optimize it a bit by coalescing contiguous pixels into larger areas, but if you keep everything squares it'll probably make the search easier. The search would no longer be Manhattan-style, but if you had large enough squares, the additional connection decision time would be more than made up for.
Alternatively, you could iteratively "grow" polygons from all of your ports, building up convex polygons (so that any point within the polygon is reachable from any other without going outside, you want to avoid the PacMan shape, for instance), although this is a refinement/complication/optimization of the "squares" approach I first mentioned. The key is that you know once you're in an area that you can get to anywhere else in that area.
I don't know if this helps, sorry. It's been a long day. Good luck, though. It sounds like a fun problem!
Edit: Forgot to mention, you could also preprocess your area into a quadtree. That is, take your entire map and split it in half vertically and horizontally (you don't need to do both splits at the same time, and if you want to spend some time making "better" splits, you can do that later), and do that recursively until each node is entirely land or sea. From this you can trivially make a network of connections (just connect neighboring leaves), and the A* should be easy enough to implement from there. This'll probably be the easiest way to implement my first suggestion anyway. :)
I reached a satisfactory solution. It is along the lines of what you suggested and what I had in mind initially but it took me a while to figure out the software and GIS concepts, I am a GIS newbie. If someone bumps into something similar again here's my setup: PostGIS for PostgreSQL, maps from Natural Earth, GIS editing software qGis and OpenJUmp, routing algorithms pgRouting.
The Natural Earth maps needed some processing to be useful, I joined the marine polys and the rivers to be able to get some accurate paths to the most inland points. Then I used the 1 degree graticules to get paths from one continent to another (I need to find a more elegant solution than this because some paths look like chess cubes). All these operations can be done from command line by using PostGIS, I found it easier to use the desktop software (next, next). An alternative to Natural Earth maps might be the OpenStreetMap but the planet.osm dump is aroung 200Gb and that discouraged me.
I think this setup also solves the distance accuracy problem, PostGIS takes into account the Earth's actual form and distances should be pretty accurate.
I still need to do some testing and fine tunings but I can say it can calculate and draw a route from any 2 points on the world's coastlines (no small isolated islands yet) and display the routing points names (channels, seas, rivers, oceans).

Categories