You need to sign in to do that
Don't have an account?
Rajiv
Google Map Lighting help needed
Hey Guys,
I am trying to implement google map using lighting. I really don't have much idea about lighting.
My requirement is to show all nearby accounts on google map.
Apex Class
public class accController {
@AuraEnabled
public static List<Account> getAccounts() {
return [select id, Account.BillingStreet, Account.BillingPostalCode, Account.BillingCity,sandbox__Geolocation__Longitude__s,sandbox__Geolocation__Latitude__s, Account.BillingState, Account.BillingCountry from Account where sandbox__Geolocation__Latitude__s != null];
}
}
Component
<aura:component implements="force:appHostable" controller="accController">
<ltng:require styles="/resource/leaflet/leaflet.css" />
<ltng:require scripts="/resource/leaflet/leaflet.js"
afterScriptsLoaded="{!c.jsLoaded}" />
<div class="map" id="map"></div>
</aura:component>
Controller
({
jsLoaded: function(component, event, helper) {
debugger;
var accs = component.get("c.getAccounts");
debugger;
accs.setParams({
"sandbox__Geolocation__Longitude__s": component.get("v.sandbox__Geolocation__Longitude__s")
});
debugger;
setTimeout(function() {
/*Not Working-- this line */
// var map = L.map('map', {zoomControl: false}).setView([sandbox__Geolocation__Longitude__s,sandbox__Geolocation__Latitude__s], 14);
var map = L.map('map', {zoomControl: false}).setView([25.509637,71.091645], 14);
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',
{
attribution: 'Tiles © Esri'
}).addTo(map);
// Add marker
L.marker([sandbox__Geolocation__Longitude__s,sandbox__Geolocation__Latitude__s]).addTo(map)
.bindPopup('Simplion Technologies Pvt Ltd');
});
}
})
The problem I am facing is to get dynamic longitude and latitude values from account object. As you can see I have commented out the line.
If I hardcode the longitude (i.e. 25.509637) and latitude (i.e. 71.091645) values then it works fine for me.
So I want to make this dynamic. So that it takes automatically longitude and latitude value from the account records.
If anyone can help me on this or give some ideas. It will be really helpful.
I am trying to implement google map using lighting. I really don't have much idea about lighting.
My requirement is to show all nearby accounts on google map.
Apex Class
public class accController {
@AuraEnabled
public static List<Account> getAccounts() {
return [select id, Account.BillingStreet, Account.BillingPostalCode, Account.BillingCity,sandbox__Geolocation__Longitude__s,sandbox__Geolocation__Latitude__s, Account.BillingState, Account.BillingCountry from Account where sandbox__Geolocation__Latitude__s != null];
}
}
Component
<aura:component implements="force:appHostable" controller="accController">
<ltng:require styles="/resource/leaflet/leaflet.css" />
<ltng:require scripts="/resource/leaflet/leaflet.js"
afterScriptsLoaded="{!c.jsLoaded}" />
<div class="map" id="map"></div>
</aura:component>
Controller
({
jsLoaded: function(component, event, helper) {
debugger;
var accs = component.get("c.getAccounts");
debugger;
accs.setParams({
"sandbox__Geolocation__Longitude__s": component.get("v.sandbox__Geolocation__Longitude__s")
});
debugger;
setTimeout(function() {
/*Not Working-- this line */
// var map = L.map('map', {zoomControl: false}).setView([sandbox__Geolocation__Longitude__s,sandbox__Geolocation__Latitude__s], 14);
var map = L.map('map', {zoomControl: false}).setView([25.509637,71.091645], 14);
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',
{
attribution: 'Tiles © Esri'
}).addTo(map);
// Add marker
L.marker([sandbox__Geolocation__Longitude__s,sandbox__Geolocation__Latitude__s]).addTo(map)
.bindPopup('Simplion Technologies Pvt Ltd');
});
}
})
The problem I am facing is to get dynamic longitude and latitude values from account object. As you can see I have commented out the line.
If I hardcode the longitude (i.e. 25.509637) and latitude (i.e. 71.091645) values then it works fine for me.
So I want to make this dynamic. So that it takes automatically longitude and latitude value from the account records.
If anyone can help me on this or give some ideas. It will be really helpful.
http://ccoenraets.github.io/getting-started-lightning-components/