We have an application that utilized the SQL Anywhere12 spatial capabilities. We have 2 tables one called "grids" and the other called "lines". The grids table is simple square polygons (i.e. 4 points) and the lines table is made up of linestrings. I would like to issue a query that selects all the linestrings contained within a specified grid. This is easily done using the ST_Intersects function but the results are not clipped. In other words the results may contain a linestring from the lines table that originates (or terminates) inside the specified grid but ends up outside it. I would like to issue a query that basically truncates the a linestring at the point of intersection with the polygon. Has anyone tries to do something like this or is it better to do this in code after you retrieve the linestring. Thanks |
While Volker is correct if you truly meant "contained within" a specified grid, from the rest of your description I gather that what you are really trying to construct is for each grid cell you want the "clipping" of any linestring that intersects that cell. Here's how you might do that.
|
I'd think that a method like ST_CoveredBy() does fit your requirements better.