Skip to content

rkj/dm-postgis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dm-postgis

Very simple type for datamapper allowing storing GeoRuby Geometries types in Postgis. This uses GeoRuby to do all the hard work. here's an example

class Foo
  include DataMapper::Resource
  
  property :id, Serial
  property :name, Integer
  property :geom, PostGISGeometry
end

# create a GeoRuby LineString
line = GeoRuby::SimpleFeatures::LineString.new(4236)
#add some points
[[12.12,13.14], [12.13,14.15], [12.15,16.17]].each{|x,y| line.points << GeoRuby::SimpleFeatures::Point.from_x_y(x,y)}
# stick it in the db!
f = Foo.create(:name => "random geometry", :geom => line)

Copyright

Copyright (c) 2010 Roman Kamyk jr, 2012 svs. See LICENSE for details.

About

Postgis adapter for DataMapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages