function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
cmarzillicmarzilli 

Google Maps Mashup

I was looking for an easy way to map all of our Accounts (of a certain type) on a map.  Possibly color code by Account Owner.  I'd like to see this on a dashboard if possible.  Has any one done this or knows how to?  I saw a few app exchange apps but none that do this (I think)
werewolfwerewolf
Well, you can definitely start by installing one of those AppExchange apps like Map Nearby Accounts.  From there, if you have reasonably decent Javascript skills, it's pretty straightforward to modify, for example, what color the markers show up as.
MendozaMendoza
Modifying the java script is not an issue.  I'd like to look at the service to tailor it to Canada.  The service works well for the US looking everything up by ZIP code, but in Canada this doesn't apply.  Ideally I'd like to try to filter markers by distance, I understand that there may be performance issues with Geocoding all the addresses, but this is what we'd need to do.  Is it possible to get the source for this service?  Where is the service published?  Has anyone taken a look at creating a Canadian equivalent?
crcochrancrcochran
werewolf - have you ever been able to get this to work, or seen it work, with fully qualified Zip Codes?  (5+4).  I have tryed a couple, but always run into a problem in production because our zip codes are the full zip codes.
werewolfwerewolf
I've never tried it with +4 but I'm not sure google maps works that way.  Why not just make a formula field that shaves off the +4 and use that?
crcochrancrcochran
Thanks for the tip; however, I did not get the results I was looking for.  It turns out that Google maps isn't the issue, it is the Flex Grid that came with the Salesforce package that is unable to resolve the extended zip code.  I am not sure where to go from here.
TeamCravenTeamCraven

CR-

 

I'm having the same issue, Zip+4 doesn't seem to work all that well, it will map the main "account" with a pin, but when I adjust the zoom, it erases the pin, and doesn't show any surrounding accounts.

 

I've tried modifying a formula for the Zip Var to get it just recognize the first 5 characters, but that doesn't seem to work either.  Any ideas?

 

var zip= "{! LEFT( "!Account.BillingPostalCode" , 5) }";

mshelmanmshelman

I've built a Google maps real estate app where the map shows all locations within a given radius in miles. Each property (location) is geocoded when first created (which is not difficult). Then there is a heuristic to translate latitude and longitude to miles as, of course, longitude is dependent on latitude. So it is not 100% accurate but is probably close enough for most purposes. It also shows the exact distance from the center point for each marker which is a function available in the Maps API.

 

Mike

TeamCravenTeamCraven
Care to share how you did this???
mshelmanmshelman

I would add custom fields for latitude and longitude to the object that I want to represent on the map. These values can then be obtained by passing the object's street address to the Google or Yahoo geocoding service.

 

Then for latitude the conversion is 69 miles per degree of lat. For longitude degrees are smaller as you go north -- I use 55 miles per degree as a heuristic which is fairly close for 35 deg. latitude (Albuquerqe). At 40 deg latitude (Kansas/Nebraska border) the figure is 53 miles per degree and for 45 deg latitude (Montana/Wyoming border) the figure is 49 miles per degree. So if you want to find all objects within 10 miles of a given lat and lng you can construct a dynamic soql query using the following logic: 

 

lat__c <  given lat + 10 / 69

and lat__c >  given lat - 10 / 69

and lng__c <  given lng + 10 / 55

and lng__c >  given lng - 10 / 55  

 

Let me know if this answers your question.

 

Mike

crcochrancrcochran

TeamCraven,

 

I tried the formula field also to no avail.  I did play with Google.  I actually think Goolge works great with the Zip + 4.  I think the Flex control object struggles with Zip + 4. 

 

The Flex control object keys off the SF standard Address field.  I am not sure how to build one to pull off of standard text fields (i.e. creating a formula field.)