All posts by ternst

Configuring Python and GeoDjango for Amazon Web Services Deployment

Quick run down of configuring Geodjango to run on amazon web service’s Elastic Beanstalk (EBS). This assumes you have a separate database instance up and running and that you’ve setup the project to use Elastic Beanstalk (i.e. eb init). Configuration files are broken into the tasks they handle and are read automatically by Elastic Beanstalk.

  1. Create two directories in the root of the project (.ebextensions).
  2. Under .ebextensions add the following files:
    • commands.config – Executes shell commands to deploy static files and migrate database changes. Enables the enterprise linux yum repository so that you can install the GIS libraries through yum (very cool).
    • django.config – default settings for Elastic Beanstalk.
    • environment.config – Setup any environmental variables that you want.
    • packages.config – Tells EBS what packages to install.
  3. commands.config:
    container_commands:
    01collectstatic:
    command: "source /opt/python/run/venv/bin/activate && python manage.py collectstatic --noinput"
    02migrate:
    command: "source /opt/python/run/venv/bin/activate && python manage.py migrate"
    leader_only: true
    03installs:
    command: "sudo yum-config-manager --enable epel"
  4. django.config:
    option_settings:
    aws:elasticbeanstalk:container:python:
    WSGIPath: kyp_backend/wsgi.py
  5. environment.config
    option_settings:
    - option_name: DB_NAME
    value: [db_name]
    - option_name: DB_USERNAME
    value: [username]
    - option_name: DB_PASSWORD
    value: [password]
    - option_name: DB_HOSTNAME
    value: [amazon host name]
    - option_name: DB_PORT
    value: [port]
    - option_name: HOST_ENVIRONMENT
    value: [development/test/production]

  6. packages.config:
    packages:
    yum:
    postgresql94-devel: []
    geos: []
    binutils: []
    gdal-devel: []
    proj: []
    gdal: []

OGR/GDAL Examples

Generate a shapefile from a postgresql table
ogr2ogr -f “ESRI Shapefile” [Shapefile Name].shp PG:”dbname='[DB Name]’ host='[Host Name]’ port='[Port Number]’ user='[User Name]'” [Table Name]

Format Types

  • ESRI Shapefile
  • MapInfo File
  • TIGER
  • S57
  • DGN
  • Memory
  • BNA
  • CSV
  • GML
  • GPX
  • LIBKML
  • KML
  • GeoJSON
  • Interlis 1
  • Interlis 2
  • GMT
  • GPKG
  • SQLite
  • ODBC
  • WAsP
  • MSSQLSpatial
  • PostgreSQL
  • PCIDSK
  • DXF
  • Geoconcept
  • GeoRSS
  • GPSTrackMaker
  • PGDump
  • GPSBabel
  • SOSI
  • GFT
  • GME
  • CouchDB
  • ODS
  • XLSX
  • ElasticSearch

Postgresql/Postgis Cheatsheet

Export table data (data only):
pg_dump –column-inserts -a -h [host name] -U [user] -d [database] -t [table] > [output directory]

Export table data and table:
pg_dump –column-inserts -h [host name] -U [user] -d [database] -t [table] > [output directory]

Execute script:
psql -h [host] -U [user] -d [database] -f [input file]

Planted Firebreaks and Fallow Field Followup

Lessons learned from planting firebreaks are fairly small but important to prevent wasted effort and money. Firstly the seeding failed on both Wet and dry sites, but for different reasons. On the dry sites it was too exposed to the sun causing the soil to be too dry. Soil fertility was also in question. With more effort and a drought tolerant seed mix, this could likely be overcome. Our solution is to let natural warm season grasses establish themselves and keep the firebreaks mowed.

Xeric Site Growth
Xeric Site Growth

In the wet sites, in our bottom lands, the clover and small grains were successful. Unfortunately they succumbed to competition from fescue grass. With more regular
Mowing this could have been delayed but we failed to give it the attention needed.

Mesic Site Growth
Mesic Site Growth

As far as firebreak widths, two tractor widths is too much for our properties. I’n flat untried agricultural land this is possible but in the upper piedmont of the Appalachians we have trees and small pastures that make a wide firebreak unrealistic. Our firebreaks range in width from one to one and a half tractor widths and seems plenty sufficient.

Disking in a Firebreak
Disking in a Firebreak

In summary, allow warm season grasses to grow on drier sites. On moist sites a mix of rye, wheat, red clover, and a white clover (Dutch or ladino) should work well. Finally keep firebreaks mowed to reduce competition and to keep them clearly marked. Plus, disking the same area is a lot easier and you’ll run into fewer rocks as well!

Here are the results of the fallow field as it grew in:

Fallow Field A
Fallow Field A
Fallow Field B
Fallow Field B

Prescribed Burning for Early Oak Successional Habitat

After a few years of burning wildlife openings we were ready for our first woods burn. We were aiming for a low intensity fire that would clean up the under growth and increase herbaceous vegetation in a ten acre southwest facing stand. This would be our test plot, which was chosen because the aspect and elevation meant that it had fire adapted species. A moist north facing slope would contain more fire intolerant species like poplar and black cherry. This stand mostly consisted of w well spaced mature pines and oak. Lastly, the terrain and tree density , unlike other stands permitted the development of fire breaks.

Stand before burning
Stand before burning

The process began with marking the proposed fire breaks by walking skidded trails and old road beds and then tying them together avoiding drainages as much as possible. These were mapped, as are all our other land management features using the geographic information systems data model we developed to handle land management, Geoforst.

Burn Map
Map of burn planning features

Next, the firebreaks were created by first bush hogging the path and then alternately using a field plow and a disk harrow to ensure that a good barrier to fire was created. Getting off the tractor and moving logs and rocks is necessary.

Video of Disking Fire Breaks

We then contacted the state forestry commission and scheduled to meet with a forester in charge of prescribed burning. He stopped by and discussed goals, strategy, and looked over the fire breaks. We arranged for them to be back in a week when the weather was good and they had available time.

To protect the hardwoods, we walked the stand marking crop trees. In this case, crop trees were undamaged hardwoods with good form. Since we knew that the fire would be low intensity we did not expect any mortality of the mature oaks, but we did not want to run the risk of fire scarring them. The mature pines are very tolerant of fire and we plan to harvest them in the next ten years and were therefore re no concern.

crop trees
Crop trees marked with green flagging

To ensure no damage to the crop trees we did two things. First we removed all brush from the trunks of the trees. Secondly we raked the leaf matter from around the trunks. We felt this was important since it was the first time these woods had been burned in at least fifty years. An alternate method used a backpack leaf blower which works well purportedly. This was not available so we went with the rake.

At this point we were truly ready and were now waiting on the weather. The day came and the forestry commission showed up with three men and a bulldozer just in case. We wanted all the protection we could be since the we really didn’t know what we were in for. Conditions were mild and the fire was very manageable. Watching how things were done and asking lots of questions has us very confident that we can perform the next burn without assistance.

Low intensity burn
Low intensity burn, just like we planned for

The next stage will be monitoring the results. Since this was a very low intensity fire, there will likely need to be several more in close succession to accomplish our goals. Ideally we’d like to stimulate oak regeneration, but literature on the subject seems contradictory. In fact there are a fair number of foresters that still believe that fire should be excluded from hardwood stands. By culling the Virginia pine and implementing a fire regime, I believe this can be achieved while simutaneously opening the understory to herbaceous vegetation. Our biggest challenge will be over powering the Virginia pine seedlings. At any rate studies show that fires were frequent in the Southern Appalachians, even in hardwood stands. Let’s s e what happens.

References:
The Fire–Oak Literature of
Eastern North America:
Synthesis and Guidelines

SDE Examples for Oracle

Export from database to SDE export file
sdeexport -l [SOURCE_TABLE],[GEOMETRY FIELD] -f .\[OUTPUT FILE NAME].sdx -i sde:oracle11g -u [USERNAME] -p [PASSWORD]@[TNS NAME]

Export from database to shapefile
sde2shp -o init -l [SOURCE_TABLE],[GEOMETRY FIELD] -f [OUTPUT FILE NAME].shp -t polygonZ -a all -i sde:oracle11g –
u [USER] -p [PASSWORD]@[TNS NAME]

Import to database from SDE export file
sdeimport -o CREATE -t [OUTPUT_TABLE_NAME] -f [INPUT_FILE_NAME] -g RTREE -k [DBTUNE KEYWORD] -i sde:oracle11g -u [USER] -p [PASSWORD]@[TNS NAME]

Delete table from database including SDO/SDE metadata.
sdetable -o delete -t [TABLE_NAME] -u [USER] -p [PASSWORD]@[TNS NAME] -i sde:oracle11g

Drop and Create Spatial Index
DROP INDEX “[SCHEMA]”.”[INDEX_NAME]”;

CREATE INDEX “[SCHEMA]”.”SIDX_[TABLE_NAME]” ON “[SDE]”.”[TABLE_NAME]” (“[SHAPE_FIELD]”)
INDEXTYPE IS “MDSYS”.”SPATIAL_INDEX” ;

Oracle Spatial Examples

Get project information (note table alias required).
select c.[GEOMETRY FIELD].sdo_srid
from [TABLE] c;

Get the geometry type
select c.[GEOMETRY_FIELD].sdo_gtype
from [TABLE_NAME] c;

Interpret results with:
*00 UNKNOWN_GEOMETRY
*01 POINT
*02 LINE or CURVE
*03 POLYGON
*04 COLLECTION
*05 MULTIPOINT
*06 MULTILINE or MULTICURVE
*07 MULTIPOLYGON

Ensure table is registered in Oracle Spatial

select *
from mdsys.sdo_geom_metadata_table;

Get spatial tolerance of table
SELECT sdo_dimname, sdo_tolerance
FROM TABLE(
select DIMINFO
from user_sdo_geom_metadata
WHERE table_name = ‘[TABLE_NAME]’
) ;

Create point geometry from x/y values
select
mdsys.SDO_GEOMETRY(
2001, — point data
[SRID],
mdsys.SDO_point_type([X Ordinate], [Y Ordinate], NULL),
NULL,
NULL )
from dual;

Create Spatial Index
CREATE INDEX “[Index Name]” ON “[Table Name]” (“[Geometry Field]”)
INDEXTYPE IS “MDSYS”.”SPATIAL_INDEX”;

Add Geometry Metadata

Insert into MDSYS.USER_SDO_GEOM_METADATA (TABLE_NAME,COLUMN_NAME,DIMINFO,SRID) values (‘[Table_Name]’,'[Geometry_Field_Name]’,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT(NULL,-180,180,0.001),MDSYS.SDO_DIM_ELEMENT(NULL,-90,90,0.001)),4269);

Determine Spatial Relationship Between Geometries
SELECT [ID_Field]
, sdo_geom.relate(
a.[Geometry_Field]
, ‘determine’
, b.[Geometry_Field]
, [Tolerance]
)
FROM
[Table_Name_1] a, [Table_Name_2] b;

Testing Coordinate Transformation in PostGIS

I spend a lot of time thinking about which projection to use for a certain project,. Sometimes picking the perfect projection bites me when things change (such as the area of interest expands). In my recent case I have been avoiding reprojecting my data because I haven’t done this before in PostGIS and I’ve been convinced that this will be a major undertaking. After a minute’s worth of research I realize I may have been dead wrong. In fact, the process seems so easy and quick that I am leery. So here it is, my attempt at convincing myself that reprojecting in PostGIS is an inconsequential task.

First I will create some test data using a table in UTM 17 N meters (EPSG:26917).

PointsToReproject

Let’s prove this worked:

SELECT 'Table_SRID' as INFO,find_srid('public', 'ProjTest', 'geom')
UNION ALL
SELECT st_AsText(geom), st_SRID(geom) FROM "ProjTest";

TableInfoBefore

Check!

Next we’ll do the transformation to US National Atlas Equal Area

ALTER TABLE "ProjTest"
ALTER COLUMN geom TYPE geometry(Point,2163)
USING ST_Transform(geom,2163);

Then check the results:
TableInfoAfter

Check!

Finally let’s display it in QGIS:

First I’ll leave the project projection in QGIS to UTM 17N, looks as expected.
DisplayAfter26917

Just to double check, I’ll change the project projection to 2163. Surprisingly things look crazy. Notice that the offset is not predictable, meaning that it might not be a datum shift.
DisplayAfter2163

Interestingly, projecting “on the fly” to other coordinate systems does not reproduce this offset. So, perhaps it is the Google Physical web service that I am using that is having problems with reprojecting to US National Atlas Equal Area and not the reproduction of the points. To test that, we will reproject one of the coordinates back to UTM from US National Atlas Equal Area using gdal.


gdaltransform -s_srs EPSG:2163 -t_srs EPSG:26917
1480246.71738073 -990001.583001807

Results:
Original = 250230.930254224, 3854029.95272766
GDAL Transformation = 250230.930251404, 3854029.95272553

Looks like the reprojection was successful, just need to figure out the problems with reprojecting the base map.

In summary, reprojecting data in PostGreSql is trivial. The work can be done in place and scripts are very succinct. I am extremely pleased with this implementation, thanks guys!

GeoForst Lite, Adding a New Property – Part 2

Introduction

Last time we downloaded and configured the software and data sources we needed to start adding data to the project. If you missed it, just visit Getting Started with GeoForst Lite.

If your familiar with GIS, this post won’t be worth much, but skimming through will get you familiar with some of the datasets. In this post we are focusing on adding data to the Land_Area table which acts as a container for properties.

Alternately, if you aren’t familiar with GIS, this will give you enough knowledge to add a property to the map. There are links to some QGIS tutorials in the post that are worth visiting.

Helpful Items

There are a few things that your should have or know before you start, if possible. Here are a few that may help you on your project:

  • The ability to find your property on a map.
  • A platt map, or some other map of the boundaries and corners of your property.
  • Intimate knowledge of your land.

Adding a property

The first thing we want to do is add the boundary of your property, so we have an area to work within. Before we do that we need to find the property somehow in the map. This is where the osmSearch plugin will help. To make the osmSearch panel visible go to the View menu View > Panel > osmSearch. You can dock this anywhere you like, or not, your choice.

Adding osmSearch panel.

For this turn on the Google Physical layer that we added through the OpenLayers plugin and type in the city and state of the location into the osmSearch panel and hit Search. The location will then appear in the results field. Clicking on the result will pan you to the location you chose. Unfortunately it will not zoom, so you’ll need to choose an appropriate scale, 1:500,000 is a good place to start.

Note: osmSearch will highlight the feature you searched for in red, which can be annoying once you’ve zoomed in to the location. Dismiss it by clicking the “x” in the right hand corner of the search text box.

Zoom to place

At this point you should be able to find your property and zoom into so that the entire property is just visible. You probably want to turn off the Google Physical layer and turn on the Bing Aerial layer once you start zooming in, you’ll have to feel that transition out for yourself.

zoomedAerial

Adding a Property to the Map

Next will will edit the layer named “Land Areas” to add the property boundary. To do this select the layer, right click on it, and select toggle editing. At this point the layer is ready for editing.

toggleEditing

Click on the add feature button on the editing toolbar and begin delineating your property by digitizing the boundaries. For more information on editing layers in QGIS, visit digitizing an existing layer.

addFeature

Digitize your property boundary and add the attributes as shown below.
Adding Property Attributes

Stop editing, and save your edits. You should have something like this:
Newly added property.

Save the project before you close down QGIS and next post we will add some forest stands.

GeoForst Lite, Getting Started – Part 1

Introduction

GeoForst Lite is a standalone program consisting of three parts, QGIS, a local datastore, and a QGIS map.

Installation

  1. Download QGIS version 2.x and install.
  2. Download GeoForst Lite.
  3. Unzip GeoForst Lite and move it to any directory you choose. Your home or documents directory is a fine place for it.

Adding Plugins

At this point you should have the ability to start the QGIS. There are a couple of ways to make this easy. Let’s step through the process.

Begin by opening the QGIS application, it should open to a blank project. At this point we need to add a couple plugins to make life easy. To do this, select the Plugins menu and select Manage and Install Plugins….

pluginsMenu

Now we want the good stuff, so let’s enable the experimental plugins and we are ready to get our plugins.

experimental

Okay lets get two plugins, the OpenLayers plugin and the osmSearch plugin. OpenLayers will let us display a variety of excellent base layers such as Google Terrain and Bing Imagery. This is really fantastic stuff. The osmSearch plugin lets you find locations by place name, which beats finding a location by pan and zoom alone. Search for those Plugins and install them.

Installing the OpenLayers plugin…
OpenLayers

Finally let’s add the OSM place search plugin…
osmSearch

At this point the setup is complete. Open the GForst_Lite.qgs file that you unzip and placed on your file system and there will be three layers under the External Layers group.

ExternalLayers

Note: The OpenLayers plugin layers need a kick in the pants to scale correctly when first added. Zoom in or pan a bit to force it to redraw. It’s wonky, but a small price to pay for a great addition to QGIS.

Next up

Adding Your Property to GeoForst.

Creating Fallow Field Wildlife Openings with Planted Firebreaks

A result of the thinning was six wildlife openings that we had marked for total harvest during the tree marking phase of the project. It is important to note that a wildlife opening, at least a maintainable one, is not created solely from the cutting of trees. In fact, that is just the beginning.

The process started with a literature review on wildlife openings and habitat development. The most thorough and applicable document found was an excellent paper by the Virginia Department of Game and Inland Fisheries Managing Habitats for Ruffed Grouse in the Central and Southern Appalachians. Although it is focused on grouse, it presents practical and scientifically based forestry practices that promotes the acceleration and spatial compression of natural processes to benefit game while keeping them viable in both and economic and labor senses. I can’t say enough about this paper. Read it, read it again, and keep revisiting it as it is information dense.

In a nutshell, this is how we transformed a cut-over area into a wildlife opening:

Freshly cleared opening.

You can see in the photo above that it’s going to take more than spreading seed to make a permanent opening from this. To accomplish this, we first burned the slash. This unfortunately cost us some of the trees surrounding the opening, the heat was blistering.

Following this, we cleared the remaining slash and prepared the opening for planting. This required cutting the remaining stumps flush so that we would be able to navigate the openings with the tractor. Regular burning of the wildlife openings is anticipated, but it is mandatory that we can control them by mechanical means as well, via rotary cutter.

Cleaned opening

After cleaning we were ready to put in the planted firebreaks. The route we chose for most of the openings was to create a firebreak 10 meters from the edge of the woods that was two tractor widths wide which we would plant with a mixture of wheat and white clover. The interior of the opening would remain as a fallow field, which we would burn every few years.

To accomplish this, we marked the edge of the firebreak with red tree marking paint, directly on the ground and plowed in the two strips. This required cleaning the plow often and moving left over rocks and debris out of the way.

Plowed in firebreak

For this we used a standard chisel plow.

Once the ground had been broken up, rock, roots and debris cleared from the plowed strips, a disc harrow was used prepare for planting. This worked moderately well, but for a proper job it requires a lot of time and a bulldozer would be handy for the stumps.
Planting was done by calculating the plowed area and seed was measured using a bathroom scale. The seed mixture was distributed using a hand spreader which affords much more control than a tractor mounted spreader.

Finally, a piece of chain link fence was dragged behind an ATV to cover the seed and the rest we left up to the weather.

Here is a little bit on the results of this:
Planted Firebreaks and Fallow Field Followup

SQL Spatial Examples

Posting these here for my own reference, but use them yourself if you’d like.

Select Well Known Text from Geometry
select [Geometry Column].STAsText() from [Table];

Create WKT from lat/long fields, good for insert/update statements
select GEOGRAPHY::STGEomFromText(‘POINT (‘ + convert(varchar(20),[LONGITUDE]) + ‘ ‘ + convert(varchar(20),[LATITUDE]) +’)’, 4269) from [TABLE];

Intersection Example:
SELECT g.* , g.[Geometry Field].STAsText() FROM [Schema].[Table] g WHERE [Geometry Field].STIntersects(geometry::STGeomFromText(‘POLYGON ((-131.232584635417 55.4096875, -131.230598958333 55.4096875, -131.230598958333 55.4100455729167, -131.232584635417 55.4100455729167, -131.232584635417 55.4096875))’, [EPSG ID])) = 1

Get Area of Intersection
select
t1.[GEOMETRY_FIELD].STIntersection(t2.[GEOMETRY_FIELD]).STArea() AREA
from [TABLE_NAME_1] t2,
[TABLE_NAME_2] t1

Create Spatial Index:
CREATE SPATIAL INDEX [sidx_tablename_geom] ON [Schema].[Table]
(
[Geometry Field]
)USING GEOMETRY_GRID
WITH (
BOUNDING_BOX =(-173.116318241729, 52.7677349180939, -129.473430300096, 71.3903800225212), GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 = MEDIUM),
CELLS_PER_OBJECT = 16, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

Get Bounding Box of Feature Class:
WITH
ENVELOPE as
(
SELECT [Geometry Field].STEnvelope() as envelope from [Schema].[Table]
),
CORNERS as
(
SELECT envelope.STPointN(1) as point from ENVELOPE
UNION ALL select envelope.STPointN(3) from ENVELOPE
)

SELECT
MIN(point.STX) as MinX,
MIN(point.STY) as MinY,
MAX(point.STX) as MaxX,
MAX(point.STY) as MaxY
FROM
CORNERS;

Use GDAL to Insert Data from Shapefile to MS SQL:
ogr2ogr -f MSSQLSpatial “MSSQL:server=[Server Name];database=[DB Name];trusted_connection=yes” “…\[Shapefile Name].shp”

SRID from geometry field
select [Geometry Field Name].STSrid FROM [TABLE NAME];

Using a Power Mac G5 as a ZFS Time Machine Backup Server


If you are considering setting up a home network file server using Zettabyte File Server (ZFS) technology the Power Mac G5 should be given strong consideration. For one, these machines are inexpensive, they have room for lots of disks (see G5 Jive), they are beautiful, and the network natively with your other Mac hardware using AFP.

Documentation on using OS X as a ZFS file server and Time Machine backup location is scarce. After reading about using OpenSolaris for this purpose Time Machine Volumes with ZFS and AFP and some serious trial and error I have a working implementation. To help others from struggling through it, here are my notes and I hope you find them useful.

To get started make sure you have installed MacZFS and followed the MacZFS Getting Started instructions to create a pool. How one creates a ZFS pool is highly variable, situation dependent, and very well documented, I can’t do a better job so I won’t repeat it.

Here are the baseline ZFS pools for reference, before creating a new example pool:

zpool status

pool: mercury
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
mercury ONLINE 0 0 0
disk0s2 ONLINE 0 0 0

errors: No known data errors

zfs list

NAME USED AVAIL REFER MOUNTPOINT
mercury 338G 2.36T 172G /Volumes/mercury
mercury/Music 27.6G 2.36T 27.6G /Users/torsten/Music
mercury/tm-quercus 136G 364G 136G /Volumes/tm-quercus
mercury/tm-smorin 2.86G 247G 2.86G /Volumes/tm-smorin

Okay now let’s make a new pool and ready it for sharing:

-- Create that pool!
zfs create mercury/backups

-- Lets limit the backup pool to 500 GB.
zfs set quota=500G mercury/backups

chmod -R 770 /Volumes/mercury/backups/

-- Change the owner to the backup user.
chown -R torsten /Volumes/mercury/backups/

-- Tell Time Machine to recognize this as a supported device.
touch /Volumes/mercury/backups/.com.apple.timemachine.supported

So far things are pretty similar to how you’d do this on OpenSolaris, let’s take a look:

zfs list

NAME USED AVAIL REFER MOUNTPOINT
mercury 338G 2.36T 172G /Volumes/mercury
mercury/Music 27.6G 2.36T 27.6G /Users/torsten/Music
mercury/backups 23.5K 500G 23.5K /Volumes/mercury/backups -- Our new pool!
mercury/tm-quercus 136G 364G 136G /Volumes/tm-quercus
mercury/tm-smorin 2.86G 247G 2.86G /Volumes/tm-smorin

Now we need to trick OS X into sharing our ZFS pool. Here we create a new directory in the pool. This needs to be done because, oddly, Finder will see the new pool as the parent pool.

mkdir /Volumes/mercury/backups/time-back

Since we are running OS X Panther (version 10.5), System Preferences won’t display many of the directories in the root of the OS. So, to make this new filesystem accessible to GUI we need to make a symlink in the user’s home directory.

ln -s /Volumes/mercury/backups/time-back ~/time-back

Now we are ready to share! Go to System Preferences > Sharing and add the newly created directory as a share.
Sharing pane in System Preferences

Let’s see what Time Machine thinks. First let’s mount the drive onto the Mac laptop (mine runs Lion 10.7). Open Finder and press Apple-K to connect to a server. Then type afp://[Server Name or IP]/[Share Name] like so:
afp://r2d2.local/time-back

Finally, open Time Machine Preferences and select the backup disk

View of Time Machine with the ZFS share visible.

** If the drive does not appear in Time Machine Preferences do this on the client (in this case the laptop):

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

If all went well you’re now storing your backups on ZFS to a remote server!

Adding the Spatialite GeoServer Plugin on OS X

Start by going to page and reading through their documentation. It didn’t quite work out for me, so I thought I’d be more specific and share with you the steps I took to make this work.

1) Get the plugin, the url given in the Geoserver manual is incorrect, as the plugin is not in the trunk of the project. Instead use the following command and/or url to download the plugin –

curl http://gridlock.opengeo.org/geoserver/2.1.x/community-latest/geoserver-2.1-SNAPSHOT-spatialite-plugin.zip --O geoserver-2.1-SNAPSHOT-spatialite-plugin.zip

2) Unzip the archive file –

unzip geoserver-2.1-SNAPSHOT-spatialite-plugin.zip

3) Copy both the jar files to Geoserver lib –

cp gt-jdbc-spatialite-2.7-SNAPSHOT.jar /Applications/GeoServer.app/Contents/Resources/Java/webapps/geoserver/WEB-INF/lib

cp sqlite-jdbc-spatialite-3.7.2-1.jar cp gt-jdbc-spatialite-2.7-SNAPSHOT.jar /Applications/GeoServer.app/Contents/Resources/Java/webapps/geoserver/WEB-INF/lib

4) Install geos and proj-
sudo port install geos
sudo port install proj

5) Startup/restart Geoserver.

6) Add a new store and you should see Spatialite as an option.

Replacing the Water Pump on a Range Rover Classic

Replacing the water pump on a Rover seems like a pretty common thing to do, but I had a hard time find a good description of the process on the net. The site www.rangerovers.net has tons of great information, but oddly it was pretty devoid of water pump replacement for the classic. Since I went through this, I took some photos and thought I’d share what knowledge I gained.

First this is NOT a 30 min job as I read some where, but at the same time it isn’t as bad as it could be. Secondly, the correct tools are important for this job. One speciality tool that I would not do this without (I tried and failed) is a fan clutch wrench. I bought a universal for around $80 at Napa that actually worked. Also, you need 11, 12, and 13 mm wrenches and sockets (I won’t use SAE because it is redundant and unnecessary), a 36 mm wrench to take off the fan, and 1/2″ socket with an 8″ extension (sometimes you have to be flexible and be a hypocrite).

Okay down to brass tacks:

1) Remove the fan and fan shroud by first taking the four screws from the shroud and then using the fan clutch wrench and 36 mm wrench to remove the fan. Rotate the 36 mm wrench to the right to loosen while holding the fan clutch wrench in place.

Fan shroud removal

2) Loosen belt tensioner and remove belts from water pump.
Remove belts.

3) Remove the pulley in front of the fan. Time to use the fan clutch wrench.
pulley removal

4) Remove belt tensioner, which comes off automatically when you remove the bolts on the bottom left of the pump.
pulley removal

5) Loosen and rotate thingy in front of the far right side of the pump. I don’t know what this is, but it moves just enough to give you the room needed to get the pump inserted without knocking the gasket out of place.
pulley removal

6) Remove the pump by giving it a healthy whack with a 2×4 or, in my case, a log. Be sure all bolts are removed. After struggling a bit, I realized that there was one bolt remaining on thr far right attached to the thingy.
pulley removal

7) Clean old gasket material from remaining half. I was very lucky and the gasket stuck to the half of the pump that I removed.

8) Add gasket. I tried attaching the gasket to the new half of the pump which didn’t work. Instead I attached the gasket to the old half and after many tries was able to insert new pump without warping the gasket.
pulley removal

9) Install pump. Straight forward but must be done carefully to avoid damaging or warping the gasket. This took many tries.
pulley removal.

From here out it’s all previous steps in reverse. Finish off by filling up the coolant. You really don’t want to forget this!

pulley removal

Getting a list of Installed Features from Server08 using PS


This is great for getting a list of installed features from a windows server. So far I’ve only tried do this locally aside from a quick test on a Windows 7 machine, from which it failed.

In powershell:
IMPORT-Module servermanager
Get-WindowsFeature

Source: http://blogs.msdn.com/b/powershell/archive/2009/01/27/managing-server-features-with-powershell-cmdlets-on-windows-2008-server-r2-beta.aspx

Fix Orphaned Users SQL2008 R2

General pattern for this common problem following a database restore. Note that the syntax has changed from SQL2005.

SQL 2008 R2 Syntax::

USE <database_name>;
GO
sp_change_users_login @Action='Report';
GO
sp_change_users_login @Action='update_one', @UserNamePattern='',
@LoginName='';
GO

SQL 2005 Syntax:


USE <database_name>;
GO
EXEC sp_change_users_login 'Report';
GO
EXEC sp_change_users_login 'Auto_Fix', 'user';
GO