Re: Specifying an empty geometry collection
Posted by: Gabriela Martinez Sanchez
Date: May 09, 2016 12:41PM

hi Andreas,
You can access to each element of the collection like this:

Create your column

For a table:

CREATE TABLE `test` (
`i` int(11) NOT NULL AUTO_INCREMENT,
`colgeo` geometry DEFAULT NULL,
`collectingdata` geometrycollection DEFAULT NULL,
PRIMARY KEY (`i`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;


insert some data

INSERT INTO test values(3 ,ST_geomfromtext('POINT(47.37 -122.21)'), st_geomfromtext('GeometryCollection(Point(1 1), LineString(2 2, 3 3))'));



// number 2 is the index of the element

SELECT AsText(GeometryN(collectingdata, 2)) FROM test;


These statements can be send and read using MySQLCommand and MySqlDataReader

Please give it a try and let us know if this worked for you.

Here is a blog post about MySqlGeometry, although it is not on collections but I think it could help.

https://blogs.oracle.com/MySqlOnWindows/entry/howto_storing_and_retrieving_spatial

Thanks,

Options: ReplyQuote


Subject
Written By
Posted
Re: Specifying an empty geometry collection
May 09, 2016 12:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.