[postgis-users] Selecting geocoded postal codes within a given distance ( miles for example )
Hugh W. O'Brien
hugho at intelis.com
Tue Dec 17 09:04:57 PST 2002
Thanks for the reply Paul. I had come to the conclusion that I had
those 2 choice but wasn't sure which one was more difficult. Thanks for
pointing out which one is easier to implement.
Now for a followup question?
What's the best way to convert my geocoded postal codes to UTM?
What would be the appropriate SRID of my new data set if I chose UTM as
my new rectangular cooridinate set?
-- Hugh W. O'Brien
Paul Ramsey wrote:
> You have a couple options.
>
> One is to take your whole data set and translate it into a planar
> projection. If you have a contrained area, that might be a good thing
> to do, because it makes the whole problem simpler.
>
> Two is to essentially two-stage the problem. Problem (a) is subsetting
> your complete data set to just those codes which *might* be within
> your radius. Problem (b) is explicitly testing those codes. To do (b)
> on a lat/lon data set, you need to know the ratio of miles/degrees
> longitude and miles/degrees latitude for your area. You can calculate
> these with a couple selects using length_spheroid and two-point
> LINESTRINGS constructed in our search area. Then you use these
> distances to construct a query box, and used distance_spheroid() to
> parse out just those codes which fall in your search area.
>
> You can see why option one is simpler :)
>
> Hugh W. O'Brien wrote:
>
>> Dear List,
>>
>> How would one go about selecting the geocoded postal codes within
>> given a distance ( say in miles ) of another geocoded postal code.
>> Finding the long/lat of the postal code we are searching around is
>> simple ( no help is needed there ). I have read/seen the faq for
>> postgis. The example given there using a bounding box doesn't
>> really fit what I am trying to do exactly because I will be dealing
>> with degrees longitude/latitude and miles ( the example in the faq
>> uses meters exclusively ).
>>
>> Thanks in advance for any help you can give.
>>
>> -- Hugh W. O'Brien
>>
>>
>> _______________________________________________
>> 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