[postgis-users] Spheroid Question

Dan Phillips danp at americanclearinghouse.com
Fri Jun 24 13:40:39 PDT 2005


Hey Steve,

The '2000' represents 2000 meters & the query returns the correct results
for both distance_spheroid() & distance_sphere(). As previously noted,
distance_sphere() is much faster. The units returned are in meters.

Dan



-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net]On Behalf Of
Stephen Woodbridge
Sent: Friday, June 24, 2005 4:18 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Spheroid Question


Dan,

I am be wrong on my understanding, but it looks like you might be doing
a full table scan. Since SRID:4326 is in decimal degrees, and you are
expanding you point by +-2000 decimal degrees which is likely
overlapping every object in the table. If you want to select items in
2km of your point you might want to convert 2000 into its approximate
degrees for the && clause.

Also what units do the *_spheroid() return in?

-Steve W.

Dan Phillips wrote:
> Okay, this works. It's just really slow (~40 minutes). Any suggestions on
> speeding this up?
>
> SELECT
>   CRID,
>   distance_spheroid(centroid(the_geom),
>   setSRID(makepoint(-72.607912, 42.058052),4326),
>   'SPHEROID["GRS_1980",6378137,298.257222101]') as distance
> FROM crrts
> WHERE
>   the_geom && expand(setSRID(makepoint(-72.607912, 42.058052),4326),2000)
>   AND distance_spheroid(centroid(the_geom),
>   setSRID(makepoint(-72.607912, 42.058052),4326),
>   'SPHEROID["GRS_1980",6378137,298.257222101]')<2000 ;
>
> Thanks,
>
> Dan
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net]On Behalf Of
> strk at refractions.net
> Sent: Friday, June 24, 2005 11:39 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Spheroid Question
>
>
> On Fri, Jun 24, 2005 at 11:36:27AM -0400, Dan Phillips wrote:
>
>>Thanks Jeff & Paul. That was the problem.
>>
>>Now I'm getting "ERROR:  Operation on two geometries with different SRIDs"
>>
>>I assume this is because I'm not setting the SRID for my makepoint(). How
>
> do
>
>>I do this to make it match the SRID (4326) of my 'crrts' table?
>
>
> Use the setSRID() function:
> setSRID(makepoint())
> --strk;
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list