优化省直辖县级行政区划经纬度获取
This commit is contained in:
+10
-4
@@ -35,18 +35,24 @@ class CommitteeLatLng {
|
||||
@Override
|
||||
void run() {
|
||||
def city = obj.city_name
|
||||
def area = obj.area_name
|
||||
if (city == "市辖区") {
|
||||
city = obj.province_name
|
||||
} else if (city == "省直辖县级行政区划") {
|
||||
city = obj.area_name
|
||||
area = ""
|
||||
}
|
||||
def address = obj.province_name + city + obj.area_name + obj.street_name + obj.name;
|
||||
List<AmapPoi> amapPoi = GaoDeUtils.searchPoi(city, address, obj.area_name, "130106|130105|130104")
|
||||
if (obj.city_name != "省直辖县级行政区划") {
|
||||
return ;
|
||||
}
|
||||
def address = obj.province_name + city + area + obj.street_name + obj.name;
|
||||
|
||||
List<AmapPoi> amapPoi = GaoDeUtils.searchPoi(city, address, area, "130106|130105|130104")
|
||||
if (amapPoi && amapPoi.size() > 0) {
|
||||
def poi = amapPoi[0]
|
||||
double similarity = CosineSimilarAlgorithm.getSimilarity(poi.name, obj.name)
|
||||
if (similarity < 0.7) {
|
||||
amapPoi = GaoDeUtils.searchPoi(city, address, obj.area_name, "")
|
||||
amapPoi = GaoDeUtils.searchPoi(city, address, area, "")
|
||||
}
|
||||
poi = amapPoi[0]
|
||||
String[] locations = poi.location.split(",")
|
||||
@@ -55,7 +61,7 @@ class CommitteeLatLng {
|
||||
villagesConn.update(new BasicDBObject("_id", obj._id), new BasicDBObject('$set', new BasicDBObject("status_location", 0)
|
||||
.append("location", new BasicDBObject("lat", lat).append("lon", lng)).append("flag_location", "关键字搜索获取经纬度")))
|
||||
} else {
|
||||
amapPoi = GaoDeUtils.searchPoi(city, address, obj.area_name, "")
|
||||
amapPoi = GaoDeUtils.searchPoi(city, address, area, "")
|
||||
if (amapPoi && amapPoi.size() > 0) {
|
||||
def poi = amapPoi[0]
|
||||
String[] locations = poi.location.split(",")
|
||||
|
||||
Reference in New Issue
Block a user