English 中文(简体)
Location based information
原标题:

I would like to show information on my website based on user s geography. In my current design would not want the user to enter their location/zip code. Using IP I can find user s location but how do i leverage this information to show relevant events/information from surrounding cities/town.

Thanks

问题回答

Based on IPs, you only have a certain accuracy with showing location. You should have a option that lets them enter their city/state or zip code.

Once you have long/lat, you just need to run a query to find records in your database a specific distance from that long/lat.

PHP/MySQL: Select locations close to a given location from DB

http://www.ipinfodb.com/ip_location_api.php

this will send you an xml response with the pertinent information

Lets say you can get their City from the IP address. You would need a database of cities with ID s that would pertain to other database entries. Like:

database table cities    database table restaurants
---------------------    --------------------------
ID       City            ID     city_id     name

1        Los Angelos     1      1           Big Al s

Then you could search for restaurants that have the city_id of the city you got from their IP.

There are so many different approaches to relational databases. This is just one small example.





相关问题
avoiding geocode range collisions

I am in the process of extracting location entities ( Madison Square Garden , San Diego Zoo , etc.) from a large table of non-uniform location. I m trying to avoid multiple entities in my new table. ...

Using Dell GPS in FireFox 3.5, not Google/Skyhookwireless

I want to make sure FireFox is using my local GPS on my machine (Dell Mini-10) for Location Aware browsing, not Google wi-fi triangulation services. How would one make sure FireFox is using the GPS?...

How to find State location from iphone GPS?

I m trying to add to my program that locates the person in GPS but sets a value to the State that person is in so example: GPS Locates person from his/her iphone then returns the state they are in so ...

Location based information

I would like to show information on my website based on user s geography. In my current design would not want the user to enter their location/zip code. Using IP I can find user s location but how ...

Geocoding town names to their coordinates in a loop

I ve read similar posts, but still didn t find a solution for myself. Basically I have an array with countries+towns in PHP and I need to show them on the map with markers. Here is my code: function ...

热门标签