Tuesday, 3 April 2012

How to get the extent of a PostGIS table

Here are two way to query the spatial extent of a PostgreSQL/PostGIS table.

For a table bc_roads in the bc schema with a geometry column the_geom...

To get the extent as a Well-known text (WKT) box:

SELECT Extent(the_geom) AS extent FROM bc.bc_roads;

To get the extent as xmax, xmin, ymax, ymin as fields:

SELECT ST_XMax(r) AS xmax, ST_XMin(r) AS xmin, ST_YMax(r) AS ymax, ST_YMin(r) AS ymin FROM  (SELECT ST_Collect(the_geom) AS r FROM bc.bc_roads) AS foo;




Monday, 26 March 2012

Leica Cyclone Back Compatability 7.2 to 6.0

In the school of Geography, Geology and the Environment, Kingston University London, we are running Leica Geosystems Cyclone 6.0 on our network, but 7.2 on the Panasonic Toughbook we use with our Leica ScanStation 2 3D scanner. Unfortunately, the 7.2 database is not compatible with older versions, so to get the data out of 7.2 and into 6.0 it must be exported as a point cloud .ptx file and re-imported. It has taken me a little while to work out how to do this as instructions appear to be somewhat limited.

The Export command in Cyclone Navigator seemed a good place to start, so I searched the database directory tree till it became active, which was when I selected a ModelSpace View.




An Export to File dialog is presented, followed by the Export Options dialog, but this just resulted in an exception. Foiled!

It appears, data can only be exported from within an open ModelSpace View using File Export, checking Visible or Selected in the Export Options depending on which data you wish to export.


Importing into version 6.0 is very straightforward. Create a new Cyclone database, then right-click and Import. Select one of your .ptx files and Merge or keep Separate multiple clouds as required.


The point clouds are now in Cyclone 6.0.


There are MultiImages associated with the scans, however, so far I have been unable to convert these. I can  export them from 7.0 as individual images, but get an error in 6.0 when I try and create a new MultiImage folder in the Images folder. 


This is most unsatisfactory, but will have to wait for another day.


Thursday, 3 November 2011

Pattern in the geographical orientation of diversification

In 'Guns, Germs and Steel' Jared Diamond argued that European technological advance was enhanced by the East-West orientation of Eurasia which allowed domesticated animals and plants to easily migrate, as ecological conditions are generally more similar to the east and west than to the north and south. I wondered if this increased motility would lead to more or less diversification? Increased motility may result in larger ranges and hence a greater probability of vicariance (splitting and diversification). Alternatively, mobility may prevent divergence through increased admixture. Perhaps the relative importance of these factors changes through time?

To investigate this question, I calculated the bearing between the geographical centroid of the ranges of terrestrial mammal sister clades. I classified the lines connecting range centroids as north-south or east-west and plotted them on a map and as a temporal histogram.


North-South diversification is most common in South America (except the Atlantic coast), Western North America, Sub-Saharan Africa, S.E. Asia and Western Australia - New Guinea, but much rarer in Eurasia and the majority of North America. East-West diversification occurs everywhere, except polar regions. Glaciations will have severely eroded pattern in northern latitudes, but why is north-south diversification uncommon in western South America and Eastern Australia?

Interestingly, over the last 50 million years the frequency of east-west diversification has been consistently 2.5-3 times more frequent than north-south diversification. Temporal slicing of the map (not shown, but see) shows that pattern does vary though time with east-west connections between southern continents being more common further back it time - traces of the breakup of Gondwana.

So, these data seem to show that, yes, diversification is more 2-3 time more common east-west than north south, and that this pattern has been consistent in mammals for the last 50 million years. It also shows there is considerable geographical variation in north-south diversification, possibly related to recent environmental change destroying pattern.

Friday, 14 October 2011

GeoPhyloBuilder for ArcGIS 10

The labs here at the Silwood Park campus of Imperial College are still running ArcGIS 9.3, but with our recent license renewal I finally decided it was time for me to personally upgrade to v10 and recompile GeoPhyloBuilder.

Following the instructions from ESRI upgrading turned out to be pretty straight-forward. I just had to remove and re-add the ESRI.ArcGIS references (they are now in C:\Program Files\ArcGIS\DeveloperKit10.0\DotNet\), change the platform CPU target and change runtime binding from using the ESRI.ArcGIS.esriSystem.IAoInitialize class to the code generated by the ArcGIS License Initializer wizard. Amazingly it all worked.

The new version can be downloaded from SourceForge, I just need to work out how to make it the default download from the project page and sort the ssh key problem out that is preventing posting the code to the repository.

Monday, 27 June 2011

The Scope of Evolution


Here is another old visualisation from the soon be history EvoViz wiki.

A very crude attempt to show how far evolutionary thinking permeates science from the evolution of organisms themselves, their effect on the environment, it's use in medicine (e.g. understanding the origins of disease), genetic algorithms, evolutionary psychology and politial thinking.



Sunday, 12 June 2011

Terrestrial Mammal Geophylogeny - another view

A third visualization of the terrestrial mammal geophlylogeny. Here it is displayed in ArcScene with nodes elevated and coloured by age. I particularly like how it shows differentiation in node age between the southern and northern hemispheres, both within continents and across ocean basins.

Mammal Geophylogeny from David Kidd on Vimeo.

Thursday, 9 June 2011

Terrestrial Mammal Geophylogeny

I have been intending to build a geophylogeny from the Bininda-Emonds et al. mammal supertree and range maps (Sechrest "World Wide Global Diversity, Endemism, and Conservation of Mammals". PhD Thesis, Univ. Virginia 2003) but have only got round to doing it. The delay was primarily due to the need to prune the mammal tree to species for which there are range maps. This I have now implemented in the Entangled Bank.

The geophylogney was built in GeophyloBuilder using the range centroids with an envelope model. I have put together two quick visualizations, a map with nodes coloured by age and a movie in ArcGlobe. The map shows a clustering of old nodes toward the center of continents and in ocean basins. The former represent continental endemicity, the latter transcontinental vicariance or dispersal.
In ArcGlobe something strange is going on with branches the cross the inverse-prime meridian, looks like an ESRI bug to me.