matryoshka_view 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 476ae7b97b8e58275a75bf20579bd1b4ccfc2dfb
4
- data.tar.gz: cebc94aadd756d91487a6dac9a876ab8f7b4689c
3
+ metadata.gz: f9abe733adeec7a0d632b300437a8c83682915b6
4
+ data.tar.gz: 4d8cd1d651217606ac0530d673053eae7ec0ab70
5
5
  SHA512:
6
- metadata.gz: 3626af9dc3a4925a637770f4f5de89c0c6b2523ff667cea8d1bcd196b0428e742864fca5a4ca88c519678ecc27a13deae1f630e426a9394f2c2900913848a8d7
7
- data.tar.gz: 7991ff9f1db8b738d5ee2274e7c0d4d85e2b9228a699b9dda9362b2173bc1865cb01390bb7c4078822aa00156dedd86cb23cb28e01cfcebfc08e6f0d66286a6f
6
+ metadata.gz: fb4f27953d68e3d8017889afa92ea2bb1c8865b0fdfcce5b084b5d70477ea975bf522b532c450446020efc41c45f705c6e534ad0870213478d7bc0197cf25d46
7
+ data.tar.gz: 05fbc48cbeeb69736d5fdb8f7ef1554b495e144c9b3d9bca7cac3d50ea8716c7055b57ccbea787a7f0988ffb7d6cd290965c1487b4091feb712c507d88d531db
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 2014-10-12 / 0.2.3
2
+
3
+ * Enhancements
4
+
5
+ * Speed things up by just using && for bbox check; ST_Contains not needed.
6
+
1
7
  2014-10-10 / 0.2.2
2
8
 
3
9
  * Enhancements
@@ -1,3 +1,3 @@
1
1
  class MatryoshkaView
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -47,9 +47,9 @@ class MatryoshkaView
47
47
  def lookup(geom_source: nil, the_geom_geojson: nil)
48
48
  # FIXME move to Record class method
49
49
  hit = if geom_source
50
- Record.where("ST_Contains(ST_Expand(the_geom, 0.00001), (SELECT the_geom FROM #{geom_source.class.quoted_table_name} WHERE id = #{quote(geom_source.id)})) AND ST_Contains(ST_Buffer(the_geom, 0.00001), (SELECT the_geom FROM #{geom_source.class.quoted_table_name} WHERE id = #{quote(geom_source.id)}))").order("ST_Area(the_geom, false) ASC").first
50
+ Record.where("ST_Expand(the_geom, 0.00001) && (SELECT the_geom FROM #{geom_source.class.quoted_table_name} WHERE id = #{quote(geom_source.id)}) AND ST_Contains(ST_Buffer(the_geom, 0.00001), (SELECT the_geom FROM #{geom_source.class.quoted_table_name} WHERE id = #{quote(geom_source.id)}))").order("ST_Area(the_geom, false) ASC").first
51
51
  elsif the_geom_geojson
52
- Record.where("ST_Contains(ST_Expand(the_geom, 0.00001), ST_SetSRID(ST_GeomFromGeoJSON(#{quote(the_geom_geojson)}), 4326)) AND ST_Contains(ST_Buffer(the_geom, 0.00001), ST_SetSRID(ST_GeomFromGeoJSON(#{quote(the_geom_geojson)}), 4326))").order("ST_Area(the_geom, false) ASC").first
52
+ Record.where("ST_Expand(the_geom, 0.00001) && ST_SetSRID(ST_GeomFromGeoJSON(#{quote(the_geom_geojson)}), 4326) AND ST_Contains(ST_Buffer(the_geom, 0.00001), ST_SetSRID(ST_GeomFromGeoJSON(#{quote(the_geom_geojson)}), 4326))").order("ST_Area(the_geom, false) ASC").first
53
53
  else
54
54
  raise "expecting geom_source or the_geom_geojson"
55
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matryoshka_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seamus Abshere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2014-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord