Xin
unread,Nov 30, 2007, 5:25:12 AM11/30/07Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to georuby
Hi Everyone,
I am having problems saving a GeoRuby Polygon type in Rails. The
strange thing is everything appears to save correctly until I refresh
the object.
I have geom field set to Polygon. For each object, I am converting lat/
lon locations stored in Float to a Polygon type.
I know I have a saving problem from performing the following in Rails
console:
1. o = Model.find(id)
2. o.convert_points_to_polygon
3. o.geom
=> #<GeoRuby::SimpleFeatures::Polygon:0x20ef5cc @with_z=false,
@srid=-1, @with_m=false, @rings=[#<GeoRuby::SimpleFeatures::LinearRing:
0x20ef4c8 @with_z=false, @points=[#<GeoRuby::SimpleFeatures::Point:
0x20efba8 @m=0.0, @with_z=false, @z=0.0, @srid=-1, @y=12.2287,
@with_m=false, @x=32.8954>, #<GeoRuby::SimpleFeatures::Point:0x20efa04
@m=0.0, @with_z=false, @z=0.0, @srid=-1, @y=12.26, @with_m=false,
@x=32.8954>, #<GeoRuby::SimpleFeatures::Point:0x20ef860 @m=0.0,
@with_z=false, @z=0.0, @srid=-1, @y=12.26, @with_m=false, @x=32.8565>,
#<GeoRuby::SimpleFeatures::Point:0x20ef6bc @m=0.0, @with_z=false,
@z=0.0, @srid=-1, @y=12.2287, @with_m=false, @x=32.8565>], @srid=-1,
@with_m=false>]>
4. o.save
=> true
5. o.geom
=> #<GeoRuby::SimpleFeatures::Polygon:0x20d0604 @with_z=false,
@srid=-1, @with_m=false, @rings=[#<GeoRuby::SimpleFeatures::LinearRing:
0x20d0500 @with_z=false, @points=[#<GeoRuby::SimpleFeatures::Point:
0x20d0be0 @m=0.0, @with_z=false, @z=0.0, @srid=-1, @y=12.2287,
@with_m=false, @x=32.8954>, #<GeoRuby::SimpleFeatures::Point:0x20d0a3c
@m=0.0, @with_z=false, @z=0.0, @srid=-1, @y=12.26, @with_m=false,
@x=32.8954>, #<GeoRuby::SimpleFeatures::Point:0x20d0898 @m=0.0,
@with_z=false, @z=0.0, @srid=-1, @y=12.26, @with_m=false, @x=32.8565>,
#<GeoRuby::SimpleFeatures::Point:0x20d06f4 @m=0.0, @with_z=false,
@z=0.0, @srid=-1, @y=12.2287, @with_m=false, @x=32.8565>], @srid=-1,
@with_m=false>]>
5. o.reload
=> #<Object id: 1, port_id: 26051, ..other fields... geom: nil>
The database confirms that the Polygon geom field was not saved.
Out of 135 records, it did however manage to save 6 of them. Each
object has 4 points to be converted to a Polygon. I'm not sure why a
few are working whilst others are not.
My setup:
Mac OS X Leopard
Using native Ruby/Rails
Darwin MySQL 5.0.38
Fink's MySQL Server
I'm using InnoDB and latin1_swedish_ci
I am stumped here. Any help is greatly appreciated.
I am going to install Fink's version of Ruby/Rails and see if it makes
a difference.
Regards,
Xin