Re: [Jeffncou] Geocoder Plugin - markers in incorrect position
Hi Jeff,
Yes, this is possible if you make some custom changes to the code.
*Please note that this change has not been tested.
Try this:
First, change $GLOBALS['GEOCODER_AUTOSET_LAT_LNG_FIELDS'] back to true. Then make this code change
// Autoset form lat/lng values if we can make an address from other form values
function geocoder_autosetFormLatLngFields() {
// Skip if autoset isn't enabled or latitude and longitude aren't defined in form
if (!$GLOBALS['GEOCODER_AUTOSET_LAT_LNG_FIELDS']) { return; }
if (!array_key_exists($GLOBALS['GEOCODER_AUTOSET_LAT_FIELDNAME'], $_REQUEST)) { return; }
if (!array_key_exists($GLOBALS['GEOCODER_AUTOSET_LNG_FIELDNAME'], $_REQUEST)) { return; }
// Get address from form field combos
$address = _geocoder_getAddressFromFieldCombos( $_REQUEST );
if (!$address) { return; }
// lookup coordinates
list($lat, $lng) = geocodeAddress($address);
$record = mysql_get(@$_REQUEST['tableName'], @$_REQUEST['num']);
// Skip if record already has lat/lng values
if (@$record[ $GLOBALS['GEOCODER_AUTOSET_LAT_FIELDNAME'] ] && @$record[ $GLOBALS['GEOCODER_AUTOSET_LAT_FIELDNAME'] ]) { return; }
// override form values
if ($lat && $lng) {
$_REQUEST[ $GLOBALS['GEOCODER_AUTOSET_LAT_FIELDNAME'] ] = $lat;
$_REQUEST[ $GLOBALS['GEOCODER_AUTOSET_LNG_FIELDNAME'] ] = $lng;
}
}
This will not overwrite values if they already exist. Keep in mind that if you then change the address, the lat/lng will not be updated.
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/