- Mais recentes
- Mais votos
- Mais comentários
The issue you're experiencing with ST_Intersection in Amazon Redshift appears to be related to how the function handles the geometries you've provided.
When using ST_Intersection, the function returns a geometry representing the intersection of two input geometries. If the geometries share space (intersect), it should return the shared portion. If they don't share any space or are empty, an empty geometry is returned.
In your case, if you're seeing the second geometry returned completely instead of just the intersection area, this could indicate one of several issues:
-
The first geometry might be completely contained within the second geometry, making the intersection equal to the first geometry.
-
There might be a precision issue with the coordinates that's affecting the calculation.
-
There could be an issue with the WKB (Well-Known Binary) representation of your geometries.
To verify if your geometries actually intersect, you can use the ST_Intersects function, which returns a boolean value indicating whether the geometries share any space:
SELECT ST_Intersects( ST_geomfromwkb('01030000000100000007000000C1029832703C3440D4B837BF61FA484037FFAF3A723C34401F86562767FA4840F4C473B6803C3440A298BC0166FA4840B2D5E594803C34405072874D64FA484038842A357B3C34405359147651FA484046B1DCD26A3C34402992AF0452FA4840C1029832703C3440D4B837BF61FA4840'), ST_geomfromwkb('01030000000100000070000000688364BEE03B344050A9B540F3F94840...') );
If this returns true, the geometries do intersect, and the ST_Intersection function should return the shared portion, not the entire second geometry.
You might also want to try visualizing these geometries to better understand their spatial relationship, which could help identify why you're getting unexpected results from the ST_Intersection function.
Sources
ST_Intersection - Amazon Redshift
ST_Intersects - Amazon Redshift
Conteúdo relevante
- feita há 4 meses
- feita há 8 meses

I have checked the geometries and the first geometry IS fully contained within the second geometry, but the function returns the second, larger geometry. ST_Intersects returns true. The ST_Intersection function does not return the shared portion but instead it returns the whole, larger geometry. I have vizualised these multiple times and when you look at them on the map it is very obvious how they intersect.