<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Use Google Map API in custom visual in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192638#M6129</link>
    <description>&lt;P&gt;llegaste a importar la libreria de TypeScript para Google Maps de NPM?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;si no lo hiciste revisa este link&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.npmjs.com/package/@types/googlemaps" target="_self"&gt;https://www.npmjs.com/package/@types/googlemaps&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2017 23:50:29 GMT</pubDate>
    <dc:creator>mhuancahuari</dc:creator>
    <dc:date>2017-06-12T23:50:29Z</dc:date>
    <item>
      <title>Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/190346#M6041</link>
      <description>&lt;DIV&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;I'm currently trying to display a google map on my custom visual that I'm developing.&lt;/P&gt;&lt;P&gt;In fact, I don't know how can I import the namespece, and the API.&lt;/P&gt;&lt;P&gt;Here is the code I'm trying to use :&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;    &amp;lt;script&amp;gt;
      var map;
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 8
        });
      }
    &amp;lt;/script&amp;gt;

    &amp;lt;script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAyARcNvQVVfuYxt8JGT2ndho2_010AWkQ&amp;amp;callback=initMap"
    async defer&amp;gt;&amp;lt;/script&amp;gt;

  &amp;lt;/div&amp;gt;&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 09:10:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/190346#M6041</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-08T09:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/191419#M6077</link>
      <description>@Anonymous&lt;/a&gt;,
One way is to append the above html to options.element using JavaScript directly.</description>
      <pubDate>Fri, 09 Jun 2017 15:13:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/191419#M6077</guid>
      <dc:creator>v-chuncz-msft</dc:creator>
      <dc:date>2017-06-09T15:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/191866#M6100</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/11389"&gt;@v-chuncz-msft&lt;/a&gt;&amp;nbsp;I already tried that without any result .. Are you sure we can use APIs within custom visual ?&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2017 20:42:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/191866#M6100</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-11T20:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192295#M6118</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, I've tested it, though not very elegant.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 10:18:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192295#M6118</guid>
      <dc:creator>v-chuncz-msft</dc:creator>
      <dc:date>2017-06-12T10:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192359#M6120</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/11389"&gt;@v-chuncz-msft&lt;/a&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;so what's wrong with my code ? if its working for you ? I cant get it xD&lt;/P&gt;&lt;P&gt;After several investigations I think the issue comes witht the wrraper "sanbox-host", since I need to put the div with a specific height.&lt;/P&gt;&lt;P&gt;Can you please Tell me how you did it ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 14:51:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192359#M6120</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-12T14:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192636#M6128</link>
      <description>&lt;P&gt;Hola Skizofree,&lt;/P&gt;&lt;P&gt;No he usado google masp sobre powerBi, pero intentaste importar el typescript dentro del Proyecto CustomVisual que estas realizando?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Revisa esto aqui.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.npmjs.com/package/@types/googlemaps" target="_self"&gt;https://www.npmjs.com/package/@types/googlemaps&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Luego mapea el TypeScript dentro de tu proyecto para que puedas utilizar esos tipos (verifica el archivo ".\typings\index.d.ts")&lt;/P&gt;&lt;P&gt;Segundamente deberás agregar la referencia al nuevo typescript instalado &amp;nbsp;algo como:&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;/// &amp;lt;reference path="globals/googlemaps/google.maps.d.ts" /&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Luego en tu codigo visual.ts (nombre por defecto de tu archivo typescript)&lt;/P&gt;&lt;P&gt;ya puedes usar referencias a los objetos MVC de Google maps&lt;/P&gt;&lt;P&gt;como declarar &amp;nbsp;variables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;private myMap: google.maps.Map;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;usar asignaciones de variables:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;var marker = new google.maps.Marker({ position: myLatLng , map: myMap});&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;y no olvides insertar en tu código la instancia del script de google maps a la página como:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;let script = document.createElement('script');&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;script.type = 'text/javascript';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;script.src=&amp;nbsp;"&lt;A href="https://maps.googleapis.com/maps/api/js?libraries=visualization" target="_blank"&gt;https://maps.googleapis.com/maps/api/js?libraries=visualization&lt;/A&gt;";&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;document.body.appendChild(script);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Si te fue bien, me comentas a marco.huancahuari@gmail.com&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 23:46:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192636#M6128</guid>
      <dc:creator>mhuancahuari</dc:creator>
      <dc:date>2017-06-12T23:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192638#M6129</link>
      <description>&lt;P&gt;llegaste a importar la libreria de TypeScript para Google Maps de NPM?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;si no lo hiciste revisa este link&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.npmjs.com/package/@types/googlemaps" target="_self"&gt;https://www.npmjs.com/package/@types/googlemaps&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 23:50:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192638#M6129</guid>
      <dc:creator>mhuancahuari</dc:creator>
      <dc:date>2017-06-12T23:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192645#M6130</link>
      <description>&lt;P&gt;Hola, llegaste a importar el typescript de google maps para npm?.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Si no lo hiciste revisa primero esto aqui:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.npmjs.com/package/@types/googlemaps" target="_self"&gt;https://www.npmjs.com/package/@types/googlemaps&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Luego&amp;nbsp;debes de mapear el typescript dentro de tu definición de tipos&amp;nbsp;en el archivo:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;".\typings\index.d.ts"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Agrega la referencia alli, y luego podras usarlo en tu CustomVisual.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 00:03:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/192645#M6130</guid>
      <dc:creator>mhuancahuari</dc:creator>
      <dc:date>2017-06-13T00:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/193017#M6146</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See script below as an example.&lt;/P&gt;
&lt;PRE&gt;        constructor(options: VisualConstructorOptions) {
			let mapDiv = document.createElement('div');
			mapDiv.id = 'map';
			mapDiv.style.height = "400px";
			options.element.appendChild(mapDiv);
			
			let js = document.createElement('script');
			js.innerHTML = "var map;"
							+ "function initMap() {"
							+ "map = new google.maps.Map(document.getElementById('map'), {"
							+ "center: {lat: -34.397, lng: 150.644},"
							+ "zoom: 8"
							+ "});"
							+ "}";
			options.element.appendChild(js);
			
			js = document.createElement('script');
			js.src='https://maps.googleapis.com/maps/api/js?key=AIzaSyAyARcNvQVVfuYxt8JGT2ndho2_010AWkQ&amp;amp;callback=initMap';
			options.element.appendChild(js);&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2017 09:35:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/193017#M6146</guid>
      <dc:creator>v-chuncz-msft</dc:creator>
      <dc:date>2017-06-13T09:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/193078#M6148</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/11389"&gt;@v-chuncz-msft&lt;/a&gt;&amp;nbsp;thank you very much; Its working now. I only have one more question. In your code you handled everything as innerHTML but can I embed this in my code for further processing for instance if I want to do calcustions, call classes and methods ... ? This is the code I was working on but not working :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {


    /**
     * Function that converts queried data into a view model that will be used by the visual
     *
     * @function
     * @param {VisualUpdateOptions} options - Contains references to the size of the container
     *                                        and the dataView which contains all the data
     *                                        the visual had queried.
     * @param {IVisualHost} host            - Contains references to the host which contains services
     */

    export class BarChart implements IVisual {
        private div: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private host: IVisualHost;
        private barChartContainer: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private barContainer: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private bars: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private target: HTMLElement;
        private g: d3.Selection&amp;lt;SVGAElement&amp;gt;;
        private object:any;
        private css: d3.Selection&amp;lt;SVGAElement&amp;gt;;
        private script: d3.Selection&amp;lt;SVGAElement&amp;gt;;
        private map : google.maps.Map;



        static Config = {
            xScalePadding: 0.1,
        };

        /**
         * Creates instance of BarChart. This method is only called once.
         *
         * @constructor
         * @param {VisualConstructorOptions} options - Contains references to the element that will
         *                                             contain the visual and a reference to the host
         *                                             which contains services.
         */
        constructor(options: VisualConstructorOptions) {
            this.host = options.host;
            this.target = options.element;

         // this.target.innerHTML = "&amp;lt;script src=\"https://maps.googleapis.com/maps/api/js?key=AIzaSyAyARcNvQVVfuYxt8JGT2ndho2_010AWkQ&amp;amp;callback=initMap\",async defer&amp;gt;&amp;lt;/script&amp;gt;");

            let script = document.createElement('script');
            script.type = 'text/javascript';
            script.src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAyARcNvQVVfuYxt8JGT2ndho2_010AWkQ&amp;amp;callback=initMap";
            script.async = true;
            document.body.appendChild(script);


            this.div = d3.select(options.element)
            .append('div');

          

           
        }

        /**
         * Updates the state of the visual. Every sequential databinding and resize will call update.
         *
         * @function
         * @param {VisualUpdateOptions} options - Contains references to the size of the container
         *                                        and the dataView which contains all the data
         *                                        the visual had queried.
         */
        public update(options: VisualUpdateOptions) {
         //   let viewModel: BarChartViewModel = visualTransform(options, this.host);
            let width = options.viewport.width;
            let height = options.viewport.height;

            this.div.attr({id:"zakaria",width: width, height : height}); 
            
            function initMap(){
                this.map = new google.maps.Map(document.getElementById('zakaria'),{
                    center : {lat:-34,lng:150},
                    zoom : 8

                });

              
            }


        }

        /**
         * Destroy runs when the visual is removed. Any cleanup that the visual needs to
         * do should be done here.
         *
         * @function
         */
        public destroy(): void {
            //Perform any cleanup tasks here
        }
    }
}&lt;/PRE&gt;&lt;P&gt;whats wrong with it ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much again (y)&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 10:58:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/193078#M6148</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-13T10:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/193191#M6156</link>
      <description>&lt;P&gt;Hello&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose that you might use these code below and apply it to your case:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;constructor(options: VisualConstructorOptions) {
    d3.select(options.element)
        .append('script')
        .attr({
            type: 'text/javascript',
            src: 'https://maps.googleapis.com/maps/api/js?key=AIzaSyAyARcNvQVVfuYxt8JGT2ndho2_010AWkQ',
            async: true
        })
        .on('load', () =&amp;gt; {
            this.initMap();
        });

    this.element = options.element;
}

private initMap() {
    const google = window['google'] || window.window['google'];

    this.map = new google.maps.Map(this.element, {
        center: { lat: -34, lng: 150 },
        zoom: 8
    });
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2017 13:05:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/193191#M6156</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-06-13T13:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/349837#M10382</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp;Did you complete this visual? Is the source code available somwhere?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 12:24:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/349837#M10382</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-01T12:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Use Google Map API in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/967166#M22640</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having problems trying to integrate Javascript Google Maps in a new custom visual i am developing using&lt;/P&gt;&lt;P&gt;nodejs and pbiviz tools. I am stuck trying to connect latitude and longitude in the map.&lt;/P&gt;&lt;P&gt;This geograpy data are comming from SQL Server and dataset is correctly imported in PowerBI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are the tools i am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "name": "visual",
  "scripts": {
    "pbiviz": "pbiviz",
    "start": "pbiviz start",
    "package": "pbiviz package",
    "lint": "tslint -c tslint.json -p tsconfig.json"
  },
  "dependencies": {
    "@babel/runtime": "7.6.0",
    "@babel/runtime-corejs2": "7.6.0",
    "@types/d3": "^5.7.2",
    "@types/googlemaps": "^3.39.3",
    "core-js": "^3.6.4",
    "d3": "^5.15.0",
    "powerbi-visuals-utils-dataviewutils": "2.2.1"
  },
  "devDependencies": {
    "powerbi-visuals-api": "^2.6.2",
    "ts-loader": "6.1.0",
    "tslint": "^5.18.0",
    "tslint-microsoft-contrib": "^6.2.0",
    "typescript": "3.6.3"
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding to the code, i have &lt;STRONG&gt;Visual&lt;/STRONG&gt; class, and i created with it:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Data model to hold latitude and longitud&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;constructor to init map with the location of my country (Dominican Republic)&lt;/LI&gt;&lt;LI&gt;update method: reference to the data model and data comming from Sql Server in which it has a table containing all latitude and longitude&lt;/LI&gt;&lt;LI&gt;converter method with dummy data to test&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;/*
*  Power BI Visual CLI
*
*  Copyright (c) Microsoft Corporation
*  All rights reserved.
*  MIT License
*
*  Permission is hereby granted, free of charge, to any person obtaining a copy
*  of this software and associated documentation files (the ""Software""), to deal
*  in the Software without restriction, including without limitation the rights
*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*  copies of the Software, and to permit persons to whom the Software is
*  furnished to do so, subject to the following conditions:
*
*  The above copyright notice and this permission notice shall be included in
*  all copies or substantial portions of the Software.
*
*  THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*  THE SOFTWARE.
*/
"use strict";

import "core-js/stable";
import "./../style/visual.less";
import powerbi from "powerbi-visuals-api";
import VisualConstructorOptions = powerbi.extensibility.visual.VisualConstructorOptions;
import VisualUpdateOptions = powerbi.extensibility.visual.VisualUpdateOptions;
import IVisual = powerbi.extensibility.visual.IVisual;
import EnumerateVisualObjectInstancesOptions = powerbi.EnumerateVisualObjectInstancesOptions;
import VisualObjectInstance = powerbi.VisualObjectInstance;
import DataView = powerbi.DataView;
import VisualObjectInstanceEnumerationObject = powerbi.VisualObjectInstanceEnumerationObject;

import d3 from './../node_modules/d3';
import { VisualSettings } from "./settings";

module geo.data {
    export interface StreamData{
        caseDataPoints: CaseModel[][];
    }
    export interface CaseModel {
        latitude: number;
        longitude: number;
        color?: string;
    }
}

export class Visual implements IVisual {
    private target: HTMLElement;
    private div: d3.Selection&amp;lt;SVGElement&amp;gt;;
    private script: d3.Selection&amp;lt;SVGAElement&amp;gt;;
    private map : google.maps.Map;
    private case_geo_data: geo.data.CaseModel;

    constructor(options: VisualConstructorOptions) {
        let mapDiv = document.createElement('div');
        mapDiv.id = 'map';
        mapDiv.style.height = "550px";
        options.element.appendChild(mapDiv);        
        
        var dr = {lat: 18.483402, lng: -69.929611};
        
        let js = document.createElement('script');
        js.innerHTML = "var map;"
                        + "function initMap() {"
                        + "map = new google.maps.Map(document.getElementById('map'), {"
                        + "center: {lat: 18.483402, lng: -69.929611},"
                        + "zoom: 8"
                        + "});"
                        + "}";
        options.element.appendChild(js);
        
        js = document.createElement('script');
        js.src='https://maps.googleapis.com/maps/api/js?key=APIKey&amp;amp;callback=initMap';
        options.element.appendChild(js);
    }

    public update(options: VisualUpdateOptions) {
        console.log('Visual update', options);
        let width = options.viewport.width;
        let height = options.viewport.height;

        if (!options.dataViews) return;
        console.log("has data");

        var dataViewCase: DataView = options.dataViews[0];
        var data = Visual.converter(dataViewCase);
        var caseDataPoints = data.caseDataPoints;
        var viewport = options.viewport;        
        
        /*
        var uluru = {lat: -25.344, lng: 131.036};
        this.div.attr({id:"test1", width: width, height:height});

        
        function initMap(){
            this.map = new google.maps.Map(document.getElementById('test1'),{
                center : uluru,
                zoom : 8

            });

          
        }
        */
    }

    public static converter(dataView: DataView): geo.data.StreamData {
        return{
            caseDataPoints: [
                [
                 {latitude:5.3884, longitude:100.306},
                 {latitude:5.34738, longitude:100.295}
                ],
                [ 
                  {latitude:5.3894, longitude:100.302},
                  {latitude:5.4079, longitude:100.292},
                  {latitude:5.4191, longitude:100.329}
                ]
            ]
        }
    }

    private static parseSettings(dataView: DataView): VisualSettings {
        return &amp;lt;VisualSettings&amp;gt;VisualSettings.parse(dataView);
    }


}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problems are with the &lt;STRONG&gt;update&lt;/STRONG&gt; method, need to connect map with the latitud and longitude comming from DB.&lt;/P&gt;&lt;P&gt;At this moment, after checking davaview data, it only shows latitude.&lt;/P&gt;&lt;P&gt;I have two dataroles defined as geography data:&lt;/P&gt;&lt;P&gt;1-&amp;nbsp;&lt;SPAN&gt;Case_Latitude&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2-&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Case_Longitud&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And this is my &lt;STRONG&gt;dataviewMappings&lt;/STRONG&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"dataViewMappings": [
        {
            "categorical": {
                "categories": {
                    "for": {
                        "in": "Case_Latitude"
                    },
                    "dataReductionAlgorithm": {
                        "top": {}
                    }
                },
                "values": {
                    "select": [
                        {
                            "bind": {
                                "to": "Case_Latitude"
                            }    
                        }
                    ]
                }
            }
        }
    ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help, please, if possible Mr. &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/17823"&gt;@v-viig&lt;/a&gt;&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/11389"&gt;@v-chuncz-msft&lt;/a&gt;&amp;nbsp;and others. It has been kind of difficult to me, because i haven't could debbug, and that is why i openned question regarding to debug issues in the &lt;A href="https://community.powerbi.com/t5/Developer/How-to-Debug-while-developing-Custom-Visuals/m-p/967042#M22639" target="_self"&gt;debug forum&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreaciate this help!!&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:59:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Use-Google-Map-API-in-custom-visual/m-p/967166#M22640</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-03-10T15:59:07Z</dc:date>
    </item>
  </channel>
</rss>

