Solved

Google and TSQL XML Readings

Posted on 2012-03-21
3
500 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 500 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
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.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This video teaches users how to migrate an existing Wordpress website to a new domain.

719 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