Friday, August 12, 2011

Small enhancement in single band raster styling




We already had tools to style single banded raster, i.e. color ramps on elevation models and similar things.
What was missing was a nice handling of novalues and other values we would not care. Take for example the following map:



This is how an ascii grid is loaded into udig...

Well, we can ask to read the values to propose a colortable through "reset colormap". But that would consider -9999 novalues. Therefore we added the possibility to define other novalues to ignore in the process. Applying that colortable will produce:



Where is the problem? The 0. The map was probably transformed and the altered collar part has been set to 0. We can try to add to the novalues list also the 0 and reset once more:



That is about it, nice, so we now apply one of the predefined colortables, to better look like a DTM:



Well, to really get rid of the 0 novalues, we need to create rules to "hide" those part, else they will not appear transparent and overlay on other layers.
We now added a button that will take the manually defined novalues and create transparent rules for them:



That is what we wanted to have. Just remember to export the style to have the same name as your raster map and the extension .sld, and you are good to go.

Also note that now we have select all/none and invert selection for rules, which get very handy when you need to move rules up and down.








Saturday, July 9, 2011

eRCP, windows mobile 6, phoneMe, J9 fruit salad

I was asked to investigate a geopaparazzi port on Trimble Juno SC. Well, obviously it is not Android. But not only that, it is also not open source at all. In fact it is one of the closest source situations I have been in many years. Anyways, while investigating all the .Net and C# and gps apis, I also gave a look at a project I fell in love with long time ago, but never really had the possibility to try: eRCP.

To be honest the project looked quite dead and it took me a really long time to figure out the current way to do things best.

The best thing right now is to download the Pulsar eclipse IDE project
and install the ERCP SDK through the update site, which now is: http://www.eclipse.org/ercp/pulsar. At that point the sdk is installed.

At that point the docs tell to go under preferences->target platform and define a new target platform based on a new eRCP template. That will take the internal sdk and load it as target platform to develop against. Well, later I found out that it didn't work for me.
What worked instead was to download:
- the ercp sdk
- the win32 runtime
- the windows mobile runtime
and add those to the target platform configuration. At that point I was ready to develop.

First thing I wanted to run the demo codes, that can be found in the ercp cvs at dev.eclipse.org.

So simply create a cvs repo with:
host = dev.eclipse.org
repo path = /cvsroot/rt
using anonymous user and browse the HEAD into the org.eclipse.ercp folder to checkout as a project the org.eclipse.ercp.app application. That way you can run the example applications on your windows pc.

Obviously you want to run them on the mobile devide. Ok, that was trickier.

First thing you need to upload top the device (let's say in the root folder) the eRCP folder that can be found inside the windows mobile runtime downloaded before. That one contains also the example runner files.

The few examples found all make use of the J9 IBM environment to run the eRCP demos. Well, that one is not open source and also not free right now. But it seemed the only possible way to go. I tried to use the J9 bundle that gvSig mobile is using but was not successful. Being in need to really know if eRCP is a way to go, I finally decided to buy the J9 environment (I hate to buy things when I don't even know if I will ever need them!). Once bought, I installed it on the Juno and was looking forward to see the examples work.

Well, that also didn't happen. The launcher crashed and I was getting more and more frustrated. But I spent money and now it HAD to work. So I started to search for solutions for the J9 crashes.

That was the moment when the following two blog posts came in my way:
Phoneme advanced and eSWT Running Under x86 Windows
Running eRCP with Phoneme Advanced on your mobile phone

This man, apart of writing amazing posts, made me feel stupid for having bought something I didn't want (I deserve it), but also really solved my issues.

From the phoneme I donwloaded the right cab, uploaded it to the juno and installed it.

I then had to change the launcher links of the examples a bit from:

37#"\Program Files\J9\FOUN10\bin\j9.exe" -jcl:foun10 -cp \eRCP\startup.jar org.eclipse.core.launcher.Main -application org.eclipse.ercp.eworkbench.eWorkbench -console

to:

37#"\Programmi\pMEA FP\bin\cvm.exe" -Djava.specification.name="J2ME Foundation Specification" -cp \eRCP\startup.jar org.eclipse.core.launcher.Main -application org.eclipse.ercp.eworkbench.eWorkbench -consoleLog

And it finally worked!! Being an RCP developer for the uDig project I really love the eRCP approach. Now I just have to understand how to take pictures in windows mobile from eRCP and then I am really happy.

I hope this can help someone else to don't lose maoney and time in trying just to make some demo code run.

Saturday, July 2, 2011

On your marks, get set... spatial toolbox on the line

Doing the last piece of migration JGrass into uDig, i.e. the Spatial Toolbox (aka. OmsBox) has been a lot of pain. One of those things in which the last 2% cost you almost as much as the 98% before.
We have been using the toolbox in testing now almost half a year now and finally today the last bits have been placed in the proper locations:

* the PSC has reviewed and accepted my plugin
* the code is inside the main uDig repository
* the libraries needed have been sorted out
* a new release of jgrasstools has been made to be aligned with the uDig libs (0.7.1)

and...

* the uDig help page that is required by the heavy metal Jody Garnett reviewer (thanks for helping) is also there. It can be found here.

Tomorrow we should be able to tag a snapshot release and on tuesday we should have the release ready for the Osgeo DVD. I think I will soon sleep much better...

Saturday, June 11, 2011

LIDAR data & jgrasstools and uDig

Well, we always like to look at things from different perspectives. And we are really fast when we use our own tools, that we can bend and change to our needs.

We are slowly bringing some las reader we wrote into the jgrasstools family, so that we then can add some analysis support. Sure thing nothing to do with the great laslib project, but it is handy for us to be able to certain tasks without dependencies and most of all be able to chain results into other modules directly.

So a first test takes 22M of points, filter them down to 12M (only first impulse) and splits them over 1M points shapefiles. I tried to write one single shapefile, but the geotools shp writer simply froze :) Will have to investigate further.

One thing uDig is really one of the best at, is to visualize HUGE amount of features. I am always amazed to see how well it does in that. Here 10M points loaded after properly stiling them by quantiles:



Yes, it already look nice for a first test. Zooming in it looks even better:



Yes, yes, shapefiles are maybe not the best format to use in this case, but hey, I really enjoy to play around with them to have a better feeling about what I am dealing with.

Well, this is a starting point. Let's see were it leads to...

Tuesday, May 24, 2011

OMS3 Grass modules Wrapper at Prague GRASS-Hackfest

Last week I took part at the GRASS Community Sprint. As every sprint I took part at, it has been an amazing experience and it has been good to catch up with "old" grass developers I knew and to get introduced to some really great "new" developers.

At the sprint I wanted to wrap all the grass modules in an OMS3/jgrasstools wrapper. Well, I had only two days to code on it, so I am not exactly where I wanted to, but lot's of stuff is already working and I can show you some stuff already loaded in the OmsBox:

Running r.watershed from within uDig:



And the result:



If you want to know what OMS3, jgrasstools and the omsbox are, you are invited to have a look at the presentation I gave at the Geoinformatics FCE CTU 2011.

While in the screenshots you can see the modules inside the OmsBox (just so it looks nice), the result is a very small java package that depends on no big library or toolbox, so that the whole java world can take advantage of this. Amen!


I would also like to thank personally the sponsors that helped out:
GFOSS.it Associazione Italiana per l'Informazione Geografica Libera
Stefan Sylla, sylla-consult, Frankfurt, Germany
R3 GIS, Merano, Italy
FOSSGIS e.V., D-A-CH

Wednesday, May 18, 2011

rst2pdf for presentations: installations and svg usage

Lately I tried out reST after a hint of good man Paolo Corti.

After some startup problems I am now really satified with the results. Amazing over all the possibility to embed svg files instead of images. My diagrams now really rock!

Not being a Python guy I had some problems to install rst2pdf. Well, in linux it is easy like:

sudo apt-get install python-pip python-virtualenv
sudo apt-get install python-matplotlib python-scitools
sudo easy_install rst2pdf
and the dev file if they are not installed already sudo apt-get install python2.7-dev

but in windows I had several problems with error messages. I will have to try again and update here the procedure.

When using svg images, I was getting missleading errors which then got solved by running with the -e inkscape switch.

rst2pdf -s 2011_05_19_Geoinformatics_FCE_CTU.style -e inkscape 2011_05_19_Geoinformatics_FCE_CTU.rst

Yes Martin, the first presentation done with reST is for you :)


-------------------
UPDATE 2011/10/06

The workflow to install rst2pdf on a windows machine was the following:

- install python 2.7.2 (for 32 bits for God's sake!!!)
- follow http://pypi.python.org/pypi/setuptools#windows
- (install mingw???)
- easy_install.exe PIL
- easy_install.exe rst2pdf
- install inkscape


I wasn't able to install matplotlib so that it would work in rst2pdf on windows up to this point.


-------------------
UPADTE 2012/11/12

Just installed rst2pdf again and got this error:

  File "/Library/Frameworks/Python.
framework/Versions/2.7/lib/python2.7/site-packages/rst2pdf-0.92-py2.7.egg/rst2pdf/styles.py", line 527, in __init__
    reportlab.platypus.tables.
CellStyle1.fontname=self['base'].fontName
AttributeError: 'module' object has no attribute 'CellStyle1'

And found the fix ready in the tracker:
 
And indeed it has no such attribute. Changing line 527 to refer to CellStyle.fontname (no numeral 1) fixed the problem.


UPDATE 2011/09/02

Due to a strange docutils-python mismatch, rst2pdf is no longer working for me, because one of the used functions changed signature.

The error I get is:
Traceback (most recent call last):

  File "/usr/local/bin/rst2pdf", line 9, in 

    load_entry_point('rst2pdf==0.16', 'console_scripts', 'rst2pdf')()

  File "/usr/local/lib/python2.7/dist-packages/rst2pdf-0.16-py2.7.egg/rst2pdf/createpdf.py", line 1452, in main

    numbered_links=options.numbered_links,

  File "/usr/local/lib/python2.7/dist-packages/rst2pdf-0.16-py2.7.egg/rst2pdf/createpdf.py", line 169, in __init__

    get_language (self.language)

TypeError: get_language() takes exactly 2 arguments (1 given)


The solutions was given by the author of rst2pdf and consists in opening the file createpdf.py (which in my case is in

/usr/local/lib/python2.7/dist-packages/rst2pdf-0.16-py2.7.egg/rst2pdf/createpdf.py


) and add at line 66 (right below the line

from docutils.transforms import Transform


) the following lines:

import docutils

if docutils.__version__ >= '0.8':

    orig_func = get_language

    def get_language(arg1):

        return orig_func(arg1, None)







Monday, May 16, 2011

The first release of jgrasstools is out



The first official release of JGrasstools has been released as 0.7.0.

We have worked about a year to prepare not only the algorithms contained in this release, but also the supporting the evolution of the OMS3 framework to gain the main objective of the JGrasstools library: the possibility to link together models in a most possible flexible way, being it along a timeline or in standalone mode, being it in complex and recursive way or in simple standalone mode.

JGrasstools represents the effort to extract the processing power of JGrass to library level.

For documentation, downloads, you can read the whole story at the release notes page.