The Address Resolution Service of Google map API is free of charge currently. You can convert the detailed address to the longitude and latitude.
The test HTML file is as follows:
<!DOCTYPE html>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var geocoder;
function initialize() {
geocoder = new google.maps.Geocoder();
}
function codeAddress() {
var address = document.getElementById("address").value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
alert(results[0].geometry.location);
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
</script>
<body onload="initialize()">
<div>
<input id="address" type="textbox" value="Sydney, NSW">
<input type="button" value="Geocode" onclick="codeAddress()">
</div>
</body>
However, this relies on the support of Google's online service interfaces. If Google leaves the Chinese market one day or there are other reasons that it will no longer open these service interfaces, it will be impossible.
In addition, Google restricts the speed and quantity of the function. The following is a description on Google:
There are limits on the use of the Google Geocoding API, that is, 2,500 geographic location query requests per day. (Google Maps API Premier users can execute a maximum of 100,000 requests per day .) This restriction is enforced to prevent abuse and/or reuse of the Google Geocoding API. This restriction may be changed in the future without further notice. In addition, we have set a request rate limit to prevent misuse of this service. If you exceed the 24-hour limit or abuse this service, Google Geocoding API may suspend your service. If you ignore this restriction, your access to Google Geocoding API will be blocked.
I tried to extract the batch address information from the backend and use the for loop for batch resolution. I found that at most 11 addresses were parsed, but none of the other addresses were parsed. Therefore, it is no problem to parse a single address when using it. For batch parsing ......