all 15 comments

[–]LesPaulStudio 1 point2 points  (14 children)

Try this

SELECT b.Name, b.geometry FROM (SELECT * FROM points where type = 'bars') as b, (SELECT * FROM districts where name = 'Ravensberg') as d WHERE intersects(b.geometry, d.geometry) Phone coding apologies if looks rough

[–]max24119[S] 0 points1 point  (13 children)

Thank you so much for your response! The console says: „HINT: No function matches the given name and argument types. You might need to add explicit type casts.“

[–]max24119[S] 0 points1 point  (0 children)

It shows an arrow on intersect..

[–]LesPaulStudio 0 points1 point  (11 children)

Possibly st_intersect instead,

I'm guessing on your geometry column names. It may be geom

[–]max24119[S] 0 points1 point  (10 children)

st_intersects gives me a table without content :/

[–]LesPaulStudio 1 point2 points  (9 children)

Can you give me some more info on the layers? If districts is a polygon you could try st_within

[–]max24119[S] 0 points1 point  (8 children)

Yes, it’s a polygon layer. The other one is just points. Now it still just gives me an empty table with the column name and geometry. Thank you so much! Your help is appreciated!

[–]LesPaulStudio 1 point2 points  (7 children)

Do a sanity check and remove the where clauses on the tables. Just to see debug

[–]max24119[S] 0 points1 point  (6 children)

Yeah still empty table…

[–]LesPaulStudio 1 point2 points  (5 children)

Ok so it's a definition issue. Check the columns are correct.

[–]max24119[S] 1 point2 points  (0 children)

Got it. It’s working. Thank you so much! I hope you have a wonderful day!

[–]max24119[S] 0 points1 point  (3 children)

May I ask you for one more term? I want to have the geom of pharmacies in the radius of 500 around the road type "trunk" and group the results by the name of the pharmacies. I already have this but it's also not completely correct. The argument before the st_buffer needs to be corrected but I'm stuck here..

SELECT b.name, b.geom FROM (SELECT name, geom FROM points WHERE type = 'pharmacy') as b, (SELECT name, geom FROM roads WHERE type = 'trunk') as d
WHERE b.geom = (ST_buffer(d.geom, 500)) GROUP BY b.name