Click HereIn this link, there is a txt file with all the zipcode and lattitude, longitude for US. How do I get lattitude and longitude for a zipcode from this text file, using javascript as I wanna create a google map application, that displays a location after providing a zipcode.

Recommended Answers

All 2 Replies

It looks like all of the data files in the directory you linked to are .zip files. So it may not be practical to read them directly with JavaScript. It can be done, but it could simply require too much memory and would definitely be slow. My advice would be to use a server-side script that would return the latitude and longitude based on the datafile when given a Zip Code. For best results, store an un-zipped copy of the datafile on the server.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.