Timeline for Replicating"Intersection" function in QGIS using PostGIS queries
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 30, 2019 at 6:19 | vote | accept | deepsky | ||
Sep 27, 2019 at 23:17 | answer | added | Paul Ramsey | timeline score: 1 | |
Sep 26, 2019 at 17:43 | comment | added | deepsky | @JGH It does look like the problem may be associated with the multipolygon/polygon issue. I did a simple case with just 2 districts and the output was saved as a "polygon" type object (though it contained two separate polygons), rather than a "multipolygon". However, when I wrap "st_intersection()" with "st_multi()", I do get a multipolygon output, but its geometries are still incorrect. Any thoughts? I can link the wkt geometries of these inputs and outputs, but they are fairly long since the polygons are complex. | |
Sep 23, 2019 at 17:59 | comment | added | jbalk | I used the same query (select st_intersection where st_intersects) to intersect Cities polygons with counties polygons and I got the expected output. | |
Sep 23, 2019 at 14:56 | comment | added | Pierre Racine | Could you reduce your example to 1 or 2 polygons in each layer in order to reproduce and simplify the problem and then provide their wkt representation? I made a similar example here and it behave as expected. There must be something with your polygons... | |
Sep 22, 2019 at 5:13 | history | edited | PolyGeo♦ | CC BY-SA 4.0 |
deleted 19 characters in body; edited tags; edited title
|
Sep 21, 2019 at 1:32 | comment | added | JGH | Could it be that in QGIS the layer is defined to show only polygons (and not multipolygons)? | |
Sep 20, 2019 at 22:38 | comment | added | deepsky | Understood about the st_intersection return formats etc. Is there not a way to achieve a similar output to the QGIS function then? | |
Sep 20, 2019 at 21:54 | comment | added | jbalk | Also read the documentation for st_intersection and st_intersects. It will help to understand what is being returned by your query. | |
Sep 20, 2019 at 21:52 | comment | added | jbalk | You're going to encounter this over and over again if you're moving from QGIS to POSTGIS. PostGIS is much more powerful, but also much more picky that QGIS. When you run an intersection in POSTGIS, it's going to return the intersection points, lines, and polygons in a geometry collection. Look at the documentation for st_collectionextract - you can extract just the polygons from your output. | |
Sep 20, 2019 at 20:54 | history | asked | deepsky | CC BY-SA 4.0 |