Skip to content

Latest commit

 

History

History
101 lines (59 loc) · 3.46 KB

README.rdoc

File metadata and controls

101 lines (59 loc) · 3.46 KB

FindIt Support

This package contains miscellaneous functions and classes to support the “Find It Nearby” application.

The “Find It Nearby” app finds closest features on a map using a geospatial database. The original application was forked several times into various projects. Unfortunately, it was difficult to setup and the forked versions diverged, with no simple way to backport improvements.

To solve this problem, I created this package to contain the GIS support and classes for managing some of the objects commonly used in these applications (such as locations on a map or marker icons).

This package provides:

  • Enhancements to the Sequel database toolkit to add “spatialite” support.

  • A FindIt::Location class that provides extremely lightweight support for map locations (latitude/longitude).

  • Various classes to represent “assets” managed by the application, including map markers (icons that represent a point on the map) and map regions (shaded areas that represent a polygon region on the map).

To incorporate this library into another package (built with “bundler” support), add to the Gemfile:

gem 'findit-support', :git => "git://github.com/chip-rosenthal/findit-support.git"

Spatialite Support

The home page for Spatialite is: www.gaia-gis.it/gaia-sins/

Debian

The libspatialite2 package on Debian “squeeze” (currently the “stable” version) is incredibly old. So I’ve been building “libspatialite” from source. The included README describes the process.

I obtained the PROJ.4 library by running:

# apt-get install libproj0 libproj-dev

I had to download and build the GEOS and FreeXL from source.

Ubuntu

Ubuntu has a libspatialite3 library that can be used.

# apt-get install libspatialite3

There is one problem, however: the package does not create a “libspatialite.so” entry. You can create the entry manually by doing:

# ln -s libspatialite.so.3 /usr/lib/libspatialite.so

Alternately, you can define SPATIALITE in your environment before running a program that uses this package.

$ export SPATIALITE=libspatialite.so.3

Mac OS

The following information is derived from: atxcivichack3.wikispaces.com/findit+on+mac

Mac’s default sqlite3 does not have R*Tree enabled so can not load extensions. This is how to work around this issue.

Assumption, you are using Homebrew: github.com/mxcl/homebrew

brew reinstall sqlite3 --with-rtree --with-docs --with-fts --with-functions

The output will contain something like:

LDFLAGS: -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include

You now need to use these paths when installing the sqlite3 gem:

gem install sqlite3 -- --with-sqlite3-include=/usr/local/opt/sqlite/include --with-sqlite3-lib=/usr/local/opt/sqlite/lib

If installation of the sqlite3 gem fails with:

The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

…and you know you have already installed development tools, then see stackoverflow.com/questions/13279856/the-compiler-failed-to-generate-an-executable-file-runtimeerror and run the following:

brew tap homebrew/dupes ; brew install apple-gcc42

Once the sqlite3 gem is successfully installed, you need to specify the path to the libspatialite library when you run the application:

SPATIALITE=/usr/local/lib/libspatialite.dylib prog ...

Author

Chip Rosenthal chip@unicom.com

This package is published at: github.com/chip-rosenthal/findit-support