Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8014707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:01:29+00:00 2026-06-04T20:01:29+00:00

I am learning google maps API v3. I was able to put together this

  • 0

I am learning google maps API v3. I was able to put together this code. I tried to make it as simple as possible. It works…

The problem I am having is that the street view map is NOT pointing to the right direction/address. The right building is the yellow one on the corner (You’ll need to scroll the street view to the left a few times).

When I use the very same cords in google maps, it points to the right building/address. My map’s StreetView points to the opposite side/building.

  • Is there a way to control the direction a streetView map will point to, within the given cords? -North/South/West…etc.
  • Also, is it possible to just use an
    address, and have google api figure the latLong?
    -It’s not efficient to figure out and find the right coords for over 300 addresses and increasing >_<

My code uses LatLon stored in a mysql database, but for this exmaple, I am using a single point to make my case:

Google Map’s code: street_view.js

//<![CDATA[
// ************************   Variables   ************************
var infoWindow = new google.maps.InfoWindow();

//Map Options
var options = {
    lat: 34.028339,
    lon: -118.2881768,
    zoom: 15,
    type: 'roadmap',
    tytle: "Address: 1256 W. 29th St. Los Angeles, CA  90007",
    html: '<div class="tooltip"><span>Address</span>: 1256 W. 29th St. Los Angeles, CA  90007<\/div>',
    icons: {
        red:  'http://labs.google.com/ridefinder/images/mm_20_red.png',
        blue: 'http://maps.google.com/mapfiles/ms/micons/blue-dot.png',
        shadow: 'http://maps.google.com/mapfiles/ms/micons/msmarker.shadow.png'
        }
    };



// ************************   Functions   ************************
function bindInfoWindow(marker, map, infoWindow, html) {
    google.maps.event.addListener(marker, 'click', function() {
        infoWindow.setContent(html);
        infoWindow.open(map, marker);
        //marker.openInfoWindowHtml(html);
        infoWindow.getContent();marker.openInfoWindowTabsHtml(infoTabs);
    });
}


function googleMaps()
{
    var map = new google.maps.Map(document.getElementById("map"), { 
        center: new google.maps.LatLng( options.lat , options.lon ),
        zoom: options.zoom,
        mapTypeId: options.type
    });

    var marker = new google.maps.Marker({
        map: map,
        position: map.getCenter(),
        title: options.title,
        icon: options.icons.blue,
        shadow: options.icons.shadow
        });

    bindInfoWindow(marker, map, infoWindow, options.html);


    map.StreetView = new  google.maps.StreetViewPanorama(document.getElementById("map_StreetView"), {
        position: map.getCenter(),
        zoom: 1
    });
    //map.setStreetView(map.StreetView); //This line adds a street view icon to the roadmap and binds it together with streetView


} //end of load()


// ************************   Load   ************************
//Call googleMaps after document is loaded
google.maps.event.addDomListener(window, 'load', function(){
    googleMaps();
    //you can add more code here
    });
//]]>

HTML:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title><?php echo $map['address']?></title>

    <!-- START: Google Maps API -->
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="http://www.mydomain.com/_api/google/maps/v3/street_view.js"></script>
    <!-- __END: Google Maps API -->
</head>


<body>
    <div id="map-container" >
        <div id="map_StreetView" style="width: 350px; height: 250px"></div><br/>
        <div id="map" style="width: 350px; height: 250px"></div>
    </div>
</body>
</html>

PS. I tried to give you a jsFiddle, but for whatever reason it is not showing a map…? http://jsfiddle.net/EdsB6/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:01:30+00:00Added an answer on June 4, 2026 at 8:01 pm

    First, the camera position is set with the pov option when initializing the StreetViewPanorama.

    map.StreetView = new google.maps.StreetViewPanorama
      (document.getElementById("map_StreetView"), {
        position: map.getCenter(),
        pov: { heading: 135, pitch: 0, zoom: 1 }
    });
    

    The updated JS Fiddle: http://jsfiddle.net/EdsB6/2/

    For more information, read the docs on StreetView

    https://developers.google.com/maps/documentation/javascript/streetview

    About the second question, geocoding is what you need. (Unfortunately, no, there’s no “easy”, one-line method of using an address with the API). If you’re repeatedly querying the same place, it’s best to do it once and save the LatLngs. Read here:

    https://developers.google.com/maps/documentation/javascript/geocoding

    This answer shows how to convert an address to a LatLng, in fact it’s an array but each address is converted one by one.

    https://stackoverflow.com/a/10743457/1325290

      function codeAddress(address, callback) {
        geocoder.geocode( { 'address': address}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            callback(results[0].geometry.location);
          } 
        });
      }
    
      function initialize() {
        codeAddress("Chicago, IL", function(default_location) {
          var map = new google.maps.Map(document.getElementById("map_canvas"),
            { center: default_location,
            zoom: 3, mapTypeId: google.maps.MapTypeId.ROADMAP });
    
          locations = ["Los Angeles", "Davis", "Truth or Consequences",
            "Ann Arbor", "Massachusetts"];
    
          for (var i = 0; i < locations.length; i++) {
            codeAddress(locations[i], function(latLng) {
              new google.maps.Marker({map:map, position:latLng});
            });
          }
        });
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm just learning javascript to mess with the Google Maps API. I was
I am starting with google maps. just learning. while ago, it was working. now
As part of my learning, i am developing a google maps V3 application, to
I'm learning dhtml using google's sample http://code.google.com/edu/ajax/tutorials/samples/dhtmltest.html however, when i add below doctype dtd
After extensive research and fun learning about Google's mapping api, I am building a
I am new to PHP but learning slowly. Problem I have is including Google
hi I started learning google data api. I have one question What will be
I am learning Google App Engine in Python. Here is my problem: I want
The Google Code site of Morphia says it works great with Guice, Spring, and
In the process of learning Ajax requests using jQuery, I tried to load google

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.