INTEGRATE MAPBOX WITH VISUALFORCE TO CREATE BEAUTIFUL MAP – Part III

by Sudipta Deb | Aug 16, 2015 | javascript, map, mapbox, mobile, Salesforce, visualforce | 0 comments

In continuation with my previous two posts –

today, I will explain how you can fetch geographic data from Salesforce and accordingly show them in Salesforce.

To start with let me first create an object – Household where I can store geographic information. Below you can find the object details – 
Now the Visualforce page – Mapbox Click here
Now when you will open the page you will see the three locations plotted.
In this example, I am using apex:repeat to prepare the GeoJSON data. To understand what is GeoJSON data, below is what Wikipedia stating –
Once the GeoJSON data is ready, I am adding the same with featurelayer –
L.mapbox.featureLayer(geojson).addTo(map);

Finally, I am using the click event to show the Household name when user clicks on the points inside map. The code for that – 
//Show popup with information on mouse click
myLayer.on(‘click’,function(e){
     e.layer.openPopup();
}); 
In my next post, I will explain how you can draw geographic areas inside map using Mapbox. Please provide your feedback. Thanks.

Written by

Related Posts

Salesforce Cancels the “Permissions in Profiles” Retirement: What It Means for Admins and Architects

Salesforce Cancels the “Permissions in Profiles” Retirement: What It Means for Admins and Architects

For the last few years, Salesforce administrators, architects, and security teams have been preparing for a major platform change: the retirement of permissions managed directly through Profiles. Salesforce had previously announced plans to move organizations toward a Permission Set–led security model, with enforcement expected to begin around the Spring ’26 timeframe.

read more...

0 Comments

Leave a Reply