tdesjardins / gwt-ol Goto Github PK
View Code? Open in Web Editor NEWGWT wrapper for OpenLayers 3+ using JSInterop
License: Apache License 2.0
GWT wrapper for OpenLayers 3+ using JSInterop
License: Apache License 2.0
Uploading gwt-ol3 artifacts to a central maven repository would be facilitate the use of it in maven projects. Probably this process can be supported by CI.
Ressources:
https://maven.apache.org/guides/mini/guide-central-repository-upload.html
I marked the Executor code as deprecated because it is not used in gwt-ol3. I also don't know the sense because there are no tests or documentation about it. Please let me know if anybody needs this. Otherwise I will remove this in the next version.
Since now it is possible to add OMS vector map as a source, it would be nice if there will be support for styles that varies with zoom level. For example displaying street names from a certain zoom level etc. As far as I know there is no support for http://openlayers.org/en/master/apidoc/ol.html#.StyleFunction now.
Are you planning on adding this feature? Or should I try it myself? I'm not that much sure on how to implement it so any advice would be nice.
I only saw an example here: https://openlayers.org/en/latest/examples/vector-osm.html?mode=raw
The ol.layer.Layer class would need an @api annotation, otherwise it is not visible in full ol.js build.
The case where this is needed is e.g. layer tree traversal to distinguish βleafβ layer from group layer.
An example of failure can be seen here: https://jsfiddle.net/tpcxL1e9/
Tested with v5.3.0.
Is it possible to set up Travis CI to build the master
branch in addition to the gwt/2.8
branch?
This would show us build issues in the main branch as well.
I will attach the images in order to have a graphical explanation. The summary is that, when addindg a spatial filter (polygon-array of coordinates like (longitude,latitude), the query is set as a polygon- array of coordinates like (latitude,longitude).
Is it a problem from gwt-ol3 or javascript openlayers library?
Thanks in advance
Regards.
ol.interaction.DragBox is missing constructor that would allow for customization.
Without it it seems that that it is not possible to allow both zooming and selecting by drawing boxes on map.
Working on a patch.
Hi TDesjardins,
can you deploy on Maven Central also the last version of gwt-ol3 for GWT 2.7? if possible?
Unfortunately, at the moment, I can't use the latest version (for GWT 2.8) because in the environment where I deploying my web-app several components are developed/compiled using GWT 2.7, and this last is shared by all.
Thanks.
Regards,
Francesco
Hello I do not find the function WMSGetFeatureInfo function from OL3.
Where should we have this coded
OL's documentation says nothing about options:
https://openlayers.org/en/latest/apidoc/ol.format.WKT.html#writeGeometry
but source code uses it:
https://github.com/openlayers/openlayers/blob/master/src/ol/format/wkt.js#L406
I have been testing some of the functionality and creating a color using a String is not possible. It works fine using an array.
https://openlayers.org/en/latest/apidoc/ol.html#.Color
And looking through the API it is only defined as an array.
By the way, I really appreciate your work! Thx :)
I'm trying to add support for ol.Object.Event
, but I'm not sure which route to take:
If I add new Event
subclass to ol.Object
it will mask every current reference to ol.events.Event
in subclasses (which is... almost every class in project :) ). This would be a clean solution, but it requires massive renaming across code base and is error prone.
If I name wrapper something like ObjectEvent
, it looks kind of dirty and goes against OL's naming scheme.
Or I'm I just overthinking this?
My primary goal here is to add listeners for change:center
, change:resolution
and change:rotation
to ol.View
.
Hi,
I'm having problems to implement the export tool ( example here: https://openlayers.org/en/latest/examples/export-map.html ). I think the absence of render.event is the main problem here. Maybe I am missing a better way to solve this, I readed the code but I couldn't find anything.
Would be great if you can help me with this.
Mario.
Since the OpenLayers project has introduced semantic versioning the name ol3 isn't correct anymore. Therefore the project name should be changed to gwt-ol to avoid confusion.
Is there already a start of the draw implementation in OL3, if not where should one start ?
It seems that a draw function is available.
According to the documentation the style function is a:
function that takes an module:ol/Feature~Feature and a {number} representing the view's resolution. The function should return a module:ol/style/Style~Style or an array of them. This way e.g. a vector layer can be styled.
In following code the resolution number is missing:
Do you eventually consider to have a GenericBiArgs functionnal interface like https://github.com/Fractaliste/gwt-ol3/blob/master/gwt-ol3-client/src/main/java/ol/gwt/GenericBiArgFunction
Thank you for creating this prototype OL3 wrapper!
Calling mvn clean gwt:run-codeserver works okay, however, on trying to run the web server I get the following error:
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
at com.google.gwt.dev.javac.CompiledClass.getSignatureHash(CompiledClass.java:166)
at com.google.gwt.dev.javac.Dependencies$Ref.<init>(Dependencies.java:42)
at com.google.gwt.dev.javac.Dependencies$Ref.<init>(Dependencies.java:37)
at com.google.gwt.dev.javac.Dependencies.resolve(Dependencies.java:114)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:366)
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:580)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:513)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:499)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:668)
at com.google.gwt.dev.codeserver.Recompiler.initWithoutPrecompile(Recompiler.java:200)
at com.google.gwt.dev.codeserver.Outbox.maybePrecompile(Outbox.java:82)
at com.google.gwt.dev.codeserver.Outbox.<init>(Outbox.java:61)
at com.google.gwt.dev.codeserver.CodeServer.makeOutboxes(CodeServer.java:156)
at com.google.gwt.dev.codeserver.CodeServer.start(CodeServer.java:118)
at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:91)
at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 21 more
I tried adding the missing dependency
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
However, with this in place, I get a different error:
java.lang.IncompatibleClassChangeError: class com.google.gwt.dev.javac.BytecodeSignatureMaker$CompileDependencyVisitor has interface org.objectweb.asm.ClassVisitor as super class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at com.google.gwt.dev.javac.BytecodeSignatureMaker.visitCompileDependenciesInBytecode(BytecodeSignatureMaker.java:227)
at com.google.gwt.dev.javac.BytecodeSignatureMaker.getCompileDependencySignature(BytecodeSignatureMaker.java:209)
at com.google.gwt.dev.javac.CompiledClass.getSignatureHash(CompiledClass.java:166)
at com.google.gwt.dev.javac.Dependencies$Ref.<init>(Dependencies.java:42)
at com.google.gwt.dev.javac.Dependencies$Ref.<init>(Dependencies.java:37)
at com.google.gwt.dev.javac.Dependencies.resolve(Dependencies.java:114)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:366)
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:580)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:513)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:499)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:668)
at com.google.gwt.dev.codeserver.Recompiler.initWithoutPrecompile(Recompiler.java:200)
at com.google.gwt.dev.codeserver.Outbox.maybePrecompile(Outbox.java:82)
at com.google.gwt.dev.codeserver.Outbox.<init>(Outbox.java:61)
at com.google.gwt.dev.codeserver.CodeServer.makeOutboxes(CodeServer.java:156)
at com.google.gwt.dev.codeserver.CodeServer.start(CodeServer.java:118)
at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:91)
at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
This is more an experiment. OL does not use standard Event, so its events do not extend DOM Event (not totally sure this sentence makes sense). Anyway, this issue is to investigate if it is possible and useful to use the Element EventType interface, and so elemental2 EventTarget and EventListener to describe the event. The best of this approach is event unification and rxgwt integration π.
Classnames like OSMXML, WKT and JSONFeature not follow Java naming coventions. Renaming will also improve the readability.
Hi,
I have just realized that WFS filters are not included in the WFS class, so we are not able to include these to the request. I tried to add them in WFSFeatureOptions but I could not make the query work. I wonder if there is something that I am missing.
Regards, and thanks in advance.
I've just updated to the last version of the wrapper and I found a new dependency on the gwt-ol3-client which is not being included in the artifact. Can't understand this approach. It's really needed?
On the previous version I added the gwt-ol3-client jar has dependency into my project and that's it. Quick and simple. (Yes my project doesn't use maven)
Hello,
I recently wanted to switch to vector map representation. I found out that I can download XML file from OSM. And here http://gis.stackexchange.com/questions/169387/using-local-openstreetmap-osm-map-with-openlayers-3 I found that I can use directly that file as a source for the map in OL3.
But it is not implemented here I think. I used GeoJSON for now, but are there any plans to add OSMXML direct support?
I guess it is just this http://openlayers.org/en/latest/apidoc/ol.format.OSMXML.html class, so I can try it myslef. I just want to know if I am not missing something that is already implemented.
Thanks
I'm not even sure what is the purpose of this namespace in OpenLayers, but I'm wondering if gwt-ol3 should support it?
One use case is to support ol.render.Event which references olx.FrameState. I'm planning to use it for animations like shown in this example.
ol.interaction.Extent is missing constructor that would allow for customization.
There are no events for reacting when extent is changed on map, too.
If no one is working on this, I can provide a patch.
Hello,
i am trying to read features using WFS, but i don't get which is the corresponding "Node" class in Java.
Could you implement a request example with the GetFeature format?
Thx :)
As OL3 development team explained in this issue, the feature is able to handle several styles (in the past, it could only manage front and back style).
I've implemented the following code in the gwt library in order to test this:
public native void setStyleArray(Feature feature, Style[] styleArray)/*-{ feature.setStyle(styleArray); }-*/;
and it worked perfectly, but this change broke the feature style getter.
In conclusion, Feature class should be modified if we want it to manage arrays of Styles.
Regards, and thanks in advance.
Map.forEachFeatureAtPixel
should have additional prototype with FeatureAtPixelOptions
for customizations.
Will provide a patch soon.
Unrelated to this issue, I would like to ask @TDesjardins if this workflow "file an issue" -> "provide a patch" is valid? I looks like there are considerable amount of missing features in gwt-ol3 (which is completely understandable) so I'll have to spam this project a bit. I could pack several improvements in one pull request, but then I risk that because of one misimplemented feature whole pull request gets rejected. Note that I don't mind filing an issue for each feature implemented, I'm just asking if that is OK with maintainer.
I created a simple popup (using ol.Overlay), that displays a box above the selected feature with additional information. There is also a button, to which I assign ClickHandler, but it never gets called. I tried setting setStopEvent
to false on OverlayOptions, but that just makes the map receive some event, but it never gets to my click handler.
I can see that my SelectFeature is receiving this click (even though it is a click on a button in an overlay, so no select at all), but the handler I add to the button by btn.addClickHandler(event -> doSomeStuff())
is not called.
I can see that other people have this issue, so it is not probably an issue with this wrapper, but with OL in general, but just how to register my button so that it will react to click?
I am trying to convert a gwt openlayers 2 project to OL3+ and use this wrapper for this.
I am at the stage of replacing the old SLD-based styling by OL3+ conform styles.
There is however one thing I cannot do: drawing a repeated pattern over a polygon for rendering.
Based on the official OL example (https://openlayers.org/en/latest/examples/canvas-gradient-pattern.html) it should be possible to set a "colorlike" (e.g. CanvasPattern created dynamically) as fill color, but the wrapper currently accepts Color only and colorlike is not known across the gwt universe...
Not sure how to solve this problem, if there is any working example (GWT, not pure js), it is also welcome as reply.... Thanks Zoli
Hi,
first of all, thank you for developing GWT-OL3.
I would like to ask, are you planning on releasing a new version? I see that some essential features (particularly, clustering) are added after the 3.0.0 version release, which would be great to try out.
Also, is it currently possible to create a popup?
Is there a possibilty to set the proxy host like in Openlayers 2 ?
The openlayers api provides a raster class ol.source.Raster
that enables you to execute per-pixel operations on a given source image via ol.RasterOperation
.
Unfortunately I didn't find any correspondence in your gwt wrapper.
Are there any technical difficulties and do you plan to add support for this class in the future?
Regards,
Daniel
Is it possible to set image as marker icon? I was using it in old GWT OL and I was also able to change that icon on the fly (for example I have road signal icon and when the road signal red lamp is activated, I change the icon appropriately).
Or is it possible to use SVG icon?
I found that I can set style to feature, and with creating this style I can pass Image as parameter, but I don't know how to instantiate the Image.
Hi,
I'm trying to implement the possiblity to select a polygon by mouse-over.
Example for JS: http://www.freytag.org.uk/ol/hover.html:
var highlighter = new ol.interaction.Select({
condition: ol.events.condition.pointerMove
});
map.addInteraction(highlighter);
I only got it to work with a select-by-click-Feature (as in your Demo), but i don't get it to work with the pointerMove-Event - i just don't know how to set the condition and unfortunately there are no examples for this in the demo.
Would be great if you can give me any advise on how to solve this!
Andreas
Release new gwt-ol version with OpenLayers 5 support.
Is gwt-ol3
the final stable artefactId of gwt-ol3 library?
Hello, I am new to all the OL3 stuff, so please excuse if there is something I am not understanding..
But I picked up some code from a co-worker and noticed certain things broken when trying to use setCoordinates
for MultiPoint
.
In my investigation something that was puzzling me was MultiPoint
wanted a 2 dimensional array of Coordinates
. But I was trying to understand why. I since I was new, I thought maybe it was treating MultiPoint
as an array of LineStrings
which only has 1 Coordinate
in each string.
But this too seemed to not work when trying it.
I found here on the OL3 Documentation that it expects an Array of Coordinates
(as I would have thought it would) MultiPoint#setCoordinates
but MultiPoint
in this project is a SimpleGeometryMultiCoordinates
which expects Coordinate[][]
Can anyone explain why this is a SimpleGeometryMultiCoordinates
and not a SimpleGeometryCoordinates
which expects Coordinate[]
PS: to get around my problem, I made a new MultiPoint
and pushed the Coordinates
in 1 by 1 using appendPoint()
instead.
Point pointToRemove; // From some other place.
MultiPoint origMP; // From some other place.
MultiPoint newMP = new MultiPoint();
Stream.of(origMP.getPoints())
.filter(p -> !GeometryUtils.isGeometrySame(pointToRemove, p))
.forEach(newMP::appendPoint);
// Set newMP in origMP's place.
Remove oss-parent because of it's deprecation:
http://central.sonatype.org/pages/apache-maven.html#deprecated-oss-parent
@ibaca Do you see any problems for release goals when removing it?
According to OpenLayers, ol.Feature
should support passing function to setStyle
method:
https://openlayers.org/en/latest/apidoc/ol.Feature.html#setStyle
gwt-ol3, however, does not support it.
I'm not very fluent in JsInterop, but I suspect that has something to do with special treatment of keyword this
inside that function. On the other hand, ol.Feature::setStyle
supports the same ol.StyleFunction
as ol.layer.Vector::setStyle
that already works fine in current gwt-ol3.
Is there a straightforward way to support this feature? If so, I could try to make a patch, possibly with some guidance on JsInterop specifics.
Add a script for building GWT-OL3-Playground.
MapGuide example does't work any more.
The demo is broken when loaded from https://tdesjardins.github.io/gwt-ol3/ because openlayers is loaded over HTTP; but openlayers.org supports HTTPS too. So you should use https://openlayers.org
or a scheme-relative //openlayers.org
.
BTW, I have the HTTPS Everywhere extension in my browsers that automatically loads sites over HTTPS when known to work (as is the case for *.github.io sites)
Hi,
There is a possibility to display a satellite map like google maps?
Best Regards
@TDesjardins, is there a reason you used interfaces instead of concrete classes for Options?
Do you prefer using interfaces in conjunction with the OLFactory or may I convert MapOptions ecc. to classes?
public class MapOptions implements Options
I would like to say thank you for creating the OL3 GWT wrapper, it looks like it's going to be very useful for integrating map functionality into a GWT application. I see that in your demo you add a
line to your .html file and then assign the map to that element. I also see that we can add a map to a GWT app by placing it in a panel that is placed directly on the RootLayoutPanel.Currently I am trying to place the map in a panel (with id "map") that exists in a TabLayoutPanel several layers down from the RootLayoutPanel, but the map doesn't seem to find that object, I was wondering if there was a current standard way of placing the OL3 map in a panel that is not attached to the RootLayoutPanel but is instead several children down?
Thank You,
Jon
Is there a reason gwt-ol3 does not provide wrappers for Bing maps (supported in OL)?
https://openlayers.org/en/latest/apidoc/ol.source.BingMaps.html
I've created a patch, basicaly just two additional simple JsInterop wrappers:
ol.source.BingMaps extends ol.source.TileImage
and
ol.source.BingMapsOptions extends ol.source.TileImageOptions
It works and if there are no issues that I'm not aware of (license?) I can provide a pull request.
Hi,
In Ol2 you could use a background image and use an icon image. Now it is only possible to choose an icon image. Is there a possibilty to still use both? I need to draw a background image like a circle and put an icon in this circle.
And create the different images (like a circle with the icon inside) is not viable, because i have over 500 different combinations that would need to be created dynamically.
Thanks for your time.
Regards
Method createXYZ has different options than default tilegrids (e.g. maxZoom):
http://openlayers.org/en/latest/apidoc/ol.tilegrid.html#.createXYZ
There are two things to do:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.