CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • mapping in africa
Pages: 1 [2]

Author Topic: mapping in africa  (Read 7542 times)

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: mapping in africa
March 07, 2008, 10:08:38 am
Quote from: tobiaseigen on March 07, 2008, 07:08:44 am
- Is it safe for me to empty the geo1 and geo2 tables and rerun the script from scratch?

yes

Quote from: tobiaseigen on March 07, 2008, 07:08:44 am
- Can you think of a way to add geocoded contacts to a group so they can all be viewed on a map?

The easiest way would be to hack the update address script and add members to a group as they are geocoded. You can use the civicrm api's to add a contact to a group

Quote from: tobiaseigen on March 07, 2008, 07:08:44 am
- Are there ways to geocode addresses to place them at least in a country? E.g. by repeating the script omitting other address fields?

You'll have to experiment with the query we send google and see what additional variables we need to send for it to give us a "loose" match. I suspect this is possible and the easiest way out :) Once we know this, its quite easy to add those variables to the code

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: mapping in africa
March 07, 2008, 08:03:17 pm
You might be able to with a smart group based on a search builder query for "geo_code_1 != 0" and "geo_code_2 != 0".

This should NOT match people who have NULL as their geo_code_X, so you will end up with a result that you can save as a smart group ("New Smart Group" from the results).

(I tested this on 2.0, but it should be the same with 1.9?)

Given that 0N 0E is actually a location (albeit a wet one) you could use star trek co-ordinates and replace the 0 with 999 ...

We had some people whose address only mapped to "New Zealand". Google geolocated them slightly off the coast of Kapiti Island, and near enough to the middle of NZ, so it is possible to use "just a country" - but you should be aware that your mapping results will become vague :)
@xurizaemon ● www.fuzion.co.nz

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: mapping in africa
March 08, 2008, 03:06:40 am
lobo, I think you have an extra comma in your sql code in UpdateAddress.php.

FROM       civicrm_contact  c,
INNER JOIN civicrm_address        a ON a.contact_id = c.id

should be

FROM       civicrm_contact  c
INNER JOIN civicrm_address        a ON a.contact_id = c.id

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: mapping in africa
March 08, 2008, 09:46:26 am
argh :(

fixed in svn, will be part of next release

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: mapping in africa
March 10, 2008, 01:53:31 am
Been looking at geocoding support in the UK. When the full address is passed to yahoo or google some addresses are not found and the location is updated to 0,0. However dropping the detail level will eventually find the address. For example if house name, street address 1,2,3, county, post code, country finds nothing then county, post code, country invariable does geocode although with less accuracy.

Would it be possible for the geocode code to evaluate the result and if it returns 0,0 (not found) to drop the detail level until it does find a result?

When the address is found 8 digits after the decimal point are returned. If the above approach is used then maybe the number of digits used could be shortened to indicate the reduced level of accuracy.

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: mapping in africa
March 10, 2008, 08:19:38 am
Alternate script to geocode an addresses by dropping detail level

Are you finding that UpdateAddress.php is returning 0,0 geocoding for some addresses? The attached script resolves this by dropping the detail level until a match is found.

From testing I've noticed a few of things:

1) Dropping the detail level will result in a less accurate result (clearly) but it's better than nothing
2) sometimes a match is not found but re-running picks it up
3) Post codes change over time. Some of my Postal Codes were incorrect hence no match.

enjoy.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: mapping in africa
March 11, 2008, 09:39:07 am

Thanx for the patch on the script. The script is now patched for 2.0

The diff is attached here: http://biryani.osuosl.org:8181/browse/CiviCRM/branches/v2.0/bin/UpdateAddress.php?r1=13598&r2=13625

i modified it a wee bit. i also promoted postal code higher up so it gets bumped off earlier in the cycle

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • mapping in africa

This forum was archived on 2017-11-26.