Home Answers Viewqa JSP-Servlet adding multiples markers to google map from a mysql database

 
 


khaoula mimid
adding multiples markers to google map from a mysql database
0 Answer(s)      8 months ago
Posted in : JSP-Servlet

hello, i am trying to add markers to my googlemaps map. the latitudes and longitudes are strored in table called appreciation in a mysql database. i followed sevrel tutoriels including this one : http://tips4php.net/2010/10/use-php-...g-data-on-map/

the problem is that i only get the map without the markers. please help

and here is the code adapted to my database :

           <?
              $dbname            ='survey'; //Name of the database
              $dbuser            ='root'; //Username for the db
              $dbpass            =''; //Password for the db
              $dbserver          ='localhost'; //Name of the mysql server

              $dbcnx = mysql_connect ("$dbserver", "$dbuser", "$dbpass");
                 mysql_select_db("$dbname") or die(mysql_error());
            ?>
            <?
               $query = mysql_query("SELECT * FROM appreciation");
       while ($row = mysql_fetch_array($query)){
       $name=$row['idAppreciation'];
       $lat=$row['latitude'];
       $lon=$row['longitude'];
       $desc=$row['zone'];
       echo "addMarker($lat, $lon,'<b>$name</b><br/>$desc');";
      }
      ?>

              <html>
              <head>
                 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
              <title>Google Map API V3 with markers</title>
                <style type="text/css">
                body { font: normal 10pt Helvetica, Arial; }
             #map { width: 350px; height: 300px; border: 0px; padding: 0px; }
                </style>
              <script src="http://maps.google.com/maps/api/js?v=3&sensor=false"                type="text/javascript"></script>
               <script type="text/javascript">
              //Sample code written by August Li
                var icon = new      google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png",
             new google.maps.Size(32, 32), new google.maps.Point(0, 0),
             new google.maps.Point(16, 32));
             var center = null;
             var map = null;
             var currentPopup;
             var bounds = new google.maps.LatLngBounds();
             function addMarker(lat, lng, info) {
             var pt = new google.maps.LatLng(lat, lng);
             bounds.extend(pt);
             var marker = new google.maps.Marker({
             position: pt,
             icon: icon,
             map: map
               });
              var popup = new google.maps.InfoWindow({
             content: info,
             maxWidth: 300
             });
            google.maps.event.addListener(marker, "click", function() {
           if (currentPopup != null) {
           currentPopup.close();
           currentPopup = null;
           }
        popup.open(map, marker);
        currentPopup = popup;
             });
          google.maps.event.addListener(popup, "closeclick", function() {
               map.panTo(center);
             currentPopup = null;
             });
            }
             function initMap() {
             map = new google.maps.Map(document.getElementById("map"), {
             center: new google.maps.LatLng(0, 0),
             zoom: 14,
             mapTypeId: google.maps.MapTypeId.ROADMAP,
             mapTypeControl: false,
             mapTypeControlOptions: {
             style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR
             },
             navigationControl: true,
             navigationControlOptions: {
             style: google.maps.NavigationControlStyle.SMALL
             }
             });


              center = bounds.getCenter();
               map.fitBounds(bounds);

               }

              </script>
              </head>
           <body onload="initMap()" style="margin:0px; border:0px; padding:0px;">
              <div id="map"></div>
            </html>
View Answers









Related Pages:
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello, i am trying to add markers to my googlemaps map. the latitudes and longitudes...; Google Map API V3 with markers body { font: normal 10pt Helvetica
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello, i am trying to add markers to my googlemaps map. the latitudes and longitudes...; Google Map API V3 with markers body { font: normal 10pt Helvetica
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello, i am trying to add markers to my googlemaps map. the latitudes and longitudes are strored in table called appreciation in a mysql database. i followed sevrel
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello, i am trying to add markers to my googlemaps map. the latitudes and longitudes are strored in table called appreciation in a mysql database. i followed sevrel
google map with jsf - Java Server Faces Questions
google map with jsf  hi, i am using jsf with googlemap.i load... values(latlong) to googlemap from jsf bean values.i want to show mutiple markers from database values.could u help me. thanks, Regards, krishnaraj
Google Map Integration - Ajax
Google Map Integration  Hi All, I am working on a vehicle tracking system project. I have to read data from sql server database and map the vehicle position in google map. I need to use ajax as the data is updated in every
how to refresh google map using ajax by fetching lat long from database
how to refresh google map using ajax by fetching lat long from database ... the route travelled by it will be displayed on the google map by fetching the lat long from db. Now, i need to refresh the map using ajax.Pls help me how to do
to make a google map point to user defined location
to make a google map point to user defined location  Hi, i wish to develop an google map,that takes the input from a form(city,area &Country... button, the form should be submitted and then the google map should display
about google map
about google map  how to add google map in website
about google map
about google map  how to add google map in website
add google map javascript
add google map javascript  How can i add google map using javascript in my web page?   Search for the " Google Maps Javascript API" it will allow you to embed the Google Map into your web Page
ApplicationDevelopment Using Google Map
ApplicationDevelopment Using Google Map  I want application using google map please guide me how can i develop
how update JTable after adding a row into database
classes, listed below, one is table model, and second show data from database in JTable, and it's OK, but after adding a row into database table does't update. How update JTable after adding a row into database? package djilepak.javaclss.for
Adding an Input Map to a Component
Adding an Input Map to a Component   ... map. Input map is used to perform actions according to the key strokes...* package. This class is used to create an input map. It performs the work
Site Map
Site Map We have organized our site map for easy access. You can browser though Site Map to reach the tutorials and information pages. We will be adding the links to our site map as and when new pages are added
JavaScript google map API example.
JavaScript google map API example.  How to Use Google Maps API in JavaScript?   Google Maps- A map is a way of representation of your route... routes, a road map shows you road, street information. In the same way google map
Map
Map  Hi how can we retrieve key - value pair from hashtable and hashmap? how can we retrieve arraylist element? Thanks Kalins Naik   Please visit the following links: HashTable Example ArrayList Example HashMAp
Adding a New Column Name in Database Table
Adding a New Column Name in Database Table  ... are going to learn about adding a new column in database table. Sometimes it happens... for connecting to the MySQL database. Remember, in this program we are going
hash map
; } values of instance variable is coming from different database tables;  ...=2; HashMap<Integer,Test> map=new HashMap<Integer,Test>
Google Gadget Eclipse plugin
views:Google Calender, Google Talk, Google Map Allow user to customize... any favorite Google Gadget by adding one extension in the plugin.xml... Google Gadget Eclipse plugin   
How to refresh a jTable On adding or deleting record ....
from database and displayed in panel... Now i have to add records in the database from same panel and i want jtable to be refreshed after every addition...How to refresh a jTable On adding or deleting record ....   Hii
retrieve data from mysql database
retrieve data from mysql database  hi am not familiar in php.....even... selected value on combobox which is to be retrieve the relevant data from mysql database using php.... below my code is that.. <html> <head>
Adding pop up menu on headlines.
($database,$link) or exit ("Database Selection Error:" .mysql_error()); $query = "SELECT * FROM majorproduct"; $result = mysql_query($query...Adding pop up menu on Headlines Here you will learn sticking a pop up menu
Displaying file from database
Displaying file from database  I have list of files in my database. I... google search result. when i click on the link it should display that corresponding file from database. I have list of file id related to search. I want
Data retrieve from mysql database
Data retrieve from mysql database  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list... from the dropdown, related data will get displayed on the textboxes. Here we have
Map java Object to database.
Map java Object to database.  How do you map Java Objects with Database tables
Adding image to database through jsp or HTML page ,while adding only image should show.
Adding image to database through jsp or HTML page ,while adding only image should show.   Adding image to database through jsp or HTML page,while adding only image should show. After that i need view that uploaded image from
progress bar in google map - Development process
progress bar in google map   in my google map i want a progress bar which should run when a button is clicked and should end when all the icons are loaded on the map.  Hi Nikhil, This is simple progress bar code
Repairing mysql database from command line
Repairing mysql database from command line  Hi, Can anyone tell me the process for repairing mysql database from command line? Thanks
Dyanmically Adding Rows
Dyanmically Adding Rows  Hi sir Am doing project in that i need to add date picker in dynamically adding rows but the dates are storing in first test...=".NET">.NET</option> <option value="Database
mysql
you need to download the mysql-connector jar file for connecting java program from mysql database.......   Hi friend, MySQL is open source database... is the link for the page from where you can understand how to Download and Install MySQL
Site map Index
| Site Map | Business Software Services India Web Services Tutorial ... | PHP Examples | Date Functions | PHP MySQL | Questions?  JAVA... Tutorials  | Bioinformatics Tutorials | MySQL Tutorials | JAVA DOM
Site map - C Tutorials
| Site Map | Business Software Services India Tutorial Section  ... FrameWork Tutorial | MySQL Tutorials | XML Tutorial  |  VB... get Substring from String | C String Join | C String lowercase | C
How to access (MySQL)database from J2ME?
How to access (MySQL)database from J2ME?  I am new to J2ME. I am using NetBeans. Can anyone help me? How to access (MySQL)database from J2ME? ( I search a lot I found that there is need to access database through servlet
The Difference between Google Penguin and Google Panda
vanish from first page or even beyond 10th page. On the other hand Google penguin... very apprehensive about the new Google Penguin update . Matt Cutts, Google's mastermind behind the new algorithm specified that new Google Penguin update
Adding a Reports tap in table pool
the data diplayed in the table from database or xml file. Regards Bonginkosi...Adding a Reports tap in table pool  strong textHow to write a code to create a report in java using eclipse and link that report in jsp file
retrieve data from mysql database and store it in a variable ?
retrieve data from mysql database and store it in a variable ?  sir... that retrieve the integer values from the database and stored in the integer... which is stored in mysql. so to apply some arithmetic operation on it we have
Adding A Primary Key to an Existing Table
Adding A Primary Key to an Existing Table   Been trying to add a primary key to a MySQL table using Java for two days with no success. I'm new to Java and JDBC so bear patience with me. It connects to the database without problem
MySql Databse query to fetch results from database
MySql Databse query to fetch results from database  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from
MySql database - SQL
to retrieve the data from Ms-access then you create a database , table and create a connection with this. Then you retrieve the data from the database. Thanks...MySql database  hello sir, i am trying to write a code which should
Google Map get Current Location on iphone and Android phones
Google Map get Current Location on iphone and Android phones  Hi, I am writing a simple javascript to get longitude and latitude for current location by using google API , but it works in my desktop browser but it doesn't
Connecting to MYSQL Database in Java
Connecting to MYSQL Database in Java  I've tried executing the code... from database"); } catch (Exception e) { System.out.println("Error...("MySQL Connect Example."); Connection conn = null; String url
problem in selecting second arraylist from mysql database
problem in selecting second arraylist from mysql database  Hi... in mysql database. In the below program , i have hard-coded that second list, but i want second list to be dynamic from database. Please, help me out. Thank
adding some value to new column
adding some value to new column   how to update a column having some...=DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root","root... * from leaveData"); String bal=""; String ide=""; String
Map code
Map code  hi................ I have map of navi mumbai, where i want to see the location vashi, nerul, turbhe.... means want to zoom into this area... as we see in google maps and locate our area of interest. Can u tel me how
database connectivity using mysql
seconds) I am using Netbeans 5.5, mysql server 5.0, to get data from table...database connectivity using mysql  java file: eg1.java package eg...[]) throws SQLException { try { String connectionURL = "jdbc:mysql
Setup MySQL Database
Setup MySQL Database      ... into MySQL database. Table created here will be used in sample application. Downloading and Installing MySQL You can download MySQL from mysql.org. Read more
Adding Databse Capibility to Struts2.2.1
Adding database capability in Struts 2.2.1 application To add the database...:mysql://localhost:3306/studentadmissionprocess"; String dbUser = "root... StudentAdmissionModel(); String query; query = "select * from stud_admission
database
database  I wanted to know if it is possible to establish database connection on a remote pc with mysql using java swings from netbeans and then create a database on the remote pc.... Kindly help me
database
database  I wanted to know if it is possible to take the fields of a table from a user and then create a table in mysql database......im doing my project in swings netbeans Plz help me ThankYou