Solved

Google and TSQL XML Readings

Posted on 2012-03-21
3
494 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
  • 2
3 Comments
 
LVL 39

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 39

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sql user function 7 32
What .NET URL re-routing tool did I use? 2 37
How to redirect all users but me properly to another page with htaccess 2 47
Generate Weekly Schedule 15 17
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

896 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now