I want to create a database-driven website with Drupal 6 to gather some information from users that is related to the location; I want to create a form (and I don't want to use Webforms, or CCK) to get some data from users, and to get coordinates by creating a point on a map (by Openlayers or Gmap API), and then saving those data in a database table. I also want to integrate it with Views module so i can make a query from data.

3 Answers 3


I'm quite happy with the Geolocation Field module for Drupal 7. It allows you to put a field on any entity (user or node or whatever) that uses a map. It also has an html5 module to collect the information. Great stuff, actively maintained.

  • Too bad it's not back ported to drupal-6. It looks very interesting!
    – grm
    Commented Apr 18, 2011 at 21:39

There is already a module that is doing the form part, see HTML5 user geolocation.

Here is a quote about it (from the module's project page):

... a simple module to let users store their location on the edit account page. It uses HTML5’s geolocation API and stores latitude and longitude. How you use that data is up to other modules.

It was used on Drupal.org when Drupal.org used Drupal 6.

For more than users or for a Drupal 7 version, try Geolocation Field with the Geolocation HTML5 widget. Now that it is on Drupal 7, Drupal.org uses the Geolocation Field for this feature.

  • thank you for your reply but I want to know how to use map in my custom form
    – Raoof
    Commented Apr 16, 2011 at 17:51
  • 1
    Then check out how that module is doing it.
    – Berdir
    Commented Apr 17, 2011 at 8:21
function geo_get_coords($address) {
  $map_key = "put your google map key";
  $url = sprintf('http://maps.google.com/maps/geo?&q=%s&output=csv&key=%s',rawurlencode($address),$map_key);

  if ($result = file_get_contents($url)) {
    $result_parts = explode(',',$result);

    if($result_parts[0] != 200) {
      return FALSE;

    $coords['lat'] = $result_parts[2];
    $coords['lon'] = $result_parts[3];

  return $coords;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.