New answers tagged point-in-polygon
You can't just say DISTINCT doesn't work without showing how you're trying to use it. It has to work if you use it like this: SELECT COUNT(DISTINCT student_id), parcel_type FROM students INNER JOIN parcels ON ST_Intersects(students.geom, parcels.geom) GROUP BY parcel_type If it doesn't use then the problem is in student_id not being unique.
You can use DISTINCT ON to remove duplicate records in the student-polygon join, so that you only get one parcel type per student. If a student is within multiple parcel types, you'll get a random type back unless you impose some kind of rule with an ORDER BY clause. SELECT DISTINCT ON (student_id) student_id, parcel_type FROM students INNER JOIN parcels ...
At this point, the only solution was to dissolve the features such that overlapping parcels were eliminated from the parcels dataset.
I had a tool I made that basically did this, so I just tweaked it a little to fit what you need. It's called Calculate Point Statistics, and you can download it here: http://ianbroad.com/downloads/CalculatePointStatistics.tbx Source code: http://ianbroad.com/downloads/scripts/CalculatePointStatistics.py It takes an input Polygon and Point feature class ...
Seeing as you have Info (Advanced) level of license you can use the cool geoprocessing toys. Get the values of the polygons onto the points either by spatial join, identity or intersect. I think that intersect would be my choice. This will generate a point for each intersection i.e. if a point falls in more than one buffer then there will be one instance ...
Would be more efficient with EXISTS I think since it can stop after first positive. Though Martin's answer should work as well SELECT boundary.* FROM boundary WHERE EXISTS (SELECT location.geom FROM location WHERE ST_Intersects(boundary.geom,location.geom) );
Try something like this SELECT DISTINCT ON (boundary.id) boundary.* FROM boundary, location WHERE ST_Intersects (boundary.geom, location.geom) [paul ramsey made an improvement, but forgot the I in ID]
You chose the wrong argument order. This is correct the ST_Contains function ST_contains(bar.hull,ST_GeomFromText('POINT (34.8039 32.1049)'))
Top 50 recent answers are included