How to get GPS location?
How to get GPS location?
Greeting,
How can I save GPS location when I press Add/Submit in entity.
Purpose; I would like to save device location for security purposes whenever a record is added.
How can I save GPS location when I press Add/Submit in entity.
Purpose; I would like to save device location for security purposes whenever a record is added.
- support
- Site Admin
- Posts: 6147
- Joined: 19 Oct 2014, 18:22
- Name: Sergey Kharchishin
- Location: Russia, Evpatoriya
Re: How to get GPS location?
There is no feature for this.
-
- Posts: 121
- Joined: 24 Mar 2020, 08:57
- Name: Spencer Crocker
- Location: Corby, UK
- Company Name: Unicloud
- Contact:
Re: How to get GPS location?
You could try the following;
Create a field of the type Map and note the ID of the field. Add the following code to your entities Form Configuration >> Add Javascript >> Javascript in form.
You will probably be prompted to allow the location and once that is done it should show the location on the map every time the form is edited.
Create a field of the type Map and note the ID of the field. Add the following code to your entities Form Configuration >> Add Javascript >> Javascript in form.
Code: Select all
let lat = '37.422176';
let long = '-122.084721';
let text = 'Google Maps Headquarters';
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(updateMap);
} else {
console.log( "Geolocation is not supported by this browser.");
}
function updateMap( position ) {
lat = position.coords.latitude;
long = position.coords.longitude;
text = 'I woz here';
//replace 1963 with the ID of your own map field
$('#fields_1963').val('[map]' + lat + ',' + long + '(' + text + ')[/map]');
}
Re: How to get GPS location?
Thank you buddy, this code is working, thank you again.
1. How can get the Lat/Long value in text box.
1. How can get the Lat/Long value in text box.
-
- Posts: 121
- Joined: 24 Mar 2020, 08:57
- Name: Spencer Crocker
- Location: Corby, UK
- Company Name: Unicloud
- Contact:
Re: How to get GPS location?
Change the field to be an input field instead of a map and then lose the map markup tags.
So you could replace
with
So you could replace
Code: Select all
$('#fields_1963').val('[map]' + lat + ',' + long + '(' + text + ')[/map]');
Code: Select all
$('#fields_1963').val(lat + ',' + long);
Re: How to get GPS location?
I really like this ... great information !
Using the location coordinates we could make much more use of this. Here are my thoughts:
In an earlier post, I have asked about the possibility to get weather information from third party providers, i.e., Openweathermap. There are a number of free/paid services. I am interested in API
http://history.openweathermap.org/data/ ... ty?q={city ID},{country code}&type=hour&start={start}&end={end}&appid={API key}
You can look this up on there homepage. A key needs to be generated and you need to implement it somehow into your app.
There are other apps available from Openweathermap (like forecast weather, ...).
I would like to use the history to retrieve temperature, rain, snow, cloudy, and other conditions for use in daily construction records. Site managers need to generate such a report every day. Next to a number of other pieces of information they have to take notes of weather conditions. This could be automated when that information taken from Openweathermap to Rukovotel. The API is key-based. In Javascript in forms one could invoke the weather API, get all the required information, and generate the necessary information. I just don't about detailed go-abouts.
I would truly appreciate information on this!
Thank you in advance for your input!
Best regards, Pepe
Using the location coordinates we could make much more use of this. Here are my thoughts:
In an earlier post, I have asked about the possibility to get weather information from third party providers, i.e., Openweathermap. There are a number of free/paid services. I am interested in API
http://history.openweathermap.org/data/ ... ty?q={city ID},{country code}&type=hour&start={start}&end={end}&appid={API key}
You can look this up on there homepage. A key needs to be generated and you need to implement it somehow into your app.
There are other apps available from Openweathermap (like forecast weather, ...).
I would like to use the history to retrieve temperature, rain, snow, cloudy, and other conditions for use in daily construction records. Site managers need to generate such a report every day. Next to a number of other pieces of information they have to take notes of weather conditions. This could be automated when that information taken from Openweathermap to Rukovotel. The API is key-based. In Javascript in forms one could invoke the weather API, get all the required information, and generate the necessary information. I just don't about detailed go-abouts.
I would truly appreciate information on this!
Thank you in advance for your input!
Best regards, Pepe
Re: How to get GPS location?
Awesome Code, Thank you buddy. It's working.
antevasin wrote: ↑22 Oct 2020, 23:53 Change the field to be an input field instead of a map and then lose the map markup tags.
So you could replacewithCode: Select all
$('#fields_1963').val('[map]' + lat + ',' + long + '(' + text + ')[/map]');
Code: Select all
$('#fields_1963').val(lat + ',' + long);
Re: How to get GPS location?
Thank you for your post, it helped.
Re: How to get GPS location?
Hello!
I thought the solution was excellent.
I would like to know if there is a possibility to register the GPS position, but instead of registering when adding a new register, register when clicking on the "signing" button.
Thanks!
I thought the solution was excellent.
I would like to know if there is a possibility to register the GPS position, but instead of registering when adding a new register, register when clicking on the "signing" button.
Thanks!
skprasad wrote: ↑24 Oct 2020, 00:30 Awesome Code, Thank you buddy. It's working.
antevasin wrote: ↑22 Oct 2020, 23:53 Change the field to be an input field instead of a map and then lose the map markup tags.
So you could replacewithCode: Select all
$('#fields_1963').val('[map]' + lat + ',' + long + '(' + text + ')[/map]');
Code: Select all
$('#fields_1963').val(lat + ',' + long);
Re: How to get GPS location?
WOW, thank you so much for sharing this, it works perfectlyantevasin wrote: ↑22 Oct 2020, 23:53 Change the field to be an input field instead of a map and then lose the map markup tags.
So you could replacewithCode: Select all
$('#fields_1963').val('[map]' + lat + ',' + long + '(' + text + ')[/map]');
Code: Select all
$('#fields_1963').val(lat + ',' + long);