matryoshka_view 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5fd3641abdb255955bfd8e0b78b13e84edadf7b2
4
- data.tar.gz: 679ada03ad403621c94785d2104ae357ea52b789
3
+ metadata.gz: 476ae7b97b8e58275a75bf20579bd1b4ccfc2dfb
4
+ data.tar.gz: cebc94aadd756d91487a6dac9a876ab8f7b4689c
5
5
  SHA512:
6
- metadata.gz: 93a02dad73d62071868513a23a7ab3178800a0bb10ec76ffdd4ce952f780a8b6b8ed7b94fc396a3b8459f4c462f6fe80d26b865f4f64ecb0a201043f5a4bf175
7
- data.tar.gz: dbc9b7e721f1a6696a2f88a087514b942b9d2c2ae0febf6d409ddcec46cc424850c273777ff8ccaf05c7c8c552cadd4805be9a3e3f7ece46aa55fc58a06a73aa
6
+ metadata.gz: 3626af9dc3a4925a637770f4f5de89c0c6b2523ff667cea8d1bcd196b0428e742864fca5a4ca88c519678ecc27a13deae1f630e426a9394f2c2900913848a8d7
7
+ data.tar.gz: 7991ff9f1db8b738d5ee2274e7c0d4d85e2b9228a699b9dda9362b2173bc1865cb01390bb7c4078822aa00156dedd86cb23cb28e01cfcebfc08e6f0d66286a6f
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 2014-10-10 / 0.2.2
2
+
3
+ * Enhancements
4
+
5
+ * Speed things up with an explicit bbox check followed by the buffer query
6
+
1
7
  2014-10-09 / 0.2.1
2
8
 
3
9
  * Bug fixes
@@ -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_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_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
51
51
  elsif the_geom_geojson
52
- Record.where("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_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
53
53
  else
54
54
  raise "expecting geom_source or the_geom_geojson"
55
55
  end
@@ -1,3 +1,3 @@
1
1
  class MatryoshkaView
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matryoshka_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seamus Abshere