1

I am using Location + Gmap module. When creating a content user have to mark location on gmap. I want to to mark location on gmap automatically when user enter the values in location.

enter image description here

I enabled Geocoding for India and tried after set Google Maps Geocoding Accuracy to Premise, Country Level etc. but it is not marking on Gmap

I tried this documentation, But map is only displaying if I manually mark on gmap. I am using a Location CCK Field.

3 Answers 3

0

The location module already geolocates automatically. Go to admin/config/content/location/geocoding and make sure you have chosen a geolocation service for the counties you need.

1
  • I used it but it is not marking in map I don't know why? Jun 4, 2013 at 12:27
0

Instead try this modules it have the option same like your requirement. See the below screenshot and also easy to configure.

Geofield Gmap allow to use a google map v3 map to input a location.

A quick text input + geocode allow you to specify an address.

You can drag and drop the marker to narrow the position.

enter image description here

Geofield Gmap require geofield.

Geofield is a module for storing geographic data in Drupal 7. It supports all geo-types (points, lines, polygons, multitypes etc.)

1
  • Can't It be done with the location + gmap module only. Jun 25, 2013 at 7:08
0

Solved this using hook_node_api

if ($op == 'presave') {
    $geocode=file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address='.$prepAddr.'&sensor=false');
    $latitude = $output->results[0]->geometry->location->lat;
    $longitude = $output->results[0]->geometry->location->lng;
    $node->field_event_location[0]['latitude'] = $latitude;
    $node->field_event_location[0]['longitude'] = $longitude;
    $node->field_event_location[0]['locpick']['user_latitude'] = $latitude;
    $node->field_event_location[0]['locpick']['user_longitude'] = $longitude;
    node_save($node);
}

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.