Wednesday, November 30, 2016

Course slides: Geographic Scritping in gvSIG - halfway between user and developer



Last week I gave a one week course about geographic scripting with gvSIG at a Master course of the University of potsdam.



As usual I want to share the material to those interested in looking at the course contents from home.

Leaving out the first introduction parts that do not involve any code, here are the good parts of the course:

The 3rd part introduces gvSIG's composer and a bit the language used: python

PART 3: THE SCRIPTING COMPOSER AND PYTHON

The 4th part dives into building of geometries and reading and writing of shapefiles.

PART 4: GEOGRAPHIC SCRIPTING

The 5th part gives an insight about raster data handling for scientific purposes.

PART 5: RASTER DATA

Part 6 has a few extras, like doing some charting and writing libreoffice spreadsheets

PART 6: FROM GEO INTO YOUR REPORT

I hope you will enjoy this course, it is a very practical one and therefore packed with tons of working code snippets.

Obviously, if you want me to come to your university giving the course, just get in touch with me. :-)




Monday, June 13, 2016

Extrusion for the 3D vector view in gvSIG

As some of you might know already, some time ago we started to migrate all our tools (JGrasstools and Geopaparazzi, as well as the Nettools) to gvSIG. We are quite young in this community and we joined as an official member the gvSIG Association only at the begin of this year.

In the meanwhile we brought geopaparazzi support, the JGrasstools based Spatial Toolbox and the Epanet part of the Nettools into gvSIG.

Recently we were involved by one of the other association members, the Spanish Company DISIS, to develop with them the extrusion part for the 3D vector viewer integrated in gvSIG.

I am really thrilled by this cooperation, which brings us one more step towards the core of the community and also shows that there is movement in the gvSIG related Open Source Market.

A few notes about the extrusion plugin

From the version 2.3 of gvSIG on (well, right now the official release is not yet out), a 3d is available which allows the user to visualize layers in a Nasa World Wind 3d view. The user can select several loading modes for the layers.

The 3d properties of a vector layer can be accessed by right clicking on the layer and accessing the Properties entry in the context menu. By default the 3D tab will show up like this:




At the current time there are 3 different loading modes for vector layers:
  1. Rasterized vector: the gvSIG vector layer will be rasterized as an image over the 3d view
  2. Vector: the features from the gvSIG vector layer will be transformed into 3d vectors and loaded in the 3d view
  3. Extruded Vector: the features from the gvSIG vector layer will be transformed into 3d vectors and loaded in the 3d view, with an applied extrusion, in order to obtain an effect of volume.
Since I have been working on the last two modes, I will give a quick insight on those.

Vector

The Vector loading mode presents the following user interface:



The altitude of the features can be defined by two factors (and also be the sum of both):

  1. the 3rd dimension of the geometry, if available (3d shapefiles for example)
  2. the Constant Height parameter

There are 3 available elevation modes, which will consider the altitude differently:
  • clamp to ground: in this case the features are clamped to the elevation model currently used in the 3d view. In this case the altitude definition will not be considered.
  • absolute: in this case the elevation of the vector is given by the altitude, defined as absolute elevation over the sea level.
  • relative to ground: in this case the elevation of the vector is given by the altitude, defined as relative elevation over the terrain.

For example this is how the clamp to ground option would look like:
 


We can see that the very coarse default terrain model in many parts covers the vectors. In this case it is possible to set the mode to relative to ground and apply a constant height to solve it:





Extruded Vector

The extruded vector loading mode adds a couple of parameters to the user interface:
 

In this case the altitude of the features can be defined by four factors:
  1. the 3rd dimension of the geometry, if available (3d shapefiles for example)
  2. a Height Field from the attributes table
  3. the Constant Height parameter
  4. the Vertical Exaggeration, which is a multiplication factor applied to the height

There are 2 available elevation modes, which will consider the altitude differently:
  • absolute: in this case the elevation of the vector is given by the altitude, defined as absolute elevation over the sea level.
  • relative to ground: in this case the elevation of the vector is given by the altitude, defined as relative elevation over the terrain.
For example, if we select the relative to ground option and apply an height field that contains the building heights, this will look like:


Again we can apply a constant height to elevate the features over the terrain. Let's also try to use the number of the floors of the buildings instead of the altitude. In this cas we can apply a vertical exaggeration of 3 meters to simulate the correct building altitude:




Other examples

Example of a lines layer of isolines that have 3d coordinates. Here the extruded mode was selected and the absolute elevation mode was picked adding also a constant height of 50 additional meters:





The same layer and parameters, but without extrusion:





An example of points layer that do not have 3rd coordinates, but an absolute elevation in the attributes table. In this case the extrusion was picked and the absolute height taken from the elevation field in the attributes table:



Since the elevation is the one of the terrain, it is not possible to appreciate the extrusion effect. By adding a constant height to add as an offset, this is solved:






There is also a short video that shows 3D extrusion in gvSIG live here.

Acknowledgements



It has been great fun to implement this and also helped me know a new piece of the gvSIG internals, which is quite important right now.

So thanks to DISID for this, since our involvement in gvSIG they have always been very supportive to involve us and teach us to get up and running as fast as possible.


Wednesday, April 20, 2016

Geoss2Go: a survey organizer and configurator for Geopaparazzi

If you are a Geopaparazzi user you might have dreamt many times of something that would allow to configure geopaparazzi for a particular survey with few clicks.

Well, you might remember that HydroloGIS participated to the MYGEOSS call for innovative apps by the European Commission and was one of the winning teams.

The result of all this is the app Geoss2Go and in this post I will explain you what it is capable of. Fasten your seat belts.

Installation


Geoss2Go can be simply installed from google play.

If one doesn't have access to google play, an APK binary ready for installation can be downloaded from the github releases page.

Create a new profile

Once launched, Geoss2Go will present the following view:




To create a new profile we can simply push the red button on the upper right part of the view.

Once pushed, the main profile info dialog will pop-up. There the user can insert a profile name and some description about the profile:



Once ok is pushed, the empty profile is created:

The profile's cardview gives information about its content, listing the number of basemaps, spatialite databases and forms.

Delete a Profile

Through the trashcan option it is possible to delete any loaded profile.

The user will be prompted to make sure profiles are not removed out of error:


  


Styling the Profile

Geoss2Go allows for a very simple styling. It is possible to apply a color to the profile cardview, in order to have a better visual feedback (colors are often useful to define categories).

Also the color plays and important role during the interaction with geopaparazzi.

By selecting the color palette button, the color selection dialog will pop-up:



Once pushed the ok button, the profile cardview will appear colored:

Adding data to the profile

To add data to a profile, the user needs to push the settings icon (the upper right icon of the cardview).

The view the opens is divided in different tabs, namely:


  • PROFILE INFO
  • BASEMAPS
  • SPATIALITE DATABASES
  • FORMS
  • PROJECT


Let's have a look at each of these.

Profile info

In this tab the main information about the profile are visualized:


  • name
  • description
  • creation date

Name and description can also be modified from this view, while the creation date is readonly.

From this tab it is also possible to activate the profile through the switch at the bottom of the view.



Since only one profile can be active at a time, the activation of a profile automatically disables the previous active profile, if there had been one.

Once a profile is active, in the main view it is marked with two red lines in the top and bottom part:

Basemaps

The Basemaps tab gives the possibility to add raster background maps to the configuration. Currently supported extensions are:

  • map: mapsforge maps
  • mbtiles
  • sqlite: sqlite databases containing rasterlite2 data
  • mapurl: mapurl files that can contain configurations for local or online service (tms or wms)


Through the plus button on the top right part of the view it is possible to browse the device's filesystem and select the resources to add.



It is possible to import mapurl definitions directly from WMS GetCapabilities url.

To do so:


  • first copy the WMS url to the device clipboard 
  • push the ADD WMS button on the right side of the action
  • a dialog will open. Paste the url into the text field



  • push the refresh button at the left of the text field to retrieve the available layers



  • select the desired layer and push ok. The mapurl file will be created and added directly to the list of basemaps



For the above example the WMS of the Province of Bolzano has been used as example.

Spatialite Databases

The Spatialite Databases tab gives the possibility to add vector databases to the configuration.

The database has to be a valid spatialite database with the extension sqlite.

Through the plus button on the top right part of the view it is possible to browse the device's filesystem and select the resources to add.



Forms

The forms tab gives the possibility to add a json file of forms definitions to use in the profile.

Once the file is added (through the upper right plus button), basic information and the names of the forms contained in the file are shown:



Project

It is also possible to bind a profile to a single project database. This happens only in the case in which the user selects a geopaparazzi database in this tab. In that case, as we will see later, from within geopaparazzi it will no longer be possible to open an existing project or create a new one.



Import and Export profiles

It is possible to import and export profile definitions. In the main view from the context menu in the actionbar, the two entries related to import and export have to be used.

Export

When pushing the Export Profiles menu entry, the profiles definitions are exported into a fixed file in the path:

/SDCARD_PATH/geoss2go/profiles_config.json

Import

When pushing the Import Profiles menu entry, the profiles definitions are imported from the fixed file in the path:

/SDCARD_PATH/geoss2go/profiles_config.json

The imported profiles are added to the profiles already present in the app.

In order to support sharing of data and profile configurations, the path of the data contained in the imported files are adapted to the sdcard path of the current device. This way relative paths in the sdcard are maintained and datasets can be loaded.

We will see this in the demo set showcase. In that case you download and import data that someone else prepared, but they will work in your device, even if the paths of the data refer to a different sdcard path.

Try it out with a demo project

To give you a better understanding about the possibilities of geoss2go, we prepared a demo profiles set for you.

Before starting with this make sure you have both geopaparazzi and geoss2go.

To go on it is mandatory that you run each app at least once.

Then download the profiles_config.json file and save it inside the folder:
/SDCARD_PATH/geoss2go

Download the demo dataset zip and extract it on your device's sdcard.

Once these steps were completed, inside the sdcard you should find, beyond others, the following structure:
sdcard
   |
   |-- geoss2go
   |        `-- profiles_config.json
   |-- geoss2go_demo
   |        |-- vienna
   |        `-- bolzano


If the above structure has been successfully created on your device, you are ready to import the demo profiles configuration.

Launch geoss2go and from the main view context menu select the Import Profiles entry.



Once run, the demo projects should have been instantly added to your main view:



Demo Bolzano

Let's have a look at the demo bolzano profile. It is actived already.

In the basemaps tab we find several layers coming from online mapping services:



In the spatialite databases tab one database is present:



The profile has also been personalized with a specific set of forms for the survey:



From the info available we know that there will be 3 different forms available in this profile:


  • Generalita' evento
  • Scheda danni
  • Colata detritica


No project file has been defined in the PROJECT tab, which means that with this profile, we can use any project we want and also create new projects.

Demo Bolzano in Geopaparazzi

So what happens once we launch geopaparazzi? Well, apparently nothing:



But the devil is in the details and as we recall, the profile defined 3 things:

  • basemaps
  • spatialite database
  • forms

So let's have a look at the available tile sources. They are available through the first icon in the actionbar:



As one can see in the image below, the only available data sources are the ones defined in the profile.



Usually Geopaparazzi has an add datasource button in this view. But when a profile is active, only those datasets can be used. No other dataset can be added or removed.

Well, once I select for example the source OI.ORTHOIMAGECOVERAGE.2011 and go to the mapview, I will be presented with the following nice map:



In background the aerial imagery is visible, which was expected. But what are those overlays?

Obviously the spatialite database! To have a look at it, we can access the context menu button and then select Spatialite data list from the menu.

Again we will be presented with a blue view, where the blue reminds the user about the fact that a certain profile is being applied.

The spatialite view shows one database with 4 tables, which are the ones visible in the map.



As for the basemaps, also here it is not possible to add or remove tables and databases.

Last but not least, also the forms have been personalized by the active profile.

If we try to add a new form based note from the mapview using the add note button:



The add note view will also appear personalized with blue background. And the available froms will be the ones defined in the profile:



If we open a form, the usual form layout will be presented:



Demo Vienna

Let's have a look at the demo of Vienna dataset. To do so you need to open geoss2go again and activate the right profile.

By now you should be able to do that and the result should look like:



Have a look at what is inside this profile. You might note, beyond other things that no form has been defined, but a project has been added.

Let's have a look what that means inside Geopaparazzi.

Demo Vienna in Geopaparazzi

Since the demo vienna profile had defined a fix project, Geopaparazzi needs to tell that the user once it opens. It does so by placing in background the color of the profile:



Exactly the same as for the Bolzano demo, the basemaps view only presents the sources defined in the profile:



And if we select the ortophoto, we will see the following in the map view:



Again, as for the Bolzano demo, a whole pile of vectorlayers are available from the profile definition. Since the Vienna demo has been though of as a sightseeing profile, data as museums, bikeways, campings and even the famous Xmas markets are available.



Conclusions

Geoss2Go can be an extremely powerful tool for professionals to better organize their work. But it can also be used to plan vacations (I do it), to keep data organized in categories, by nation, by project, by whatever necessary.

Together with Geopaparazzi it gives the possibility to standardize the layout of surveys for teams in a simple and effective way. Installing datasets and survey forms has never been that simple (remember the demo profiles import?).

We hope you will enjoy this app as much as we are already...



Friday, April 15, 2016

Geopaparazzi 5 is out! We are ready for Android 6!

To be honest I don't even know where to start from. This release has so many news against the previous one that it would need a complete review. And since it took so long to create this release we didn't even have time to update the user manual...

So let's just try to browse in a random way though some of the new features and the new look and feel of Geopaparazzi 5.

This is how it looks like: 


The look and feel is much smoother:


And the action bar now holds the context menu:






A big news for this release is that the datasources don't have to stay inside a dedicated maps folder. And more important, they are not scanned and checked all at every startup.

At first startup only the basic online mapnik datasource will be available:


 
but it is now quite simple to browse the device and choose supported datasources:



and have them available directly:


On long tap resources can be removed from the list.

Also the add note view has changed quite a bit. The simple notes are available from the actionbar on the right top part.

Form based notes now get the whole space of the view, below the switch that defines if the note is placed in the gps point or map center.


The forms view has been cleaned up:


and... it now can rotate!!! :-)


The GPS data list has been cleaned up:


as well as the track settings:


One of the biggest beauty in my opinion is the properties editor:






And the chart view has finally been reviewed and smoothing of the charts has been added:



Also the properties for the spatialite layers have been enhanced:


We have a labelling dialog:






The properties dialog adapts to the geometry type, adding fill, stroke and shape where necessary:


There is even an experimental dash pattern helper:



On the editing side of life some bugs were fixes and more important line editing has been added:






It is now possible to sort notes by proximity. To better understand, have a look at these 3 notes: Note 1, Note 2, Note 3


Please note that the map center is between note 2 and 3, while the gps position is on note 1.

Let's open the notes view by long tapping on the add note button. The view should open with the notes in insertion order:


Tap on the button in the action bar:





select the option to sort by mapcenter distance and you will find the list to be sorted like:


Need to sort by proximity with the gps position? Use the center on GPS button on the map view and you will be good.


I think this post has already taken too long. Just update your Geopaparazzi version (or install it for the first time) and play around with it. You will find those things that I forgot to mention here.

What we still need:


  • update of the user manual. I really have no time to do that right now, so if anyone is ready to volunteer, please contact me. 
  • add geopaparazzi to the f-droid project
  • language updates

Enjoy!!!!!!