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 717065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:22:11+00:00 2026-05-14T05:22:11+00:00

I have a PHP-variable called $go_Adress which contains the adress I need to get

  • 0

I have a PHP-variable called $go_Adress which contains the adress I need to get a map and a street view from. How do I do that? I have created an api-key but else I don’t know how to do it!

Hope you can help.

  • 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-05-14T05:22:11+00:00Added an answer on May 14, 2026 at 5:22 am

    I have just answered another question on Google Maps, and I think I can use the same example here.

    The following example may help you getting started. All you would need to do is to change the JavaScript variable userLocation with the address you have in your php variable.

    <!DOCTYPE html>
    <html> 
    <head> 
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
        <title>Google Maps API Demo</title> 
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false"
                type="text/javascript"></script> 
      </head> 
      <body onunload="GUnload()"> 
    
        <div id="map_canvas" style="width: 400px; height: 300px"></div> 
    
        <script type="text/javascript"> 
    
        var userLocation = 'London, UK';
    
        if (GBrowserIsCompatible()) {
           var geocoder = new GClientGeocoder();
           geocoder.getLocations(userLocation, function (locations) {         
              if (locations.Placemark)
              {
                 var north = locations.Placemark[0].ExtendedData.LatLonBox.north;
                 var south = locations.Placemark[0].ExtendedData.LatLonBox.south;
                 var east  = locations.Placemark[0].ExtendedData.LatLonBox.east;
                 var west  = locations.Placemark[0].ExtendedData.LatLonBox.west;
    
                 var bounds = new GLatLngBounds(new GLatLng(south, west), 
                                                new GLatLng(north, east));
    
                 var map = new GMap2(document.getElementById("map_canvas"));
    
                 map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
                 map.addOverlay(new GMarker(bounds.getCenter()));
              }
           });
        }
        </script> 
      </body> 
    </html>
    

    The above example would render a map like the one below:

    Render google map in based on selected location

    You would probably need to replace the static:

    var userLocation = 'London, UK';
    

    … with:

    var userLocation = '<?php echo $go_Adress; ?>';
    

    … as Fletcher suggested in another answer.

    Note that the map will not show if the Google Client-side Geocoder cannot retreive the coordinates from the address. You may want to see how to handle this situation.

    As for the API Key, you need to add it as a parameter to the <script> src that is calling the Maps API, as shown in the The “Hello, World” of Google Maps.


    UPDATE:

    I am updating the above example to use the Street View Panorama object. I hope that the example is self-explanatory, and that it gets you going in the right direction:

    <!DOCTYPE html>
    <html> 
    <head> 
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
        <title>Google Maps API Demo - Street View</title> 
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false"
                type="text/javascript"></script> 
      </head> 
      <body onunload="GUnload()"> 
    
        <div id="map_canvas" style="width: 400px; height: 300px"></div> 
    
        <script type="text/javascript"> 
    
        var userLocation = 'London, UK';
    
        if (GBrowserIsCompatible()) {
           var geocoder = new GClientGeocoder();
           geocoder.getLocations(userLocation, function (locations) {         
              if (locations.Placemark)
              {
                 var north = locations.Placemark[0].ExtendedData.LatLonBox.north;
                 var south = locations.Placemark[0].ExtendedData.LatLonBox.south;
                 var east  = locations.Placemark[0].ExtendedData.LatLonBox.east;
                 var west  = locations.Placemark[0].ExtendedData.LatLonBox.west;
    
                 var bounds = new GLatLngBounds(new GLatLng(south, west), 
                                                new GLatLng(north, east));
    
                 new GStreetviewPanorama(document.getElementById("map_canvas"), 
                                         { latlng: bounds.getCenter() });
              }
           });
        }
        </script> 
      </body> 
    </html>
    

    Screenshot from the above example:

    Google Maps API Demo - Street View


    2nd UPDATE:

    You can enable both the street view and the map canvas, by “merging” the two examples above, as follows:

    <!DOCTYPE html>
    <html> 
    <head> 
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
        <title>Google Maps API Demo - Street View with Map</title> 
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false"
                type="text/javascript"></script> 
      </head> 
      <body onunload="GUnload()"> 
    
        <div id="pano" style="width: 400px; height: 200px"></div> 
        <div id="map_canvas" style="width: 400px; height: 200px"></div> 
    
        <script type="text/javascript"> 
    
        var userLocation = 'London, UK';
    
        if (GBrowserIsCompatible()) {
           var geocoder = new GClientGeocoder();
           geocoder.getLocations(userLocation, function (locations) {         
              if (locations.Placemark)
              {
                 var north = locations.Placemark[0].ExtendedData.LatLonBox.north;
                 var south = locations.Placemark[0].ExtendedData.LatLonBox.south;
                 var east  = locations.Placemark[0].ExtendedData.LatLonBox.east;
                 var west  = locations.Placemark[0].ExtendedData.LatLonBox.west;
    
                 var bounds = new GLatLngBounds(new GLatLng(south, west), 
                                                new GLatLng(north, east));
    
                 var map = new GMap2(document.getElementById("map_canvas"));
    
                 map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
                 map.addOverlay(new GMarker(bounds.getCenter()));
    
                 new GStreetviewPanorama(document.getElementById("pano"),
                                         { latlng: bounds.getCenter() })
              }
           });
        }
        </script> 
      </body> 
    </html>
    

    Screenshot for street view with map:

    Google Maps API Demo - Street View with Map


    3rd UPDATE:

    The Google Maps API does not have a direct method to link the movements of the street view with the map. Therefore this has to be handled manually. The following example makes the red marker draggable, and when dropped it moves the street view accordingly. In addition, each time the street view is updated, the marker is updated on the map as well.

    To try this example, make sure that you insert the API Key in the <script> src parameters, and that you try it from the domain where you registered the key. Otherwise, it looks like the events do not work properly.

    <!DOCTYPE html>
    <html> 
    <head> 
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
        <title>Google Maps API Demo - Street View with Map</title> 
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false"
                type="text/javascript"></script> 
      </head> 
      <body onunload="GUnload()"> 
    
        <div id="pano" style="width: 400px; height: 200px"></div> 
        <div id="map_canvas" style="width: 400px; height: 200px"></div> 
    
        <script type="text/javascript"> 
    
        var userLocation = 'Copenhagen, Denmark';
    
        if (GBrowserIsCompatible()) {
           var geocoder = new GClientGeocoder();
    
           geocoder.getLocations(userLocation, function (locations) {         
              if (locations.Placemark)
              {
                 var north = locations.Placemark[0].ExtendedData.LatLonBox.north;
                 var south = locations.Placemark[0].ExtendedData.LatLonBox.south;
                 var east  = locations.Placemark[0].ExtendedData.LatLonBox.east;
                 var west  = locations.Placemark[0].ExtendedData.LatLonBox.west;
    
                 var bounds = new GLatLngBounds(new GLatLng(south, west), 
                                                new GLatLng(north, east));
    
                 var map = new GMap2(document.getElementById("map_canvas"));
    
                 map.setCenter(bounds.getCenter(), 14);
    
                 map.addOverlay(new GStreetviewOverlay());
    
                 var marker = new GMarker(bounds.getCenter(), { draggable: true });
                 map.addOverlay(marker);                                
    
                 var streetView = new GStreetviewPanorama(document.getElementById("pano"));
    
                 streetView.setLocationAndPOV(bounds.getCenter()); 
    
                 GEvent.addListener(marker, "dragend", function(latlng) {
                    streetView.setLocationAndPOV(latlng);
                 });
    
                 GEvent.addListener(streetView, "initialized", function(location) {
                    marker.setLatLng(location.latlng);
                    map.panTo(location.latlng);
                 });
              }
           });
        }
        </script> 
      </body> 
    </html>
    

    Screenshot of the above example:

    Google Maps API Demo - Street View with Map

    Getting the street view working nicely with the map could be the topic of another Stack Overflow question, as there are quite a few considerations to make.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variable called $tags , which just references from a database field.
Static variable gotcha in php I am from Java background and have switched to
So I have a PHP class called router that takes the URL and explodes
I have the following string in the smarty (php templating system) variable $test: <img
I have PHP configured so that magic quotes are on and register globals are
We have PHP 5.2.6 deployed to c:\php and in that folder there is the
I have a php server that is running my domain name. For testing purposes
We have a PHP project that we would like to version control. Right now
I have a custom class that, when called, will redirect to a page and
Can anyone help? I have a PHP method that sends an http post: <?php

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.