I am trying to build a custom app with Geolocation, I have trouble using the control. I find no documentation about the Geolocation control and what I do find is not helpful.
First my problem, I want to show a location on the Map in my DocType, I have lat, long
Below is the code I have
const location = `{"type": "FeatureCollection", "features": [{"type": "Feature","properties": {},"geometry": {"type": "Point","coordinates": ${frm.doc.latlong} }}]}`;
frm.set_value("location", location);
var ctrl = frm.get_field("location").locate_control;
if(ctrl) //locate control is null in reload,
ctrl.start(); //This move to my current location and not to the location I set
What I want to do
- Show a pin the map where I set the latlong value, it shows Mumbai when it loads even after I set the value (See above)
- Zoom it into the street level.
- Center the point on form reload.
- Freeze it and not allow anyone to add additional pins.
Additional questions.
Can I replace open maps implementation with google maps? Is there any example of the implementation?