Google Maps Iframe is not showing location markup

1

There is a part on my site where there is select with several places in Brazil. When selecting a place, just below it has a iframe with GoogleMaps that automatically updates to the coordinate corresponding to the selected location.

The problem is that some coordinates do not appear right. The location indicated is different from the correct location, perhaps because the location is not registered with Google or because it has not actually been mapped.

In some cases it even shows the correct area of the place, but without any marking. Example:

Thereshouldbeamarkerinthemiddleofthisbrownspot.

ThecodeforiframeI'musingisthis:

<iframewidth="734" height="302" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.br/maps?ie=UTF8&amp;hq=&amp;hnear=&amp;t=m&amp;iwloc=A&amp;ll=COORDENADA_AQUI&amp;spn=0,0&amp;output=embed"></iframe>

Would anyone have a solution for this? I thought about using API of maps to generate the codes, but since there are several places (approx.10), it could generate some conflict or it would even be difficult to retrieve the coordinates of the database to insert them into javascript .

    
asked by anonymous 19.12.2014 / 15:45

2 answers

0

I was able to find the solution, well beast and simple by the way.

I just re-read the address that was linking iframe to:

link

Thank you.

    
23.12.2014 / 12:35
1

Let's see if I understand, what you need is to put several points on the map and set the zoom for the user to see all?

If I understand correctly, you can use the Google Maps API. I applied something along these lines to upload client references. For my case, I did the following:

JavaScript

$.ajax({
      type: "POST",
      data: {MODULO: "<?=$_POST["MODULO"]?>", TELA:"<?=$_POST["TELA"]?>", LATSUL: ne.lat(), LNGSUL: ne.lng(), LATNORTE: sw.lat() , LNGNORTE: sw.lng()},
      url: urlBase + "/principal.php?ACAO=CarregarReferencias",
      success: function(result){
        dadosMapa = mapa.data.addGeoJson(JSON.parse(result)); 
        mapa.data.setStyle(function(feature) {
            return {icon:"<?php echo URLBASE; ?>Imagens/referencePoint.png",title: feature.getProperty("nome")};
        }); 
      },
       beforeSend: function(){
           $(".clCarregando").show();
       },
       complete: function(msg){
           $(".clCarregando").hide();
           QtdReferencias = dadosMapa.length;
            $("#spnQtdRef").html(QtdReferencias);
       }
    });

And in PHP I searched the database for my references:

public function CarregarReferencias($ClienteId, $LatSul, $LngSul, $LatNorte, $LngNorte) {
    if ($LatSul < $LatNorte){
        $whereLat = "AND R.Latitude BETWEEN {$LatSul} AND {$LatNorte}";
    } else {
        $whereLat = "AND R.Latitude BETWEEN {$LatNorte} AND {$LatSul}";
    }

    if ($LngSul < $LngNorte){
        $whereLng = "AND R.Longitude BETWEEN {$LngSul} AND {$LngNorte}";
    } else {
        $whereLng = "AND R.Longitude BETWEEN {$LngNorte} AND {$LngSul}";
    }

    $sql = "SELECT R.Latitude AS LAT, R.Longitude AS LNG, R.Descricao AS REFERENCIA
    FROM Referencias RC
    INNER JOIN Referencias R ON (RC.ReferenciasId = R.ReferenciasId)
    WHERE ClienteId = {$ClienteId} AND R.Latitude <> 0 AND R.Longitude <> 0  $whereLat  $whereLng and R.status > 0";
    $this->bd->Clear ();
    $this->bd->setSQL ( $sql );

    $tmp = '{"type": "FeatureCollection","features": [';
    if ($this->bd->Executar ()) {               

        foreach ( $this->bd->Registro as $registro ) {
            $tmp.='{ "type": "Feature", "geometry": { "type": "Point",  "coordinates": [ '. $registro->Campo ["LNG"] .', '. $registro->Campo ["LAT"] .' ]}, "properties": { "nome": "'. str_replace("'", ''', str_replace('"', ''', $registro->Campo ["REFERENCIA"])) .'" } },';
        }
        $tmp = substr($tmp, 0, -1);

    } 
    $this->Lista = $tmp.']}';
    $this->Lista = json_decode($this->Lista);
    return true;
}
    
19.12.2014 / 19:46