Adam Zastawski

My Personal Blog

Google Maps: Return to specific Street View POV

Posted by Adam

Problem:

Imagine you want to sell your house and you'd like to programmatically point users at the Google street view of it. This will give the visitors of your site an idea of where the house is, and it will give them the ability to browse around your neighborhood a little. They will also see the charming curb appeal.

Solution:

Let's put a Google map on a sample web page that will automatically navigate to the correct street, open street view and point the visitor at the correct Point Of View (POV).

While researching this I ran across the following example.  It helped me quite a bit and you will notice that I only had to modify it very slightly to accomplish my task.

Original Inspiration
http://groups.google.com/group/Google-Maps-API/browse_frm/thread/a93055bdd1890acc/c43137f765a71544?hl=en&lnk=gst&q=yawchanged#c43137f765a71544

Mike's Example
http://econym2.googlepages.com/temp_streetviewpanorama3.htm

My Live Demo
http://www.adamzastawski.com/samples/GoogleMapsStreetViewEvents.html

Step 1: You will need to register with Google in order to host a map solution on your web site. They will give you a 'key' that you will need in order to use their API.

Keep in mind that some of the features in the API won't work unless you are viewing the HTML via a web browser on your localhost (web server) or on your registered domain name. If you view your HTML from your local file system expect the occasional anomaly

Step 2: Create a web project with a plain old HTML page add the following script tag.

<script src=http://maps.google.com/maps?file=api&amp;v=2&amp;key=[Your Google Maps Key Here]
        type="text/javascript"></script>

Step 3: Scope out the Google Maps API documentation, specifically the examples.
The example below depicts the main code segment.

JavaScript example from the sample web page.

Step 4: Finish the web page to allow you to capture the desired latitude, longitude, pitch, zoom, and yaw. I basically lined up my street view window and hard coded the values back into the JavaScript. A more robust solution might provide this form to a user to capture the values and then store them in a database to be retrieved at runtime.

image 

The Google Maps API Documentation
http://code.google.com/apis/maps/documentation/reference.html

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 11/20/2008 at 11:08 PM
Tags: , , ,
Categories: AJAX | RIA
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Related posts

Comments

Jesse Foster us

Friday, November 21, 2008 8:12 AM

Jesse Foster

Whoa! Now I know where you live. Nice house....

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Monday, January 05, 2009 8:52 PM