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

  • Home
  • SEARCH
  • 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 6639669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:34:51+00:00 2026-05-25T23:34:51+00:00

I have followed two different tutorials for my google map, one to run the

  • 0

I have followed two different tutorials for my google map, one to run the map from a MySQL database, and another to style the map.

I’m having trouble combining the two of them, I haven’t got much experience with javascript…

the code i have for the map working with the database is:
you can see this map here

<!DOC

TYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Intern Map</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=myapikey" type="text/javascript"></script>

<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map { height: 100% }
</style>


<script type="text/javascript">
//<![CDATA[

var iconStudent = new GIcon(); 
iconStudent.image = 'images/man.png';
iconStudent.shadow = 'images/man_shadow.png';
iconStudent.iconSize = new GSize(35, 60);
iconStudent.shadowSize = new GSize(60, 55);
iconStudent.iconAnchor = new GPoint(6, 30);
iconStudent.infoWindowAnchor = new GPoint(5, 1);

var iconAgency = new GIcon(); 
iconAgency.image = 'images/pin.png';
iconAgency.shadow = 'images/pin_shadow.png';
iconAgency.iconSize = new GSize(40, 40);
iconAgency.shadowSize = new GSize(60, 40);
iconAgency.iconAnchor = new GPoint(6, 20);
iconAgency.infoWindowAnchor = new GPoint(5, 1);

var customIcons = [];
customIcons["restaurant"] = iconStudent;
customIcons["bar"] = iconAgency;

function load() {
    if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(40, 0), 3);
   // map.setCenter(new GLatLng(47.614495, 0), 3);

    GDownloadUrl("marker.php", function(data) {
      var xml = GXml.parse(data);
      var markers = xml.documentElement.getElementsByTagName("marker");
      for (var i = 0; i < markers.length; i++) {
        var name = markers[i].getAttribute("name");
        var address = markers[i].getAttribute("address");
        var type = markers[i].getAttribute("type");
        var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                parseFloat(markers[i].getAttribute("lng")));
        var marker = createMarker(point, name, address, type);
        map.addOverlay(marker);
      }
    });
  }
}

function createMarker(point, name, address, type) {
  var marker = new GMarker(point, customIcons[type]);
  var html = "<b>" + name + "</b> <br/>" + address;
  GEvent.addListener(marker, 'click', function() {
    marker.openInfoWindowHtml(html);
  });
  return marker;
}



    //]]>
  </script>

  </head>

  <body onload="load()" onunload="GUnload()">
    <div id="map"></div>
  </body>

and then i have code working for the style i want:
you can see this one here

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

<style type="text/css">
    html { height: 100% }
    body { height: 100%; margin: 0; padding: 0 }
    #map_canvas { height: 100% }
</style>

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>

<script type="text/javascript">
    function initialize() {
    var latlng = new google.maps.LatLng(40,0);
    var myOptions = {
    zoom: 3,
    center: latlng,
    panControl: false,
    panControlOptions: {
    position: google.maps.ControlPosition.RIGHT_TOP 
    },
    zoomControl: true,
    zoomControlOptions: {
    position: google.maps.ControlPosition.RIGHT_TOP
    },

    scaleControl: false,
    mapTypeId: google.maps.MapTypeId.SATELLITE
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),
    myOptions);
    }
</script>

</head>
<body onload="initialize()">

<div id="map_canvas" style="width:100%; height:100%"></div>

</body>
</html>

can anybody help me combine the two, or point me in the right direction.

thanks in advance

alsweeet

  • 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-25T23:34:52+00:00Added an answer on May 25, 2026 at 11:34 pm

    The first script is using the javascript api v2 and the second the javascript api v3.
    So it is not possible to combine the two.You should begin with basics and post here any further questions

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

Sidebar

Related Questions

One of the classical reasons we have a database deadlock is when two transactions
I have followed the instructions found at http://code.google.com/p/pubsubhubbub/wiki/DeveloperGettingStartedGuide to setup a hub. When I
I have followed the following instructions in setting a git repository locally in one
I have two rails application running at different ports. First at 3000 and the
I have a regex that contains a character class followed by TWO cadinality characters
I have a page which has DIVs which contain short phrases (one-two words) of
I have followed the suggestions from this post to try and get Distinct() working
tl;dr: I need to show data from two different tables in the list view
I have a question about the merits of two different approaches to implementing a
I have an ArrayList of objects that I need to sort in two different

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.