Generate Latitude/Longitude at the time of import using feed-import module.

Events happening in the community are now at Drupal community events on www.drupal.org.
gaurav-varshney's picture

My Problem is that i am using get-location module for storing the location data. i want to import large data using csv and i am using the feed-import module for that .it is working fine but the lat/lon are not generated. even i am using the get-location feed module.

Comments

Use Field Tamper

amjad1233's picture

Hi Gaurav,

You are right that modules is quite not working.

I used field temper to achive the task.

You can create your own temper and add GeoCoder code snippets to it.

Hope this helps.

Regards,
Amjad

Please told me the snippets

gaurav-varshney's picture

Please told me the snippets of GeoCoder. and i have only the address in csv file.

amjad1233's picture

//The Address field ( Country )
//The Address Variable is going to save the country
$country = 'China';
$point = geocoder('google',$country);
$type = $point->data['geocoder_address_components'][0]->types[0];
if($type!="country")
$point = geocoder('google',"South Africa");

$long=$point->coords[0];
$lat=$point->coords[1];
$country_long_name=$point->data['geocoder_address_components'][0]->long_name;
$country_code=$point->data['geocoder_address_components'][0]->short_name;


$node->field_success_story_location[LANGUAGE_NONE][0]['country']= $country_code;
$node->field_success_story_location[LANGUAGE_NONE][0]['latitude'] = $lat;
$node->field_success_story_location[LANGUAGE_NONE][0]['longitude']=$long;
$node->field_success_story_location[LANGUAGE_NONE][0]['address']=$country;

i have a address in the form

gaurav-varshney's picture

i have a address in the form 'Plot No 84 Vill -Badli NR State Bank Opp Bank Of Baroda Rohini Sector-18' the is above code work for same and country is constant 'india' in all the cases.

Good Luck with Indian Addresses :-)

amjad1233's picture

Hi Gaurav,

Well I don't know if it gives a "Pin" in Google Maps then it probably can be Geo Coded but otherwise forget about it.

Regards.
Amjad

amjad1233 i have e one

gaurav-varshney's picture

amjad1233 i have e one another problem with Proximity search using search api and solr . will you help me for that.
thanks

amjad1233 i have one

gaurav-varshney's picture

amjad1233 i have one another problem with Proximity search using search api and solr . will you help me for that.
thanks

Not Sure

amjad1233's picture

Hi Gaurav,

I am not sure about Solr but I used views to get proximity search and stuff.

Regards,
Amjad

hi amjad i have to setup the

gaurav-varshney's picture

hi amjad i have to setup the code snippet you provided please tell me how can i access the address present in csv file in our custom code of feed tamper plugin to geolocate the data.

Location and Mapping

Group organizers

Group categories

Wiki type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: