Does ZK GMaps work?

asked 2017-05-01 11:44:32 +0800

tredmond gravatar image tredmond
21 1

updated 2017-05-04 10:01:32 +0800

cor3000 gravatar image cor3000
5399 2 7
ZK Team

Hi, I'm evaluating ZK 8 EE and I've been trying to get it to display a Google Map. I've used the example from the demo i.e.

<div apply="com.eg.MyMapController">

    <script type="text/javascript" content="zk.googleAPIkey='MYKEY'" />
    <gmaps version="3.26" id="gmaps" width="520px" height="400px" showSmallCtrl="true" protocol="https">
        <ginfo id="info" open="true" 
            content="Hello, &lt;a href=&quot;http://www.zkoss.org\&quot;&gt;ZK&lt;/a&gt;."/>
        <gmarker id="marker" lat="51.508742" lng="-0.120850" open="true"
            content="Hello, &lt;a href=&quot;http://www.zkoss.org&quot;&gt;ZK&lt;/a&gt; on top of Gmarker."/>

I registered for my key (MYKEY), put it in and tried to access on localhost. Javascript console warns about Missing API Key. Accessing from or the machines IP shows a map of Palo Alto and gmarker coordinates are ignored. Console shows NoApiKeys warning. Looking at HTTP trace shows that the 'key' parameter is missing from the gmapz calls. Has anyone got this to work properly.

I got so frustrated with this I decided to write a simple HTML page as follows:

<!DOCTYPE html>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <h1>My First Google Map</h1>

        <div id="googleMap" style="width:100%;height:400px;"></div>

        function myMap() {
        var mapProp= {
            center:new google.maps.LatLng(51.508742,-0.120850),
        var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
        <script src="https://maps.googleapis.com/maps/api/js?key=MYKEY"></script>

This worked first go. Any ideas??


delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-04 09:56:03 +0800

cor3000 gravatar image cor3000
5399 2 7
ZK Team

updated 2017-05-04 10:03:28 +0800

Please use ZK Gmaps 3.0.4 (as maven version or download) which adapts to the latest changes in the google maps API. This was implemented in the issue: http://tracker.zkoss.org/projects/ZKGMAPS/issues/ZKGMAPS-12

BTW: Which demo are you referring to that still uses an old version so we can correct the download package?


link publish delete flag offensive edit


Thanks Robert - the new download solved the problem. I also had a contention between the new jar file deployed in the war vs one deployed in the app server.

tredmond ( 2017-05-19 08:07:58 +0800 )edit

thanks for getting back! I am glad this works for you now :)

cor3000 ( 2017-05-19 08:38:45 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2017-05-01 11:44:32 +0800

Seen: 42 times

Last updated: May 04 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More