Friday, August 10, 2007

REST for Rasters: a RANGE of options

Hey, I know a dogpile when I see one. I'll jump in. (Seriously, follow that link first, then read the response.)

Sean's spot on. Resources can have subcomponents. I even—while addressing a different but related point—have opined about file-based formats not forming a sensible basis of REST rasters. Dividing rasters into interesting slices as Sean has suggested is the right big idea. As far as suggestions, I've been meaning to write about the following because we've been working on them on one of my projects.

RANGEd (partial) GETs. HTTP GET supports ranged requests. In other words, I can ask for specific bytes of a file. In this case, a smart raster client could indeed notice that a resource was a GIF, and only ask for the first few hundred bytes, read critical header information, and use random access to obtain the actual pixel values. A naive approach would end up being awfully chatty, and it leaves the resource a bit more opaque than you might like (after all, the byte range is not part of the URL) but it is a practical solution.

Standard Raster Accessors. Libraries like GDAL or ESRI make very very similar assumptions when dealing with raster data. Everyone agrees that rasters have bands of data, might hold data of different types (ints, floats, bits, etc.), are conveniently arranged in tiles, etc. It is probably not too hard to agree on a standard header for raster information to be returned to a HEAD request. And then a fragment/anchor identifier language could be used to agree on raster chunks to be returned in an appropriate binary format. (That's the part after the '#' in the resource.)

  • http://example.org/seafloor.png. The whole shootin' match. Ask for a HEAD or do smart partial GET requests.
  • http://example.org/seafloor.png#*.0,0.100,100. Gets all bands (*) and all pixels between (0,0) and (100,100) pixel coordinates.

The actual syntax above is obviously only a stab in the dark, and perhaps there are already better examples in things like the OGC Web Coverage Service, but the fact is indexing into even very large rasters doesn't take a lot of data, and it'd fit nicely in the fragment/anchor. Which would be very RESTy, very URL chic.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home