8 Replies Latest reply on Feb 15, 2016 10:06 AM by aanjan RSS
    aprabhakara Explorer

    Displaying Multiple Locations in Google Map

    Hello,

    I am Newbie to Thingworx,

     

    I want to highlight multiple Locations on Google map.

    [Example-3 Different locations with the marker]

     

    I have created a Data Table and included the different Location's inside it in another Data Table, But after binding it to the Google Map 'm unable to get the desired output.

     

    Kindly suggest, How do i get those multiple Locations on the Google Map.

     

     

    Regards & Thanks

    Arpitha.P

      • Re: Displaying Multiple Locations in Google Map
        paic Collaborator

        As long as you have a Service that returns an infotable with Locations, the map can display that.

        Bind the data to the Map and then make sure you set the 'Location' Property of the Map Widget, indicating which column has the locations.

        • Re: Displaying Multiple Locations in Google Map
          aprabhakara Explorer
          I have many queries regarding this google Map widget.I kindly request you to guide me.

           

          a) As you have mention, i have a service which returns the Infotable with locations.

           

          i have created an Infotable with name [Axcend_Table] in this way.
               1.In the Field Definitions i have added 2 Locations
                   Name:Bangalore
                   Base type: Location
                   Has Default value:Yes
                   Default Value:12.8896959,77.5429539 (latitude and Longitude)
          Similarly i added another location in the same way...

           


          b) In the service , i have done as follow

           

          Input-Location
          BaseType-BaseTypeName

           

          Output ,
          BaseType:Infotable
          DataShape: Axcend_Table (Correct me if 'm wrong here)

           

          Snippet- i added this from 'Create Infotable from datashape' under snippet

           

          var params = {
          infoTableName : "InfoTable",
          dataShapeName : "Axcend_Table"
          };

           

          // CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(Axcend_Table)
          var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

           

          These all the steps i have done..But still 'm unable to get the output...Please suggest me if 'm wrong some where..

           


          Regards & Thanks

           

          Arpitha.P

           

            • Re: Displaying Multiple Locations in Google Map
              paic Collaborator

              If you check your actual output, you'll find that creating an infotable based on a datashape just gives you an empty infotables with no records inside.

              Also this most likely isn't the best way to retrieve the information.

              If you have not yet done so, I recommend you go through the online training. The online training will point you in the direction of best practice modeling and what are appropriate services to use.

            • Re: Displaying Multiple Locations in Google Map
              aprabhakara Explorer

              okay...Thank you

              • Re: Displaying Multiple Locations in Google Map
                Mayank Patel Apprentice

                ,

                 

                Follow the steps for require multiple marker in your Google Map :

                 

                Create service in your Things or Thing Template

                 

                Add below code in your Service . Before Add create DataShape .

                 

                var params = {

                    infoTableName : "InfoTable",

                    dataShapeName : "Datasahpe"

                };

                 

                 

                // CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(Datasahpe)

                var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

                 

                 

                // location:LOCATION

                var location = new Object();

                location.latitude = 23.452;

                location.longitude = 72.124;

                location.elevation = 0;

                location.units = "WGS84";

                 

                result.AddRow({location:location})

                //location:LOCATION2

                 

                var location2 = new Object();

                location2.latitude = 23.123;

                location2.longitude = 72.456

                location2.elevation = 0;

                location2.units = "WGS84";

                 

                result.AddRow({location:location2});

                 

                 

                 

                Thanks,

                Mayank