0

Openstreetmap and ZK

asked 2012-05-11 02:46:00 +0800

Fujitsu gravatar image Fujitsu
117

Hi All,

Has anyone tried to link up ZK and Openstreetmap (OSM)?

At the moment I am trying just to link to OSM api in a zul:

<?xml version="1.0" encoding="UTF-8" ?>
<zk xmlns:zk="http://www.zkoss.org/2005/zul" xmlns:w="http://www.zkoss.org/2005/zk/client" xmlns:h="http://www.w3.org/1999/xhtml" >
<?script src="http://www.openlayers.org/api/OpenLayers.js" ?>

  <fwwindow id="${arg.windowId}"
            apply="com.pnl.fw.screens.map.freighttracker.FreightTrackerController"
            screenName="Freight Tracker"
            width="100%" height="100%">
    <zk:borderlayout>
      <zk:center border="none">
      <div id="mapdiv" width="100%" height="100%" vflex="true" hflex="true">
<!--   <zk:gmaps id="gmap" mapType="map" lat="-30" lng="134" showLargeCtrl="true" zoom="4" width="100%" height="100%" vflex="true" hflex="true" />
 -->
 <attribute w:name="onBind">
    map = new OpenLayers.Map("mapdiv");
    map.addLayer(new OpenLayers.Layer.OSM());
 
    var lonLat = new OpenLayers.LonLat( -0.1279688 ,51.5077286 )
          .transform(
            new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
            map.getProjectionObject() // to Spherical Mercator Projection
          );
 
    var zoom=16;
 
    var markers = new OpenLayers.Layer.Markers( "Markers" );
    map.addLayer(markers);
 
    markers.addMarker(new OpenLayers.Marker(lonLat));
 
    map.setCenter (lonLat, zoom);
    alert("hello");
 </attribute>

</div>
      </zk:center>

But I am getting an error: Failed to mount: OpenLayers is not defined

Any help please?
Thanks!

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-05-22 08:29:36 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

Maybe the script is not loaded yet, you may do them in another setTimeout() function.

link publish delete flag offensive edit

answered 2012-05-31 11:14:23 +0800

DrFrank gravatar image DrFrank
39 1

Hi Fujitsu.

Do you have solved your issue??? Is very intresting for me to. A ZK Openlayer integration may be a very intresting component.

link publish delete flag offensive edit

answered 2012-06-13 02:20:51 +0800

Fujitsu gravatar image Fujitsu
117

Nope, I am now creating my own ZK component... it current supports setting the map and adding markers with popups... but I am having issues with multiple maps in tabs, I get a javascript error: this.__mask

link publish delete flag offensive edit

answered 2012-07-03 09:25:55 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

You can refer to this blog.

link publish delete flag offensive edit
Your reply
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

Follow

RSS

Stats

Asked: 2012-05-11 02:46:00 +0800

Seen: 361 times

Last updated: Jul 03 '12

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