README.rdoc in nofxx-postgis_adapter-0.1.7 vs README.rdoc in nofxx-postgis_adapter-0.1.8

- old
+ new

@@ -1,8 +1,7 @@ -== Postgis Adapter += PostgisAdapter - A plugin for ActiveRecord which manages the PostGIS geometric columns in a transparent way (that is like the other base data type columns). It also provides a way to manage these columns in migrations. This fork adds handy methods to make geometrical calculations on postgis. @@ -14,31 +13,33 @@ === Install If you are using Spatial Adapter, *remove it first*. + ==== Dependencies - georuby - postgres 8.3+ - postgis 1.3+ + ==== As gem: sudo gem sources --add http://gems.github.com sudo gem install nofxx-postgis_adapter config.gem "nofxx-postgis_adapter", :lib => "postgis_adapter", :source => "http://gems.github.com" + ==== As plugin: script/plugin install git://github.com/nofxx/postgis_adapter.git === How to Use - Geometric columns in your ActiveRecord models now appear just like any other column of other basic data types. They can also be dumped in ruby schema mode and loaded in migrations the same way as columns of basic types. @@ -88,10 +89,11 @@ @place.outside?(@park) @street.crosses?(@park) @area.contains?(@place) + Polygons: @park.area => 1345 @@ -99,10 +101,11 @@ @park.contains?(@point) => true @park.overlaps?(@other_park) => false + Line Strings: @street_east.intersects?(@street_west) => false @@ -162,19 +165,21 @@ @area.bbox "|>>", @point @area.bbox "@", @park + === Warning *To be fixed:* This only supports one geom column per model. Still looking for the best way to implement a multi geom. http://nofxx.lighthouseapp.com/projects/20712/tickets/3-multiple-geoms-in-model + === Wiki Check out the wiki pages (http://github.com/nofxx/postgis_adapter/wikis). For all functions. @@ -204,13 +209,13 @@ In PostGIS, since you can only use operations with geometries with the same SRID, you can add a third element representing the SRID of the bounding box to the array. It is by default set to -1: Park.find_by_geom([[3,5.6],[19.98,5.9],123]) + == Database Tools - === Migrations Here is an example of code for the creation of a table with a geometric column in PostGIS, along with the addition of a spatial index on the column : @@ -242,19 +247,24 @@ geom: <%= Point.from_x_y(123.5,321.9).to_yaml %> == Geometric data types - Ruby geometric datatypes are currently made available only through the GeoRuby library (http://georuby.rubyforge.org): This is where the *Point.from_x_y* in the example above comes from. It is a goal of a future release of the Spatial Adapter to support additional geometric datatype libraries, such as Ruby/GEOS, as long as they can support reading and writing of EWKB. +== Annotate +If you are using annotate_models, check out this fork which adds geometrical annotations for PostgisAdapter and SpatialAdapter: + +http://github.com/nofxx/annotate_models + + === Warning - Since ActiveRecord seems to keep only the string values directly returned from the database, it translates from these to the correct types everytime an attribute is read, which is probably ok for simple @@ -275,24 +285,25 @@ place.the_geom = the_geom == License - Spatial Adapter for Rails is released under the MIT license. -PostGis Adapter is released under the MIT license. +Postgis Adapter is released under the MIT license. == Support - Tested using rails 2.2.2 / postgresql 8.3.5 / postgis 1.3.3 / linux / osx Any questions, enhancement proposals, bug notifications or corrections: -=== PostGis Adapter +=== PostgisAdapter + Project Tracker http://nofxx.lighthouseapp.com/projects/20712-postgis_adapter + === SpatialAdapter + guilhem.vellut+georuby@gmail.com.