Jump to content

Pulling Data Based on Location


bkurzbuch

Recommended Posts

I've been asked to give a quote on a job and not sure if FusionPro can do this. I will be doing a mailing to let a customer know a business is closing but they can visit the next 3 nearest store's. The 3 nearest stores would be the variable. I would be given a weekly updated provider list. Since I haven't started this yet, I believe I'll be able to at least suggest how I need the data to come in. So my question is. Is there a way for FusionPro to pull in data based on closest location. Any ideas or suggestions are greatly apprecatied. Thank You
Link to comment
Share on other sites

I think you're asking whether FusionPro can access GIS/mapping data, like from Google Maps. The short answer is No, there's nothing built into FusionPro to do this.

 

The longer answer is that it might be possible to call out to a Web Service via a static URL, kind of like how you can pull in a map from various web pages, as described here and here. But I have to reiterate that accessing such data, especially for printed output, is very likely not permitted without a special license. PTI is not responsible for any liabilities or damages which you may incur from using FusionPro to access online GIS/map generation systems, or any other web APIs or online material, in an unauthorized way.

Link to comment
Share on other sites

It's funny that you posted this question as I just finished off a similar project for a dialysis company in my state with approx. 20 locations. They wanted to remind previous customers to the closest location to them. Can FusionPro handle this? All but one part, and that's getting the long/lat info of the address and comparing it to the long/lat info for the locations and returning the closest n of them. Check and see if your postal software has a long/lat module (most do) along with CASS. The free long/lat coordinates are not roof-top to roof-top perfect like google maps but are usually within a mile or two of the intended coordinates... good enough if your locations are fairly well dispersed. You can also go to a service provider like GoDataSolutions.com which does provide roof-top to roof-top remote encoding for a fee (thinking a setup fee and a few bucks a thousand). Once you have the long/lat coords assigned to both your data & location file, you can concentrate on the general logic.

 

First, you need to define a function to calculate the distance between 2 sets of coordinates. Google haversine formula and many examples show up. Two params will be passed into the function, point 1 coords and the top n number of locations to be returned . Have the function compare each recipient coord to each store coord. Once all location distances are calculated, sort the location array by distance and return an array with the top n locations.

 

Next is the general logic. On job start, use an external data file to load the store locations into an array. On record start, pass the recipient coords and the n number (3) of locations to return to your calculate. Rinse and repeat till done and salt to taste! That's pretty much it in a nutshell.

 

Gregg

 

A couple of caveats:

 

Remember the haversine formula is as 'the crow flies'. Not like mapquest calculating the driving distance.

 

If an address does'nt CASS (Like if there's bad data entry) long/lat cords returned will be in the geographic center of the zip code (which means the calculation could be off by 5 or 6 miles.

Link to comment
Share on other sites

  • 4 weeks later...

bkurzbuch,

 

Just got back from vacation and saw your message. You were asking about an example of how to do a closest 3 stores geo-code calculation (to instance file records) in FP to get an idea of the basics. You will find that attached.

 

The ingredients:

 

FP template

Instance data file with long/lat populated

Locations data file with long/lat populated

 

Logic:

 

OnJobStart callback will load and populate the locations object array.

 

OnRecordStart callback will take the current instance records long/lat and calculate how far each store location is from it in miles. The locations array is then sorted by distance in ascending order.

 

Return Array Rule returns a table showing either all the locations listed ordered by there distance to this instance records location, or, if the closest location is over 10 miles the page will be suppressed. (business rule example).

 

Caveats:

 

Most of the free long/lat stuff in modern mailing presort software are accurate to within a mile or so if the record CASS's (the address is found in the USPS nat'l database thereby appending a plus 4 code to the zip). If not, the geo-graphic center of the zip is returned which can be off by 4 or 5 miles.

 

If your projects locations are fairly spread out (like in different cities & states), the free long/lat stuff would work just fine. But if your locations are numerous in a large metro area (like StarBucks coffee stores in Seattle), you would want to pay for the rooftop to rooftop long/lat type appending (usually a setup fee + x dollars per thousand).

 

Gregg

LongLat.zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...