Tuesday, September 16, 2014

Cannot Register Assembly for ESRI.ArcGIS.Desktop.AddIns

I'm doing a lot of coding in Visual Studio 2010 for ArcGIS Desktop Add-ins at 10.2. Every few saves (build/rebuild solutions/etc.) I get an annoying message:
Cannot register assembly "[path to my project]\[Projectname].dll". Could not load file or assemly ' ESRI.ArcGIS.Desktop.AddIns, Version=10.2.0.0, Culture=neutral, PublicKeyToken=[Unique Token]' or ont of its dependencies. They system cannot find the file specified.
Screenshot of the error in the Error List window
Try one or both of the following procedures to solve this problem.

Disable COM Interop Registraion

Some Esri forum posts mentioned to sure the "Register for COM interop" setting was disabled. Here's how to find it in Visual Studio 2010:

  • Go to the Properties window for the project from the Solution Explorer
  • Navigate to the Compile tab
  • Uncheck Register for Com interop toward the bottom of the page

  • Close and re-open Visual Studio and it should solve the issue.  If not, try the next step that we've been using a bit

Remove & Re-Add AddIns Reference

This usually only works for a few hours, or up to a few days, but it'll definitely solve the problem so you can continue work.
  • Open the Properties window for the project again, but navigate to the References tab.
  • Scroll down through the references and look for ESRI.ArcGIS.Desktop.AddIns under the Reference Name field. Highlight it and click the Remove button

  • Click the Add button just to the left of the Remove button and choose Reference...
  • Navigate to the .NET tab
  • Scroll down a ways (further than you might think; it's not necessarily in alphanumerical order) to find the ESRI.ArcGIS.Desktop.AddIns component.  Select it and click OK to add it. As long as you removed it in the previous step, it will be included in this list.
  • Close Visual Studio.  When you open it again, the problem will be fixed


Tuesday, April 1, 2014

3D GPS Visualization Workflow of Snowboarding Sessions



I recently got crazy into snowboarding and thought it would be neat to play around with some data visualization methods.  Here's exactly how I created the video above of a session at Spirit Mountain on March 30, 2014.

Tools:

  • Android phone (any mobile device with a GPS receiver that can provide GPX exports [or any other GPS output format] will work)
  • AlpineReplay app (any GPS tracking app or sports tracking app will do)
  • Google Earth
  • MS Paint / Google Picasa / Gimp / Photoshop / your favorite graphics processing software
  • Camtasia (or CamStudio) screen capture software
  • Sony Vegas (any NLE / video editing software will do, but more powerful software provides cooler features)

Data Collection:

  1. Load AlpineReplay onto your device and hit the big play button
  2. Get rad
  3. Press pause at the end of your sesh, and hit Send
Now just grab the GPX export of this session from the AlpineReplay web site (using a desktop computer):
  • Log in to AlpineReplay.com
  • From the navigation menu at the top, choose Account > Settings
  • Scroll to the very bottom of the page. Under Data Export, click the Export Data to GPX link
  • Select you session by date & time from the drop-down menu, and click the Download button to get a single GPX file for an individual session composed of multiple slope and lift rides
Simple!

Render in 3D:

  • Install and open Google Earth
  • Choose File > Open and navigate to the directory where you downloaded the GPX file.  It's probably sitting in D:\Users\[user name]\Downloads
  • Change the expected file format to GPS so Google Earth will show any GPX files (etc.) you have on your machine. Click the drop-down menu over the Open and Cancel buttons and choose
    GPS (*.gpx, *.loc, *.mps, *.gdb...)
  • Click OK on the GPS Data Import dialog to continue with default settings. Make sure Adjust altitudes to ground height is selected so it conforms better to the DEM (Digital Elevation Model)

Now you can zoom, pan, tilt, and go to town playing with your data.  

Create a snapshot image:

At this point it already looks pretty sweet so I took a screenshot (using the Print Screen button on my keyboard) and ran it through through Gimp to crop, tune, and add a few filters. Maybe I went overboard, but it looks cool.


Google Earth Recommended Settings:

By default, Google Earth may put some extra crap on the map that you don't want.  Maybe you want to add roads or other information. That's cool, but I don't want it now.
  • In the bottom left corner of Google Earth, expand the Layers menu
  • Click to clear/un-check the box next to Primary Database so we can re-add one layer at a time
  • I am really only interested in that awesome Lidar data that Google incorporates into its DEM, so put a check next to 3D Buildings. If you expand that layer, make sure at least the Photorealistic layer is checked


Turn off some map clutter:
  • From the View menu at the top of the Google Earth window, un-select Tour Guide, and Status Bar
    (Although the status bar can be very helpful, so don't forget how to turn that back on later)
If you have a decent processor and graphics card, consider boosting your rendering with these settings:
  • Click Tools > Options to open the Google Earth Options dialog. The following settings are all under the 3D View tab, but get familiar with the rest of the settings in here if you want to work with Google Earth some more
  • Set Anisotropic Filtering to High
  • Check Use high quality terrain
  • Check Use photorealistic atmosphere rendering (EXPERIMENTAL)

Symbology:

  • Expand the Places menu on the left side of the program to view the layers you have loaded in your map display
  • By default, your imported GPX file will load into the Temporary Places category and should be labeled as GPS Device. Drag that into My Places, and un-check Sightseeing Tour.  Now if you close Google Earth, this GPS track will load by default

The thick blue line isn't dong it for me. Let's make the track look a bit better.
  • Right click on your GPS device layer (if you haven't already renamed it) and chose Properties
  • Navigate to the Style, Color tab
  • Most importantly, change the Width to something around 2.0 to 3.0.  A thin bright line is important in this method
  • I prefer a 100% Opacity for the next animation trick too
  • I usually avoid red on maps, but I really want it to stand out and I don't have a red-green color impairment, so I'll change mine to full on Red. Those with a red-green color impairment may have a difficult time seeing the contrast between green trees and the red track, but I digress

Right: Simulated red-green color impairment (deuteranopia)
Left: Normal rendering

Animation:

Hover over the Time Slider toolbar to interact with its controls. It appears when GPS layers (or any other layer with time attribute data) are added to the scene.
! Read more about the Time Slider from Google's documentation

  • Click on the wrench icon in the upper left corner to open the Time Options dialog
  • Move the Animation speed slider somewhere toward the middle to slow down the animation. Return here and tune it to your liking later
  • Check the Loop animation option and click OK

We'll need to define a time range for the little trail effect. Note on the screenshot below that there are two controls on the timeline. The control on the far right points to the current location in the time sequence - it's essentially track position, just like you would see on YouTube, or another media player. The control on the far left is the range marker. The further away it is from the time position marker, the longer your trails will be.


  • Click and drag the time position marker (the control on the right) somewhere into the middle of the time bar. Something funny happens if it's not moved from the far right.  Anywhere besides at the very end/beginning position will do
  • Click and drag the range marker (the funny icon on the left) closer to the time position marker
  • Play around with it until the track's tail looks sufficiently long
The tail on the left is probably too long for this type of visualization.
The tail on the right looks too short to be useful.
(Note: I didn't move the time marker away from
the end for these screenshots)

The length of this tail looks about right.
  • Run the animation! Click the fourth icon from the top left to start the animation. It looks like a white clock with a "play" button/arrow on the right
  • Review the tail length. Click that same icon to pause the animation and adjust the range marker to shorten/lengthen the tail
  • Click the wrench icon again to adjust the speed of the animation

Screen Capture:

This was a real pain, and I'll explain why as we move along.

First, we want a high quality output in a format that we can edit later. Right off the bat, anything that can only export .swf is out because we have to jump through extra hoops to get it to work with video editing software.
! Usually CamStudio will do the trick, but I'm having trouble finding an legitimate h.264 encoder (.mp4 file type, high quality, high quality compression, manageable output file size) or other codecs that isn't straight spyware. All I'm getting for outputs are 2-5 frames per second that look like garbage.
I settled on Camtasia Recorder which produces very good quality, high frame rate .avi files. The drawback is that it's not free like CamStudio is.

Although Google Earth looks pretty impressive on its own AND the time lapse location animation looks really cool too, it would be nice to illustrate the the 3D aspect a little more directly.  Slight movement in a 3D scene really shows off dynamic depth in a 3D scene, however Google Earth doesn't do a very good job of letting the user control subtle movement.  It does a great job of moving significant distances (say between various locations across town, or across the globe) but it was very tricky to get the program to keep the camera fixed on one spot while rotating about that location. Here's what I did instead for the video
  • Turn on the looping GPS animation in the time slider
  • Compose a shot from a low angle (close to the ground ) to show the dramatic topography along with some sky along the horizon in the background. I even tried to align the shot so that the GPS path would briefly hide behind some 3D trees in a few areas to really highlight that third dimension
  • Let the animation run a few times to find and adjust the best viewing angles
  • Configure and engage screen recording software
  • While Camtasia was recording, I placed the cursor out of the recording area and subtly and slowly dragged the scene back and forth in a "smooth" manor
The subtle movement would have been better with a rotating motion (clicking and dragging with the mouse wheel button [or Shift + Left/Right], rather than dragging with the left mouse button), but the controls moved way too quickly and the shot would have been jerky and awkward.

The drawbacks were that this is still pretty jerky movement as I didn't have a ton of control with the mouse and a human hand at slow speeds, so I countered it with a movement effect in Sony Vegas. I added a slow and subtle zoom in and pan effect via three keyframes.  One at the beginning, one in the middle, and a copy of the first keyframe that was pasted at the end so the motion would end where it originated.  This part was all hands-off so it was far smoother than a human hand could ever produce.

That's it!  Here's the video again:

Unfinished Ideas:

  • Snow is a pretty important factor in a snowboarding. Google acquired mostly leaf-on imagery. Here's an idea to change that - at least a little:
Here's my first attempt at adding snow to a Google Earth scene
    • Obtain imagery. If you can find winter imagery, you're done. Otherwise, download spring/summer orthophotography; even grabbing a screenshot from Google maps will work
    • Use Gimp/Photoshop/etc. to turn the photo into snow.  Here's a brief workflow I used:
      • Turn down the saturation all the way so the color photo turns black & white
      • Invert the colors so the areas of mid-dark trees become more white instead of more black
      • Boost the contrast so those mid-tones become brighter white
      • Play with the brightness to fine tune your new winter scene
    • Export that image and add it to Google Earth as a new image overlay (Add > Image Overlay or use the Ctrl + Shift + O shortcut command)
      • After you align/georeference the overlay, adjust the transparancy slightly to help it blend into the scene to your liking
    Unfortunately this image doesn't snap to the "3D Buildings" layer with the high resolution Lidar DEM, but that might be okay. It looks kind of cool to have the trees sticking out, but that's up to your discretion.

    The other alternative is to just turn off the 3D buildings to have a completely snow-covered landscape.  This option will require high resolution imagery to pull off when zoomed in, however.

  • Change the location icon from an arrow to a snowboarder/skier
    • In the Places menu, expand your GPS track layer until you see the symbol for the arrow
    • Right click this layer and choose Properties
    • Cilck the button at the top right corner of the Edit Track dialog to change the icon used for this symbol.  

      I chose the skier icon, but you can add a custom in this dialog box if you create your own snowboarder dude.  I'd suggest rotating it 90° anti-clockwise so it looks like it's snowboarding in the direction of travel. The skier dude looks kinda funny in certain directions.

  • I'd like to combine this with some footage from my cameras.  I have a GoPro camera, and some other HD Canon cameras that have waterproof housings which are ideal for shooting in snow and cold weather
  • A clock face rushing through time would be pretty neat instead of text time stamps rushing by. It would be a more intuitive way to gage how fast real time is passing
  • Using the GPS data as information overlays would be sick!  I'm thinking some way to illustrate gauges (instruments) that report things like:
    • Speed 
    • Altitude/elevation
    • G-forces (from phone accelerometers, not necessarily from a GPS signal, but this could  theoretically be calculated to a degree from the raw data)
    • Change in speed (acceleration/deceleration)

Thursday, March 27, 2014

Why Isn't In-Water Recompression Mentioned in an Open Water Scuba Course?

Photo courtesy TDI/SDI 
TDI Diver News recently posted an article discussing in-water recompression, titled, "Remote Dive Site Decompression Illness - How to Save a Diver's Life."  A few people have been asking some important questions about why Open Water scuba courses simply state that it's never an option.  I'd like to offer my perspective.

What can go wrong?

  • If a diver is showing signs of a decompression illness (DCI) hit, what's to say they won't get worse in the water?
  • Paralysis complicates things tremendously and makes the diver uncontrolled; and it significantly increases the difficulty of evacuating the injured diver from the water.
  • Passing out, convulsing, or toxing out in the water can quickly turn it into a drowning situation.
  • Compound emergencies are extremely challenging to mitigate

Why don't they teach it in an Open Water scuba class?

  • There is a frigging TON of information to learn in a basic Open Water class in addition to the in-water skills. It's just too complicated to include. It's safer on a whole to just say it's off limits.
  • At the open water level, divers don't have the training to manage necessary equipment to support in-water decompression
  • How about working on your form and buoyancy before worrying about performing emergency medical procedures
  • Delaying access to proper medical care (even in remote locations) places a huge burden of liability on others around you
  • If you're spending that much money to haul yourself and your gear to such a remote location then you should have already invested in an oxygen administration course ($25-100 tops) and purchased the necessary gear (suitable O2 kit) to mitigate such a situation. Even an extra AL80 with a 100% O2 fill is under $200
  • Divers Alert Network is a better resource to rely on than this for >99% of open water divers

Additional points:

  • If this were skiing/snowboarding, this is the equivalent to learning how to ride the ski lift, and immediately trying to pull huge airs and flips off of monster jumps at 40+ mph. You're gonna kill yourself. One thing at a time.
  • If that type of diving sounds interesting to you (and it should - it's frigging awesome and learning as much as possible should always be the goal of scuba diving) then start taking advanced classes, tec courses, rescue diving courses, first aid/O2 admin courses, deco courses, etc. It's just not a basic topic.

Friday, February 14, 2014

Manage SD Card Media with an Android Tablet

I love my Nexus 7.  It's the 2012 version and when I got it for Hanukkah, I pretty much entirely stopped using my laptop.  It's a large enough screen while still being small, light, and portable. It's powerful enough to be a solid graphics post-production workstation for photos from my adventures, and it was quite a bit less expensive than similar tablets.  There are tons of really powerful (FREE) apps that can tune my pictures and really make my photos pop!

The only drawback to the Nexus is that I've had to transfer media from my old GoPro HD Hero or my point & shoot camera to an intermediate device before I can dig into editing the files on the tablet.  I'll have to:
  1. Connect the camera/card to a computer
  2. Transfer the files to the computer
  3. Connect the tablet to the computer and transfer again, or e-mail the photos to myself
This also implies that I have both a mini-USB cable for the cameras, and a micro-USB cable for the tablet.

Solution:


  1. Any micro-USB OTG cable ("On The Go" cable): $1-2

  1. Nexus Media Importer app: $4 on Google Play

Setup:

  1. Buy the card reader and the OTG cable. With shipping, it's still probably under $10.
  2. Download Homesoft's Nexus Media Viewer and test out your new cable and card reader. If you can successfully view photos with this app, uninstall it and buy the Nexus Media Importer app
That's it! It's a pretty solid app.  Simple to use, simple to copy data to your tablet, and it has some pretty sweet methods to select the specific files or groups of files that you want out of a given directory.

It also works for other types of data (video, music, documents, folders, etc.)