lib/postgis_functions/common.rb in nofxx-postgis_adapter-0.5.1 vs lib/postgis_functions/common.rb in nofxx-postgis_adapter-0.5.5

- old
+ new

@@ -233,11 +233,11 @@ end def simplify!(tolerance=0.1) #FIXME: not good.. - self.update_attribute(get_column_name, simplify) + self.update_attribute(geo_columns.first, simplify) end # # Returns a "simplified" version of the given geometry using the Douglas-Peuker # algorithm. Will avoid creating derived geometries (polygons in particular) that @@ -436,11 +436,11 @@ # Requires PostGIS be compiled with Proj support. # # Return Geometry ST_Transform(geometry g1, integer srid); # def transform!(new_srid) - self[get_column_name] = postgis_calculate("Transform", self, new_srid) + self[geo_columns.first] = postgis_calculate("Transform", self, new_srid) end def transform(new_srid) dup.transform!(new_srid) end @@ -459,11 +459,11 @@ # # Returns the instance`s geom srid # def srid - self[get_column_name].srid + self[geo_columns.first].srid end # # Return UTM Zone for a geom # @@ -492,11 +492,11 @@ # Returns the Geometry in its UTM Zone # # Return Geometry def to_utm!(utm=nil) utm ||= utm_zone - self[get_column_name] = transform(utm) + self[geo_columns.first] = transform(utm) end def to_utm dup.to_utm! end @@ -517,22 +517,22 @@ # of the geometry. # # Returns Float # def length - dis = postgis_calculate(:length, self).to_f + 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).to_f + 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 @@ -549,11 +549,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).to_f + 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 @@ -707,10 +707,10 @@ # Only implemented for points. # # Returns Float ST_Distance_Sphere(geometry pointlonlatA, geometry pointlonlatB); # def distance_sphere_to(other) - dis = postgis_calculate(:distance_sphere, [self, other]).to_f + postgis_calculate(:distance_sphere, [self, other]).to_f end # # Calculates the distance on an ellipsoid. This is useful if the # coordinates of the geometry are in longitude/latitude and a length is