[Georuby-devel] MySQL Point in unit test

Guilhem Vellut guilhem.vellut at gmail.com
Thu May 11 06:14:03 EDT 2006

This would indeed be devastating.

You can try to use the MySQL canonical form for geometries. It works when
you try to insert a string in this form in a geometric column. 

The canonical form is as follows: 4 characters of code 255 followed by the
strict WKB form of the geometry.

In the context of your test, you could do:


Id: 1

 Some_point: <%=  (255.chr * 4) + Geometry.from_ewkt( "POINT(0 0)").as_wkb


Note that I haven't tried myself yet. If it works, I will update the adapter
tonight with a method which can do it for you. In the meantime, you will
have to do it manually.





From: georuby-devel-bounces at rubyforge.org
[mailto:georuby-devel-bounces at rubyforge.org] On Behalf Of Wayne Kao
Sent: 11 May 2006 13:15
To: georuby-devel at rubyforge.org
Subject: [Georuby-devel] MySQL Point in unit test


Is there a way to express a MySQL Point in Rails YML for a model unit test?


I've been trying something like this but it doesn't work since it becomes
quoted and turns into 'GeomFromText(\'POINT(0 0)\')'



  id: 1

  some_point: GeomFromText('POINT(0 0)')

  created_on: 2002-12-30

  updated_on: 2002-12-30


I can't make it NULL either since MySQL enforces that geospatial columns be
non-NULL.  So unless someone has an idea, my only option would be to not
have a unit test for this model, which would be devastating.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/georuby-devel/attachments/20060511/ce4f365b/attachment-0001.htm 

More information about the Georuby-devel mailing list