Geofield Filter Contains
This project is not covered by Drupal’s security advisory policy.
This module provides a Views filter that can be used to query entities that use Geofield for geographic regions. The filter takes a geographic point (such as a mailing address) and returns all the entities whose Geofield data contains that point.
- MySQL database (though I haven't tried anything else)
- [Views](https://www.drupalproject.org/project/views) module
- [Geofield](https://www.drupalproject.org/project/geofield) module
- [Geocoder](https://www.drupalproject.org/project/geocoder) module
What county am I in?
A site has a node type called "County" that contains a Geofield populated with geographic boundaries. Users need to be able to enter their address and see the County that they live in.
Nearby courts in my district
A site has a node type called "Court" that countains a Geofield populated with a geographic point (a single address). The site also has a taxonomy vocabulary called "District" that countains a Geofield populated with geographic boundaries. Users need to be able to enter their address and see the Courts nearby, sorted by proximity, but *only* the ones that are within the user's District.
Enable the module in the usual way.
- Make sure you have an entity type/bundle (such as a node type or a taxonomy vocabulary) that contains a Geofield configured to accept region data, such as WKT or GeoJSON.
- Create a View that can query the entity type/bundle from #1.
- Add a filter and search for "contains" to narrow down the list, selecting the "contains" filter for the Geofield in question.
- Save the view.
Ways to get the geographic point
The module uses a single geographic point to find Geofield regions that contain it. There are 3 ways to provide the View with that point:
- You can hardcode a value directly in the View filter
- You can "Expose" the filter so that users will be able to enter a value
- You can configure the filter to take its value from a different exposed filter (such as a Geofield proximity filter)
Note that all 3 of these methods send the value to a Google service for geocoding into latitude/longitude.
- Provide a more pluggable geocoding setup, for alternatives to the Google service
- Confirm whether MySQL is really required, or if PostgreSQL might also work
- Similar type of thing for Solr, for integration with `search_api_location` module.
- D8 version
|7.x-1.x-dev||tar.gz (9.61 KB) | zip (11.34 KB)||2017年10月20日||发布说明||简 | 繁 | 更多|