http://maps.googleapis.com/maps/api/geocode/json?address="; +
(System.Web.HttpUtility.UrlEncode(address) + "&sensor=false

I use this URL, and pass in JUST the ZIP code, w/o any kind of Google API
authentication token, just using this URL. Go to this URL in Chrome, and
then replace the (system.web.xxxxxxx) with your ZipCode. Include the
sensor=false in the URL string.

This returns a JSON object. I parse it out and get the location lat and long
from it. Get a web response and then pull it out of the response string. My
"oController" code saves the geo coords into a database for use later.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 string str = null;
                    using (Stream stream = response.GetResponseStream())
                    {
                        using (StreamReader streamReader = new
StreamReader(stream))
                        {
                            str = streamReader.ReadToEnd();
                        }
                    }
                    GeoResponse geoResponse =
JsonConvert.DeserializeObject<GeoResponse>(str);
                    if (geoResponse.Status == "OK")
                    {
                        int count = geoResponse.Results.Length;
                        for (int i = 0; i < count; i++)
                        {
                            this.ScheduleHistoryItem.AddLogNote("BusinessID:
" + BusinessID + ".<br />");
                            this.ScheduleHistoryItem.AddLogNote("latitude: "
+ geoResponse.Results[i].Geometry.Location.Lat.ToString() + ".<br />");
                            this.ScheduleHistoryItem.AddLogNote("longitude:
" + geoResponse.Results[i].Geometry.Location.Lng.ToString() + ".<br />");

                            // update the database with the Geo Coord from
Google Maps API

oController.UpdateProspectGeoCoordsinDB(BusinessID,
geoResponse.Results[i].Geometry.Location.Lat.ToString(),
geoResponse.Results[i].Geometry.Location.Lng.ToString());

                            i = count;
                        }
                    }
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



Dale Bingham



On Sun, Oct 2, 2011 at 4:13 PM, John <[email protected]> wrote:

> Hi Dale,
>
> Cheers for yoru reply.  I searched for that "just zip" but didn't find
> anything.  Sorry, not sure what you mean by auth code?  Auth code for
> what?
>
> Kind regards,
> John
>
> >
> > Dale Bingham
> > On Oct 2, 2011 3:55 PM, "John" <[email protected]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi all,
> >
> > > I want to be able to obtain the long and lat of any given post code
> > > for several countries across the world.
> >
> > > I did find one websitehttp://download.geonames.org/export/dump/but
> > > when I started to do some testing, I found that there were errors
> > > within only a few tests that I had carried out. I searched on here
> > > for others but the messages were quite old and didn't find much
> > > searching.
> >
> > > I don't want each and every street but just the general long,lat for
> > > each postcode so I can store it in my database. I'm trying to achieve
> > > the type of functionality that lets you enter your postcode, select
> > > xMiles and then retrieves the surrounding postcodes.
> >
> > > Does anyone know of a good website where I can download such data that
> > > is accurate? Or, am I better off using an API like google for
> > > example, and just start grabbing only 15,000 a day. Am I even allowed
> > > to do that using google's API? I ask because I don't intend on using
> > > a google map - well, not at this stage. Something planned further
> > > down the line. I'm a student so can't afford to pay for a service :(
> >
> > > Cheers,
> > > J
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> >
> > "Google Maps API V2" group.> To post to this group, send email to
> [email protected].
> > > To unsubscribe from this group, send email to
> >
> > [email protected].> For more options, visit
> this group at
> >
> > http://groups.google.com/group/google-maps-api?hl=en.
> >
> >
> >
> >
> >
> >
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API V2" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>
>


-- 
Dale Bingham
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to