Hi @revant_one
Trust you’re doing great and thanks again for all the great work in the community. This no longer works as stated above in V12. Could you pls suggest if there’s a way to restore this behaviour for V12 instances?
Kind regards,
Hi @revant_one
Trust you’re doing great and thanks again for all the great work in the community. This no longer works as stated above in V12. Could you pls suggest if there’s a way to restore this behaviour for V12 instances?
Kind regards,
I am not able to fix the issue with the plugin
same thing happening here https://www.openstreetmap.org/ for me (from pc chromium)
It is working on my android chrome 80.0.3987.99
it is working on my laptop chrome 80.0.3987.106
Hi @revant_one
But it works fine in V11! Tested it again… it defaults to current location but in V12 you have to click on the location button. This is strange
Is there any way to automatically trigger the location button with a custom script (preferably client-side)?
Kind regards,
try if this works
frm.get_field("geolocation_fieldname").locate_control.start()
Hi @revant_one
This seems to work just fine using the ‘onload_post_render’ trigger. Thanks a great deal!
Kind regards,
On the contrary, seems the fix you pushed just shipped with last Thursday’s release (even though it wasn’t mentioned in the release notes). It appears the map layers are now working again… at least on some platforms
Cheers
Hi @revant_one
Is there any standard way to get nearest address from the geolocation field? I would really appreciate any pointers or suggestions
Thanks
Nothing that I’ve used personally.
Search for “LeafletJS find nearest”
Hi @revant_one
Based on your suggestion I found the following leaflet plugin:
Would however need assistance in getting this implemented. How do I go about it? What I’d like to achieve is to have the address automatically populated in a field similar to how the Latitude and Longitude get automatically populated in the Location DocType
Thanks
Resources if anyone is interested to add it to core
Documentation : How To Improve A Standard Control
Check how other docfields are made:
Data field is common parent of most fields
Then check how geolocation field is made. You can add many plugins.
Custom app alternatives is:
Once the field is loaded on form it is an object of the control class.
You can hack things up on properties of the field object in your custom script. Get the object with frm.get_field() you get the map, plugins and other functions here.
Hello @revant_one, thanks for the work.
It works well in the desk side, but it seems that this geolocation field type cannot be seem in a web form. When I create a new field in the web form, I see the geoposition field from the doctype, but the is no “Geolocation” in the list of field type.
Is there any standard way to show this field in web form?
Cheers
@revant_one I used your piece of code (link)
I’m running into a similar issue. I’m trying to read data from form field then change the market on the map. This is my code, but it doesn’t move the market.
frappe.ui.form.on("Shipment", "vessel_location", function(frm) {
var imo = cur_frm.doc.imo_number_vessel;
var latitude= 50.454100;
var longitude= -2.370833;
cur_frm.get_field("location").locate_control._marker._latlng.lat = latitude;
cur_frm.get_field("location").locate_control._marker._latlng.lng = longitude;
});
Thank you much for the help
hi @revant_one
Some leaflet plugins can be used via cdn by adding the relevant files in the html header. Is there any way to do this in an ERPNext doctype ?
Kindly advise
Thanks
Hi @revant_one
Any suggestions pls ? Also, if the html header approach isn’t feasible, could you pls give some guidance on how to add the plugin via custom script? If I can get a better idea how to add a plugin, I think I could figure the rest out
Thanks
I don’t know. I’ve not tried.
Hi @revant_one, I was actually referring to your statement above… I thought it inferred there was a known way of achieving this
Thanks anyway
That is how current plugins are added.
Oh, I see what you mean. Thanks a lot for the clarification
Cheers