Trackserver v3.0 released

Almost 14 months after the last big update, Trackserver v3.0 was released today. Since this is quite a big update, with lots of new features and improvements mainly on the presentation side, I thought I’d spend another blog post on it. If you don’t know what Trackserver is, you can read my initial blog post on it, and the update on v2.0 in December 2015. I will present some demos at the end of this post to give you a better idea.

First I will sum up some of the smaller changes. I will get to the big ones later.

  • Leaflet was updated from 0.7.7 to v1.0.3. This brings in all the great work that the creators of Leaflet have done for their 1.0 release in September 2016. For Trackserver, this mainly means performance improvements, not to mention the mere joy of having up-to-date dependencies 🙂
  • Our own hacked version of Leaflet-omnivore was synchronized with version 0.3.4.
  • The PNG images that served as markers to indicate the start and the end of a track have been replaced by L.CircleMarker objects. These objects were already used for ‘points’ style tracks that were added in v2.2 and now also for the normal markers.
  • The infobar that’s available on live maps gained some extra tags: {userid}, {userlogin} and {displayname}, only the last of which is somewhat interesting, I guess…
  • Bugfixes!

All the tracks

Perhaps the biggest change is in the communication between the server side of Trackserver and the JavaScript that is responsible for creating the maps and drawing the tracks. Trackserver has since long distinguished between 3 basic types of tracks:

  1. Static tracks from the Trackserver database, referred to by their ID
  2. Live tracks from the Trackserver database, referred to by the word ‘live’
  3. External tracks in GPX or KML format, referred to by their URL

It was possible to mix these types, but in very limited ways. On top of that, each track, regardless of the type, was downloaded separately, one HTTP request per track. For maps with a lot of tracks, that wasn’t the best design, performance-wise. Both these shortcomings led to a new scheme for getting tracks from Trackserver.

  • First of all, it is now possible to mix all types of tracks in unlimited numbers. Just specify track=a,b,c user=@,x,y,z gpx="URL1 URL2" kml=URL3 and you get them all in one map. The ‘@’ in the user attribute, by the way, is a shortcut for your own username, so user=@ becomes a replacement for track=live, and the former is preferred as of Trackserver 3.0.
  • All the tracks that need to be downloaded from Trackserver are downloaded in a single HTTP request.
  • You can show multiple users’ live tracks in a single map. The live update feature can only ‘follow’ one of them, but the red markers that mark the current locations can be clicked to start following that particular track. The infobar will display the info for the track that is currently followed. On page load, the map will follow the first user that is listed in the user attribute.
  • The new track loading mechanism makes use of JavaScript promises, which are somewhat of a novelty (Chrome >= 49, Firefox >= 50, Edge >= 14, Safari >= 10, all except Chrome released late 2016. No version of MSIE supports them). A polyfill for this is included and loaded automatically to support older browsers. There are multiple Promise polyfills to choose from on the web, but I went for this one, by Taylor Hakes.

Don’t forget: if you want to display GPX or KML files, you are bound to the limitations of CORS.

Shortcode attributes

The [tsmap] shortcode gained some attributes for more control over the maps and how the tracks are displayed:

    • As explained above, the user attibute is now used to specify one or more users’ live maps. You need the ‘trackserver_publish’ capability to publish other people’s tracks. This capability is granted to administrators and editors by default.
    • The live attribute can be used to force enable or disable live-updates. For example, this can be used to turn any track (even an externally hosted GPX file!) into a live track.
    • The zoom attribute can be used for some control on the initial zoom factor when the track is first drawn. This is most useful with maps that have live tracks, because Trackserver would normally zoom in on the latest position in the track, rendering other tracks invisible without zooming out first. For live maps, the argument to the zoom attribute is absolute: what you set is what you get. For maps that have no live tracks, the behaviour is a bit different. By default, Trackserver chooses the zoom factor that makes the best fit for all tracks combined. In this case, the zoom attribute serves as an upper limit, a maximum zoom level, so you can use it to zoom out (but not in) the initial view.

Tracks with style

Trackserver already had some options to style your tracks: markers, color, weight, opacity and (since v2.2) points. However, these style options were per-map, rather than per-track. You would have all markers, or no markers at all. You could have really fat, purple lines for your tracks, but you would have them for all tracks.

Not any longer.

All the styling options now support comma-separated lists of values. Multiple values in such a list will be applied to the specified tracks in order. For example:

[tsmap track=1,2 color=red,#8400ff weight=1 points=n,y]

will draw two tracks on the map: ID 1 in a really thin red line and ID 2 in a collection of purpleish points. I think you get the idea. If less values than tracks are given, the last value is applied to all remaining tracks, so track=1,2,3,4,5 color=red,blue will give you one red track (ID 1) and four blue ones (IDs 2-5).

There is one thing to keep in mind though, when you specify multiple values. While track order will be preserved within each track type, different track types are evaluated in a specific order, and styling values are applied in that order too. The order is:

  1. Static tracks (track=a,b,c)
  2. Live user tracks (user=x,y,z)
  3. GPX tracks (gpx=…)
  4. KML tracks (kml=…)

Example: [tsmap gpx=/url/for/file.gpx user=jim track=10,99 color=red,blue,green,yellow]

In this case, the GPX track will be yellow, Jim’s live track will be green and tracks 10 and 99 will be red and blue respectively.

GPX downloads

Trackserver has a new shortcode: [tslink], perhaps not the most intuitive name. This shortcode produces a link, with which the specified tracks can be downloaded as a GPX file. Other formats are on the horizon, please open a feature request issue on Github if you need a specific format. [tslink] is used almost the same as [tsmap], except that it lacks all the styling attributes.

[tslink track=12,87,525 user=patrick]

will give you a link to a dynamically generated GPX file, containing tracks with IDs 12, 87 and 525, as well as Patrick’s latest track. There is also a class attribute that can be used for styling the resulting <a> element, and a format attribute whose only valid value is ‘gpx’ at this time.

What do you think?

If you use Trackserver, I would LOVE to know about it!! If you have problems with it, please open a support request or an issue in Github. If you are happy with it, please leave a review. And if you absolutely love it, please consider a small donation to support development. It will be much appreciated!

Demo time

A bigger collection of demos can be found on this dedicated demo page, but here are just a couple of them to give you an idea:

[tsmap user=trackserver1]:


[tsmap track=564,575,656,657,658,625,627,628,629,622,623,624,619,618,620,621,647,630,646,648,653,655 color=black,blue,red,green,#8400ff weight=2 continuous=y opacity=1]


Le Corbier, 2 January 2017

Snow conditions could have been better…

(360×180 degrees panorama shot with Google Camera on Android, no tripod, displayed with Pannellum)

Photo spheres met Pannellum

Google Camera Photo Sphere

Een paar dagen geleden vond ik op ‘t web Pannellum (“A Lightweight Panorama Viewer for the Web“), en het leek me leuk om daar eens mee te spelen. Daarom heb ik van LEGO® iets geknutseld om mijn telefoon op mijn foto-statief te bevestigen en ben ik met Google Camera aan de slag gegaan. Deze app maakt het erg eenvoudig om photo spheres (360×180 graden panorama’s) te schieten. Het resultaat is een JPEG in de zgn. afstandsgetrouwe cilinderprojectie, oftewel in beter begrijpbaar Engels: de equirectangular projection.

Dit plaatje kan zo met Pannellum worden weergegeven, alleen zijn er limieten op de grootte van de plaatjes, en die zijn per device verschillend. Op mijn PC is dat 4096×2048, en op mijn Android telefoon 2048×1024, voor een volledig 360×180 graden-panorama. Pannellum ondersteunt in een eigen formaat ook multi-resolution panorama’s, maar voor het gemak heb ik maar de grootste gemene deler gepakt en dat is 2048×1024.

Zie hieronder het resultaat. Uiteraard zijn de foto’s niet perfect; zowel de manier van schieten als de software hebben wat beperkingen, maar ik vind het niet onaardig. Klik op het vierkantje in de viewer voor full-screen weergave.

Ik heb overigens ook een poging gedaan om met een DSLR een serie plaatjes te maken, en deze met Hugin aan elkaar te plakken, maar dat brengt weer nieuwe uitdagingen met zich mee. Ten eerste heb je eigenlijk een panoramic head nodig voor je statief, en ‘t is een secuur werkje om alles er goed op te krijgen, zeker als je de volledige 180 graden verticale field of view wilt hebben. Wellicht is dit voer voor een latere post.

 
 

Nederland Anno 2016

Met het verergeren van de situatie in Syrië en Irak en het toenemende aantal vluchtelingen dat naar Europa en naar Nederland komt, stijgt de populariteit van de PVV en polariseert de samenleving. “Links” en “rechts” (tussen aanhalingstekens, want zo simpel is het natuurlijk niet) maken elkaar uit voor alles was lelijk is, alleen gaat “rechts” nog een stapje verder, met het verstoren van democratische processen en het plegen van terroristische aanslagen op AZCs.

Ik probeer uit alle macht te begrijpen wat die mensen bezielt, maar het lukt me niet. Ik ben uiterst voorzichtig met mensen “dom” te noemen, maar ik zie bij de hard schreeuwende PVV-aanhang maar weinig oog voor de realiteit en vooral heel veel ongefundeerde boosheid en angst. “Het volk” (wederom tussen aanhalingsteken, want laat duidelijk zijn dat hiermee lang niet het gehele Nederlandse volk wordt bedoeld, al lijken Wilders en zijn aanhang te denken van wel) vindt, dat de politiek niet naar ze luistert. En wie niet luisteren wil, die moet maar voelen. De columnist Laurens van Voorst schreef het laatst al eens treffend op, maar “het volk” heeft geen idee waar het allemaal over gaat. Iedereen heeft een mening, zonder zich te verdiepen in de materie. Dat vind ik jammer. En dom.

Wat helaas wel pijnlijk duidelijk wordt, is dat er in Nederland erg veel racisten wonen. Mensen die zich in hun denkbeelden laten leiden door hun onderbuik en zich laten meeslepen in de waan van de dag. Mensen met weinig tolerantie, die vooral voor zichzelf kiezen en bang zijn voor- of een hekel hebben aan alles wat “anders” is. Die mensen voelen zich nu gesteund door Geert Wilders en gaan zonder schaamte de straat op om de ruiten van het gemeentehuis in te gooien en de politie te bekogelen met vuurwerk. Het blijkt weer dat mensen erg veel moeite hebben om hun emoties onder controle te houden. En dan vinden ze het gek dat politici niet naar ze willen luisteren. De rechtsstaat komt op deze manier vrij ernstig in gevaar, en dat is Wilders en de PVV zwaar aan te rekenen.

Overigens roepen deze mensen ook hard dat ze vooral géén racisten zijn. Nee, ze willen gewoon geen islam in Nederland. Want moslims, dat zijn terroristen en verkrachters. En die “gelukszoekers”, die moeten hun geluk maar ergens anders gaan zoeken, maar in ieder geval niet in hun wijk. Sorry hoor, maar als je vindt dat alle mannelijke asielzoekers zonder aanleiding moeten worden opgesloten, dan ben je zo ongeveer per definitie een racist.

Ik denk dat iedereen zich wel eens afvraagt hoe het allemaal moet. De antwoorden liggen niet voor de hand. Hoeveel asielzoekers komen er nog? Hoe lang blijven ze? Hoe geven we die mensen een huis en een baan zonder Nederlanders te discrimineren? Hoeveel moet dat allemaal niet kosten? Criminaliteit? Feit is, dat je er op verschillende manieren met deze vragen kunt omgaan, maar je kop in het zand steken, doen alsof ze er niet zijn, of ze wegpesten, lijken me in ieder geval niet de juiste manier.

Natuurlijk zullen er incidenten zijn, en natuurlijk kan niet alles perfect geregeld zijn en probleemloos verlopen. Asielzoekers zijn, net als autochtone Nederlanders, mensen, en die hebben, net als  autochtone Nederlanders (of misschien nog wel vaker) wel eens moeite om hun emoties onder controle te houden. Deal with it. Normen en waarden kun je uitdragen. Criminaliteit kun je bestraffen, daar hebben we politie en justitie voor. Geld voor opvang en integratie is écht niet het grootste probleem. Verder lijkt het mij vooral fijn, als we er met z’n allen voor zorgen dat Nederland een leefbaar land blijft. En dan bedoel ik niet dat we zo weinig mogelijk asielzoekers moeten toelaten of de islam moeten uitbannen, maar dat we vooral een beetje tolerant zijn naar de mensen om ons heen en het hoofd een beetje koel houden. Elkaar met wat waardigheid en respect behandelen. De democratie zijn werk laten doen en de ruiten van het gemeentehuis heel laten. Gewoon een beetje normaal doen. Niet al te moeilijk toch?

Ik ben veel banger voor grote groepen boze bange mensen en voor politieagenten met zware automatische wapens, dan voor alle asielzoekers in Nederland bij elkaar. Ik ben veel banger voor types als Geert Wilders, die de rechtsstaat ondermijnen met opzwepende praatjes en discriminerend getoeter, dan voor alle moslims in Nederland bij elkaar.

Tot slot nog een quote van een boze PVV-aanhanger, die een fragment uit een programma van Paul de Leeuw op Youtube heeft gezet, wat illustreert hoe misleid sommige mensen blijkbaar zijn: “90 procent van de mensen in ons land delen het gedachtegoed van geert wilders maar worden emotioneel gechanteerd door hun geitenwollensokken omgeving en zijn bang slecht te zijn om zo te denken.” Als je dat écht denkt, dan ben je ook wel écht gek.

Trackserver v2.0 released

This evening, I released Trackserver version 2.0. If you don’t know what Trackserver is, please read my introductory post.

The v2.0 update contains many changes and some interesting new features:

  • It is now possible to add multiple tracks to a single map, by giving a comma-separated list of track IDs to the track parameter of the [tsmap] shortcode. You can also mix static tracks and live tracking in a single map, for example [tsmap track=12,84,live]
  • For maps with track=live, an information bar can be shown at the top of the map with some data about the latest track point. Add infobar=yes to the shortcode parameters. The content of the infobar can be formatted using a template that can be specified in the Trackserver user profile.
  • Experimental support for the SendLocation iOS app. This has not yet been tested with the actual app, but it works in theory. Please test this if you own an iOS device and a willing to spend the 99 cents for the app.
  • Upload via the WordPress admin and HTTP POST now accept GPX 1.0 files in addition to GPX 1.1. It seems that some modern software (most notably Viking) still creates GPX 1.0 files 🙁
  • The Leaflet JavaScript library was updated to v0.7.7 (a minor update)

Some bugs were fixed too:

  • The track management page in the WP admin gained a lot of speed through some indexes on Trackserver’s database tables.
  • Fixed a bug in the handling of OsmAnd’s timestamps, that caused an integer overflow on 32-bit systems.

Under the hood, there were some changes too.

Trackserver is now capable of using GeoJSON, rather than Polyline encoding, for getting tracks from the server to display them on a map. However, the benefit of this is somewhat limited. GeoJSON is human-readable (sort-of) but it is also a multitude bigger than Polyline, so for performance reasons, the default is still Polyline.

Trackserver has always tried to determine whether its JavaScript files (including those belonging to Leaflet and its plugins) are necessary on the current page, and to not load them if they are not. It appeared that there are quite a few possible ways in which this detection mechanism could fail, and maps could not be displayed even though they should. Version 2.0 has two ways to mitigate this problem.

First, there is the new [tsscripts] shortcode, that forces Trackserver to load its scripts and CSS, even though the [tsmap] shortcode is not detected. Use this if all else fails. Second, there is an alternative detection algorithm, that can detect the use of the [tsmap] shortcode much more reliably (should be 100%) but has the disadvantage that Trackserver’s CSS cannot be loaded in the <head> of the HTML document anymore. So, neither solution is perfect and that’s why they’re both there.

The technical background story to this problem is, that some WordPress plugins and themes use custom WP_Query objects. This means that the actual list of posts to be displayed can be totally different than what WordPress initally thinks it should be. The initial shortcode detection can only look at the initial query, so any changes that add or remove posts from the query will surely confuse the detection algorithm. The alternative detection just uses the actual shortcode handler to initiate the inclusion of Trackserver’s JavaScript and CSS, but since this handler runs during the rendering of the page, long after the <head> section is printed, the CSS is loaded very late in the document. I am not sure whether this is a big problem, but opinions seem to differ on the subject, and loading CSS in the <head> is still best practice, so Trackserver will try to do that whenever possible.

Please test Trackserver v2.0. If you find any problems, please open a support ticket on the plugin page, or open an issue on Github.

And here’s a map for you 🙂