Wednesday, February 25, 2015

Geopaparazzi 4.2.0 is out: never out of data in the field

When I got that odd issue on the tracker about the GPS azimuth value not being properly handled in Geopaparazzi, I didn't think that this release would have any new feature. But well, once you sit down to fix things, you see things... and once you see thing, you want things :-)

First off, some bugs should be now fixed:
  • notes halo is ignored 
  • mapview doesn't render points and tracks when returning from standby
  • while downloading remote tiles sometimes the dashboard freezes 
  • azimuth should be only one: this is a big one, since now we the azimuth is always calculated properly and when a picture is taken it will be the right one.
  • geopap sometimes crashes when taking pictures
And that is already nice, particularly the azimuth one.

But here comes the Boom:

OSM data extraction from mapsforge tiles in offline mode


The mapsforge tiles are generated on the device from a particular vector format. This means that there are information available in the database. Problem is that, very very simply put, the information contained is extracted differently at different zoom levels, because in fact the library and the format have been done that way to allow rendering performance.

But still it is possible to extract almost everything we see, which is nice.

Let's see how this works. Assume you have a job to do, are out in the field and want view information overlayed on the ortofoto pictures from the local WMS service.

Well, the map file you get from mapsforge looks like the following:


Now go in the mapvieW menu and you will find a new entry: Import mapsforge data


The import view will appear:


From the view you can see that 2 types of data can be imported: points and ways.

Points

Since the points are often visible on a different zoomlevel then the current, also 3 zoomlevels below the current are investigated to extract data and double points are not considered. So if you start this at zoomlevel 16, you will also get 17, 18, 19. Since the same are at a different zoomlevel will have many more tiles, about 10000 tiles are read to import the data.

You can add a filter text to import only tags containing a given text or exclude all those containing the text.

Points are imported in the current projectdatabase and saved as forms notes containing all the values Openstreetmap has. As such they can also be edited.


Ways

Many types of ways are stored in the mapsforge map files and many of them are actually related to areas.

The user can choose to import:
  • ways: roads, railways, cableways and similar
  • waterways: lines that represent water
  • contours: contour lines if they are available
Since these data are heavy, the data are imported into a spatialite database.
This brings up a new issue: since this release a database for mapsforge extracted data is automatically created if there is none present. You will find a database named mapsforge_extracted.sqlite always present in your maps folder. And you will find 3 layers always present in the spatialite data layers: osm_waterlines, osm_roads and osm_contours.



But let's get back to import the data. Just select the data you want to import and push the start button. In the case you selected all data types, you should see first an import dialog like this:


and then something like this:


Nice ha? :-)
Depending on what has been imported first, the labels might not be coming from the right field. In that case you can simply change the label in the spatialite layer settings.

Before we look into it, let's see what happens in the case we use a map that also shows contour lines. To do so, we want to clear those layers. The fastest way to do so is to simply delete the mapsforge database and let geopap recreate it.
So after doing so and loading a map with contours I will have the same region as:



If you now import everything available exactly as before, you will get:


To have a better idea, change the background map to something different. I also change the contours color to white:






Label support is not advanced, so they get readable only once you zoom in:




That is quite cool ha? All from offline data!!

You now might wonder why all imported notes have a (MF) in their name. That is done so one can quickly select and remove them. Believe me, that is a feature you want to have. The region I am showing you has few points and already around 50 notes have been imported. In towns this is exponential.

This anyways brings us to the next point:

Enhancement of notes handling

While working on this, I noticed that when importing notes, all my notes got hidden in the mass of imported notes. Also, many of the imported notes are POIs that I do not care about (ex. benches, towers, etc).

The current notes list didn't have the tools to handle this. So how does it work now?
Enter the new notes list:


This is how it looks like after the previous import. Somewhere there is also a note I created manually "My tiny note".

As you can see, notes can now be selected (checkbox on left). You can zoom to the note as before and all other icons are now in the last one on the right side.

If you tap it, you get a context menu:


  • Edit: as before it allows you to edit a note if it is a form note and view image notes
  • Share: share the note in social networks
  • Delete: delete the note
  • Use as selection: this gives the possibility to select only those notes that have the same name as the one used to pop the menu
  • All notes: opens a submenu for actions that apply to all notes
 Lets assume I want to remove all bus stops. I select the menu on any of the bus stops and tap on the Use as selection.

Only the bus stops will be visible and selected:






Now access the All notes menu:





well, it is quite clear what to do. Delete all selected.


What if I want to remove all mapsforge notes? Insert (MF) in the filter text and remove all selected.

Last but not least, with all this spatialite fiddling, a big help has been added for vector editing.

Import a template spatialite database

If you go in the import section, you will find a new entry: Default Database.

When hitting that, you are asked to name the new database to create, let's use testdb for the sake of this example.






Now you will have to restart geopap, sadly that is still required. One it is done, go in the spatialite database view. 3 new layer of the database testdb.sqlite will be visible:






While lines and points won't be of much use in geopap yet, you will find the polygon layer interesting, since it is editing ready. Enable editing and edit right away. Since it is a template db, the attributes table has been created as 20 fields with names from field1 to field10. As said, very simple, but in my opinion still of use when you have to quickly collect some polygon data with attributes.






That is all for this release... enjoy!!!







No comments: