In the order function, how to obtain the latitude and longitude of the merchant?

to make a Mini Program shopping order, you need to call the API to obtain the merchant"s information, such as latitude and longitude. I want to know whether the latitude and longitude fields in the backstage merchant information are saved in the database, whether to fill in them manually or to obtain them automatically with Baidu map.

Php
Mar.02,2021

both Baidu and Gaode have an api to obtain users' longitude and latitude. Including h5 is also a way to obtain latitude and longitude

<script>
var x=document.getElementById("demo");
function getLocation()
  {
  if (navigator.geolocation)
    {
    navigator.geolocation.getCurrentPosition(showPosition);
    }
  else{x.innerHTML="Geolocation is not supported by this browser.";}
  }
function showPosition(position)
  {
  x.innerHTML="Latitude: " + position.coords.latitude +
  "<br />Longitude: " + position.coords.longitude;
  }
</script>

Mini Program document


it is recommended that users select Baidu map in the background and save it in the database.
but pay attention to a coordinate system conversion


convert to latitude and longitude according to the urban area https://blog.csdn.net/evan_ch.

.
Menu