How to search inside the boundaries of an area?

Events happening in the community are now at Drupal community events on www.drupal.org.
user654's picture

Hi,
I would like to search for nodes inside an area e.g. nodes inside "London" .Each node has a latitude/longitude.So as a result,the search should return only the nodes inside the boundaries of this area.
I have search all drupal spatial modules but I cannot find one that does this.
Any suggestions?
thanks

Comments

This might work for you.

JSCSJSCS's picture

Look at GeoLocation module and GeoLocation Proximity Module with Views exposed filters and set origin to geocoder lookup. The user could put in "London" and say 50 kilometers and expose the filter.

http://drupal.org/project/geolocation

http://drupal.org/project/geolocation_proximity

James Sinkiewicz
Drupal Site Builder and Generalist
http://MyDrupalJourney.com

Hi, thanks for the answer. I

user654's picture

Hi,
thanks for the answer.
I have already checked this.
What I want is not to force user to enter a radius for the area.
Instead I want user to enter only the area and then search inside that area.
thanks!

Don't expose the area

JSCSJSCS's picture

Set the distance to 100 miles (or whaterver) and don't expose it to the user. They would just enter "London" and as long as your lat/long of nodes were withing 100 miles of the geocoder resolved position for "London" they will appear!

James Sinkiewicz
Drupal Site Builder and Generalist
http://MyDrupalJourney.com

Hm,not exactly what I

user654's picture

Hm,not exactly what I want.
E.g. if a user enters a small town,then if I have set the distance to 100 miles,search results will also include results of towns next to the one the user entered.

I doubt there is a Drupal way

JSCSJSCS's picture

I doubt there is a Drupal way to do what you want, especially with MySQL since even the INTERSECT function uses a MBR as an estimate to contain the polygon bounds and will give false positives (I hear).

So you will have to settle for the BEST alternative.

James Sinkiewicz
Drupal Site Builder and Generalist
http://MyDrupalJourney.com

Solr spatial search

user654's picture

Could the answer be on this ?
http://wiki.apache.org/solr/SpatialSearch

I have a similar task

Sahin's picture

@pinkonomy, how happy to find another desperate soul in Drupal community having a very similar problem to mine! (I try to map linguistic recordings inside certain dialect regions.) just to get things more complicated I want to get back to your original question: How to retrieve the nodes inside a given "closed path" (i.e. "area")?
This closed path might be a settlement border as in your case or a geographic area which is my case.
As mentioned in the solr documentation you linked to, the "bbox - Bounding-box filter" as a quick and cheap approximation does not solve my "path" requirement but maybe helps you if you can provide a bounding-box for every (!) city/location you have.

Hi sahin, similary to you I

user654's picture

Hi sahin,
similary to you I have to find the nodes inside a geographic area.Take a look on the comments above,for reverse geocoding,maybe they are also helpful to you.

I think I found the answer on

user654's picture

I think I found the answer on this:Using the Google Places library https://developers.google.com/maps/documentation/javascript/places#overview
It has no limits to use.
Then you should use the Nearby search
https://developers.google.com/maps/documentation/javascript/places#place...

Hope this helps

What about "tagging" each

Sinan Erdem's picture

What about "tagging" each content with the location / area / city etc.? One way can be doing it manually if you have few locations. For this, address field or even standard taxonomy terms can be used. Then, an exposed views filter can be used to search for a specific area.

But if you have many locations, maybe you can do reverse geocoding with the help of a service. (I used Google geociding service sometime ago for this, you send your coordinates to Google for each location, it sends you back the location info). Another service is Geonames (http://drupal.org/project/geonames).

There is also this module: http://drupal.org/sandbox/nodoxi/1893210

Hi Sinan, thanks for the

user654's picture

Hi Sinan,
thanks for the info,I really didn't know anything about them.I have a lot of towns/cities,so I think they will necessary to me.
They seem very interesting,I have surely have a look.
Thanks very much!

Just a note; Geocoding is

Sinan Erdem's picture

Just a note; Geocoding is done when you save the node. So if you have many nodes, after setting up a working reverse geocoding system, you have to re-save all your nodes (http://drupal.stackexchange.com/questions/45539/how-can-i-quickly-re-sav...)

Location and Mapping

Group organizers

Group categories

Wiki type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: