You need to sign in to do that
Don't have an account?
Working Google Map Example?
I've done quite a bit of research on the forums on how to include a "simple" Google Map example, and have tried many of them. With all , I seem to end up in the same place as a lot of others end up based on the forum comments - the map never actually comes up. I have a valid API key that I substitute, and still nothing comes up - just a blank VF page. Does anyone have a real working example that I could review and modify?
I just want to display a set of locations on the map. In my case, location is a custom object with country, state,city and zip (not a standard account record). If I can just get something basic working (i.e. actually see a map), I can then modify it to also set the marker colors based on some properties of the location - it's for a dashboard.
Any help would be greatly appreciated (something in API V3 would be best, but at least an example that works). I thought this was going to be simple...
1. Create a visual force page.
2. if you want to put visual force page as inline visualforce page for you account than you can use it.
3. Most Importan thing - the address which you are specifying in you account information field, it must be available on google map.(i should be pined on map). i have seen many people test google map with data whic in not already sticked on map.
All Answers
1. Create a visual force page.
2. if you want to put visual force page as inline visualforce page for you account than you can use it.
3. Most Importan thing - the address which you are specifying in you account information field, it must be available on google map.(i should be pined on map). i have seen many people test google map with data whic in not already sticked on map.
Thanks! I can actually see the map :-) One issue is that it I got a message saying that only secure content is shown, and the map came up after I clicked on "Show all Content". Do you know why?
Robert,
It is because that example was loading resources via a non-secure HTTP connection and the browser didn't load them until after you clicked ok.
For an example that uses v3 of google maps (and allows for https) please see this page.
Please note that my example expects your system to have the geocoding (i.e. long / lat data) cached out (see an example here). This is so you can map many points at once without hitting google API limits.
The previous example given by Shiv appears to make the geocoding call in real time which if you are mapping many many points can sometimes hit the API limits unless you have a paid API key.
Thanks
Correction, it looks like Shiv's example is using V3 as well but just doesn't load from a HTTPS connection.
As colemab said it might be the region, can you check with following script link
Just put this code instend on link which we have in our code.
Also, I set up https://maps.googleapis.com as a remote site on the security
settings.
And, colemab, thank you for the tips on the geocoder.
You guys saved me from days of effort and frustration. Much appreciated!
Here are the missing lines in the above.
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
Thanks for the script. It works great except for the fact that if your street field has a line break of any kind it stops working. I have done much research into this and tried everything from JSENCODE, replace, unescape, urlencode. Nothing seems to work. I always get a syntax error in the dev console that looks like it's only getting the first or second part of the street. I'm sure I'm not the only one trying to find a solution to this.
Draper,
Here is an example of a javascript function that will clean up string's for use with the geocoder:
Of course you would need to modify your page / script to call this funciton.
I hope this helps.
Ok, I figured out why it wasn't working! You have to put your code: {!SUBSTITUTE(JSENCODE(Contact.MailingStreet),'\r\n',' ')} in the address variable AND in the marker code. It was breaking in the marker code because it still had the returns in the street field. Hope other people find this post for the soution:)
Error Error: The value of attribute "src" associated with an element type "script" must not contain the '<' character.
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
and it works. Had the same problem....for me it works fine. Do not forget to set the Remote Site Settings appropriately.
best Thomas
Oops! 's billing address could not be found, please make sure the address is correct.
how can i get particular account id billing address? can u please send what to do?
thanx waitin for ur reply