[Proj] proj4 string for perfect sphere

Demitri Muna thatsanicehatyouhave at me.com
Fri Apr 13 19:07:54 EST 2012


Hi Frank,

Thanks very much for the help!

On Apr 13, 2012, at 7:26 PM, Frank Warmerdam wrote:

> I'm not not sure why you are using +proj=moll (Mollweide) if you are just
> going to be working with lat/long degrees.  Instead you should use latlong.

Ah, I didn't see that option; that makes much more sense. I chose Mollweide when I came across this:
http://zerospace.org/gis/projections/mollweide.html

> However, if you want an existing SRID, you could use EPSG:4035 which is:

Ah, that one looks right!

> If you want great circle distances (geodescics) you would need
> something apart from the default distance operator.   If you just
> wanted to do it at the commandline you could use the geod command from
> PROJ.4.  If you want to do it in a database, I'd normally recommend
> using the special "GEOGRAPHY" geometry type in PostGIS which is
> oriented to calculations on a sphere, particularly using geodesics.

Let me step back a bit and explain what I am trying to do (I became focussed on the SRID detail!). I have two lists of coordinates (ra/dec in my field, but lat/lon on a perfect sphere is the same). I'm trying to find out how many of the points from list 1 matches those on list 2 to within some value, e.g. 5 arcsec. I want to load each list into [x], and for each object in the first list perform a search to see if it appears in the second list. I was hoping to take advantage of GIS spatial indexing to make this a fast operation - I'm guessing this is a simple operation in the field.

[x] above is some GIS tool that I'm trying to find. I'm a huge fan of PostgreSQL (and will at some point investigate PostGIS), but my first goal is to do this with a Python script for catalogs < ~100,000. If I have two simple lists, I don't want to have to go into PG, create the schemas, populate, etc. spatialite seemed perfect - create the db file on the fly, populate it from the script, do the search with the GIS tools, then throw the file away. Simple. (At least that's the idea.) It also can be used without requiring someone to install PG+PostGIS, and I can wrap the spatialite complexity in Python classes. If this can be done with another (e.g. command line) tool I'd love to hear about it.

> I'm not sure if there is an appropriate function in spatialite.

I was using the distance operator to test the geometry, which is how I got here. spatialite does seem to have a function:

GreatCircleLength( c Curve ) : Double precision

which is a little unclear to me how to use:

spatialite> GreatCircleLength(GeomFromText('LINESTRING(2.47254166667 25.9237777778, 2.77729166667 -12.1073136111)',4035))
---------------------------------------------------------------------------------------------                
4228993.04708947                                                                                             

Those are not degrees! :)

Thanks again for your help. I'm trying to build a bridge between the astronomy and GIS communities...

Cheers,
Demitri


More information about the Proj mailing list