Instantiate a pyephem EarthSatellite from positional coordinates without a TLE - pyephem

I have the position of a satellite at a given time, in altitude/latitude/longitude coordinates.
I'd like to calculate the azimuth/elevation from an observer on earth (given in lat/long) to this satellite at that position.
The ephem.EarthSatellite object only operates on TLEs and a desired timestamp. Is there anyway to instantiate a satellite from positional coordinates? Maybe with a different ephem.Body type?

No, there is no way to create your own objects with Earth-fixed coordinates in PyEphem. You might want to take a look at its replacement that I am writing, though, called Skyfield — you should be able to create a Topos object with any lat / lon / elevation you want, and then observe it from any other location you define with a Topos and get an alt / az back.

Related

Anything in Leaflet that is similar to isLocationOnEdge() from Google Maps?

Google Maps has the function isLocationOnEdge(point, polyline, tolerance) that takes a tolerance value in degrees and uses it to determine whether a point falls near a polyline.
Is there anything similar in Leaflet(or some plug-in) that does the same thing?
A handful library for such operation is Turf.
For your case, a simple approach would be to:
Create a polygon out of your polyline using turf.buffer with appropriate "tolerance" (Turf takes a distance at Earth surface, or degrees).
Check whether your point is within that polygon or not using turf.inside.
Unfortunately, turf.buffer is only an approximation, it does not takes geodesy into account… therefore for big tolerance you will have a deformed shape.
An exact method could be to:
Use instead turf.pointOnLine to find the nearest point of the polyline.
turf.distance to measure the distance between those 2 points, and compare with your tolerance (or even just Leaflet latLng.distanceTo, but you would have to convert GeoJSON points back to Leaflet LatLngs).

Layout GPS coordinates without using a map

I'm trying to create a view that present a bunch of coordinates without using a map.
The user's coordinates should be at the center of the screen(in the middle of the circle),
and the rest of the coordinates will be layout relative to one another according to their real latitude and longitude.
Something like this:
I understood that I can't do this with MKMapKit because it will be a violation of Google license, so I need a way to place and manage the coordinates myself.
What is best practice to do something like this? how should I convert the coordinates to a screen points?
I'd go about it as follows:
1) I'd start by normalizing at the user's current location (translate it to 0,0 then apply the same translation to the rest of the coordinates).
2) Once you've done that, use a distance function to find out which coordinate in your list is furthest away from your current location.
3) Use the furthest away coordinate to determine the scale of your view.
4) Calculate the X & Y screen coordinates of all your locations based on the scale you come up with in #3

What is the projection used by MKMapView?

I am storing a number of point features inside a SQLite database for display inside of MKMapView and I would like to precompute and store coordinates in the the projection of the map instead of in lat/lon (for index/performance reasons). However, I am creating this database externally (in Python), so I cannot simply use the MKMapPointForCoordinate() function. What is the projection used by MKMapView? The documentation states that it is a mercator projection but it does not appear to be the web mercator projection that I expected. How can I compute an X/Y coordinate from a Lat/Lon ?
Personally I feel you're approaching the problem from the wrong angle - you say don't want to store latitude/longitude co-ordinates for 'index/performance reasons'. What are these reasons?
Storage, indexing, and querying of geographic coordinates inside of a database is not an unusual problem. They are simply two decimal numbers, making indexing and querying very straightforward.
Apple also tell you only to save co-ordinates rather than MKMapPoints in their own documentation:
When saving map-related data to a file, you should always save coordinate values (latitude and longitude) and not map points.
Perhaps you could share some of the issues you're having saving co-ordinates to a database?
I'm pretty sure it is webmercator because the overlay tiles I have produced are in that projection and they fit. But like other conmenters said, you're advised to store them in lat/long. If you want to query results in a grid lat/long provide a pretty good starting point. The grid isn't square as you leave the equator but it is rectangular.

Finding real world coordinate(3D) from 2D coordinates

I have x, y coordinates of a feature from a single photograph. I know camera parameters. How can i get the 3D coordinate of that feature (in matlab). please help me.
Give a look to this: http://www.cim.mcgill.ca/~langer/558/4-cameramodel.pdf
Systems like this that I've seen before requires that you know where the camera is (latitude and longitude), in which direction (azimuth and elevation) the camera is pointing, together with the field of view. Then you project this onto the geodata of the environment and from there you can do all kinds of things, like finding the 3D position of an object based on its location in the photograph.

iOS is it possible to convert CLLocation into some sort of XYZ metric coordinate system?

I'm building an augmented reality game, and working with CLLocation is rather cumbersome.
Is there some way to locally approximate CLLocation as XYZ coordinate, expressed in meters with the origin starting at some arbitrary point (for example the initial position when the game was started)?
Lets say I'm working with a 1 mile radius and do not really care about the curvature of the earth. Is it possible to approximate or somehow simplify the location based calculations for local position tracking?
Alternatively, is there a coordinate system that can be used with CLLocation that also incorporates the roll, pitch, yaw of the CMAttitude as well as compass orientation?
Clarification: As far as I understand, the problem with latitude and longitude is that their units vary in size, depending on the position on the globe. I should've specified that X,Y,Z should be in standard units, like meters or feet.
Thank you!
The Haversine formula may be useful.
I found a good article on it at http://www.jaimerios.com/?p=39 with code examples.
You could get the initial point at the app's launch and calculate the relative points based on the user coordinates as he or she moves. Admittedly, this is not super elegant, but if you are just trying to do some simple comparisons based on the user's location relative to an arbitrary origin, this should work. For the Z, Alex Stone's suggestion of calculating it based on the altitude should be fine.