Attending IndieWebCamp SF

This coming weekend I will be attending IndieWebCamp SF. I enjoy attending IndieWebCamps for my time off from my day job.

I am once again co-organizing and once again volunteering to handle the  video for the intros, sessions and demos. This means I will be bringing the equipment to record the sessions, which will be ultimately available online. You can watch our last event, in Berlin Germany, here. The intros, demos, and keynote are not yet up, but I’ve added most of the sessions. You can see examples of those at the prior event in Brighton UK, available here.

IndieWebCamps are a great place to talk about creating or updating your own website and the technologies or ideas around it. The first day involves sessions, the topics for which are chosen by the attendees. The second day is when you build and demo something you built the previous day.

It is a fun event at a minimal cost. If you are in the area, why not stop by?

 For IndieWebCamp Berlin 2 2019, I built this proof of concept feature in the WordPress Admin. It does actually work, but the functionality that enables the posting needs a lot more backend work before it will work properly.

Problem is that the WordPress post endpoint does not allow you to set a taxonomy during post creation, so I need a custom endpoint. If I need one, it needs to be a bit more fleshed out so I can use it.

I considered modifying the Micropub endpoint to accept local queries and sending everything in Micropub, but a custom endpoint seems simpler for what is being done.

 

Simple Location Version 4.0.0 Released

The Simple Location plugin adds location support to WordPress posts, users, and comments.

Version 4.0.0 adds/rewrites a lot of the plugin.

  • The timezone handling functions were updated to use backported versions of functionality introduced for WordPress 5.3.
  • Fixes related to when WordPress’s default timezone is set to a UTC offset over a timezone string. This only works if the site is running PHP5.5 or greater.
  • Add support for WeatherBit as a weather provider
  • Add support for LocationIQ as a geo and map provider
  • APIXU is now WeatherStack
  • Add elevation support to geonames provider
  • Improve sunrise and sunset functions to account for elevation and introduce new class to handle astronomical functions…plan in future to add additional for weather purposes.
  • Improve Settings page and settings page text. Page is now tabbed.
  • Add airport weather widget and refresh airport data.
  • Last Seen Widget now optionally shows local time, sunrise/sunset times and map.
  • Comments are now adjusted with the timezone of the post they are attached to.
  • Nominatim geo provider now gets admin email as required by the service
  • Timezone overrides are cached.
  • A completely redesigned settings page
  • Previously, maps were set based on width and height, now width and aspect ratio. There are several presets there. This allows for the introduction of responsive images in the future.
  • Enhanced styles for HERE Maps
  • The default map zoom level for a post will be automatically adjusted based on altitude or the accuracy of the GPS information.
  • Adding /map to a WordPress archive page will load a custom template called map-template.php, which will show all of the locations in that archive on a map, along with a location list. The map-template.php file can be added to any theme to override this.
  • The timestamp data extracted from attachments is now adjusted for the correct timezone based on the picture location if set.
  • The creation timestamp of media is now displayed if set on the media modal and edit attachment admin screens.
  • The location is now displayed on the media modal.
  • Historic location lookup in supported location providers(currently only compass). This means when you set the publish date to the past in the Classic Editor or in Micropub, it will look up the historic location if this functionality is available. Not currently in Gutenberg.
  • Default Map Zoom settings now describe scale(City, Town, Village) instead of using Zoom number levels.
  • You can now update the location of a user using geojson over the REST API, allowing it to be automatically updated by an external service.
  • Compass as a location provider can be set on a per user basis, instead of globally.
  • Weather is no longer added if the publish time is not recent. Will look into historic weather in a future update.
  • Misc bug fixes and validation checks.

Converting Google Location History into GeoJSON for Compass

After a lot of procrastinating, I finally decided to import all of my Google Location History into Compass. This meant I had to convert Google’s export format into Compass’s GeoJSON.

A few notes

  • timeStampMs is the timestamp in milliseconds.  Most functions use the timestamp as seconds, so this needed to be converted into an ISO8601 date format.
  • latitudeE7 and longitudeE7 are the coordinates, and must be divided by 1e7 in order to get the more conventional format. Also, there was an issue where some of the numbers were incorrectly exported, so there is a sanity check on that below
  • accuracy is, as suggested, the accuracy of the location
  • Finally, there is activity. I considered doing more with this, but I’m just storing it. Will explain why below the example of my simple PHP code to export.
json = json_decode( $file, true );
$json = $json['locations'];
foreach( $json as $item ) {
	$date = date_create_from_format( 'U', round( $item['timestampMs'] / 1000 ) );
	if ( $item['latitudeE7'] > 900000000 ) {
		$item['latitudeE7'] = $item['latitudeE7'] - 4294967296;
	}
	if ( $item['longitudeE7'] > 900000000 ) {
		$item['longitudeE7'] = $item['longitudeE7'] - 4294967296;
	}
	$output = array(
		'locations' => array(
			array(
				'type' => 'Feature',
				'geometry' => array(
					'type' => 'Point',
					'coordinates' => array(
						( $item['longitudeE7'] / 1e7 ),
						( $item['latitudeE7'] / 1e7 )
					)
				),
				'properties' => array(
					'timestamp' => $date->format( DATE_W3C ),
					'horizontal_accuracy' => $item['accuracy']
				)
			)
		)
	);
				
	if ( array_key_exists( 'activity', $item ) ) {
		$output['locations'][0]['properties']['activity'] = $item['activity'];
	}

For activity, it only appears on some entries, and is for the most part, accurate enough..

  "activity" : [ {
        "type" : "IN_VEHICLE",
        "confidence" : 100
      }

It notes the type of activity, and the confidence level.   However, in this example…

  "activity":[ 
    {"type":"UNKNOWN","confidence":50},          
    {"type":"ON_FOOT","confidence":36}, 
    {"type":"ON_BICYCLE","confidence":11},  
    {"type":"IN_VEHICLE","confidence":2}
  ]

In this example, Google thinks I am either doing something unknown, walking, riding, or on a bicycle. I promise, never a bicycle. So, for now, I consider the information to be less than useful, but am storing it for future use only.

Looking forward to using the data in interesting ways.