Question

I'm writing a Quicklook generator plugin for a GPS logging file format (.fit files). I've shoved something together which loads the file and plots the path using the NSGraphics/NSBezier stuff:

Plot of path

(the horrible code for the above can be found here)

This is fine, but it would be much nicer to display this over Google Maps data or similar (the recorded tracks cover a fairly small distance - e.g the above covers about 20km by 10km - too small to display on a single map of the earth, so the map needs to be dynamically loaded somehow)

Things I've tried so far:

  1. Returning HTML which shows a Javascript GMap instance. Doesn't work as the Quicklook HTML rendering doesn't allow Javascript (or Flash, Java etc)
  2. Returning HTML containing a static Google Maps image. Quicklook wont load remote images.
  3. Getting a NSGraphicsContext and displaying a standard WebKitView into this, modified from some thumbnailing code - this errors because you cannot initialise WebKit from a secondary thread (which seems to work fine for thumbnails, but not previews?)

With 2. I could possibly download the static Google Map image in ObjC, then display that with HTML, but the static map isn't ideal (fixed size so no zooming, and potentially slow to initially load)

I came across MacMapKit which I've not tried yet, but since it's WebKit based, I suspect it will have the same issue as 3.

Is there some way of displaying a map in a Quicklook that I am overlooking?

Was it helpful?

Solution

  • trying to get Google data directly in your generator (whatever way you try to do it) is not possible as the host of your plug-in is sandboxed and denies any connection to the network

  • trying to return HTML data and some clever javascript won't work either as the Quick Look panel also protects against network access for security reason and there is no public way to work that around

I am afraid you won't find a real solution to your problem, except by using your own map data.

Still, your use case is interesting and you should file a bug to Apple's Bug Report website.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top