Making sense of openstreetmap ski data

Some Opensnowmap.org services now rely on a smarter pistes search API than previously. It’s not replacing a Xapi or Overpass API, but is oriented toward a webservice that allows one to find what people usually calls a ‘ski piste’.

On Opensnowmap, there is less redundant search results when searching a piste by its name. It’s the same for pistes information and route description when you click on the map. Also, the search function is now a bit tolerant to typos.

A piste API ?

Well, it’s a big word for a python CGI making requests to a slightly modified pgsnapshot database.

Simplify search results

What happens if you search for a piste named ‘Pauvre Conche’ in openstreetmap data? You have 4 alpine pistes results: two easy ways, and two intermediate one. The new API then check if these ways touch each other, and if they share the same tags. If it is the case, they are concatenated. These give only two ‘pistes’ the blue one and the red one for ‘Pauvreconche‘.

Also, some pistes are mapped as ways, other as relations. There is even some people that map the pistes as both way and relation, both with the same name. Now the list of result can be filtered to remove the ways if they belong to a relation. This means that the piste ‘Le Vourbey’ can be found as a single result, omitting the way ‘Chemin de coupe le Vourbey’ part of the relation ‘LeVourbey’. However, if you use the routing feature of Opensnowmap, then the results will emphasize the way tags, but still show you that the way belong to a relation.

This will hopefully gives a user what he or she is looking for: a ski piste, not ways or relations.

Typos

This is easy: Postgres provides the module pg_trgm that does a pretty decent job.

Performance

Some burden in filtering the results have also been moved from the client(your browser) to the server. Also, geometries are sent as encoded polylines instead of wkt to reduce bandwidth consumption. Nevertheless, some filtering process can be long, so the API restrains itself to process only 50 OSM elements (ways and relations, before filtering) per request to ensure areasonable response time. So you won’t be able to find all the piste named’Loipe‘on Opensnowmap.org website. If needed you can add &limit=false to the query.

1 thought on “Making sense of openstreetmap ski data”

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *