Re: [GENERAL] locating cities within a radius of another

2010-07-22 Thread Oliver Kohll - Mailing Lists
On 21 Jul 2010, at 23:14, Joe Conway m...@joeconway.com wrote: If you want something simple, and not requiring PostGIS, but plpgsql instead, see: http://archives.postgresql.org/pgsql-sql/2003-12/msg00193.php For completeness, the earthdistance module also provides the distance between two

Re: [GENERAL] locating cities within a radius of another

2010-07-22 Thread Geoffrey
Oliver Kohll - Mailing Lists wrote: On 21 Jul 2010, at 23:14, Joe Conway m...@joeconway.com mailto:m...@joeconway.com wrote: If you want something simple, and not requiring PostGIS, but plpgsql instead, see: http://archives.postgresql.org/pgsql-sql/2003-12/msg00193.php For completeness,

Re: [GENERAL] locating cities within a radius of another

2010-07-22 Thread Geoffrey
Oliver Kohll - Mailing Lists wrote: On 21 Jul 2010, at 23:14, Joe Conway m...@joeconway.com mailto:m...@joeconway.com wrote: If you want something simple, and not requiring PostGIS, but plpgsql instead, see: http://archives.postgresql.org/pgsql-sql/2003-12/msg00193.php For completeness,

Re: [GENERAL] locating cities within a radius of another

2010-07-22 Thread Geoffrey
Oliver Kohll - Mailing Lists wrote: On 21 Jul 2010, at 23:14, Joe Conway m...@joeconway.com mailto:m...@joeconway.com wrote: If you want something simple, and not requiring PostGIS, but plpgsql instead, see: http://archives.postgresql.org/pgsql-sql/2003-12/msg00193.php For completeness,

Re: [GENERAL] locating cities within a radius of another

2010-07-22 Thread Oliver Kohll - Mailing Lists
On 22 Jul 2010, at 12:57, Geoffrey wrote: For completeness, the earthdistance module also provides the distance between two lat/longs, the point@point syntax is simple to use: http://www.postgresql.org/docs/8.3/static/earthdistance.html Disgregard my last post, Surely as soon as I hit

Re: [GENERAL] locating cities within a radius of another

2010-07-22 Thread Geoffrey
Oliver Kohll - Mailing Lists wrote: On 22 Jul 2010, at 12:57, Geoffrey wrote: For completeness, the earthdistance module also provides the distance between two lat/longs, the point@point syntax is simple to use: http://www.postgresql.org/docs/8.3/static/earthdistance.html Disgregard my

[GENERAL] locating cities within a radius of another

2010-07-21 Thread Geoffrey
We need to locate all cities within a certain distance of a single city. We have longitude and latitude data for all cities. I was thinking postGIS was a viable solution, but I don't see a way to use our existing data via postGIS. Is postGIS a viable solution, or should I be looking at a

Re: [GENERAL] locating cities within a radius of another

2010-07-21 Thread Andy Colson
On 7/21/2010 8:01 AM, Geoffrey wrote: We need to locate all cities within a certain distance of a single city. We have longitude and latitude data for all cities. I was thinking postGIS was a viable solution, but I don't see a way to use our existing data via postGIS. Is postGIS a viable

Re: [GENERAL] locating cities within a radius of another

2010-07-21 Thread Joe Conway
On 07/21/2010 06:01 AM, Geoffrey wrote: We need to locate all cities within a certain distance of a single city. We have longitude and latitude data for all cities. I was thinking postGIS was a viable solution, but I don't see a way to use our existing data via postGIS. Is postGIS a

Re: [GENERAL] locating cities within a radius of another

2010-07-21 Thread Pierre Racine
: PostgreSQL List Subject: Re: [GENERAL] locating cities within a radius of another On 07/21/2010 06:01 AM, Geoffrey wrote: We need to locate all cities within a certain distance of a single city. We have longitude and latitude data for all cities. I was thinking postGIS was a viable solution, but I

Re: [GENERAL] locating cities within a radius of another

2010-07-21 Thread Paul Ramsey
create table cities ( geog geography, name varchar, id integer primary key ); insert into cities select Geography(ST_SetSRID(ST_MakePoint(lon, lat),4326)) as geog, name, id from mytable; create index cities_gix on cities using gist ( geog ); select st_distance(a.geog, b.geog),

Re: [GENERAL] locating cities within a radius of another

2010-07-21 Thread Pierre Racine
2010 12:04 To: Joe Conway; Geoffrey Cc: PostgreSQL List Subject: Re: [GENERAL] locating cities within a radius of another Once PostGIS is installed you can do it with a single SQL query looking like this: SELECT dest.id, ST_Distance(ST_MakePoint(orig.longitude, orig.latitude), ST_MakePoint