lib/postgis_functions/common.rb in nofxx-postgis_adapter-0.5.7 vs lib/postgis_functions/common.rb in nofxx-postgis_adapter-0.7.0
- old
+ new
@@ -436,11 +436,11 @@
# Requires PostGIS be compiled with Proj support.
#
# Return Geometry ST_Transform(geometry g1, integer srid);
#
def transform!(new_srid)
- self[geo_columns.first] = postgis_calculate("Transform", self.new_record? ? self.geom : self, new_srid)
+ self[postgis_geoms.keys[0]] = postgis_calculate("Transform", self.new_record? ? self.geom : 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[geo_columns.first].srid
+ self[postgis_geoms.keys.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[geo_columns.first] = transform(utm)
+ self[postgis_geoms.keys.first] = transform(utm)
end
def to_utm
dup.to_utm!
end
@@ -790,10 +790,10 @@
# Returns the 2D perimeter of the geometry if it is a ST_Surface, ST_MultiSurface
# (Polygon, Multipolygon). 0 is returned for non-areal geometries. For linestrings
# use 'length'. Measurements are in the units of the spatial reference system of
# the geometry.
#
- # Accepts optional parameter, the srid to transform to.
+ # Accepts optional parameter, the sridto transform to.
#
# Returns Float ST_Perimeter(geometry g1);
#
def perimeter transform=nil
postgis_calculate(:perimeter, self, { :transform => transform }).to_f