473,224 Members | 1,604 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

gps to zipcode query: postgres or postgresql + postgis or how?

I would like to map from GPS coordinates to US Zipcode for US
Continental based needs.

(Yes, I am excluding perhaps Hawaii and Alaska for now, and I am also
assuming that a simple 2D geometry, assuming the GPS coordinates are
Euclidean and not spherically based will be good enough to find the
closest zip code.)

So assuming something simple like

create table zipcode (
zcode integer primary key,
loc point

I have the zipcode data from the postoffice and it contains lat, lon.
(As I'm sure you guys know....)

I notice that Postgresql already supports the point type. And I
figured how to enter points into the db.

What I haven't figured out how is to make a query that selects other
rows that are closed to my target.

select zcode from zipcode where loc ## 'userx, usery';

That seems to fail.

Can someone tell me:

A) Can I do this in postgresql without using postgis,
and if so, how? (and what indices should I create?)
B) Where a good reference to making queries with the
postgres native geometric types can be found?

I'm happy to use postgis, I just don't want to toss an a-bomb after a
fly. If I implement postgis and do this in postgis, would it be
faster than the "native" postgres query, and if so, why?

And how would I do this postgis and what sort of index would I need to

And hell, all I need is a mapping the fastest way possible. Given
that I have the zipcode => (lat, lon) data, anyone know of any C code
to do a spatial search?

Jerry Asher
Jul 19 '05 #1
0 3715

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Gregory S. Williamson | last post by:
I've been charged with investigating postGIS as a replacement for our current Informix runtime (9.3), which uses the Spatial blade. Currently we use two Sun Sparc/Ultra 80 boxes with 3 CPUS...
by: N.K. | last post by:
Hi, I've just installed postgres on the Linux server. It is supposed to start automatically which I think it does since I can run an sql stmt right away. When I'm trying to connect from a remote...
by: Egyd Csaba | last post by:
Hi All, how can I improve the query performance in the following situation: I have a big (4.5+ million rows) table. One query takes approx. 9 sec to finish resulting ~10000 rows. But if I run...
by: Stijn Vanroye | last post by:
Hi List, I'm running a query on a not-so-small db. Mostly this query runs fast enough, but every once in a while the query takes a long time to complete in wich case the users start banging away...
by: dananrg | last post by:
Seems like most web hosting providers support MySQL, but not PostgreSQL. I need a web hosting account that supports PostgreSQL for a particular personal project I'm working on (as well as Python,...
by: Lee Blevins | last post by:
I'm trying to query a postgresql database with PHP. I am having a problem when using a WHERE. It works without the WHERE. Example: $query = "SELECT job_number, customer, desription, archive,...
by: webhead74 | last post by:
Hi, I'm having intermittent problems with queries from my php script to a postgresql database. I have a form where I can enter a search query - for instance a last name. This leads to a...
by: dvelst | last post by:
Hi All, I have the following query which was based on a working query in MySQL: (don't be afraid of the size of the query you see below, later on I will concentrate on part of this query) ...
by: isaacmckensey | last post by:
Hi, I hope i don't spam this thread, I did not want to open a new thread. I'm a noob here (programming). I need help with creating the program. I need to connect to the database- postgres/postgis...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.