Jump to content

Geocoding with MySQL


a2bardeals

Recommended Posts

I am working on a geocoding program that will calculate distance between two addresses and I think I have found a way to do it. However, the data I could find is from the US census website. It's called TIGER/Line data and its in a wierd format. I have found one site that kind of explains how to do it but I can't get it to work the way they want. Basically, they have a PHP script that is supposed to read the data into MySQL which dosen't seem to work for me (gives parse errors and such). I am desperatly in need of finding a way to use this TIGER/Line Data to geocode a certain county. To fully undertand this problem you may need to read the article.

 

http://blog.tooleshed.com/?p=16

 

Any ideas on getting this data into a MySQL format?

Link to comment
Share on other sites

I don't know what GIS means...

but I made a few hacks to the provided code on that article and loaded the data in. Now the second page to the article explains how to pull the data and calculate distance but when i try their geocode.php script i get all kinds of parse errors. Maybe because I'm using PHP 4.1.2 and they wrote it for 5 or something but now I am really stuck. I can post the code for anyone interested in helping a distraught student.

Link to comment
Share on other sites

I don't know what TIGER data is. But what you want to calculate distances is the Lat Lon of each point. Can TIGER be converted somehow to lat lon? You could just register an account w/ google and use their geocoding api. But if your a student, you probably aren't allowed that option.

Link to comment
Share on other sites

GIS stands for "geographic information system"

 

Take a look at  ESRI's site for more info on GIS. The TIGER format and GIS are compatible as wierd as the format may seem.

www.esri.com/

 

GIS software can easily calculate distance, but it has been too many years since I worked with GIS to formulate an interface to extract and manipluate the data in MySQL.

 

Artacus' suggestion as to lat long with google may be the most straight forward route, but knowing what GIS is may help you solve your problem. 

 

If you have not solved it yet, please post your code as it will definitley be helpful.

 

best  :)  (thirty plus years since a distraught stutent... and then there was no GIS to worry about)

Link to comment
Share on other sites

basically I've loaded the data from 2 counties into a table using the method in the article posted above. Now I can not figure out how to:

 

1. Parse the user inputed address.

e.g. 3004 N. Main St. would break up into 4 parts the street number (3004) the direction (N) the street (main) and the type (St.)

2. Then search the database for the lat-long of the address.

Finally:

3. Calculate the distance from a set lat long (aka a store location).

 

Link to comment
Share on other sites

They may have a strict policy for commercial purposes, but for testing, you can get one for "localhost".

 

I was able to get the data uploaded for my City, the query results are weaker than I would like, so I am reviewing the underling data. I may have to use the search with the LIKE function. When I did locate a street address it was accurate or when I used it to calculate distances between 2 lat lon it als0 was accurate.

 

The issue was that not as many streets showed up. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.