I would love to be able to expose an address field that allows my users to search for content within X distance to the address that the type in.

Is this possible with the Geo module?

If so, can you please offer a little guidance for making that happen?

Thanks for your time,
:) Andy

Comments

jerdavis’s picture

Hi Andy,

Yup, that certainly is possible. What does your set up look like currently? Have you installed and configured any of the modules yet?

Thanks!

Jeremiah

allie micka’s picture

You want to install the Geocode module, which will allow you to use a plain text field, a textarea, or, if you install Postal.

You can then create a filter against your Geo field, use the "Distance" calculation type, and expose it. Assuming you have Geocode installed, one of the input options will be a textarea with google/some other geocoder available.

Once set up this way, the textarea/text field/address form presented to the user will be converted by the Geocode API into something that Geo can recongnize, and you should be good to go!

aprice42’s picture

Thank you both for the quick responses!

@Allie Micka, that did the trick. I got it working now, thank you!

:) Andy

itserich’s picture

StatusFileSize
new193.79 KB

Installed Geo, Geocdoe, and Postal.

Created a Location View. Filter is Location: Distance - Zip code exposed.

Created a node with just a title and 2 Postal address fields, for zip code and full address.

The view allows me to enter a zip code but there is no result.

The part I am not sure about from above is: "Assuming you have Geocode installed, one of the input options will be a textarea with google/some other geocoder available."

Attached is my View filter, none of the options seem to match that. One of the weird things, I tried Postal Code / Country (both exposed) but the filter still did not expose country.

This seems sooo easy I must be missing something.

itserich’s picture

I checked the node fields again and geospatial looks like it might be relevant but I can't find any comments on geospatial and proximity.

aprice42’s picture

I got the proximity search to work great as you suggested, and it seems very accurate...

Now I would like to present the distance from the searched address/postal code in the results table that is presented by the view.

I have added a field based on the geo cck field. and set it to distance (spherical) and chose the widget content: geo, which I am guessing is my exposed filter? but I don't see any distance... I have tried a number of other configuration options for this field but nothing seems to work to get a distance to display...

Is it possible to display the actual distance to the searched location from the results that are returned?

Thanks,
Andy

aprice42’s picture

itserich,

I think the problem you were experiencing started with creating a location view type. Here is a quick description of what I did to get things working for me:

Created a node view type with the following settings

style: GMAP
fields: Node - title
geocoded data lat - my geocode cck field formatted as lat.
geocoded data long. - the same geocoded cck field this time formatted as long.

click the cog next to the style GMAP and then choose "choose latitude and longitude fields" for the data source.
then select the corresponding geodata fields added above for lat and long.

to add the proximity search:
add a filter type content:your_geocode_field
expose the filter
set filter function to use: to distance (spherical)
I chose the widget "Google API textfield"
show value as: a list of predefined values

I hope this helps...

:) Andy

itserich’s picture

StatusFileSize
new41.15 KB
new74.29 KB
new74.1 KB
new54.68 KB
new207.16 KB

Thanks.

I set up a node with two CCK fields:
1-Postal
2-Geospatial Data (Attachment 1)
3-Linked the two fields (Attachment 2)

View
1-Style:GMap
2-3 Fields: Title, Geospatial Field labeled Longitude, Geospatial Field labeled Latitude (Attachment 3)
3-Set the Data source (Attachment 4)
4-Filter (Attachment 5)

I think the node is set up okay, because it displays the long/lat.

I don't understand the View field, does it require Geospatial data to be pulled twice?

And do you filter for node type?

Thanks for any comments.