Link to home
Start Free TrialLog in
Avatar of solution1368
solution1368

asked on

google map

var locations = new Array([34.01843,-118.491046,'90032','AgencyName1'],[34.006673,-118.486562,'90032','AgencyName2']);

I have above code from google map. 34.01843,-118.491046 i guess it is what google need.
my question is

1. assume I have web form to allow user to enter name and address. and I need to convert
the address into 34.01843,-118.491046 and save into the database.

Where can I find the function to convert it?

2. If I already have database with address information, how can i convert it?

thanks
Avatar of shishir_sri
shishir_sri
Flag of India image

Avatar of Gary
Are you familiar with XML? Do you want to do this at the server or at the browser?

You can make a direct request to Google and it will return an XML response with the data.
http://maps.google.com/maps/api/geocode/xml?address=your-address&sensor=false

You can then just parse out the coordinates
Avatar of solution1368
solution1368

ASKER

can you show me in .cs? not a javascript programmer
About the xml. I don't know how to parse out the location from the xml. do you know any codes I can use?
You can replace the 'XML' with 'json' in that url to get JSON response, if you prefer that.

https://developers.google.com/maps/documentation/geocoding/?csw=1#JSON
Try this
string url = "http://maps.google.com/maps/api/geocode/xml?address=london&sensor=false";
XDocument doc = XDocument.Load(url);

foreach (XElement element in doc.Element("GeocodeResponse").Element.("result").Element("geometry").Element("location").Descendants())
{
    string value = element.Value;
}

Open in new window

I don't get it. XDocument? Can you provide complete working codes? Thanks
Did you try the code, you are using C#?
There is a tutorial here - have a read through and report back if you are uncertain about anything.
http://www.dotnetcurry.com/ShowArticle.aspx?ID=564
show me working codes example. don't refer me to url. everyone know how to google it.
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