This offline geocoder is a database of over 28,000 zip codes across the United States with their geocoded locations.
Admittedly, using zip code offline is less useful than city and state, because when you are away from home, you are probably aware of a nearby city, but you probably don't know the zip code. But this may be useful for a single-page app that needs to determine a zip code's location without going online.
Because we're trying to locate zip codes 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.
For city and state, you're better off using this offline city and state geocoder.
... shows latitude & longitude for zip code 95030 (Los Gatos, CA).
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 zip code. (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