Active
Project:
Geofield
Version:
7.x-2.x-dev
Component:
Documentation
Priority:
Major
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
27 Apr 2013 at 20:42 UTC
Updated:
29 Mar 2016 at 20:04 UTC
Jump to comment: Most recent
Comments
Comment #1
Exploratus commentedDid you ever get an answer to this? Very interested. WOuld love to get nodes within a polygon of another node using views.
Comment #2
stopshinal commentedNope - not yet.
Comment #3
stopshinal commentedBump
Comment #4
Brandonian commentedGreat question, @stopshinal. In order to do spatial queries with Geofield, you'll need to do the following, some of which will take some custom coding. Also, you'll need to use a PostGIS enabled Postgres database for your site's database.
1. Make sure you're using Geofield 2.x
2. Download https://github.com/phayes/geofield_postgis, which provides a PostGIS backend for geofield. I can't guarantee it's completely functional at this point, but I don't think we've modified anything that would break it at this point.
3. You'll need to manually query the database yourself for the intersection. You'll likely use something like http://postgis.refractions.net/documentation/manual-1.4/ST_Contains.html to do the actual query.
Hope this helps! This is an area (geospatial analysis) that I would actually love to have some extra help with in fleshing out better contrib tools for Geofield if you're interested.
Comment #5
stopshinal commentedBrandonian - Thanks for these directions! I wrote this off a while ago as too much to expect, but I see it's not so distant!
I'm coming into this with alot of interest but zero experience. For instance, here is my birds eye view of what I want to do - might you be able to reign this in a bit as I begin the discovery process?
I'd like to use views for it's display flexibility
Thinking about a large dataset - my initial thought was to build a proximity query off the polygon centroid and quickly gather nodes that could potentially lie within the polygon. I'm not up on processing - but would this step save any resource use? Otherwise it could be skipped and instead just jump right into Step 2.
Step 2 would then simply involve comparing these remaining nodes to the polygon with ST_Cointains. Those that return true are the winners.
As I said - i'm not up on Views, but I'm presuming this will all be possible as I dive in.
Comment #6
stopshinal commentedUsing Pantheon for hosting prohibits the use of postGIS - could there be another solution?
Comment #7
held69 commentedhttps://drupal.org/node/2155691
Comment #8
Aldus commentedKeeping it open, is anyone aware of some solution for displaying all nodes with a geofield point that is inside a given polygon (contextual argument in views), without changing database or such?
Comment #9
robertwb commentedhey @Aldus - this sandbox module (that I will repackage as a geofield plugin/sub-module soon) will do this. It supports a full range of spatial operators (within, contains, crosses, intersects).
https://www.drupal.org/sandbox/robertwb/2202159