6 Replies Latest reply on Feb 15, 2010 5:20 AM by Vinodh NK

    Draw lines On Map

    Vinodh NK

      I am a newbie to map viewer, I want to know how to draw lines between two points (eg drawing lines between two cities) using the spatial data.

      Also please tell me for drawing these lines only Oracle Locator which comes along with Oracle DB is enough or we need to have Oracle Spatial.

      Any help on this highly appreciated.

        • 1. Re: Draw lines On Map
          Use the redline tool: see the tutorial at /mapviewer/fsmc/tutorial/samples/redLine.html of your mapviewer deployment.

          Or use the first (Long, Lat) and second (Long,Lat) to construct a line and display it as a feature-of-interest
          e.g. see code below using shipments as an example
          function createShipments()
          var theShipments = new Array();
          var aShipment = new Object();
          aShipment.id = 1;
          aShipment.name = 'Six Sixty Center';
          aShipment.value = 300.75;
          aShipment.longitude = -122.39607;
          aShipment.latitude = 37.7725;
          theShipments[0] = aShipment;

          aShipment = new Object();
          aShipment.id = 2;
          aShipment.name = 'Carlmont Village';
          aShipment.value = 100.50;
          aShipment.longitude = -122.31881;
          aShipment.latitude = 37.54334;
          theShipments[1] = aShipment;

          aShipment = new Object();
          aShipment.id = 3;
          aShipment.name = 'Montclair Village';
          aShipment.value = 700.00;
          aShipment.longitude = -122.20602;
          aShipment.latitude = 37.81906;
          theShipments[2] = aShipment;

          aShipment = new Object();
          aShipment.id = 4;
          aShipment.name = 'Rose Pavilion';
          aShipment.value = 400.00;
          aShipment.longitude = -121.87664;
          aShipment.latitude = 37.69349;
          theShipments[3] = aShipment;

          return theShipments;
          function createLineFOITheme(shipments)
          var lineFOI = null;
          var lineFOITheme = new Array();
          var numPoints = shipments.length;
          var htmlString;
          var ordArray = new Array();
          var theLine;
          var totalValue = 0.0;
          var shipmentIdList = "" ;
          var xmlDef = null;
          var lineStyle = null;

          // 'marker-name:M.IMAGE105_BW;marker-position:0.5;marker-size:12"+

          xmlDef = '<svg width="1in" height="1in">'+
          '<g class="line" '+
          '><line class="base"/>'+

          lineStyle = new MVXMLStyle("myLineStyle", xmlDef);

          for(var i = 0; i < numPoints ; i++)
          ordArray[2*i] = shipments.longitude;
          ordArray[2*i+1] = shipments[i].latitude;
          totalValue += shipments[i].value;
          if( i == 0)
          shipmentIdList += shipments[i].id ;
          shipmentIdList += ", " + shipments[i].id;
          theLine = new MVSdoGeometry.createLineString(ordArray, 8307);
          lineFOI = new MVFOI("l_01", theLine, lineStyle,"", 20, 20);
          htmlString = "<table class=\"ResultsTable\" border=\"1\">" +
          "<tr><td>Id:</td><td> Shipment Route L_01 </td></tr>" +
          "<tr><td>Shipment Ids:</td><td>" + shipmentIdList + "</td></tr>" +
          "<tr><td>Total Value:</td><td>" + totalValue + "</td></tr>" +
          lineFOI.setInfoWindow(htmlString, 200, 100);
          lineFOITheme[0] = lineFOI;

          return lineFOITheme;

          or contruct a predefined theme which takes two city ids or names as param and returns a line connecting them.
          • 2. Re: Draw lines On Map
            Vinodh NK

            Thanks for the repy.

            I am integrating Map viewer with OBIEE, based on OBIEE data I will generate the the maps.

            Can we create lines between certain points on our theme definition itself without code?

            • 3. Re: Draw lines On Map
              Can you provide more details? What the obiee query result (or report) will look like and what the map should show.
              • 4. Re: Draw lines On Map
                Vinodh NK

                I will convert the Obiee result set into XML data set and feed it into mapviewer as datasource.
                Based on the dataset the map will generated.

                eg: I have created map with all the states in a country.
                My Obiee rquest have all the state details, and the map will displayed for all the states.
                when I am filtering based on 2 state values, then only those two states will be colored differently.That already did.

                Now I want to connect between the cities I want using lines.

                So that when I am doing filtering based on the new dataset the lines between the cities on the states only visible
                because only that filtered dataset passed in.

                • 5. Re: Draw lines On Map
                  The whole display a report result on a map stuff works on the premise that the report essentially contains
                  a LocationIdentifier followed by values of interest for that location.

                  Like a State name and year-to-date sales for that state.
                  In your case it sounds like you have Place1 and Place2 as the location ids.

                  So I'm not sure how to do this. Maybe others will have better suggestions.
                  Am assuming that this (i.e. what you want to do) is something like the following.
                  You have a obiee report which contains, lets say,
                  Origin Destination ValueOfInterest e.g.
                  DEL BLR 1,500,000
                  BLR BOM 11,475,000
                  etc and you want to a line between DEL-BLR, and BLR-BOM and use the valueOfInterest to color the line or show up in an info-window when the user clicks on the line.

                  If that is similar to your use case then it'll likely have to be in client side code.
                  Unless all possible city pairs are well-defined and limited.
                  Assuming they're too many possible pairs and you decide to use MVFOIs( i.e. client side code) then the report should actually be something like
                  Origin, XY_for_Origin, Destination, XY_for_Destination, ValueOfInterest, i.e. contain the X,Y for the cities too.

                  If the list of city pairs is not too large (say a million rows or less) you could create a table like
                  city_pair_id, city1, city2, line_between_the_two. e.g.
                  DEL_BLR, DEL, BLR, sdo_geometry(...) using a query like
                  select a.english_name||'_'||b.english_name city_pair_id,
                  a.english_name city1, b.english_name city2,
                  sdo_geometry(2002, a.geometry.sdo_srid, null,
                  sdo_ordinate_array(a.geometry.sdo_point.x, a.geometry.sdo_point.y,
                  b.geometry.sdo_point.x, b.geometry.sdo_point.y)) LineBetweenCities
                  from wom_poi_city_center a, wom_poi_city_center b
                  where a.iso_country_code='IND' and b.iso_country_code='IND' and
                  a.english_name <> b.english_name and rownum < 6





                  SDO_GEOMETRY(2002, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(

                  80.56976, 16.55665, 80.29119, 13.09104))

                  BENGALURU NORTH
                  SDO_GEOMETRY(2002, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(

                  80.56976, 16.55665, 77.46068, 13.06148))

                  SDO_GEOMETRY(2002, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(

                  80.56976, 16.55665, 76.69454, 28.16687))

                  VIJAYAWADA_NEW DELHI
                  NEW DELHI
                  SDO_GEOMETRY(2002, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(

                  80.56976, 16.55665, 77.21001, 28.61966))

                  SDO_GEOMETRY(2002, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(

                  80.56976, 16.55665, 80.17714, 13.20154))

                  Then you'd have a predefined theme on the city_pairs table with city_pair_id as an info column (or label column) and your bi report would contain city_pair_id, value of interest.

                  And this only needs Locator.

                  If you want to experiment with either of these approaches email me directly. (jayant dot sharma at oracle)
                  1 person found this helpful
                  • 6. Re: Draw lines On Map
                    Vinodh NK
                    Hi Sharma,

                    Thanks for the reply.

                    Will reach you for any help.