-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revamp of the geocoder system #2320
Conversation
// Function takes latitude and longitude | ||
// of two places as input and returns the | ||
// distance in miles. | ||
public static function LatLonDistance($lat1, $lon1, $lat2, $lon2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are copy/past form the other geocode.php file i'm not sure how useful the data is
@@ -507,18 +506,18 @@ class="fa fa-cart-plus"></i> <?= gettext("Add All Family Members to Cart") ?></a | |||
<?= $item['text'] ?> | |||
</div> | |||
|
|||
<?php if (($_SESSION['bNotes']) && ($item["editLink"] != "" || $item["deleteLink"] != "")) { | |||
<?php if (($_SESSION['bNotes']) && (isset($item["editLink"]) || isset($item["deleteLink"]))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is to fix errors in the logs
@@ -298,7 +298,7 @@ | |||
|
|||
<script src="<?= SystemURLs::getRootPath() ?>/skin/locale/<?= $localeInfo->getLocale() ?>.js"></script> | |||
|
|||
<?php if ($sGlobalMessage) { | |||
<?php if (isset($sGlobalMessage)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing log errors
if (SystemConfig::getValue('nChurchLatitude') == '' || SystemConfig::getValue('nChurchLongitude') == '') { | ||
require 'Include/GeoCoder.php'; | ||
$myAddressLatLon = new AddressLatLon(); | ||
<div class="callout callout-info"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added exra info to link to the update all lat/lon
@@ -72,6 +63,8 @@ | |||
//Map all the families | |||
$families = FamilyQuery::create() | |||
->filterByDateDeactivated(null) | |||
->filterByLatitude(0, Criteria::NOT_EQUAL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we no longer update on the fly, filter out bad lat/lon
<?php | ||
|
||
foreach ($families as $family) { | ||
echo '<li><a href="'.$family->getViewURI().'">' . $family->getName() . '</a> ' . $family->getAddress() . '</li>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added link to it is faster to fix the bad addresses
@@ -40,7 +40,8 @@ | |||
"setasign/fpdf": "1.8.1", | |||
"phpmailer/phpmailer": "5.2.*", | |||
"verot/class.upload.php": "dev-master", | |||
"ifsnop/mysqldump-php": "2.*" | |||
"ifsnop/mysqldump-php": "2.*", | |||
"willdurand/geocoder": "3.3.*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new lib
|
||
use ChurchCRM\Utils\GeoUtils; | ||
|
||
class ChurchMetaData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
"bUseGoogleGeocode" => new ConfigItem(56, "bUseGoogleGeocode", "boolean", "1", gettext("Set true to use the Google geocoder. Set false to use rpc.geocoder.us.")), | ||
"sISTusername" => new ConfigItem(54, "sISTusername", "text", "username", gettext("Intelligent Search Technolgy, Ltd. CorrectAddress Username for") . " - https://www.intelligentsearch.com/Hosted/User"), | ||
"sISTpassword" => new ConfigItem(55, "sISTpassword", "text", "", gettext("Intelligent Search Technolgy, Ltd. CorrectAddress Password for") . " - https://www.intelligentsearch.com/Hosted/User"), | ||
"sGeoCoderProvider" => new ConfigItem(56, "sGeoCoderProvider", "choice", "GoogleMaps", gettext("Select GeoCoder Provider") . " - https://github.com/geocoder-php/Geocoder/blob/3.x/README.md#address-based-providers", '{"Choices":["GoogleMaps", "BingMaps"]}'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
$this->setLatitude($output->results[0]->geometry->location->lat); | ||
$this->setLongitude($output->results[0]->geometry->location->lng); | ||
public function updateLanLng() { | ||
if (!empty($this->getAddress()) && (!$this->hasLatitudeAndLongitude())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we want to update the lat/lng of an existing family?
$this->setLongitude($output->results[0]->geometry->location->lng); | ||
public function updateLanLng() { | ||
if (!empty($this->getAddress()) && (!$this->hasLatitudeAndLongitude())) { | ||
$latLng = GeoUtils::getLatLong($this->getAddress()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this causes a traceback:
vagrant@scotchbox:~$ tail -f /tmp/ChurchCRM.log
[2017-04-18 21:06:22] defaultLogger.INFO: INSERT INTO note_nte (nte_ID, nte_per_ID, nte_Text, nte_DateEntered, nte_EnteredBy, nte_Type) VALUES (NULL, 2, 'Created via Family', '2017-04-18 21:06:22.000000', 1, 'create') [] []
[2017-04-18 21:06:22] defaultLogger.INFO: INSERT INTO note_nte (nte_ID, nte_per_ID, nte_Text, nte_DateEntered, nte_EnteredBy, nte_Type) VALUES (NULL, 3, 'Created via Family', '2017-04-18 21:06:22.000000', 1, 'create') [] []
[2017-04-18 21:06:22] defaultLogger.INFO: INSERT INTO note_nte (nte_ID, nte_fam_ID, nte_Text, nte_DateEntered, nte_EnteredBy, nte_Type) VALUES (NULL, 1, 'Created', '2017-04-18 21:06:22.000000', 1, 'create') [] []
[2017-04-18 21:06:22] defaultLogger.INFO: SELECT fam_ID, fam_Name, fam_Address1, fam_Address2, fam_City, fam_State, fam_Zip, fam_Country, fam_HomePhone, fam_WorkPhone, fam_CellPhone, fam_Email, fam_WeddingDate, fam_DateEntered, fam_DateLastEdited, fam_EnteredBy, fam_EditedBy, fam_scanCheck, fam_scanCredit, fam_SendNewsLetter, fam_DateDeactivated, fam_OkToCanvass, fam_Canvasser, fam_Latitude, fam_Longitude, fam_Envelope FROM family_fam WHERE fam_ID = '1' [] []
[18-Apr-2017 21:06:22 America/New_York] PHP Fatal error: Uncaught Error: Class 'ChurchCRM\Utils\CurlHttpAdapter' not found in /var/www/public/ChurchCRM/utils/GeoUtils.php:15
Stack trace:
#0 /var/www/public/ChurchCRM/model/ChurchCRM/Family.php(298): ChurchCRM\Utils\GeoUtils::getLatLong('4222 Clinton Wa...')
#1 /var/www/public/FamilyEditor.php(442): ChurchCRM\Family->updateLanLng()
#2 {main}
thrown in /var/www/public/ChurchCRM/utils/GeoUtils.php on line 15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is also what's causing the travis tests to fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya bad last min refactor ... i just fixed it
This should good tongo |
closes #2314
closes #582
closes #1867
closes #2259
closes #2322