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

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 (8) | Post RSSRSS comment feed

Comments

Jesse Foster United States

Friday, November 21, 2008 8:12 AM

Jesse Foster

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

Moe United States

Saturday, January 03, 2009 3:13 AM

Moe

which service are you using to get the  pitch, zoom, and yaw, I am using Google web service but they just returns the latitude, longitude

Adam United States

Monday, January 26, 2009 4:15 PM

Adam

This is comming directly via the Javascript API.  The map and street view are deposited into a <div> in the page. The code then tells the js referece to create a map in it with the correct location.  The pitch and yaw are applied programatically when the map is created. I then show the method of handling the change events for  pitch and yaw by updating the textboxes.

Toronto Corporate Housing Canada

Monday, March 09, 2009 9:08 AM

Toronto Corporate Housing

I use Google API since long time. But I came to this feature now. I will try to put this in my blog. Thanks Adam.

Short Jokes India

Tuesday, March 10, 2009 10:48 PM

Short Jokes

Really ,it can work to visit the home online..and one can search out the features.It works.and by providing sample web page ,POV will increase.
Nice idea,one can apply to sell and attracts the buyers.thanks for sharing..

EDI United States

Thursday, March 26, 2009 12:10 AM

EDI

This gives me a very good idea of how to go about buying my next home. Thanks a lot for the advice on Google maps.

Simulation pret United States

Tuesday, June 16, 2009 8:03 PM

Simulation pret

If this is your house than you must be really happy :)
Thanks a lot for your great blog.

vINCE United States

Sunday, August 09, 2009 4:07 PM

vINCE

Thanx for the very useful code.

Now I'm trying to find the same layout but with the newer more sophisticated streetview. The addition of the targets and full screen button was a great step forward.   vINCE

Add comment


(Will show your Gravatar icon)

  Country flag


  • Comment
  • Preview
Loading