How to make a business directory (in Wordpress)?

Joined
Nov 5, 2014
Messages
831
Likes
616
Degree
3
I've seen these before and, when I want to make one for my own site, I can't figure out how it's done!

So, a few days ago, @hehejo was good enough to help me out on how to scrape the Government website.

Now, I have a .csv filled with listings of different business in different cities.

My goal is to have a page for major metropolitan areas so I can capture local keywords. So, for example, I'd like to target "Chicago, IL webmaster meetup" and not "Oak Brook, IL webmaster meetup" (a suburb of Chicago).

How does one organize the listings so that the listings are categorized to their nearest major metropolitan area?

I already went and got a list of cities by population. My cutoff is 100,000 so I would like to place each listing into the nearest city of 100,000 people.

How would I do that? I thought about decoding the Zip code structure but found out that's unreliable.

I'm guessing one could convert the address to a GeoLocation and then use trigonometry to find all locations within X miles of the center of the city but... err... I don't know if I can do that. lol.

Is there a better way? I'm sure someone has already figured this out. No point in re-inventing the wheel, you know.
 
Well, there are much cheaper solutions than this, but the quickest thing off the top of my mind would be MaxMind's GeoIP database offerings. They have a database you can purchase, but they also have an API you can query. Couple that with WP All Import, and you could get something significant up and running quicker than you'd think.
 
If you have the coordinates of both, it would be pretty simple.
Sum the difference in latitude and longitude. Sort by that (lowest first) and get the top 1 result for each row.
 
Back