Is there a tutorial anywhere on how to use this? I have a simple need to let people enter a zip code, find out which nodes are within X distance.

I set up a test node with longitude and latitude, per a tutorial on drupal.

Then I set up a view with proximity exposed. I don't know what it means to get location from a string or a node. Is there anyplace to go to find out? Thanks.

Comments

sammo’s picture

Hi I'm trying to do the same. I've got pretty far...

You need to install and enable, (just enable all the sub modules):

openlayers
openlayers_geocode
openlayers_proximity

Create a content type and add an Openlayers field and choose the Geocode widget

This will let you set the WKT value using an interactive map and geocode text box

Enter some test data

Then you need to create a view display of the type Openlayers data

Select Openlayer data from style, you will need to add a field to the view to access the WKT data and set this to the WTK value type, then back to the Openlayer style choose the WTK data and choose your WTK field as the value

Once you have saved this you should have a view that contains your content and its location

You need to attach this view to a map, so go to the Openlayers admin and setup a new preset (you can clone the default preset). Go to the layers and styles tab of this preset and enable and activate the view - its listed under Open layers at the bottom of the page. Save this preset

You now need to create another view as a container for the preset you have just created. Create a view of display type page and change the style to Openlayers map. Then for the settings of this style set the map to be the preset you have just created.

Create a path for this view. If you go to the path you will now see your map with the data on it. Now you need to go back to your page view and apply a filter. Choose a proximity filter, expose this and choose which values your users can change.

You can test the filter is working from the views ui page if you change the view style to Html grid. if you add a proximity and a location only the results that match will be listed.

Now this is the bit I can't get to work, if you change the view style back to Openlayer map, save and view via its path you see a map but the filters don't do anything. I might be doing something wrong or it might be a bug, I'm not sure as I didn't get any error messages. If anyone know's how to get this to work please let me know!

itserich’s picture

have you seen the tuotrial? http://drupal.org/node/627816

i can't even get the little marker to show up. not even sure if the marker is supposed to show up.

it seems like such a simple process but when you don't know anything about the process it is hard to guess and be right.

i have spent days on the internet looking for a working tutorial, can't find one. what a shame. such a great module.

sammo’s picture

Yes I've seen this tutorial. I didn't have too many problems with it (well ok I've been working on it all day), I just can't get openlayers proximity working.

It's frustrating because I'm so close! I'll post if I figure it out.

itserich’s picture

You saw the little icon? Yeah it is crazy to spend all day on something so simple. I finally got Locations to work but it seems Openlayers is the up and coming module.

sammo’s picture

Did you manage to get the distance search to work - how did you do this with location?

itserich’s picture

I did with Location, it took me about 30 hours.

The problem with Location is it requires two database tables. Both contain longitude/latitude values and I guess they compare to calculcate distance.

The geographic input goes into the Location table and that data is compared against a data set called the zipcode table.

The problem I have with Location is the zipcode table needs to be imported into mySQL and if you use myPhpAdmin it probably needs to be broken up into perhaps 10 or 20 uploads.

It isn't so bad, I might use it if necessary, but for long term I wonder if the Location module which uses the input data is going to be able to transferred to Openalyers. In other words, I wonder if all the nodes which contain their geographic data will need to be rewritten to work with Openalyers at some point, no idea.

The thing with Openlayers is I think it does not require a static table to check against to calculate distance, so it seems much easier.

There is a Locations and Mapping group, check it out.

This is one exchange I had, it is so frustrating, I think I am asking the most basic questions.

http://groups.drupal.org/node/92314

Good luck.

sammo’s picture

Thanks for the write up. I will definitely take a look at Location. BTW I got openlayers proximity to work by sheer luck! I discovered that proximity does not appear to work if both the openlayers data display and the openlayers map are in the same view. They need to be in their own views. I'll file a bug and think about doing a proper tutorial.

itserich’s picture

If you got Openlayers to work I wouldn't bother with Location if you are only looking for Proximity. It takes so long to upload the zipcode table unless you know how to do it. I had never uploaded mysql table before.

Envious you got Openlayers to work. Even if you just post screen shots of the views and stuff will be helpful.

Thanks.

itserich’s picture

Here is the tutorial I used for Location. It worked for me. Note the issue of the zipcode table is not brought up until about the middle of the second video, and it is not explained much at all.

http://torontowebsitedeveloper.com/drupal-video-tutorials/drupal-locatio...

Good luck.

muckel112’s picture

I haven't got Proximity to work as expected and need some help.

My configuration:
Drupal 6.19
Openlayers 6.x-2.0-alpha10
Openlayers Proximity 6.x-2.x-dev (as of October, 11)
Views 6.x-3.0-alpha3
CCK 6.x-3.x-dev

I've got the map to display showing the markers but when I add the Proximity filter I see the search field on top of the map but it doesn't show any results on the map.
Is it okay to have both the data display and the page display (map) in one single view or better split it into two separate views?

See here for the page:
http://drupal.deutsches-portal.de/worldmap

Thanks
Chris

ademarco’s picture

@muckel112: data and map display must share the same exposed filters, from README.txt:

If you plan to show proximity search results on a map using exposed filers
remember to add them in both your OpenLayers Map and OpenLayers Data display.
More at http://drupal.org/node/789668.

Have you done that? In any case having Openlayers data and map display on different views won't solve the problem.

muckel112’s picture

Hi Antonio,

thanks for your quick reply.
And yes, I have the exposed filter set in both data and page display. See screenshots:

page display:
http://s1.bild.me/bilder/290710/5307207x.jpg

page proximity filter configuration:
http://s1.bild.me/bilder/290710/1291189x.jpg

data display:
http://s1.bild.me/bilder/290710/2907931x.jpg

data proximity filter configuration:
http://s1.bild.me/bilder/290710/2483054x.jpg

Chris

ccardea’s picture

I was struggling with this same issue myself. I think the best explanation of how the proximity filter works is right on the project page. I'm so happy that I got this to work, I just want to thank you guys (maintainers). What a great job you did on this! My hat is off to you.

itserich’s picture

Chris I have not tried OL proximity for a map yet.

Have got it to work for a Views list.

If you have questions about a View please post.

I would like to learn how to proximity on a map display.

YK85’s picture

Is everyone able to get this working with Views 6.x-3.x? I tried but not able to #963464: Views 3 Compatibility
It works when I switch to Views 2 but from above it seems like Views 3 is working?
I hope you can help me get it working with Views 3. Thank you

itserich’s picture

I have not tried Views 3 yet.

rob c’s picture

@6 itserich

'and if you use myPhpAdmin it probably needs to be broken up into perhaps 10 or 20 uploads.'

Have you seen the 'feeds' module? I know my reply is a bit late, but i just found this issue. I use feeds for importing loads of stuff, runs nice on cron, can do a lot of neat tricks for importing cvs/etc/etc files, just a tip. :-)

Marko B’s picture

muckel, any new info on your problem? i have similar problem, when i use proximity filter i dont get any nodes shown, dont know is proximitx index table has anything to do with this as when i try to index i get "Proximity index rebuilt for 0 nodes."

ccardea’s picture

I was recently asked privately to write a tutorial on how I got openlayers proximity to work. I'm a little reluctant to write a tutorial since my application is very simple and I'm not sure how useful it will be for others. I will explain my application briefly here. Feel free to ask questions and maybe a tutorial will come out of this.

I input data into a cck field using openlayers geocoder. For this application you do not need to set up a Data Layer display or map in Views. I have a simple Views listing of the node titles and location data. Openlayers proximity provides filters for the location data. I'm using the great-circle proximity filter. All I have to do is type in the name or postal code of the starting point, enter the radius, and the proximity filter does the rest.

The key in my application is having the proximity distance field in the views output. If you don't have that in your output, there's nothing to filter.

Marko B’s picture

What are you talking about? If you use OpenLayers Maps as style in views then you can't use fields as "The style selected does not utilize fields."

ccardea’s picture

As I said, my proximity application does not use maps directly. I am using table style to list my node titles and proximity distance field. I haven't tried this with points on a map, but the filters do work. It seems to me that if you can get points to display on a map, you should also be able to filter them.

Jimmel’s picture

Hi

I got this working ok, and placed some pointers at

http://drupal.org/node/1099934#comment-4257484

it does not go into minute details about drupal settings or else it would become a novel.

Main issue seems to be make sure force singe option is not clicked when exposing the proximity circle filter. This was pointed out on anther thread which I would like to thank but I cannot remember where I found it.

Jimmel

ccardea’s picture

Tutorial added. See http://drupal.org/node/1112144

silverwing’s picture

Issue tags: +orphaned node

ccardea,

Can you make sure the tutorials get added to a book outline (we're going through the docs to make sure every node has a home!)

Probably under http://drupal.org/node/595850

Nodes that need homes:
http://drupal.org/node/1112308
http://drupal.org/node/1112320

Thanks!

ccardea’s picture

silverwing,

Done.

silverwing’s picture

Issue tags: -orphaned node

thanks!