No announcement yet.

Google Mpas

  • Filter
  • Time
  • Show
Clear All
new posts

  • Google Mpas

    Hello, im trying to add a google map and get the latitude and longitude.
    I first try using a blank application. with the following code:

    (copy paste in a blank app...)
    $latitude= -27.450809;
    $longitude= -58.986476;

    $_head = "
    <!DOCTYPE html>
    <title>Simple Map</title>
    <meta name='viewport' content='initial-scale=1.0, user-scalable=no'>
    <meta charset='utf-8'>
    html, body, #map-canvas {
    margin: 0;
    padding: 0;
    height: 90%;

    <script src=''></script>
    var map;
    function initialize()
    var myLatlng = new google.maps.LatLng(".$latitude.",".$longitude.");
    var mapOptions = {
    zoom: 16,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP

    map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);

    var marker = new google.maps.Marker({
    position: myLatlng,
    map: map,
    title: 'Dependencia',

    marker.addListener('drag',function(event) {

    document.getElementById("latitud").value =;
    document.getElementById("longitud").value = event.latLng.lng();

    marker.addListener('dragend',function(event) {
    document.getElementById("latitud").value =;
    document.getElementById("long").value = event.latLng.lng();


    google.maps.event.addDomListener(window, 'load', initialize);
    <div id='map-canvas'></div>


    $escrever = ($_head);
    echo $escrever;


    the problem is:
    im using a form to complete other data and i have to call the blank app to get the latitude and longitude... how can i do it?
    how can i get the values an put it on my lat and long fields of the form??


  • #2
    Write on initial value of your fields Lang and lat of your form, values [glolong] and [glolang] for example. When you redirect to the form, pass in URL this values, somehnt like..

    Professional Scriptcase Services
    Some Customers opinions


    • #3
      Sorry for misspelled words. I'm on mobile and cant edit, but you got the point

      Professional Scriptcase Services
      Some Customers opinions


      • #4
        Thank you Giu, Ive got it. !