This offline geocoder is a database of over 14,000 cities across the United States with their geocoded locations. These represent all cities with population greater than 1000.
Even if you are offline, you can look up the city at your current location, or any city, and get its longitude and latitude coordinates. Note that because we're trying to locate cities and not specific addresses, it's not important to have meters of precision, so the data entries have only three decimal places, which translates to about 0.6 miles or 1 kilometer.
This can be useful if you are trying to look up something from your motel room or your car when you don't have an internet connection. This project comes with some static databases of things like book stores, national parks, and gluten free restaurants that can be looked up even when there is no internet connection.
This offilne zip code geocoder is probably less useful but it's still fun.
... will show the latitude and longitude for Cupertino, California.
Further, it is intended that the URL parameters include a
parameter that indicates the calling page. When invoked in this way, the geo.html
page will invoke the calling page with all its original URL parameters, plus
longitude and latitude parameters. An example would be ...
... which immediately redirects back to this page with the extra URL parameters appended.
You can add logic to your page to detect the additional URL parameters and do something useful with them. In this case, the page prints the coordinates and displays a Google Map of the queried city. (Of course, if you're truly offline, the Google map won't appear, but the coordinates should still be reported in text.)
» The latitude is
» The longitude is