lib/postgis_functions.rb in nofxx-postgis_adapter-0.1.7 vs lib/postgis_functions.rb in nofxx-postgis_adapter-0.1.8

- old
+ new

@@ -54,11 +54,11 @@ tables.map! { |f| "#{f[:class]} #{f[:uid]}" } # streets W1 # # Data => SELECT Func(A,B) # BBox => SELECT (A <=> B) - # + # if type == :bbox opcode = nil s_join = " #{options} " else opcode = type.to_s @@ -71,23 +71,25 @@ sql << "FROM #{tables.join(",")} " if tables sql << "WHERE #{conditions.join(" AND ")}" if conditions #p sql; sql end + # # Execute the query and parse the return. # We may receive: # # "t" or "f" for boolean queries # BIGHASH for geometries + # HASH for ST_Relate # Rescue a float # def execute_geometrical_calculation(operation, subject, options) #:nodoc: value = connection.select_value(construct_geometric_sql(operation, subject, options)) return nil unless value - if value =~ /^\D/ + if value =~ /t|f/ {"f" => false, "t" => true}[value] else - GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(value) rescue value.to_f + GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(value) rescue value end end # Get a unique ID for tables def unique_identifier