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
Robert Lange 6Robert Lange 6 

Map to show property location LWC

I have an org with a custom object call Property.  I wish to put a lwc map on the Property record page that shows the location of the Property on the map.  Haven't quite been able to find what I'm looking for.
ANUTEJANUTEJ (Salesforce Developers) 
Hi Robert,

I found the documentation where in it showed a component which shows location that is put in the js file on the map here according to your scenario you can put the property lication so that it can be used in record page.


I hope this helps and in case if this came in handy can you please mark this as best answer so that it can be used by others in the future.

There is already a component available lightning-map, which you can refer
import { LightningElement } from 'lwc';

export default class LightningExampleMapSingleMarker extends LightningElement {
    mapMarkers = [
            location: { //just pass property location here
                Street: '1600 Pennsylvania Ave NW',
                City: 'Washington',
                State: 'DC',

            title: 'The White House',
                'Landmark, historic home & office of the United States president, with tours for visitors.',

    <div class="slds-m-around_medium">
        <h1 class="slds-text-heading_small">Single Marker</h1>
        <p class="slds-text-body_regular">A single marker is displayed on the map. Map is centered on that marker and zoom is calculated automatically.</p>

I have created similar component using lightning:map which you can refer

If this answer helps you, please mark it as accepted.

Tushar Sharma
Robert Lange 6Robert Lange 6
Thank you Tushar.  The code you wrote above seems like something that will work if the Property address is static.  However, I am looking to set this up so that whatever Property object you pull up (222 State St., 333 Hudson St., etc.), it will indicate that particular property on the map.  I tried using your code on your web site under "Iterate Map in Lightning Web Component," but haven't had luck with that.  For one thing, when I wrote the LwcMapIterationController class in IntelliJ, it said that the controller class was never used.