Integrar aplicação com google maps

3 respostas
robinsonbsilva

Senhores(as),

Preciso integrar uma aplicação com o google Maps. A idéia é a seguinte, com base no cadastro de nossos clientes(nesses cadastros possuem as coordenadas), gostaria de plotar no “maps” todos os clientes ativos, para que possamos dessa forma realizar estudos estratégicos.

Alguém tem alguma dica.

obrigado.

3 Respostas

J

caso sua aplicação seja web, o javascript seria assim:

<!DOCTYPE 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>Google Maps 1</title>
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=SUA_CHAVE_AQUI"
          type="text/javascript"></script>
        
		<script type="text/javascript"> 
  var map1;
  var latlng1 = [
    new GLatLng( -26 + Math.random( ), -51 + Math.random( ) * 2 ),
    new GLatLng( -26 + Math.random( ), -51 + Math.random( ) * 2 ),
    new GLatLng( -26 + Math.random( ), -51 + Math.random( ) * 2 ),
    new GLatLng( -26 + Math.random( ), -51 + Math.random( ) * 2 ),
    new GLatLng( -26 + Math.random( ), -51 + Math.random( ) * 2 ),
    new GLatLng( -26 - Math.random( ), -51 + Math.random( ) * 2 ),
    new GLatLng( -26 + Math.random( ), -51 - Math.random( ) * 2 ),
    new GLatLng( -26 - Math.random( ), -51 - Math.random( ) * 2 )
  ];
  function map1_initialize( )
  {
    if ( GBrowserIsCompatible( ) )
    {
      map1 = new GMap2( document.getElementById( 'map1div' ) );
      map1.addControl( new GSmallMapControl( ) );
      map1.addControl( new GMenuMapTypeControl( ) );
      map1.setCenter( new GLatLng( 0, 0 ), 0 );
      for ( var i = 0; i < latlng1.length; i++ )
      {
        var marker = new GMarker( latlng1[ i ] );
        map1.addOverlay( marker );
      }
      var latlngbounds = new GLatLngBounds( );
      for ( var i = 0; i < latlng1.length; i++ )
      {
        latlngbounds.extend( latlng1[ i ] );
      }
      map1.setCenter( latlngbounds.getCenter( ), map1.getBoundsZoomLevel( latlngbounds ) );
    }
  }
  GEvent.addDomListener( window, 'load', map1_initialize );
</script> 
		
  </head>
  <body onload="map1_initialize()">
        <div id="map1div" style="width: 450px; height: 300px;"></div>
  </body>
</html>

Coloque suas coordenadas dessa forma:

var latlng1 = [ new GLatLng( 48.1234, -120.1234 ), new GLatLng( 48.5678, -120.5678 ), new GLatLng( 48.9101, -120.9112 ), new GLatLng( 48.1121, -120.1314 ), new GLatLng( 48.3145, -120.1516 ), new GLatLng( 48.1617, -120.1718 ), new GLatLng( 48.1819, -120.1920 ), new GLatLng( 48.2021, -120.2122 ) ];

Agora, se a sua aplicação for desktop, não saberia lhe dizer um modo correto de fazer isso utilizando Java.

jidlafe

Olá, Robison Silva, dei uma olhada em alguns fóruns e realmente a quem utilize recursos do Google
em aplicações Desktop.

Dá uma olhada nestes links:
http://today.java.net/pub/a/today/2007/10/30/building-maps-into-swing-app-with-jxmapviewer.html

http://groups.google.com/group/Google-Maps-API/browse_thread/thread/8c1884e7d74f0bfe/6183416774bbd952

E como disse o Joel Lazzari não é algo comum.
Mas nada é “impossível” vai postando, pois o assunto é interessante.

R

joellazzari

como eu faço usando esse exemplo com valores dinamicos…

exemplo: se eu quero saber uma determinada região ou rua o que preciso alterar nesse seu exmplo ?

Criado 25 de agosto de 2009
Ultima resposta 14 de set. de 2009
Respostas 3
Participantes 4