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
Nicole LaperouseNicole Laperouse 

Google map marker does not display in water

I am using a simple visualpage to display google map with the last known geo coordinates of our ships. 
My issue is that the google map Marker does not display in the water... only when the geoLocation is on land. Any thoughts? 
<apex:page standardController="Asset">
    <apex:variable value="{!Asset.Last_AIS_Reported_Location__Latitude__s}, {!Asset.Last_AIS_Reported_Location__Longitude__s}" var="address" />

    <apex:map width="500px"
                height="250px"
                mapType="roadmap"
                zoomLevel="7"
                center="{latitude:{!Asset.Last_AIS_Reported_Location__Latitude__s},longitude:{!Asset.Last_AIS_Reported_Location__Longitude__s}}">

        <apex:mapMarker title="{!address}"
                        position="{!address}">
                        
                <apex:mapInfoWindow >
                    <apex:outputText >{!address}</apex:outputText>
                </apex:mapInfoWindow> 

        </apex:mapMarker>

    </apex:map>
</apex:page>
AbhishekAbhishek (Salesforce Developers) 
Hi Nicole,

You can now access the address and geolocation compound fields in Apex using the new Address and Location classes. You could previously access only compound fields’ component fields in Apex. You can now query compound fields and their components using the new Address and Location class methods.

Declare a variable of type Address or Location first, then access the subfields on that variable. For example, you can retrieve the city, zip code, and state values on an address field.

>>>Account acct = [SELECT BillingAddress FROM account WHERE name='Acme' LIMIT 1]; Address addr = acct.BillingAddress; String acctCity = addr.city; String acctZipCode = addr.postalCode; String acctState = addr.state;

Or, you can retrieve the latitude and longitude values of a geolocation field.

>>>Account acct2 = [SELECT id, MyLocation__c FROM Account WHERE Name='Cloud Computing' LIMIT 1]; Location loc = acct2.MyLocation__c; Double lat = loc.latitude; Double lon = loc.longitude;

For your reference, you can check the below articles,

https://releasenotes.docs.salesforce.com/en-us/spring15/release-notes/rn_forcecom_general_geolocation_ga.htm

https://releasenotes.docs.salesforce.com/en-us/spring15/release-notes/rn_forcecom_general_maps.htm

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks.