Giter Site home page Giter Site logo

tdesjardins / gwt-ol Goto Github PK

View Code? Open in Web Editor NEW
69.0 15.0 32.0 2.49 MB

GWT wrapper for OpenLayers 3+ using JSInterop

License: Apache License 2.0

Java 99.71% CSS 0.14% HTML 0.09% Shell 0.06%
java openlayers gwt-ol3 jsinterop gwt wrapper maps gis ogc mapping

gwt-ol's Introduction

GWT-OpenLayers 3+

Build Status Maven Central Join the chat at https://gitter.im/gwt-ol3/Lobby

With gwt-ol you can write fast mapping applications for web and mobile in pure Java. Technically speaking, it is a GWT wrapper for OpenLayers 3+ using the JSInterop-Features of the GWT-SDK. The project consists of two parts:

  • a GWT wrapper for OpenLayers 3+ (gwt-ol3-client)
  • a demo module for showing wrapper functionality (gwt-ol3-demo)

You can build (mvn package) and run (mvn gwt:devmode) the application using Maven.

If you want to build the application without Maven please consider the following hints:

  • Building the application with older GWT-SDK than 2.8.0-beta1 will not work. You can download the latest SDK here.

Demo App

GWT-OL live example

Project Setup

Maven dependency

<dependency>
  <groupId>com.github.tdesjardins</groupId>
  <artifactId>gwt-ol3</artifactId>
  <version>[x.x.x]</version>
</dependency>

Replace [x.x.x] with the gwt-ol version you want to use.

GWT module

  <inherits name='ol.GwtOL'/>

optional: add this line for proj4js support

  <inherits name="proj4.GwtProj4"/>

Resources

  <link href="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v[x.x.x]/css/ol.css" rel="stylesheet" type="text/css">
  <script src="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v[x.x.x]/build/ol.js" type="text/javascript"></script>

Replace [x.x.x] with the OpenLayers version you want to use.

Download

Releases are deployed to the Central Repository.

Snapshots of the development version are available in Sonatype's snapshots repository.

Projects using gwt-ol

Running Reality
Mapping of Covid19 spread in Italy

gwt-ol's People

Contributors

aaauaaau avatar batchmode avatar brauchle avatar d-eggert avatar dependabot[bot] avatar fractaliste avatar gitter-badger avatar gkresic avatar grandeemme avatar ibaca avatar ikzent avatar jackydfu avatar lobmarib avatar mamta avatar marcoge avatar marcrh avatar mbrigl avatar peterza avatar sebasbaumh avatar tdesjardins avatar umbertodistaso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gwt-ol's Issues

Background images for icons

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

Remove deprecated Executor code

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.

How to add pointerMove to a SelectFeature?

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

Problems handling spatial filters to WFS.writeGetFeature

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.

screenshot_1
screenshot_2
screenshot_3

Super Dev mode run issue

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)

New release?

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?

Change project name from gwt-ol3 to gwt-ol

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.

WFS and GetFeature format

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 :)

Apply elemento typed events

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 πŸ˜‰.

elemental2 Dom

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)

Consider using https for openlayers; demo is broken

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)

Support WMS GetFeatureInfo

Hello I do not find the function WMSGetFeatureInfo function from OL3.
Where should we have this coded

Improvement: Add to the feature the capability of handling an array of styles

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.

Customizable Map.forEachFeatureAtPixel

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.

Include ol.format.filter to WFSWriteFeatureOptions?

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.

Support for polygon repeating patterns

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

Image as marker icon

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.

Click events from Overlay

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?

Satellite

Hi,
There is a possibility to display a satellite map like google maps?

Best Regards

Setup Travis CI for the master branch

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.

olx namespace

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.

Integrating OL3 into tabpanel of GWT Application

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

gwt-ol3 for GWT 2.7 on Maven?

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

Setting style via function in ol.Feature

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.

Support for ol.Object.Event

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.

support for ol.source.Raster

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

Style function should have two parameters

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:

https://github.com/TDesjardins/gwt-ol3/blob/b30f6cf45ed7050142e0543eda96b9b1997ba20a/gwt-ol3-client/src/main/java/ol/layer/VectorLayerOptions.java#L72

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

Bing Maps support?

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.

MultiPoint setCoordinates

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.

Vector open street map as a source

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

ol.StyleFunction support

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

New functionality Draw features

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.