Hello all.

I spent a few hours this weekend porting JTS 1.10 to GWT. For those who
don't know GWT (Google Web Toolkit), it is a web programming framework
released by Google in which you develop in Java and it compiles and
generates the corresponding JavaScript code. It manages to do so by
emulating a good part of the Java Runtime Environment. However not all, for
example, since web browsers have no file access, I had to strip out the
classes which did file IO, because such classes are not emulated and I had
to re-implement some of the code in the classes to make it compatible with
GWT.

This effort was made because after a post in the GWT group, people started
showing interest in using JTS with google maps, although while I was porting
it, I noticed that not all can be ported with a one to one relationship, for
example, JTS Polygons can have holes in them, while Google Maps Polygons
(apparantly) can't.

Here is an example project I setup that does the buffer operation on the
client (web browser) and sends it to a server through a RPC call, which
merely clones it, and returns it, just to test Serialization in GWT :
http://www.4shared.com/file/85146364/98e14118/jts4gwt.html it is 20 megs
because it has all required libraries to run included - sorry, windows only
for now, if you run other platform, you can try downloading GWT for your
platform and swapping the libraries.
To run the example you have to import it in eclipse, click the down arrow
beside the Debug button, choose Debug Configurations... and in the following
dialog, choose JTS4GWT under Java Application on tree view on the left and
click Debug. It might take a little while to start because it must compile
all Java sources into JavaScript when it starts debugging, then 2 windows
will open, one being the window of the web browser, with a google map and a
button beneath it to test the buffer function on the client side.

With Martin Davis approval (and everyone else involved in making JTS) I
would setup a jts4gwt project in SourceForge and continue the port (there is
still work to do), also, with the project in SourceForge, whoever needs a
function which is not implemented yet in the GWT version, can implement it
and contribute.

Google Maps is not the only option in mapping for GWT, there is a binding
for OpenLayers as well, so I think one could use JTS geometries with
OpenLayers too.

Regards,
Alexandre Pretyman
_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to