none
Bing Maps to use MySql RRS feed

  • Question

  • Can someone walk me through importing longitude and latitude data from MySQL to Bing Maps?

    I wanted to use AJAX to do this from a table I made in phpMyAdmin, but I can't seem to make any progress.  I only know the basics of javascript and php.

    Monday, June 10, 2013 2:52 PM

Answers

  • You will first need to create a web service to expose your database to the web. Here is a post on how to create a web service using MySQL and PHP: http://davidwalsh.name/web-service-php-mysql-xml-json Once you have this you can then pull the data from your database ad turn it into JSON. Once you have JSON getting to your web page then it is just a matter of looping through the data and creating pushpins out of it and adding it to the map.


    http://rbrundritt.wordpress.com

    Monday, June 10, 2013 4:51 PM
  • So I managed to get some code working.

    [code]

    $.ajax({
            type:    "POST",
            url:    "BingHere.php",
            data:    {},
            dataType:    'json',
            }).done(function(result){
                for (var i = 0; i < 150 ; i++){

                var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(result[i].passedLon,result[i].passedLat));
    [/code]

    Would this be fine if I were importing a large number of coordinates?  I guess what I'm trying to ask is if my code were to execute with a large number, would it crash the browser, exceed my limits, or have terrible slow response time?

    Tuesday, June 18, 2013 8:55 PM

All replies

  • You will first need to create a web service to expose your database to the web. Here is a post on how to create a web service using MySQL and PHP: http://davidwalsh.name/web-service-php-mysql-xml-json Once you have this you can then pull the data from your database ad turn it into JSON. Once you have JSON getting to your web page then it is just a matter of looping through the data and creating pushpins out of it and adding it to the map.


    http://rbrundritt.wordpress.com

    Monday, June 10, 2013 4:51 PM
  • So I managed to get some code working.

    [code]

    $.ajax({
            type:    "POST",
            url:    "BingHere.php",
            data:    {},
            dataType:    'json',
            }).done(function(result){
                for (var i = 0; i < 150 ; i++){

                var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(result[i].passedLon,result[i].passedLat));
    [/code]

    Would this be fine if I were importing a large number of coordinates?  I guess what I'm trying to ask is if my code were to execute with a large number, would it crash the browser, exceed my limits, or have terrible slow response time?

    Tuesday, June 18, 2013 8:55 PM