Geolocation field

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”: [
106.6964048,
10.7511488]
}
}
]
}
)
}
data = json.dumps(dd)
r = requests.post(url, data, auth=(‘59aa898bdfdf713’, ‘1365c7955faa000’))
print(r)

Example command:

curl -Ssl -X POST https://erp.example.com/api/resource/ToDo \
    -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

3 Likes

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

Cheers

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

Cheers

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!

Hello,

I have added above code my_location, but its not working, Could you please guide me where to add the above code and save in DB

Regards,
Sathish

The code shared as a cross linked post is using Google maps. Continue the conversation on that thread. This thread is for the geolocation field that uses leafletjs. It’ll cause confusion for readers.

2 Likes

Hi @revant_one i got error on geoLocation in my erpnext
can u help me?
it makes entirely docType error

Unable to handle success response {message: Array(0)}
request.js:251 ReferenceError: L is not defined
    at _a12.bind_leaflet_map (geolocation.js:71)
    at _a12.make_map (geolocation.js:30)
    at _a12.make_wrapper (geolocation.js:21)
    at _a12.make (base_control.js:16)
    at _a12.make (base_input.js:5)
    at new BaseControl (base_control.js:4)
    at new _a (base_input.js:1)
    at new _a2 (data.js:3)
    at new _a12 (geolocation.js:3)
    at Object.frappe.ui.form.make_control (control.js:46)

currently using erpnext v13.5.2

hey @roquegv did you find a way to show Geolocation in Web form?