Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 113
Registered: ‎07-25-2018

Calling Google Map Javascript API from M.App Enterprise Browser

Hi,

 

I am implementing place search using google map javascript api in M.App enterprise.

 

I have used custom panel here.

I have passed the javascript name (javascript is written in javascript panel)  as callback function in the google api Url and Google api url is referred in external link .

 

But the map is not displaying  in M.App browser, although the code works fine when ran from visual studio.

Is it not possible to pass javascript function name to the url referred in the external link ?

 

 

I have attached a screenshot of the error from developer console(autocomplete is the callback function I am trying to pass in url)

 

Could anyone please suggest what I am missing here?

 

Regards,

Sreedevi

Frequent Contributor
Posts: 113
Registered: ‎07-25-2018

Google Map Javascript API in map enterprise browser

Hi,

 

I am implementing place search using google map javascript api in M.App enterprise.

 

I have used custom panel here.

I have passed the javascript name (javascript is written in javascript panel)  as callback function in the google api Url and Google api url is referred in external link .

 

 

I have attached a screenshot of the error from developer console(autocomplete is the callback function I am trying to pass in url)

 

Could anyone please suggest what I am missing here?

 

Regards,

Sreedevi

Frequent Contributor
Posts: 113
Registered: ‎07-25-2018

Re: Google Map Javascript API in map enterprise browser

[ Edited ]
 
Staff
Posts: 1,036
Registered: ‎10-18-2015

Re: Google Map Javascript API in map enterprise browser

do you use any other library in your code like jquery? in that case you should add them as reference too. Please provide your code where you get the error in the callback.

 

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Frequent Contributor
Posts: 113
Registered: ‎07-25-2018

Re: Google Map Javascript API in map enterprise browser

Hi Stefano,

 

Thanks a million for your quick response.

 

I don't use any jquery here.

I have attached sample function written in javascript panel.

 

What I am trying to do is to call google javascript api to display the google map and a search box where it predicts and retrieves the places when user types.

 

I created a custom panel and pasted this javascript function,css, html on respective panels .

 

And on external reference, I have added the below reference to google api.

https://maps.googleapis.com/maps/api/js?key=APIKEY &libraries=places&callback=Autocomplete

 

Regards,

Sreedevi

 

 

Frequent Contributor
Posts: 113
Registered: ‎07-25-2018

Re: Google Map Javascript API in map enterprise browser

Hi,

 

I am sharing the html I have used in custom panel also if it helps to  give more clarity on what I am trying to do.

 

<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
</head>
<body>
<input id="pac-input" class="controls" type="text" placeholder="Search Box">
<div id="map"></div>
</body>

Staff
Posts: 1,036
Registered: ‎10-18-2015

Re: Google Map Javascript API in map enterprise browser

[ Edited ]

Are you implementing the whole google maps map in the custom panel? Since the custom panel is an iframe within the whole App I'm not sure this will work.

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Frequent Contributor
Posts: 113
Registered: ‎07-25-2018

Re: Google Map Javascript API in map enterprise browser

Hi Stefano,

 

Thank you for the response.

 

Yes, I am trying to implement the google maps along with a search in M.App enterpise .

 

I have gone through the what3wordssearch.

Is the API key which is mentioned in example  a  google maps javascript API key?

 

Regards,

Sreedevi

 

Staff
Posts: 1,036
Registered: ‎10-18-2015

Re: Google Map Javascript API in map enterprise browser

no in that case is the W3W API key.

That sample is implemented on the Map panel template, which is a different use case of your Custom panel where you are implementing the whole map engine. I think you may explore the integration using the embed API from google maps, like for an existing website:

 

https://developers.google.com/maps/documentation/embed/guide

 

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.