Link to home
Start Free TrialLog in
Avatar of solution1368
solution1368

asked on

zip code to latitude and longitude

Can you show me where I can get a code to convert from zip code or address to get
latitude/longitude?

latitude/longitude is all I need to know. I know there is google xml that I can use. but need some helps to get latitude/longitude.

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of solution1368
solution1368

ASKER

can you show me in c# asp.net? eventually, i would like to create as a wcf service.
I don't know, you asked this in JavaScript.
If you want a .net version you should probably post a separate question in that topic area.
I don't believe you will find this in any web scripting code.  The lat/lon for a polygon is based on the population centroid.   You would get this from the census.  However, it looks like due to the govt shutdown, it is not available.  http://www.census.gov/tiger/tms/gazetteer/zips.txt

There are plenty of sources to purchase data from if you are interested.
With GIS mapping in the U.S. polygons are made from things like postal carrier routes, zip codes, block groups, counties, states, congressional districts and countries.

Postal carrier routes are a subset of zip codes and determined by the postal service.  Block Groups are a subset of Counties and are determined by the census.     Counties are typically larger areas then Zips(Postal Code) and Zips will typically not match up with counties.  Just as postal carrier routes will not match up with block groups. Actually postal carrier routes can be disjointed and are based on the traffic patterns of the carrier.

The Centroid of the polygon refers to the the population center.  Let's say you live in zip code 12345 and the zip code is a square with 10,000 homes. In the north east corner of the zip there is a lake.  Because of the lake, there is heavy population.  The west side of the zip is made up of multiple large parks and nature reserves with few residents.  

Because the population is heavier in the north east, you would see the lat/lon point for that zip polygon placed closer towards the north east.    A good way to think of this is a fulcrum.  If you are on a teeter toter with 3 people on one side and one on the other, the point where the teeter toter needs to be attached has to be closer to the 3 people in order for it to balance.

That "balance" point is the centroid or population centroid.  I think this point is determined by the U.S. Census.  When you see points on a map based on a zip or state, that is typically the population centroid.
Good solution.  You don't have to download your own data that way.