I have a Zip Code MySQL database that has the lat/lng of each zip code. How do I go about finding the center zip code for each state? I would be doing this in PHP.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Kludge it. Make all the states rectangles.
It’s not perfect, but unless you like complex math it’s the best of a bad situation.
edit: I just re-read the question, realized it’s not asking for the center lat/lng, but center zip. Having retrieved a list of the approximate center lat/lng for each state you can loop through and find the nearest ZIP to each.