The following stored procedure from
I found
itemprop = "text">Does this work?
create myWithin (P-point, poly polygon) back INT (1) declarative start declaration n INT default 0; DECLARE PX decimals (9, 6); DECLARE PY DECIMAL (9, 6); DECLARE ls LINESTRING; DECLARE poly1 point; DECLARE poly1x DECIMAL (9, 6); DECLARE poly1Y DECIMAL (9,6); DECLARE poly2 POINT; DECLARE poly2x DECIMAL (9, 6); DECLARE poly2Y DECIMAL (9,6); DECLARE I INT DEFAULT 0; DECLARE RESULT INT (1) DEFAULT 0; Set px = x (p); SET pY = y (p); Set ls = outerring (poly); SET poly2 = endos (ls); SET poly2X = X (poly2); SET poly2Y = Y (poly2); Set N = Null Point (LS); WHILE i & lt; N DO SET poly1 = PointN (ls, (i + 1)); SET poly1X = X (poly1); SET poly1Y = Y (poly1); If (i Poly1X)) & amp; PY>; (poly2Y - poly1Y) * (px - poly1X) / (poly2X - poly1X) + poly1Y)) set result = result; end if; SET poly2X = poly1x; SET poly2Y = poly1Y; Set I = I + 1; In the end; Return results; End;
Usage:
set @point = PointFromText ('point (5 5)'); SET @ pligon = polyphorm text ('polygon ((0, 10, 0, 10 10,0 10))'); Select myWithin (@ point, @ polygon) as the result;
I am using phpMyAdmin and while using stored procedures, it blows if it does one thing, then I try to find out how to call it in php Instead of
thanks,
Laxmidi
Do:
call myWithin (@ point, @polygon);
Instead
Comments
Post a Comment