nofxx-postgis_adapter 0.1.2 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +1 -1
- data/{README.markdown → README.rdoc} +32 -35
- data/Rakefile +1 -8
- data/lib/postgis_adapter.rb +1 -1
- data/postgis_adapter.gemspec +4 -4
- metadata +4 -3
data/Manifest.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
Postgis Adapter
|
2
|
-
|
1
|
+
== Postgis Adapter
|
2
|
+
|
3
3
|
|
4
4
|
A plugin for ActiveRecord which manages the PostGIS geometric columns
|
5
5
|
in a transparent way (that is like the other base data type columns).
|
@@ -7,36 +7,35 @@ It also provides a way to manage these columns in migrations.
|
|
7
7
|
|
8
8
|
This fork adds handy methods to make geometrical calculations on postgis.
|
9
9
|
|
10
|
-
|
10
|
+
Postgis Manual - http://postgis.refractions.net/documentation/manual-svn
|
11
11
|
|
12
12
|
*PostGIS and Rails 2+ only*.
|
13
13
|
|
14
14
|
|
15
|
-
Install
|
16
|
-
-------
|
15
|
+
=== Install
|
17
16
|
|
18
17
|
If you are using Spatial Adapter, *remove it first*.
|
19
18
|
|
20
|
-
|
19
|
+
==== Dependencies
|
21
20
|
|
22
21
|
- georuby
|
23
22
|
- postgres 8.3+
|
24
23
|
- postgis 1.3+
|
25
24
|
|
26
|
-
|
25
|
+
==== As gem:
|
27
26
|
|
28
27
|
sudo gem sources --add http://gems.github.com
|
29
28
|
sudo gem install nofxx-postgis_adapter
|
30
29
|
|
31
30
|
config.gem "nofxx-postgis_adapter", :lib => "postgis_adapter", :source => "http://gems.github.com"
|
32
31
|
|
33
|
-
|
32
|
+
==== As plugin:
|
34
33
|
|
35
34
|
script/plugin install git://github.com/nofxx/postgis_adapter.git
|
36
35
|
|
37
36
|
|
38
|
-
How to Use
|
39
|
-
|
37
|
+
=== How to Use
|
38
|
+
|
40
39
|
|
41
40
|
Geometric columns in your ActiveRecord models now appear just like
|
42
41
|
any other column of other basic data types. They can also be dumped
|
@@ -44,7 +43,7 @@ in ruby schema mode and loaded in migrations the same way as columns
|
|
44
43
|
of basic types.
|
45
44
|
|
46
45
|
|
47
|
-
|
46
|
+
=== Model
|
48
47
|
|
49
48
|
class TablePoint < ActiveRecord::Base
|
50
49
|
end
|
@@ -62,8 +61,7 @@ model and the table defined above :
|
|
62
61
|
=> 1
|
63
62
|
|
64
63
|
|
65
|
-
PostGIS Functions
|
66
|
-
-----------------
|
64
|
+
== PostGIS Functions
|
67
65
|
|
68
66
|
Here are this fork additions. To use it:
|
69
67
|
|
@@ -79,7 +77,7 @@ Here are this fork additions. To use it:
|
|
79
77
|
@street = Street.new( :line => **LineString** )
|
80
78
|
|
81
79
|
|
82
|
-
|
80
|
+
=== Play!
|
83
81
|
|
84
82
|
@place.inside?(@park)
|
85
83
|
=> true
|
@@ -119,7 +117,7 @@ Line Strings:
|
|
119
117
|
=> 4.40853636
|
120
118
|
|
121
119
|
|
122
|
-
|
120
|
+
=== And for classes:
|
123
121
|
|
124
122
|
City.close_to(@point)
|
125
123
|
=> [Array of cities in order by distance...
|
@@ -134,7 +132,7 @@ Line Strings:
|
|
134
132
|
=> [Array of areas contains the point...
|
135
133
|
|
136
134
|
|
137
|
-
|
135
|
+
=== BBox Support
|
138
136
|
|
139
137
|
@area.strictly_left_of? @point
|
140
138
|
|
@@ -166,7 +164,7 @@ Or use a (almost) postgis like notation:
|
|
166
164
|
@area.bbox "@", @park
|
167
165
|
|
168
166
|
|
169
|
-
|
167
|
+
=== Warning
|
170
168
|
|
171
169
|
*To be fixed:*
|
172
170
|
|
@@ -175,13 +173,13 @@ implement a multi geom.
|
|
175
173
|
|
176
174
|
http://nofxx.lighthouseapp.com/projects/20712/tickets/3-multiple-geoms-in-model
|
177
175
|
|
178
|
-
|
176
|
+
=== Wiki
|
179
177
|
|
180
|
-
Check out the
|
178
|
+
Check out the wiki pages (http://github.com/nofxx/postgis_adapter/wikis).
|
181
179
|
For all functions.
|
182
180
|
|
183
181
|
|
184
|
-
|
182
|
+
=== Find_by
|
185
183
|
|
186
184
|
find_by_*column* has been redefined when column is of a geometric type.
|
187
185
|
Instead of using the Rails default '=' operator, for which I can't see
|
@@ -208,10 +206,10 @@ In PostGIS, since you can only use operations with geometries with the same SRID
|
|
208
206
|
Park.find_by_geom([[3,5.6],[19.98,5.9],123])
|
209
207
|
|
210
208
|
|
211
|
-
Database Tools
|
212
|
-
|
209
|
+
== Database Tools
|
210
|
+
|
213
211
|
|
214
|
-
|
212
|
+
=== Migrations
|
215
213
|
|
216
214
|
Here is an example of code for the creation of a table with a
|
217
215
|
geometric column in PostGIS, along with the addition of a spatial
|
@@ -228,7 +226,7 @@ index on the column :
|
|
228
226
|
end
|
229
227
|
|
230
228
|
|
231
|
-
|
229
|
+
=== Fixtures
|
232
230
|
|
233
231
|
If you use fixtures for your unit tests, at some point,
|
234
232
|
you will want to input a geometry. You could transform your
|
@@ -244,8 +242,8 @@ the geometric column is a point:
|
|
244
242
|
geom: <%= Point.from_x_y(123.5,321.9).to_yaml %>
|
245
243
|
|
246
244
|
|
247
|
-
Geometric data types
|
248
|
-
|
245
|
+
== Geometric data types
|
246
|
+
|
249
247
|
|
250
248
|
Ruby geometric datatypes are currently made available only through
|
251
249
|
the GeoRuby library (http://georuby.rubyforge.org): This is where the
|
@@ -255,8 +253,7 @@ geometric datatype libraries, such as Ruby/GEOS, as long as they
|
|
255
253
|
can support reading and writing of EWKB.
|
256
254
|
|
257
255
|
|
258
|
-
Warning
|
259
|
-
-------
|
256
|
+
=== Warning
|
260
257
|
|
261
258
|
- Since ActiveRecord seems to keep only the string values directly
|
262
259
|
returned from the database, it translates from these to the correct
|
@@ -278,24 +275,24 @@ something like this :
|
|
278
275
|
place.the_geom = the_geom
|
279
276
|
|
280
277
|
|
281
|
-
License
|
282
|
-
|
278
|
+
== License
|
279
|
+
|
283
280
|
|
284
281
|
Spatial Adapter for Rails is released under the MIT license.
|
285
282
|
PostGis Adapter is released under the MIT license.
|
286
283
|
|
287
284
|
|
288
|
-
Support
|
289
|
-
|
285
|
+
== Support
|
286
|
+
|
290
287
|
|
291
288
|
Tested using rails 2.2.2 / postgresql 8.3.5 / postgis 1.3.3 / linux / osx
|
292
289
|
|
293
290
|
Any questions, enhancement proposals, bug notifications or corrections:
|
294
291
|
|
295
|
-
|
292
|
+
=== PostGis Adapter
|
296
293
|
|
297
|
-
|
294
|
+
Project Tracker http://nofxx.lighthouseapp.com/projects/20712-postgis_adapter
|
298
295
|
|
299
|
-
|
296
|
+
=== SpatialAdapter
|
300
297
|
|
301
298
|
guilhem.vellut+georuby@gmail.com.
|
data/Rakefile
CHANGED
@@ -37,16 +37,9 @@ Dir['tasks/**/*.rake'].each { |t| load t }
|
|
37
37
|
# TODO - want other tests/tasks run by default? Add them to the list
|
38
38
|
# task :default => [:spec, :features]
|
39
39
|
|
40
|
-
|
41
40
|
desc 'Default: run specs.'
|
42
41
|
task :default => :spec
|
43
42
|
|
44
|
-
#desc 'Run the specs'
|
45
|
-
#Spec::Rake::SpecTask.new(:spec) do |t|
|
46
|
-
# t.spec_opts = ['--colour --format progress --loadby mtime --reverse']
|
47
|
-
# t.spec_files = FileList['spec/**/*_spec.rb']
|
48
|
-
#end
|
49
|
-
|
50
43
|
desc "Run all specs"
|
51
44
|
Spec::Rake::SpecTask.new do |t|
|
52
45
|
t.spec_files = FileList['spec/*_spec.rb']
|
@@ -74,7 +67,7 @@ Rake::RDocTask::new do |rdoc|
|
|
74
67
|
rdoc.rdoc_dir = 'doc/'
|
75
68
|
rdoc.title = "PostGIS Adapter for Rails Documentation"
|
76
69
|
rdoc.options << '--line-numbers' << '--inline-source'
|
77
|
-
rdoc.rdoc_files.include('README.
|
70
|
+
rdoc.rdoc_files.include('README.rdoc')
|
78
71
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
79
72
|
end
|
80
73
|
|
data/lib/postgis_adapter.rb
CHANGED
data/postgis_adapter.gemspec
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "postgis_adapter"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.7"
|
4
4
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
5
5
|
s.authors = ["Marcos Piccinini"]
|
6
6
|
s.date = "2008-12-10"
|
7
7
|
s.description = "Postgis Adapter for Activer Record"
|
8
8
|
s.email = ["x@nofxx.com"]
|
9
|
-
s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
|
10
|
-
s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.
|
9
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
|
10
|
+
s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "init.rb", "install.rb", "lib/postgis_adapter.rb", "lib/postgis_adapter/acts_as_geom.rb", "lib/postgis_adapter/common_spatial_adapter.rb", "lib/postgis_functions.rb", "lib/postgis_functions/bbox.rb", "lib/postgis_functions/class.rb", "lib/postgis_functions/common.rb", "lib/postgis_functions/linestring.rb", "lib/postgis_functions/point.rb", "lib/postgis_functions/polygon.rb", "postgis_adapter.gemspec", "rails/init.rb", "script/console", "script/destroy", "script/generate", "uninstall.rb"]
|
11
11
|
s.test_files = ["spec/acts_as_geom_spec.rb", "spec/common_spatial_adapter_spec.rb", "spec/db/database_postgis.yml", "spec/db/models_postgis.rb", "spec/db/schema_postgis.rb", "spec/postgis_adapter_spec.rb", "spec/postgis_functions/bbox_spec.rb", "spec/postgis_functions/linestring_spec.rb", "spec/postgis_functions/point_spec.rb", "spec/postgis_functions/polygon_spec.rb", "spec/postgis_functions_spec.rb", "spec/spec.opts", "spec/spec_helper.rb"]
|
12
12
|
s.has_rdoc = true
|
13
13
|
s.homepage = "http://github.com/nofxx/postgis_adapter"
|
14
|
-
s.rdoc_options = ["--main", "README.
|
14
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
15
15
|
s.require_paths = ["lib"]
|
16
16
|
s.rubyforge_project = %q{postgis_adapter}
|
17
17
|
s.rubygems_version = %q{1.3.1}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nofxx-postgis_adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Piccinini
|
@@ -49,11 +49,12 @@ extensions: []
|
|
49
49
|
extra_rdoc_files:
|
50
50
|
- History.txt
|
51
51
|
- Manifest.txt
|
52
|
+
- README.rdoc
|
52
53
|
files:
|
53
54
|
- History.txt
|
54
55
|
- MIT-LICENSE
|
55
56
|
- Manifest.txt
|
56
|
-
- README.
|
57
|
+
- README.rdoc
|
57
58
|
- Rakefile
|
58
59
|
- init.rb
|
59
60
|
- install.rb
|
@@ -78,7 +79,7 @@ homepage: http://github.com/nofxx/postgis_adapter
|
|
78
79
|
post_install_message:
|
79
80
|
rdoc_options:
|
80
81
|
- --main
|
81
|
-
- README.
|
82
|
+
- README.rdoc
|
82
83
|
require_paths:
|
83
84
|
- lib
|
84
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|