Skip to content

Instantly share code, notes, and snippets.

@zhm
zhm / patch_filegdb_dylibs.sh
Created July 18, 2012 05:22
Patch ESRI FileGDB dylibs
$ install_name_tool -id "$(pwd)/lib/libFileGDBAPI.dylib" ./lib/libFileGDBAPI.dylib
$ install_name_tool -change "@rpath/libfgdbunixrtl.dylib" "$(pwd)/lib/libfgdbunixrtl.dylib" ./lib/libFileGDBAPI.dylib
$ install_name_tool -id "$(pwd)/lib/libfgdbunixrtl.dylib" ./lib/libfgdbunixrtl.dylib
@zhm
zhm / osmstats.sh
Created June 25, 2012 02:15
osmstats
OSMUSER="coleman"; curl -s "www.overpass-api.de/api/interpreter?data=%5Bout%3Ajson%5D%3B%28node%28user%3A%22$OSMUSER%22%29%3Bway%28user%3A%22$OSMUSER%22%29%3Brelation%28user%3A%22$OSMUSER%22%29%3B%29%3Bout%3B" | ruby -e "require 'json'; osm = JSON.parse(STDIN.read); nodes = osm['elements'].select {|e| e['type'] == 'node'}; ways = osm['elements'].select {|e| e['type'] == 'way'}; relations = osm['elements'].select {|e| e['type'] == 'relation'}; puts ''; puts 'stats for $OSMUSER:'; puts 'nodes: ' + nodes.count.to_s; puts 'ways: ' + ways.count.to_s; puts 'relations: ' + relations.count.to_s; puts ''"
@zhm
zhm / configure.in
Created May 24, 2012 20:40
configure.in for GDAL 1.9.1
dnl ***************************************************************************
dnl $Id: configure.in 24333 2012-04-28 12:18:28Z rouault $
dnl
dnl Project: GDAL
dnl Purpose: Configure source file.
dnl Author: Frank Warmerdam, warmerdam@pobox.com
dnl
dnl ***************************************************************************
dnl Copyright (c) 2000, Frank Warmerdam
dnl
@zhm
zhm / gdal_with_ruby.sh
Created May 17, 2012 20:52
GDAL w/ Ruby
./configure \
--with-local=yes \
--prefix=$HOME/local \
--with-threads \
--with-libtool \
--with-libtiff=internal \
--with-geotiff=internal \
--with-pcraster=internal \
--with-pcidsk=internal \
--with-libz=/usr \
@zhm
zhm / gist:2005158
Last active February 28, 2022 17:11
Building GDAL 1.9 with ESRI FileGDB support on OS X Lion

Building GDAL 1.9.x with ESRI FileGDB support on OS X Lion

  • Download the SDK from ESRI's website http://resources.arcgis.com/content/geodatabases/10.0/file-gdb-api
  • Extract the SDK, and put the contents of the directory in a known location, I used ~/local/filegdb. Here's an example path to one of the files: ~/local/filegdb/lib/libFileGDBAPI.dylib
  • I use ~/local/filegdb so it can stay isolated in it's own place. You can put it anywhere, but the next few steps might be different.
  • Go into the directory containing the FileGDB SDK, e.g. ~/local/filegdb
  • ESRI built these dylib's using @rpath's, so to avoid needing to mess with DYLD_LIBRARY_PATH, I updated the @rpath's using install_name_tool. There might be a more elegant way to handle this. If so, comments are welcome!
  • Here are the commands I used to patch the dylibs, this is not required if you want to use DYLD_LIBRARY_PATH yourself:
install_name_tool -id "$(pwd)/lib/libFileGDBAPI.dylib" ./lib/libFileGDBAPI.dylib
install_name_tool -change "@rpath/libfgdbunixrtl.dylib" "$(pwd)/lib/libfgdbunixrtl.dylib" ./lib/libFileGDBAPI.dylib
install_name_tool -id "$(pwd)/lib/libfgdbunixrtl.dylib" ./lib/libfgdbunixrtl.dylib
./configure \
--with-local=yes \
--prefix=/Users/zacmcc/local \
--with-threads \
--with-libtool \
--with-libtiff=internal \
--with-geotiff=internal \
--with-pcraster=internal \
--with-pcidsk=internal \
--with-bsb \
@zhm
zhm / gist:2005082
Created March 9, 2012 04:45
configure.in for GDAL 1.9
dnl ***************************************************************************
dnl $Id: configure.in 23690 2012-01-03 18:56:17Z rouault $
dnl
dnl Project: GDAL
dnl Purpose: Configure source file.
dnl Author: Frank Warmerdam, warmerdam@pobox.com
dnl
dnl ***************************************************************************
dnl Copyright (c) 2000, Frank Warmerdam
dnl
(lldb) po [[NSManagedObjectContext defaultContext] objectWithID:[self projectObjectID]]
(id) $33 = 0x0048b520 <SNProject: 0x48b520> (entity: Project; id: 0x489040 <x-coredata://29AA8056-CC37-4157-A6DC-1D1A535BC425/Project/p1> ; data: {
accountID = 4f31fbfb14414036cc000006;
attributes = "(...not nil..)";
createdAt = "2012-02-08 18:56:03 +0000";
defaultFormID = nil;
deletedAt = nil;
downloadRecordFilterNELatitude = nil;
downloadRecordFilterNELongitude = nil;
downloadRecordFilterSWLatitude = nil;
GDAL_ROOT = /Users/zacmcc/Downloads/gdal-1.9.0
top_builddir = $(GDAL_ROOT)
#
# the library can be built by the native build or with the help of libtool
#
SHELL = /bin/sh
HAVE_LIBTOOL = yes
LIBTOOL = $(SHELL) $(top_builddir)/libtool