13

See new documentation page for geofield that shows how to setup a basic proximity search (it is based on MotoTribe's answer, but with a bit more info) As requested, some of the link content: Instructions Required modules You must download the latest modules. These instructions have been tested with the 'dev' versions of geocoder, geofield, and ...


8

Looks pretty straightforward using geofield 7.x-2.0-alpha2: I assume you have geofield and geophp enabled and assume you have added a geofield to your users that get the location from an addressfield. create a view of type users add "[name of your geofield] - proximity" field select "source of origin", I tried "exposed geofield proximity filter", check ...


6

You can also use the #access check to keep people from seeing the vertical tabs. $form['additional_settings']['#access'] = FALSE; Simply add that to a hook form alter or in between the loading and the rendering of a form. After that you can call render($form) to get the markup.


5

There's a actually a way to do this in Views UI. Add all your fields in Views as per usual On the bottom most field (ideally the one that's the bubble), edit it and click on "Rewrite results". (Note you can drag / reorder fields to get the right one at the bottom.) Check the box, "Rewrite the output of this field" Below that once expanded, you will see "...


5

I guess I should have looked through the module better. Here's the answer (tip: it's built right in!): Go to your view (it needs to be a node based view I think) In the "fields" section choose "add" In the search box type "distance" and then choose the "Location: Distance / Proximity" field Choose miles or kilometers to suite your needs Then choose "Use ...


5

Not to put a damper on things (I've written more scrapers than I care to remember and it's always fun), but such an act is specifically against Google's Terms of Service: Do not misuse our Services, for example, do not interfere with our Services or try to access them using a method other than the interface and the instructions that we provide. I'm sure ...


5

And the answer: $entity_metadata_wrapper = entity_metadata_wrapper('node', $node_object); $data = array( 'lat' => 44, 'lon' => -93 ); $entity_metadata_wrapper->field_position->set($data);


4

So maybe my question wasn't worded in the best way, but I have found the answer. All countries in Drupal (at least in 7) are taken from the /includes/iso.inc file. This includes Location and Address Field. You can add countries to this list via drupal_alter An example: <?php function hook_countries_alter(&$countries) { // Elbonia is now ...


4

It's a shame Sumeet didn't continue his answer, as he got so close, but here is the alter hook: function HOOK_countries_alter(&$countries) { $US = $countries['US']; unset($countries['US']); array_unshift($countries, $US); } It copies US, removes it from the list, and attaches the copy back to the top. You don't say in what context you use the ...


4

Here is an alternative to @Kenny and @Bearden solution, using template preprocess instead of overriding the template. Not only it makes for a more readable solution, you can reuse it for other views. It should also work for list summaries, just remove _unformatted from the function name. /** * Implements hook_preprocess_views_view_summary_unformatted(). */...


4

hook_boot() is invoked too early to use the session, as Drupal has not yet initialised the session. Furthermore, hook_boot() has been removed from Drupal 8. hook_init() is not invoked for cached pages, but there is a trick to avoid the page is cached: Call drupal_page_is_cacheable(FALSE) in hook_init(). The function that actually stores the current page in ...


4

Your problem is that views uses SQL to sort, since that is a lot easier and faster and it otherwise would be required to load all the records and sort them with PHP, before selecting which to show, which is a massive resources waste if you have a lot of records and use paging. A simple solution to this problem, is to create a work around. Since the country ...


4

According to README.TXT: API NOTES Geofield fields contain nine columns of information about the geographic > data that is stores. At its heart is the 'wkt' column where it stores the full geometry in the 'Well Known Text' (WKT) format. All other columns are metadata derived from the WKT column. Columns are as follows: 'geom' Raw ...


4

I have been able to accomplish this task following these steps: Installed modules for search: search_api, search_api_location, search_api_solr search_api_views, search_api_facetapi, Search API location views Installed modules for "geosearch": geofield (to store lat, lon...), addressfield (make it easier for users to enter an address and don't worry about ...


4

MotoTribe's answer is basically correct, but you might want to use the dev release instead of the alpha release. We've had a few bug fixes in since then. We should probably do a new release soon. Source: Geofield maintainer.


4

Location: provides the Location API; handles address storage and geocoding. Essentially the base of the location module to which the other modules rely upon. Location CCK: provide a Location behavior as a CCK field. This module uses the field API properly rather than its legacy node location module which implemented its own fields and storage. If you are ...


4

I have created a working sandbox version of address autocomplete. https://drupal.org/sandbox/adammitchell/2126989. I will endeavour to get it created into a full blown project. However if you could help me and test it that would be greatly appreciated.


4

Set Geofield using EntityMetadataWrapper if you only have the Longitude & Latitude information. (2015): $geofield_data = geofield_compute_values(array( 'lat' => [Latitude], 'lon' => [Longitude] ), GEOFIELD_INPUT_LAT_LON); $entity_metadata_wrapper->field_position->set($geofield_data); When a geofield is saved using ...


4

I had a similar issue with editing the exposed form. Form alter is not the right way to go though. You'll need to use element info alter. Take a look at this custom module I threw together for editing the geofield proximity search. You can see what I did, and add/modify functionalities for your needs (although I think i did exactly what you wanted).


4

If you have an array of nids you could just run this piece of code example will unpublish the nodes with nid 1,2,3: $nids = array(1, 2 ,3); foreach($nids as $nid) { db_query("UPDATE {node} SET `status` = '0' WHERE `nid` =:nid ;" ,array(':nid'=> $nid)); } entity_get_controller('node')->resetCache($nids);


3

If your are using drupal 7, then my favorite option is openlayers with address field and geofield. The advantage of openlayers is that you are not tight to one particular map provider, but you can switch just by changing your options. You can set geofield to take the value of the address field, geocode it and store the lon/lat value of the address. You can ...


3

There are two basic approaches for doing locations in D7: the location and gmap modules the addressfield, geocoder, and openlayers modules According to Karen Stevenson's presentation at Do It With Drupal 2011, only location/gmap currently has location proximity search working in D7... but not very well. Based on this presentation and the book Mapping with ...


3

Guess you want this to take place, when you create (aka save to db) a new node. You could do this in hook_node_presave.


3

It was a lot easier than I thought. I dsm the query and did it like below. Not sure it's the perfect way to do it but it's working. function distprox_mini_views_query_alter(&$view, &$query) { //dsm($query); if ($view->name == 'search' && $view->current_display == 'page_3') unset($query->where[1]['conditions'][0]); unset($...


3

With the first solution, the country key is missing, so you can't save this country field because the country key doesn't match. I suggest that (similar to the second solution) : function hook_countries_alter(&$countries) { $country_key = 'FR';//eg. your country key $country_data = $countries[$country_key]; unset($countries[$country_key]); $...


3

Okay, well the major issue with this particular field is that id doesn't have all the properties you need to go through the standard routes to display the term instead of the id. So, without a major rewrite of the module I would do this if you really need this feature. Copy the views-view-summary-unformatted.tpl.php to your admin theme directory and edit ...


3

I had a good experience with Geolocation Field. I used this module on dealing website to show location of store. It lets you mark location via node creation/edition form and have display formatter to rendering the address as PNG or Google map. It was simple and good enough.


3

Results may vary based upon your drupal version, but basically when you create a proximity filter: the first option is "Node location" but when you click on that: it will allow you to use a Location CCK field as well.


3

This works, but (here's the trick), only if you enable the location_entity module, which ships with location. $location = array( 'latitude' => $latitude, 'street' => $street, // etc, other elements added here ... ); $ew->field_location->set($location); $ew->save(); May no one else lose as much time on this ever again.


Only top voted, non community-wiki answers of a minimum length are eligible