Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > FusionPro® VDP Creator

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 3rd, 2016, 08:53 AM
draco66 draco66 is offline
Regular Contributor
 
Join Date: Sep 2008
Posts: 70
Default Geo Directories

Looking for suggestions on how to create Geo Directories with Fusion Pro. These are listings of health care providers within a set radius of the recipients address.

Any suggestions would be helpful.

Software to create tagged data that can then be run through Fusion Pro?

Thank you.
Reply With Quote
  #2  
Old February 3rd, 2016, 11:11 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Geo Directories

Google has several well-documented API's that you'd probably find useful for this. Specifically: Places and possibly Maps Geocoding. Note that there are usage limitations tied to the latter.

In any event, I've done something similar in the past and had the most success with processing an existing data list of addresses and updating it with the results of the API queries prior to going to FusionPro. So essentially, the script loads a data file, walks through each record calling the script below for each address, and tacks on an additional field for "nearby health care providers" that you could then parse and format within your template. While the script that I wrote is in PHP, you could easily modify it for JavaScript if you'd like:

PHP Code:
<?php

function google_API($url$params){
  
$api '##################################'// Google API KEY
  
$output "json"// json or xml
  
$params array_filter($params);
  
$params['key'] = $api;
  
$params implode('&'array_map(function ($v$k) { return $k '=' $v; }, $paramsarray_keys($params)));
  
$jsondata json_decode(file_get_contents($url '/' $output .'?'.$params));
  
  if (
$jsondata->status === "OK"){
    return 
$jsondata;
  }
  return 
'';
}

function 
get_long_lat($address) {
  
$url "https://maps.googleapis.com/maps/api/geocode";
  
$parameters = array (
      
"address" => urlencode($address),
      
"region" => "us"
    
);
  
$coordinates google_API($url$parameters);
  
$lat $coordinates->results[0]->geometry->location->lat;
  
$lng $coordinates->results[0]->geometry->location->lng;
  
$result implode(','array_filter(array ($lat,$lng)));
  return 
$result;
}   

function 
get_nearby($address){
  
$url 'https://maps.googleapis.com/maps/api/place/nearbysearch';
  
$parameters = array (
      
"location" => get_long_lat($address),
      
"radius" => 500,
      
"types" => "health|hospital" 
    
);  
  
$result google_API($url$parameters);
  if (empty(
$result)) {
    return 
'';
  }
  
$locations = array();
  foreach (
$result->results as $i) {
    
$name $i->name;
    if (!empty(
$name)){
      
array_push($locations$name);
    }
  }
  
$locations implode('|'$locations);
  return 
$locations;
}

print 
get_nearby('1600 Pennsylvania Avenue, Washington DC');
?>
The script above returns a list of places of type "health" or "hospital" within a 500 meter radius of the White House which I've delimited with a pipe so the appended field would have a value of:
Code:
return Field("nearest health care provider"); // "Harris Teeter|Safeway|Safeway Pharmacy (inside Safeway)|Malone Thomas O DDS|Capitol Hill Dental Associates|Shelton R. Penn, DDS, PC|Comprehensive Psychiatric Emergency Program|Malone Bennye L DDS|Bmarchai Studios|Baker Moorean a DDS|Chardonnay Dialysis Inc|2fitt Wellness|Freed Bodyworks Holistic Wellness Center|Harris Teeter Pharmacy|Think Pilates!|Yorke Leigh V|Khojandi Mohammad MD|Erin Lee, PharmD|Dr. Carlos H. Powers Jr, DDS|William Community Residential"
And you could make a list of them like this:
Code:
return Field("nearest health care provider").split('|').join('\n<br>');
/*
Harris Teeter
Safeway
Safeway Pharmacy (inside Safeway)
Malone Thomas O DDS
Capitol Hill Dental Associates
Shelton R. Penn, DDS, PC
Comprehensive Psychiatric Emergency Program
Malone Bennye L DDS
Bmarchai Studios
Baker Moorean a DDS
Chardonnay Dialysis Inc
2fitt Wellness
Freed Bodyworks Holistic Wellness Center
Harris Teeter Pharmacy
Think Pilates!
Yorke Leigh V
Khojandi Mohammad MD
Erin Lee, PharmD
Dr. Carlos H. Powers Jr, DDS
William Community Residential
*/
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
Old February 3rd, 2016, 01:42 PM
tou
This message has been deleted by tou.
  #3  
Old February 4th, 2016, 07:09 AM
draco66 draco66 is offline
Regular Contributor
 
Join Date: Sep 2008
Posts: 70
Default Re: Geo Directories

Thank you for the input. Our project will be searching an internal database of providers rather than those found on the web. But this gives me some good information as a starting point.
Reply With Quote
  #4  
Old February 4th, 2016, 07:59 AM
tou tou is offline
Regular Contributor
 
Join Date: Oct 2015
Posts: 107
Default Re: Geo Directories

draco66, what do you use for mailing software?
Reply With Quote
  #5  
Old February 4th, 2016, 08:32 AM
draco66 draco66 is offline
Regular Contributor
 
Join Date: Sep 2008
Posts: 70
Default Re: Geo Directories

Bulk Mailer Pro by Satori.
Reply With Quote
  #6  
Old February 4th, 2016, 08:37 AM
tou tou is offline
Regular Contributor
 
Join Date: Oct 2015
Posts: 107
Default Re: Geo Directories

We have BCC, which can use a function called "nearestLocation" comparing recipient's address to a listing of address (healthcare in your case), and can return x number (you specify) of nearest locations in distance. I'm not familiar with Satori, but I assume they might have a similar tool/process to achieve it.

I'm sorry I couldn't be of an assistance on this.

Thanks.
Reply With Quote
  #7  
Old February 4th, 2016, 11:22 AM
David Miller David Miller is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Hamden, CT
Posts: 265
Default Re: Geo Directories

Quote:
Originally Posted by draco66 View Post
Bulk Mailer Pro by Satori.
There is a Geocode add-on for Bulk Mailer Pro and Business that will Append latitude and longitude information during the address correction process.

Using this information, we've calculated the distance between two locations as mentioned in this post.

Of course, the distance is "as the crow flies", not actual driving distance.
__________________
David Miller
FusionPro VDP Creator 10.0.26
Adobe Acrobat Pro 2019.008.20074
Suitcase Fusion 20.0.0 (7653)
macOS High Sierra 10.13.6

Last edited by David Miller; February 4th, 2016 at 11:26 AM..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:22 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.