Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder: Plugins & Add-ons:
Filter Geocoder multi-map based on field info

 

 


4cdg
User

Sep 8, 2011, 9:11 AM

Post #1 of 6 (2019 views)
Shortcut
Filter Geocoder multi-map based on field info Can't Post

I have a geocoder multi-map and proximity search on the same page at http://stoddardmls.com/proximity.orig.php

When the page loads it shows all the records in the listings table, I need it to show only the records where category = For Sale.

Once i do a proximity search i filter the results with a hidden field in the search form, but the map that loads initially i don't know how to only show records marked for sale.

I have attached the page
Attachments: proximity.orig.php (16.8 KB)


4cdg
User

Sep 8, 2011, 9:58 AM

Post #2 of 6 (2018 views)
Shortcut
Re: [4cdg] Filter Geocoder multi-map based on field info [In reply to] Can't Post

Also some of our records are not coding correctly, like some in other states or other towns completely. We tried to go to google earth and get exact lat and lon and enter manually, but when you save it reverts back to the geocoded lat and lon

any way to manually enter the latitude and longitude when geocoder is activated?


Jason
Staff / Moderator


Sep 8, 2011, 10:34 AM

Post #3 of 6 (2017 views)
Shortcut
Re: [4cdg] Filter Geocoder multi-map based on field info [In reply to] Can't Post

Hi,

For your first issue, you can manually add that condition to your WHERE clause like this:


Code
list($addressRecords, $addressMetaData) = getRecords(array( 
'tableName' => 'listings',
'addSelectExpr' => geocoder_getSelectExprForDistance($myLat, $myLng, '_distance', $kmOrMiles), // adds '_distance' field to output records
'where' => geocoder_getWhereForDistanceWithin($myLat, $myLng, $maxDist, $kmOrMiles)." AND status = 'For Sale'", // 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
));


For your second issue, you can set the plugin so that it doesn't automatically overwrite/set the lat and long field when you save but setting this in the plugin:


Code
$GLOBALS['GEOCODER_AUTOSET_LAT_LNG_FIELDS'] = false;


Please note that this means that you will either have to manually enter your lat and long values, or use the "Geocode Table" function from the plugins page.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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


4cdg
User

Mar 23, 2012, 9:41 AM

Post #4 of 6 (1707 views)
Shortcut
Re: [Jason] Filter Geocoder multi-map based on field info [In reply to] Can't Post

the code you provided above won't work in my case because the website is auto coding thousands of records being input by multiple users. It is a real estate multi listing website and sometimes we have cases of google not having the correct location on a map such as a new sub-division or a really rural area or some acreage for sale and need to enter lat and long manually. This is something that we need a fix for. May require second level support or an update to the geocoder, which by the way is awesome.


Tom P
User


Mar 26, 2012, 10:50 AM

Post #5 of 6 (1655 views)
Shortcut
Re: [4cdg] Filter Geocoder multi-map based on field info [In reply to] Can't Post

Hi 4cdg,

Which part of the code isn't working for you - the "for sale" filter or disabling the lat/long auto-overwrite for the geocoder?

If it's the former we'd need to see the script that's generating the page and the input method for the data so we can make some more suggestions - please submit a second level support request https://www.interactivetools.com/support/email_support_form.php.

If the latter - we would need to look at customizing the geocoder to not overwrite extant lat/long (eg only complete those that are not already present). This would be a consulting job so you'd have to send details to consulting@interactivetools.com so we can spec up what needs to be done for you.

Let me know if this helps,

Tom


4cdg
User

Mar 26, 2012, 11:33 AM

Post #6 of 6 (1654 views)
Shortcut
Re: [Tom P] Filter Geocoder multi-map based on field info [In reply to] Can't Post

It is disabling the lat/long auto-overwrite. I will send info to consulting.