Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Integration Apex 5.0 with Google Map doesnt shoe marker

abreurettoFeb 13 2017 — edited Mar 13 2017

Hi

What is wrong with my procedure.  The map is showing but markers dont show.

The command  " for r_klt in (SELECT '-23.5505' as LAT, '-46.6333' as LON FROM dual)" is only to sample. I need get all Lat Lng from oracle table.

Can you help me?

CREATE OR REPLACE PROCEDURE VWC_MAPA_ORGS Is

l_t number(3) := 0;

  l_lon NUMBER;

  l_lat NUMBER;

begin

  htp.print('<script type="text/javascript" src="https://maps.google.com/maps/api/js?key=AIzaSyCXtFkdrQcu2Rl0nOHGZua4Ux-3askZ694&callback=initMap"></script><script type="text/javascript">');

  htp.print('function initialize() {    google.maps.visualRefresh = true;    var isMobile = (navigator.userAgent.toLowerCase().indexOf("android") > -1) ||      (navigator.userAgent.match(/(iPod|iPhone|iPad|BlackBerry|Windows Phone|iemobile)/));');

  htp.print('if (isMobile) {      var viewport = document.querySelector("meta[name=viewport]");      viewport.setAttribute("content", "initial-scale=1.0, user-scalable=no");    }');

  htp.print('var mapDiv = document.getElementById("googft-mapCanvas");    mapDiv.style.width = isMobile ? "100%" : "2200px";    mapDiv.style.height = isMobile ? "100%" : "800px";    var map = new google.maps.Map(mapDiv, {      center: new google.maps.LatLng(-23.5505,-46.6333),      zoom: 6,      mapTypeId: google.maps.MapTypeId.ROADMAP    });');

for r_klt in (SELECT '-23.5505' as LAT, '-46.6333' as LON FROM dual)

  loop

  htp.print('

            function initializeMarkers() {

                var myLatLng = {

                    lat: ' || r_klt.LAT || ',

                    lng: ' || r_klt.LON || '

                };

               var marker = new google.maps.Marker({

                position: myLatLng,

                map: map,

                title: "Teste"

                });

            }

    ');

  end loop;

htp.print('   map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById("googft-legend-open"));');

htp.print('    map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById("googft-legend"));');

htp.print('    layer = new google.maps.FusionTablesLayer({      map: map,      heatmap: { enabled: false },      query: {        select: "col2",        from: "10wMGqm8id-H7NzuMgvzO0KSOstHhX9tLWrO8J3jv",        where: ""      },');

htp.print('    options: { styleId: 2,        templateId: 2      }    });');

htp.print('    if (isMobile) {      var legend = document.getElementById("googft-legend");      var legendOpenButton = document.getElementById("googft-legend-open");      var legendCloseButton = document.getElementById("googft-legend-close");');

htp.print('      legend.style.display = "none";      legendOpenButton.style.display = "block";      legendCloseButton.style.display = "block";      legendOpenButton.onclick = function() {        legend.style.display = "block";        legendOpenButton.style.display = "none";      }');

htp.print('      legendCloseButton.onclick = function() {        legend.style.display = "none";        legendOpenButton.style.display = "block";      }    }  }google.maps.event.addDomListener(window, "load", initialize);');

htp.print('</script></head><body>  <div id="googft-mapCanvas"></div></body></html>');

END VWC_MAPA_ORGS;

This post has been answered by abreuretto on Feb 14 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2017
Added on Feb 13 2017
4 comments
497 views