MySQL Forums
Forum List  »  GIS

Geometry objects and stored procedures
Posted by: Simon Giddings
Date: August 31, 2010 08:32AM

I am writing a stored procedure to select elements from a table containing a geometry field.
The select statement will do a comparison between the POINT data in the geometry field and a POLYGON which is passed to it.

My choice is either to
a) pass the content of the polygon as a string into the SP and then create the polygon geometry within the SP -
create procedure MyProc(polybounds BLOB)
begin
-- create a geometry object
declare poly GEOMETRY;
-- create the polygon object from the correctly formatted
-- passed in string "POLYGON((lat lng, lat lng, lat lng, ....))"
set poly = PolygonFromText(polybounds);
-- call the select
select .....
from mytable as m where MBRContains(poly, m.mypoint);
end $$

or
b) create the polygon geometry on the command line when passing it into the SP
create procedure MyProc(poly GEOMETRY)
begin
-- call the select
select .....
from mytable as m where MBRContains(poly, m.mypoint);
end $$
Where the command line call would be -
call MyProc(PolygonFromText("POLYGON((...))");

Can anyone advise me as to which option would be the most efficient on the server ?

Options: ReplyQuote


Subject
Views
Written By
Posted
Geometry objects and stored procedures
5190
August 31, 2010 08:32AM


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.