Geocoder - Not working

By shawnpatoka - October 16, 2012

i just installed the geocoder addon, and when i clicked the examples, they are all erros...

http://seenstream.com/cmsAdmin/plugins/examples/sample_map_multi.php

Re: [shawnpatoka] Geocoder - Not working

By gregThomas - October 16, 2012

Hi,

The geocoder files and example directory should be in a geocoder directory in the plugins section. As in the example files the include for the viewer functions are hard coded to drop down three directories.

To get around this you could either move the geocoder files and example directory into a geocoder directory in the plugins section.

Or you could open the example files and change line 2 from:

<?php require_once "../../../lib/viewer_functions.php"; ?>

to

<?php require_once "../../lib/viewer_functions.php"; ?>

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com

Re: [shawnpatoka] Geocoder - Not working

By Jason - October 17, 2012

Hi,

You shouldn't need the $GLOBALS array. Try this:

$addressRecords = array();
if ($myLat && $myLng) {
$maxDist = floatval(@$_REQUEST['maxDistance']);
list($addressRecords, $addressMetaData) = getRecords(array(
'tableName' => 'participating_bars',
'addSelectExpr' => geocoder_getSelectExprForDistance($myLat, $myLng, '_distance', $kmOrMiles), // adds '_distance' field to output records
'where' => geocoder_getWhereForDistanceWithin($myLat, $myLng, $maxDist, $kmOrMiles), // optimization: remove results outside of minimum bounding rectangle
'having' => "_distance <= " . $maxDist, // only show results within max distance
'orderBy' => 'ISNULL(_distance), _distance', // sort nearest records first -and- unknown or undefined distances last
));
}


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Geocoder - Not working

By shawnpatoka - October 17, 2012

nice! that seems to work. thank you!