Summer with MAPS Part 1
22 May 2014Hi all!!
This is my first report on working on GNOME Maps. I have worked on a few features which I will be describing below.
Querying of POIs
I wrote a gjs overpass query manager (a wrapper perhaps) that fetches the POIs provided by OSM using the Overpass Query Language. Basically, it can be configured to add types of POIs(tags) that needs to be fetched from the overpass, takes as input a Bounding Box and it will generate the corresponding URL containing the query that can be understood by Overpass.
The code can be found here.
A simple usage demo
let QM = new Overpass({
'timeout' : 600,
'outputCount' : 1000,
'outputFormat' : 'json'
});
QM.addSearchTag('amenity', 'pub');
QM.addSearchTag('amenity', 'hospital');
QM.addSearchTag('amenity', 'fast_food');
QM.addSearchTag('amenity', 'restaurant');
QM.addSearchTag('amenity', 'library');
let bbox = {
'bottom': 41.7,
'left': -0.4,
'top': 41.8,
'right': -88.3
};
let queryUrl = QM.getQueryUrl(bbox);
log(queryUrl);
This URL can then be queried to the server that will return the POIs as a JSON.
Selection of POIs
I wrote a couple of scripts to get the tags available in OSM and getting the count information relating to that tag. Taginfo provided a wealth of information regarding the tags. The selection of POIs is an ongoing process. Mattias, Jonas, Andreas and myself are working on selecting the best set of POIs that will be shown to the user.
Overlaying of POIs
POIs are shown on a separate layer, i.e., a layer on top of the map-tiles layer (the layer which displays the map images). This layer contains only the clickable location markers corresponding to a POI, clicking on them provides information regarding the POI.
Caching of POIs
The caching of POIs is done so that when the user pans away from a place, and then returns the overpass is not queried. It is done in a similar fashion like the tiles image caching in maps. Libchamplain provides apis for caching, so that you can write your own virtual functions on what to cache, and it will do the rest, both in memory and file system.
Rendering of POIs
Since I was caching POIs, that are nothing but a place marker in the form of JSON data, a POI renderer was required by libchamplain so that it knows how to render the data that it has cached.
One of my tasks will be to make this renderer as generalised as possible, so that it can be used for User Checkins (another Maps project by Damian) also, and possibly other things that have place information encoded as JSON.
Meanwhile, my next task would be to write a function that selects an icon for a given poi type. This function would exist in geocode-glib library, and will be using Maki POI Icons.
I will be writing another blog soon depicting more functionality I add.