lib/postgis_functions/linestring.rb in nofxx-postgis_adapter-0.1.7 vs lib/postgis_functions/linestring.rb in nofxx-postgis_adapter-0.1.8
- old
+ new
@@ -15,22 +15,22 @@
# of the geometry.
#
# Returns Float
#
def length
- dis = postgis_calculate(:length, self)
+ dis = postgis_calculate(:length, self).to_f
end
#
# Returns the 3-dimensional or 2-dimensional length of the geometry if it is
# a linestring or multi-linestring. For 2-d lines it will just return the 2-d
# length (same as 'length')
#
# Returns Float
#
def length_3d
- dis = postgis_calculate(:length3d, self)
+ dis = postgis_calculate(:length3d, self).to_f
end
#
# Calculates the length of a geometry on an ellipsoid. This is useful if the
# coordinates of the geometry are in longitude/latitude and a length is
@@ -47,11 +47,11 @@
# SPHEROID["IERS_2003",6378136.6,298.25642]
#
# Returns Float length_spheroid(geometry linestring, spheroid);
#
def length_spheroid(spheroid = EARTH_SPHEROID)
- dis = postgis_calculate(:length_spheroid, self, spheroid)
+ dis = postgis_calculate(:length_spheroid, self, spheroid).to_f
end
#
# Return the number of points of the geometry.
# PostGis ST_NumPoints does not work as nov/08
@@ -102,10 +102,10 @@
# This is useful for approximating numbers of addresses.
#
# Returns float (0 to 1) ST_Line_Locate_Point(geometry a_linestring, geometry a_point);
#
def locate_point point
- postgis_calculate(:line_locate_point, [self, point])
+ postgis_calculate(:line_locate_point, [self, point]).to_f
end
#
# Return a derived geometry collection value with elements that match the
# specified measure. Polygonal elements are not supported.
\ No newline at end of file