Map View for doctypes with a geolocation fied

For Doctypes with a Geolocation field, a map view option would be available alongside other view options. If multiple geo fields are available, the user can choose which field to be displayed. If geo field value is updated, a dot moves on the map though sockets

This clearly exists for the “Location” doctype under the “Assets” module, but it’s not clear how to enable this for other/custom doctypes. Any clues?

Nevermind, just found it:

Map: {

                condition: this.list_view.settings.get_coords_method ||

                    (this.list_view.meta.fields.find(i => i.fieldname === "latitude") &&

                    this.list_view.meta.fields.find(i => i.fieldname === "longitude")) ||

                    (this.list_view.meta.fields.find(i => i.fieldname === 'location' && i.fieldtype == 'Geolocation')),

                action: () => this.set_route("map")


Clearly, the doctype needs a float “latitude” field, a float “longitude” field, and a Geolocation “location” field to enable this.

1 Like

Can you share a screen shot?

Sure. Here are the required fields in the doctype:

Which automatically activate a “Map” view on the list:

Which renders all of your entries on a map based on their location: