?
Solved

Google and TSQL XML Readings

Posted on 2012-03-21
3
Medium Priority
?
501 Views
Last Modified: 2013-11-19
Hello everyone,

I am currently working on getting geocoding information that may be obtained from google in xml using the following command:

http://maps.googleapis.com/maps/api/geocode/xml?address=3595+cadillac+ave,+costa+mesa,+ca&sensor=true

Open in new window


Is there a way to execute the line in above in TSQL and get the results back as follows: (so I can save that to a table)

<GeocodeResponse>
	<status>OK</status>
	<result>
		<type>street_address</type>
		<formatted_address>3595 Cadillac Ave, Costa Mesa, CA 92626, USA</formatted_address>
		<address_component>
			<long_name>3595</long_name>
			<short_name>3595</short_name>
			<type>street_number</type>
		</address_component>
		<address_component>
			<long_name>Cadillac Ave</long_name>
			<short_name>Cadillac Ave</short_name>
			<type>route</type>
		</address_component>
		<address_component>
			<long_name>Costa Mesa</long_name>
			<short_name>Costa Mesa</short_name>
			<type>locality</type>
			<type>political</type>
		</address_component>
		<address_component>
			<long_name>Orange</long_name>
			<short_name>Orange</short_name>
			<type>administrative_area_level_2</type>
			<type>political</type>
		</address_component>
		<address_component>
			<long_name>California</long_name>
			<short_name>CA</short_name>
			<type>administrative_area_level_1</type>
			<type>political</type>
		</address_component>
		<address_component>
			<long_name>United States</long_name>
			<short_name>US</short_name>
			<type>country</type>
			<type>political</type>
		</address_component>
		<address_component>
			<long_name>92626</long_name>
			<short_name>92626</short_name>
			<type>postal_code</type>
		</address_component>
		<geometry>
			<Location>
				<lat>33.7001816</lat>
				<lng>-117.9295300</lng>
			</Location>
			<Location_type>ROOFTOP</Location_type>
			<viewport>
				<southwest>
					<lat>33.6988326</lat>
					<lng>-117.9308790</lng>
				</southwest>
				<northeast>
					<lat>33.7015306</lat>
					<lng>-117.9281810</lng>
				</northeast>
			</viewport>
		</geometry>
	</result>
</GeocodeResponse>

Open in new window

0
Comment
Question by:John Esraelo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 37749784
You could store it in a XML type data column or use XML SQL commands like FOR XML and OPENXML to read it in format you want.

http://msdn.microsoft.com/en-us/library/ms191268.aspx
0
 
LVL 40

Accepted Solution

by:
lcohan earned 2000 total points
ID: 37749802
And you can run the http:// above in a SQL CLR stored proc since SQL 2005 and up - here's an example:

http://davidhayden.com/blog/dave/archive/2006/04/25/2924.aspx
0
 

Author Comment

by:John Esraelo
ID: 37753047
Hi LCohan,
I have been reading the article and it is a very interesting piece.
Currently building the visual studio c# DLL.  Although, this example is for the city, state, county, I would like to see if I can alter this and add the street address as well.  After all, that is my project.

Going to discuss this with my boss and then take it from there today.
It looks like a promising code.
Will get back to you shortly.
thx

JohnE
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question