[Proj] proj4 string for perfect sphere
thatsanicehatyouhave at me.com
Mon Apr 16 16:58:43 EST 2012
Thanks very much for the extensive comments. The biggest thing I learned about GIS this week (starting from knowing nothing about it last week) is that calculations are primarily done on an XY plane which are projections of a curved surface. I had naively assumed going in that calculations and indices (e.g. spatialite) were optimized for the surface of a sphere.
On Apr 13, 2012, at 10:16 PM, Fischer, Robert P. (GISS-6110)[COLUMBIA UNIVERSITY] wrote:
> 1. You can compute distance between two lat/lon points on a sphere using the Haversine formula or Vincenty's formula specialized to the sphere. They are described at:
> Code for Haversine is below. Fix it up as needed.
Thanks for the code. I've been using the law of cosines and wasn't aware of the problem at small separations (though this seems to trade that problem for one at large separations).
> 2. If all you need is an R-Tree, just use an R-Tree. Don't bring in a database just because it has an R-Tree built inside, that will distort your entire programming effort needlessly. Here is an R-Tree that works in 2 or 3 dimensions. It worked for me in just a couple of hours of work:
> NOTE: There are multiple versions of this file floating around the Internet. Use what works for you.
I was not familiar with this - I will look into it. You are right; the database isn't crucial for what I'm doing.
I will also look at the other links you mentioned. Since all my source points are in ra/dec (not 3D cartesian), there will be the computation hit to convert them back and forth. So I agree, proj.4 doesn't give me much.
As for indexing on a sphere, I've used this for a few years now with great success:
Some details on how it works are here (though the first link is a little old):
My GIS wanderings were to try to find a similar solution for smaller datasets without the overhead of creating a new schema, importing the data, etc. to take advantage of the optimized indexing. It might be in the end that implementing q3c into sqlite or through a Python interface is the best solution.
Thanks again for your suggestions.
More information about the Proj