4 Replies Latest reply: Oct 10, 2012 11:21 AM by Kiran Pawar RSS

    google maps, multiple markers/polyline, cordinates from db

    963323
      hi all,

      i have a buss tracking/time tabling project

      i have 3 types of data on my db

      1 stations with (station_id lat long) of station
      2 i have bus information, (buss_id, busname .....)
      3 i have events table for that stores when the buss will pass a station (buss_id, station_id, datetime)

      first things first:
      i am using apex.oracle.com.
      i have multiple tables with lat and long info on different columns.

      am trying to do 2 things,

      1) i have the locations of bus stations on a table, as station_id, lat, long
      -i want to show them all on the map my using markers
      -i want to be able to filter the shown


      2) i want to show the route of a selected bus on the map date/time filtering would be nice

      my idea is to create a report page(do filter the info on the page) then when some how forward the data i have to the map pages

      thanks in advance :)
        • 1. Re: google maps, multiple markers/polyline, cordinates from db
          Kiran Pawar
          Hello,

          >
          960320 wrote:

          i have a buss tracking/time tabling project

          i have 3 types of data on my db

          1 stations with (station_id lat long) of station
          2 i have bus information, (buss_id, busname .....)
          3 i have events table for that stores when the buss will pass a station (buss_id, station_id, datetime)

          first things first:
          i am using apex.oracle.com.
          i have multiple tables with lat and long info on different columns.

          am trying to do 2 things,

          1) i have the locations of bus stations on a table, as station_id, lat, long
          -i want to show them all on the map my using markers
          -i want to be able to filter the shown

          2) i want to show the route of a selected bus on the map date/time filtering would be nice

          my idea is to create a report page(do filter the info on the page) then when some how forward the data i have to the map pages
          >

          Welcome to Oracle Application Express OTN Forum.

          Following are the some of the links that will help you to achieve what you want:

          http://www.oracle.com/technetwork/developer-tools/apex/application-express/integration-086636.html#GOOGLE

          http://blog.whitehorses.nl/2009/10/04/integrating-google-maps-in-oracle-apex/

          http://monkeyonoracle.blogspot.in/2010/01/oracle-spatial-apex-and-google-maps.html

          Please change your handle to something meaningful rather than *960320*.
          Please do read the [url https://forums.oracle.com/forums/ann.jspa?annID=1324]Forum Instructions and [url https://wikis.oracle.com/display/Forums/Forums+FAQ] Forum FAQ before posting a question.
          While posting a question please include the following information upfront to get a speedy response and to understand your problem:
          <ul>
          <li>Full APEX version</li>
          <li>Full DB/version/edition/host OS</li>
          <li>Web server architecture (EPG, OHS or APEX listener/host OS)</li>
          <li>Browser(s) and version(s) used</li>
          <li>Other related software(s) with their version</li>
          </ul>

          Hope it helps!
          Regards,
          Kiran
          • 3. Re: google maps, multiple markers/polyline, cordinates from db
            963323
            hi,
            after hours of work i did it
            but been busy dint have the time to post sorr :(

            whell how to put poins(markers) on the map when lat and long are storen in your database :)

            create an empty page
            open edit page
            paste the following to the "html header" content with out the ***** :)
            *******
            <script type="text/javascript"
            src="http://maps.googleapis.com/maps/api/js?key=&API_KEY&sensor=true">
            </script>
            **********
            paste the following to the "Page HTML Body Attribute" content with out the ***** :)
            *******
            onload="initialize()"
            ******
            hit apply changes :)

            on your page create a PL/SQL Dynamic Content
            int he code section pas the following with out the **** again
            **************
            begin
            your_procedure_name;
            end;
            *****************
            when done go to object browser in apex under sql workshop
            create procedure

            now out procedure will have 2 sections 1) the sql query which will have the lat and long info and the id/name of the station
            details of the sql query your query must give the results in the following way

            GEOLOC ID TYPE
            40.479484,49.728563 market 1
            40.394697,49.818812     bla lba 2
            40.412434,49.935188     nnnnnn 2
            40.411119,49.934641     adadawdaw 1


            the code for the procedure
            **************************************
            create or replace procedure "SHOW_ALL_STATIONS" is
            cursor c_klt is
            select **** this will be your query
            "STATION.LAT"||','||"STATION.LON" geoloc,
            "STATION.ID" AS ID,
            "STATION.TYPE" AS TYPE
            from "TRACKER.STATIONS"
            order by "STATION.ID"; *******************

            l_t number(3) := 0;

            begin
            htp.print('
            <script type="text/javascript">
            function initialize() {

            var center_map = new google.maps.LatLng(40.390227,49.872385);
            var mapOptions = {center: center_map,zoom: 10,mapTypeId: google.maps.MapTypeId.ROADMAP};
            var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
            var marker = new google.maps.Marker(
            {position: center_map,map: map,animation: google.maps.Animation.DROP,title:"center of map!"});
            ');
            for r_klt in c_klt
            loop
            htp.print('
            var geocoder = new google.maps.LatLng('||r_klt.geoloc||''||');

            var marker = new google.maps.Marker(
            {position: geocoder,map: map,animation:google.maps.Animation.DROP,title:"Station ID: '||r_klt.ID||''||' Station type: '||r_klt.TYPE||''||'"});
            ');

            l_t := l_t + 1;
            end loop;
            htp.print('
            }
            </script>
            ');

            htp.print('
            <body onload="initialize()" style="font-family: Arial;border: 0 none;">
            <div id="map_canvas" style="width: 1000px; height: 600px"></div>
            </body>
            ');

            end;
            ********************************************************************************

            almost done

            now go to shared components
            then goto edit definitions

            in substutuutions
            add      Substitution String API_KEY
            Substitution Value **your gogole maps api keyy


            all done :)

            Edited by: orhiee on Oct 9, 2012 8:54 AM
            • 4. Re: google maps, multiple markers/polyline, cordinates from db
              Kiran Pawar
              Hi orhiee,

              >
              orhiee wrote:

              after hours of work i did it
              >

              That's what developers are meant to do! ;)

              Kudos! :) for achieving the functionality you wanted!

              Thanks a lot for posting your findings. This will help other forum members with the same/similar questions. :)

              Regards,
              Kiran