Categories

Site search

Create World Files For a Directory of KMZ/KML Raster Files

A while back, I worked on a project that required the conversion of a number of KML/KMZ (Google Earth) raster files into vector format (don’t ask!) Because there were a lot of files, it was painstaking to manually geo-reference the files after unzipping the KMZ to extract the raster files. I dug around on the web, and was able to find two tools that did the job. The first, WorldFileTool, works great, but must be run individually for each file (ie. you can’t run it in a batch over multiple files in a directory).  I use this tool if I’m only converting a single file, or less than a handful at at time.

 

The other option I found was a shell script created by Nicolas Moyroud, who had made it available at this link. However, the link now appears to be broken, and I can’t find another reference to the file. As it’s tagged as a “GNU/GPL v3 – Free use, distribution and modification” license, I’m posting a copy here for others who may find it of use. Note that all credit for this file goes to Nicolas Moyroud, and I have no claim to this work!

Click here to download the file!

 

Edit:  I also found a working download link and Nicholas’ descriptive page here (en francais).  He must have changed his URL structure since my original StackExchange post!

More ANT+ USB Key Options

Two years ago, I wrote a posted titled “Why You Need a ANT+ USB Key,” which has been one of my more popular posts. If you train indoors at all, I recommend you give it a read, and see how this little gizmo will make riding inside much more effective and, dare I say, fun!

Since the time of my original post, there have been a few changes in the market, with more options now available.  The ‘standard’ is still a Garmin unit, but they now make a smaller, more compact version than they did in 2013. It’s similar to, but more readily available than the more expensive Suunto Movestick Mini I mentioned in the last post, in that it doesn’t stick out as far, and thus has a much lower chance of getting broken off or pulled out by mistake. This makes the updated Garmin my recommended buy at this point if that’s an issue to you.

Garmin USB ANT+ Stick

Garmin USB ANT+ Stick

For those not wanting to spend quite as much, there’s also a cheaper version now available on Amazon. It’s called the Docooler USB ANT+ Stick, and costs only $15! It’s the ‘larger size’ (like a USB Thumbdrive, or the older style Garmin) which means it’s more prone to getting bumped or broken, but at the price, it may be worth a shot! Reviews are limited, but mostly good, with only a couple reports of driver issues. In theory,  ANT+ should always work with ANT+ (it’s a standard), so this should work in any application where the other sticks work. I think if I break or lose my Garmin stick, I’ll be getting one of these. Why spend more? This makes the Docooler USB ANT Stick my current recommendation!

Docooler USB ANT Stick

Docooler USB ANT Stick

Dissolve Shapefiles using OGR

Quite often, I’ll run across a large or complex shapefile that causes issues (crashing, very poor performance, etc) in QGIS or other desktop GIS.

However, sometimes you have to find a way to deal with these files, and not spend a lot of time worrying about them. Often, the best way is to head back to the mysterious black box that is the command line, and use the ultra-stable suite of tools available there. My favourite for spatial work is GDAL/OGR

I was recently struggling to do a simple dissolve on a large and complex shapefile. I didn’t want to bring it into a database, but QGIS would crash trying to dissolve the shapefile. Of course, OGR had no problem with the file!

Here’s how to turn this (nine features with three different attributes):

Input to dissolve - 3 attributes

Input to dissolve – 3 attributes

Into this (three attributes, three multi-part features!):

Dissolved shapes

Dissolved shapes

Simply use this command (substituting your file names and field names as appropriate) into ogr, and you’re all set!

ogr2ogr outputfile.shp inputfile.shp -dialect sqlite -sql “SELECT dissolvefield,ST_Union(geometry) as geometry FROM inputfile GROUP BY dissolvefield”

Recording Power from CycleOps 300 Pro Indoor Bikes

I recently started an indoor cycling program at a studio that uses the CycleOps 300 Pro Indoor Cycles.

CycleOps 300 Pro Indoor Cycle

CycleOps 300 Pro Indoor Cycle

These bikes have a built in power meter, which is fantastic for training. However, they don’t use a ‘standard’ ANT+ protocol to transmit the data. They in fact use a ‘subset’ of the ANT+ frequency, that only CycleOps products can detect. This limits you to using the Joule line of head units. Unfortunately, this means that the bikes will not transmit a power and cadence value that you can pick up on a Garmin or other much more common head unit. Don’t get me started on how annoying this is, and how shitty of a business model it is to advertise your product as ANT+ when in fact it is not compatible with other ANT+ products…

However, being annoyed led me to do some research. Thinking that there had to be a way, I scoured the internet. I found one reference on the Cyclops Virtual Training website that listed the IC300 bikes as compatible with their VirtualTraining Android and iOS Apps. I emailed their tech support, who first said told me that the bikes are compatible with any ANT+ device (they are not). When I pressed them for confirmation, they retracted that statement, saying:

‘Sorry.  That generation of bikes were designed well before the explosion on handlebar mounted technology.’

Riiight. And yet you still advertise them as ANT+ compatible? I should note here that the newer CycleOps “Phantom” line of bikes claim to actually be fully ANT+ compliant, so this applies only to the older bikes (IC 300 and IC 400).

However, by this point I had already ordered a USB OTG (On The Go) Adapter cable for my phone (you can get them very inexpensively) in the faint hope that the VirtualTraining app might work. It arrived the day after my next class (of course!) so I had to wait until last night to test it out. I plugged my trusty USB ANT+ Key (see my post about why you need one here!) into the OTG cable, and plugged that into my phone. Using the VirtualTraining app (Android, iOS) I was able to start a “Free Ride” session, and connect to the bike to get cadence and power! Awesome!

USB OTG Adapter Cable

USB OTG Adapter Cable

I  should note that I also tried the IpBike app to see if the “only compatible with CycleOps products” statement held true. It does appear to be true, as IpBike did not recognize any devices. CycleOps must have done something special in their software to pick up the frequency that others do not since the ANT+ key itself seems to have no problem seeing it, thus ruling out the hardware as the issue. Very odd.

So! It is entirely possible to record the data from a CycleOps 300 Pro bike without using a Joule head unit. It can be done fairly inexpensively.. However,  having said all of this, there are a couple of issues:

  1. You will need a phone that is capable of USB OTG. See how you can determine if your phone is compatible here.
  2. You’ll have to install the ANT Radio Service and ANT USB Service apps from the Play Store (not sure how this works on iOS, but it may not be necessary)
  3. The VirtualTraining app is not free. It costs $6 per month after the initial 14 day trial period–which of course just ran out for me :(
  4. The VirtualTraining app, quite frankly, kind of sucks:
    • It’s very hard to connect to a specific device (which is an issue in a studio environment with multiple bikes) – it appears you have to just keep doing consecutive ‘searches’ for devices, and it will pick one up randomly. Another search may or may not yield a different device, while a third search may turn up a different one, or one of the original two again. I think I had to do about 10-15 searches for it to pick up the bike I was on. It would be ideal if you could manually type in a known ID, and have it just connect to that sensor, but I found no way of doing that.
    • I couldn’t get it to connect to my ANT+ heart rate monitor at all. I’ll have to try that at home when there are less other devices present to confuse it. Again, the ability to manually enter an ID would likely solve this issue.
    • The app interface is junk. The button to ‘stop’ a ride is not obvious (a little x in the corner that to me looks like it should delete something, making me hesitant to push it,) and the app itself just behaves in non-intuitive ways
  5. Saris/CycleOps clearly doesn’t care to play by standards. This makes me really not want to pay them for their app, as that reinforces their decision to make ‘vendor specific’ products, then charge for them in a world where everyone else is moving towards completely open protocols. I’m going to decide before next Tuesday if a month of data recording is worth $6 to me.

Video Player Blank in Golden Cheetah?

This entry is part 5 of 5 in the series Golden Cheetah

Are you trying to get the “Train” view of Golden Cheetah set up so you can suffer all winter, but the Video Player is not working? Well yesterday I decided to set up Train View, and experienced exactly this problem.

I opened up Golden Cheetah on a new Windows 8 laptop (that I have yet to run Train view on), and noticed that the default Train View setup doesn’t include the Video Player ’tile.’ I easily added the Video Player to the layout by going to the View Menu > Add Chart > Video Player.

Add Video Player to Train View

Add Video Player to Train View

I then started a workout, and although the sensors were all properly detected, recording, and the .erg file was working properly and showing target wattage, the video was not playing. The “Video Player” tile was just a black box. Weird!

I did a search of the Golden Cheetah website, and the user group, and didn’t find much info. However, one post in the user group mentioned trying to open the video in VLC Media Player to see if the video works. I normally have VLC installed, but apparently I had yet to install it on this new laptop.  It turns out that VLC is required for Golden Cheetah to play videos. I installed it, and right away everything worked perfectly!

Train View with working video!

Train View with working video!

Note that I used the very useful Sufferfest ERG Spreadsheet to create an .erg file for the video — it works with all of the Sufferfest videos, and makes them much more useful! The spreadsheet allows you to correlate what’s happening in the video with target power zones based on your personal FTP.  That’s what is driving the “Target Power’ and blue graph you see above. Also, if you have a CompuTrainer or Wahoo Kickr, Golden Cheetah will control the resistance based on this file as well. Sadly, my workout was terrible. I couldn’t reach any of the target power zones (despite setting my FTP to a ‘lower’ estimate than it should be) and my heart rate was sky high the entire time. Bizarre, but an issue for another day!