Beers and Python GIS in Praha

2008-10-03T07:49:41Z | Comments: 2

One of the highlights of this trip was the chance to meet fellow Python and GIS programmer, and blogger, Jáchym Čepický.

http://farm4.static.flickr.com/3235/2885863662_3b4aba9659_d.jpg

I'm not sure how many readers of Planet OSGeo understand Czech and know that Jáchym went through a scary episode in life this past summer. He gave me a sobering recap and then we had some less sobering toasts to his good health at Pivovarský klub. In a city served almost exclusively by single-beer pubs, Pivovarský klub is an oasis for the beer enthusiast. I had several beers from the tap that I never saw anywhere else -- beers far more fresh and flavorful than the ubiquitous Gambrinus.

Friends don't let friends use EndNote, part 2

2008-09-27T12:38:06Z | Comments: 1

I've just seen mention of this via Twitter, but haven't discussed with or seen any statement from the developers, on advice of lawyers, no doubt: Reuters sues GMU for no real reason other than Zotero's competition with, and besting of EndNote. Is this the kind of company you want to support, Steve? One that seems ready to sue its users for trying to free their data from its proprietary format?

More from Bruce D'Arcus, and also Hugh Cayless.

OpenLayers and 900913

2008-09-19T17:21:11Z | Comments: 2

Thanks to some hand holding from Chris and Josh, Pleiades now has Spherical Mercator maps using the Google physical geography layer as a stand-in for our ideal ancient world base map. See http://pleiades.stoa.org/places/639166. Coordinate transformation is provided by the code I blogged yesterday.

Geojson and pyproj interop

2008-09-18T21:20:13Z | Comments: 0

I've just finished writing a module that supports projection of objects that provide the geometry part of the Lab's geo interface: proj.py. Maybe you'll find it useful. What it does is take a geojson geometry (or Shapely geometry) and return a new projected geojson geometry object:

>>> from pleiades.openlayers.proj import Transform, PROJ_900913
>>> transform = Transform(PROJ_900913)

>>> # Point, forward
>>> from geojson import Point
>>> point = Point(coordinates=(25.0, 25.0))
>>> fwd = transform(point)
>>> fwd
Point(coordinates=(2782987.269831839, 2875744.6243522423))

>>> # Point, inverse
>>> inv = transform(fwd, inverse=True)
>>> inv
Point(coordinates=(24.999999999999996, 24.999999999999996))

>>> # Line, forward
>>> from geojson import LineString
>>> line = LineString(coordinates=((25.0, 25.0), (30.0, 30.0)))
>>> fwd = transform(line)
>>> fwd
LineString(coordinates=((2782987.269831839, 2875744.6243522423), ...))

>>> # Line, inverse
>>> inv = transform(fwd, inverse=True)
>>> inv
LineString(coordinates=((24.999999999999996, 24.999999999999996), ...))

There's also an object hook if you'd like the transform to yield instances of your own classes.

Adding pyproj to a buildout

2008-09-18T16:11:54Z | Comments: 0

Pyproj is Jeffrey Whitaker's Python interface to PROJ.4. I'm no longer interested in other Python projection packages. Its most interesting feature is interoperability with packages (such as Shapely) that use the Numpy array interface. It depends on Cython, which makes it a bit tricky to include in a buildout: you must install Cython into your buildout's python, not as an egg, and make the pyproj egg only after this step is finished. Like this:

[buildout]
parts =
  cython-src
  cython-install
  pyproj

[cython-src]
recipe = hexagonit.recipe.download
url = http://cython.org/Cython-0.9.8.1.1.tar.gz

[cython-install]
recipe = iw.recipe.cmd
on_install = true
cmds =
  cd ${buildout:directory}/parts/cython-src/Cython-0.9.8.1.1
  ${python:executable} setup.py install

[pyproj]
recipe = zc.recipe.egg:eggs
index = http://atlantides.org/eggcarton/index
eggs = pyproj

You might be able to pull pyproj off PyPI, but here I am using my own index. Once built, you can try it out using zopepy:

>>> from pyproj import Proj
>>> defn_900913 = """
... +proj=merc +a=6378137 +b=6378137
... +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0
... +units=m +nadgrids=@null +no_defs
... """
>>> proj_900913 = Proj(defn)
>>> lonlat = (25.0, 25.0)
>>> proj_900913(*lonlat)
(2782987.269831839, 2875744.6243522423)

I like that projection definitions can be split across lines of the screen.

kml:description considered harmful

2008-09-17T15:39:58Z | Comments: 6

KML lacks two important elements. It has neither 1) a simple and universal element equivalent to Dublin Core description (such as {http://purl.org/dc/elements/1.1/}description), nor 2) an excellent element for encapsulating or linking to rich content accompanying placemarks. Instead of the first, we have kml:Snippet. Snippet! It's somewhere in between a title and a description and that's no place to be. Instead of the second, we have kml:description, which supports an under-specified subset of HTML and other media including video.

The kml:description element is not about metadata anymore, it's about adding rich content -- charts, photos, video -- to popup windows of a geographic browsers. Under-specification of the content of kml:description is a problem. Which HTML elements are valid? Why shouldn't all be valid? The choice only between escaping HTML and using CDATA blobs is another problem. XHTML in a description wouldn't break the KML document; why shouldn't we be able to use XHTML without CDATA? Lack of support for dynamic content is yet another problem. Why can't we specify rich content by a URL, to be fetched only as needed and refreshed only if modified? Limitations of KML's description element and its ties to the original implementation hold us back. We need something better.

The Atom community wrestled with the same issues and came up with the atom:content element. An atom:content element may contain text, HTML, XHTML, XML, encoded binary media, or provide a URL to another document or media resource. When prompted, Atom processors (such as a news reader) display this content to a user. All HTML or XHTML elements are valid. CDATA blobs are unnecessary and not allowed. Atom's content element comes with clear processing instructions: HTML must be escaped, and should be valid within a <div>. The immediate child element of XHTML content must be a <div>. While guided by implementations, none of this depends on unspecified behavior of a particular Atom processor.

The "src" attribute of the atom:content element provides developers with more options. It allows you to decouple semi-static data from dynamic data. The locations and identifiers of physical instruments deployed in the field (river gauges, ASOS, you name it) can be decoupled from their nearly real-time observations and measurements. Serve a representation of the deployed instruments as a static document updated only as are the physical objects. From each instrument entry, link to a specialized web resource that produces tables or graphs on demand.

Atom processors can also take advantage of the "src" attribute to improve performance perceived by a user. Fetch the feed, show users titles and summaries first, get rich content as the user asks for it -- or get the rich content in the background, or during lulls in user activity. Processors should also be able to exercise conditional GET to avoid reloading unchanged rich content.

The atom:content element appears to support all of the requirements of, and overcome all of the faults of, kml:description. It fully embraces and accommodates rich content and provides new design options via links to dynamic or massive content. KML is already open to Atom elements (version 2.2 already includes atom:author, atom:link, and atom:name) and so atom:content is a more natural replacement for kml:description than RSS 1.0's content element or RSS 2.0's enclosure element. I'm not in a position to offer any advice to Google, but -- considering its investment in Atom, to act on the commonalities between KML and Atom seems useful and even profitable.

I've heard from KML folks that nothing pushes the spec forward more than working code. I'm not interested in writing a new geographic browser, but I can start serving KML enhanced with atom:content (which meets needs of a user that just cropped up on Monday), support it in my own KML processing packages, and perhaps even exercise my withering C++ skills on a libkml patch. After that? Let's swap in atom:summary for kml:Snippet. Snippet!

G(eo)nomes of Atlanta

2008-09-16T18:41:52Z | Comments: 0

Martin Daly:

The OGC Geospatial Search Summit was held here at the Atlanta TC yesterday. It was an invitation only, behind closed doors event - grumble, grumble, moan, moan - so I don’t know any details about what went on.

Inside the "Open" Geospatial Consortium there are yet more inner circles?