lib/postgis_functions/common.rb in postgis_adapter-0.7.2 vs lib/postgis_functions/common.rb in postgis_adapter-0.7.5

- old
+ new

@@ -327,10 +327,13 @@ # def touches? other postgis_calculate(:touches, [self, other]) end + def st_collect(other=nil) + postgis_calculate(:collect, [self, other]) + end # # The convex hull of a geometry represents the minimum closed geometry that # encloses all geometries within the set. # # It is usually used with MULTI and Geometry Collections. Although it is not @@ -504,12 +507,12 @@ # # Returns Geometry as GeoJSON # # http://geojson.org/ # - def as_geo_json - postgis_calculate(:AsGeoJSON, self) + def as_geo_json(precision=15, bbox=0) + postgis_calculate(:AsGeoJSON, self, [precision, bbox]) end # # @@ -685,12 +688,22 @@ # ST_max_distance Returns the largest distance between two line strings. #def max_distance other # #float ST_Max_Distance(geometry g1, geometry g2); # postgis_calculate(:max_distance, [self, other]) #end - end + # + # Returns a (set of) LineString(s) formed by sewing together a MULTILINESTRING. + # + # Only use with MULTILINESTRING/LINESTRINGs. If you feed a polygon or geometry collection into this function, it will return an empty GEOMETRYCOLLECTION + # + # Returns geometry ST_LineMerge(geometry amultilinestring); + # + def line_merge + postgis_calculate(:LineMerge, self, { :stcollect => self}) + end + end # # # # # POINT