Geolocation field

Hi @chabito79

Could you pls give some more insight on how you achieved this? How were you able to access the map’s HTML? Did you have to use a separate field other than the geolocation field itself?


I dont have the project’s code anymore…but I remember I ended up integrating google maps instead of leaflet.

I used an HTML field and injected the map on it (following the standard way)… here’s a nice tutorial about it.


1 Like

Thanks a lot @chabito79

This was very helpful indeed


This is the code for showing popup on the marker. The below code can be included on refresh(frm) trigger.

var map = frm.get_field("geolocation_field").map;
var latlng = L.latLng({'lat':<value>, 'lng': <value>});
var marker = L.marker(latlng);
map.flyTo(latlng, map.getZoom());

that great

I want to use restapi to send geojson to erpnext. but I have a trouble, could you check this?
Thank you.

Check the json

Nested “features” is array of objects

1 Like

Thank for your reply, I tried fixed follow your suggestion but it still not work, the map is default, dont’ have a point here

dd = {
“name1”: “Hcm096”,
“odo”: 200,
“geolocation”: json.dumps(
{“type”: “FeatureCollection”,
“features”: [{
“type”: “Feature”,
“geometry”: {
“type”: “Point”,
“coordinates”: [
data = json.dumps(dd)
r =, data, auth=(‘59aa898bdfdf713’, ‘1365c7955faa000’))

Example command:

curl -Ssl -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: token $api_key:$api_secret" \
    -H "Accept: application/json" \
    -d '{
        "description": "ToDo Mumbai",
        "todo_location": "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[72.867851,19.088689]}}]}"

todo_location is a custom Geolocation field added on ToDo


Hi all

Anyone got this error/warning on mobile app-android?

Geolocation error: application does not have sufficient geolocation permissions

If so, how did you resolve it?

Hi @glz

You’ll need to recompile the app yourself and include the Cordova Geolocation Plugin


Mind explaining how to go about this please?

The ERPNext Android app is built with Cordova. You’ll need to research on how to build a Cordova app and follow the steps in the ERPNext Mobile Github repo at GitHub - frappe/mobile: Mobile App for Frappe built on Flutter


This is in order. Was just wondering whether this means, I will end up with a different app from the mainstream?

Yes :pensive:

Ok. Thank you. Will do so.

Hello, I tried the first code on this post and the results are not 2 circles on the map as shown in the diagram. There’s nothing happening.

I want to make a system where I enter coordinates (longitude and latitude) then points are created and joined on the map. How can I go about it?

@Duncan_Nkhata @adam26d

Thanks a lot @mujeerhashmi

Can someone explain how can I make a Geolocation based Attendance Employee check-in system?

  1. As the Employee goes to the Employee check-in its current location should be fetched and when he saves it, it should store the current location.
  2. The Employee does not have the permission to change the location, no even draw tools provided by geolocation.

I tried to make some changes in geolocation.js file frappe.
I was able to hide all the control options, but it was not storing the current location.

Thanks in advance!

Hope It helps someone!