Month: November 2010

Getting the Well-Known Binary representation of geometries using the JTS Topology Suite.

Posted by – Thursday 2010-11-25

In this post we will see how to get the Well-Known Binary[1] (WKB) representation of geometries using the Java library JTS Topology Suite. WKB is a binary, serialized form of the Well-Known Text (WKT) representation of geometries.

In the first section a sample program getting the WKB representation of two simple geometries is shown. The second section covers potential issues related with endiannesss.

1. Simple Java code

JTS Topology Suite package provides classes to get both WKB and WKT representations of geometries. Let’s see how to get the WKB representation of a point and a polygon using them; the key class is WKBWriter.


Some TileCache deficiencies (and workarounds).

Posted by – Sunday 2010-11-14

TileCache, as every piece of software complex enough, is not free of deficiencies. In this post I write about some TileCache features (or lack of) which, in my opinion, are deficiencies. These are: (a) a TileCache layer will only work with one set of map resolutions, (b) poor logging, (c) the TileCache seeder always stops on error, (d) the TileCache seeder cannot be restarted from a given point and (e) the lack of support for distributed computing. In some cases a workaround to partially overcome limitations is given.

TileCache version 2.11 is covered in this post.

1. Only one set of map resolutions per TileCache layer.

By nature WMS caches work with finite sets of map resolutions. In my opinion, one deficiency of TileCache is that a layer will only work with one set of map resolutions. For each layer the set of map resolutions is set in the configuration file by using the parameter ‘resolutions’ or by giving both ‘maxResolution’ and ‘zoomLevels’ parameters.

The problem comes when you have to work with more than one set of map resolutions. Say you have a WMS layer named ‘municipalities-boundaries’ that it is cached and must be shown at two different sets of map resolutions, say one with maximum map resolution 100 and the another one with map maximum resolution 200. In this case there would be two possible workarounds. One of them is creating two TileCache layers, say ‘municipalities-boundaries-200’ and ‘municipalities-boundaries-100’, as show in the following TileCache configuration file snippet: