优化经纬度获取

This commit is contained in:
沈健
2021-09-09 16:16:38 +08:00
parent 35ab32f65e
commit 613cd0db9b
2 changed files with 10 additions and 1 deletions
@@ -1,5 +1,6 @@
package com.fangjia.script.temp.shenjian.poi
import com.fangjia.core.util.CosineSimilarAlgorithm
import com.fangjia.script.statistics.poi.AmapPoi
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
import com.fangjia.script.util.MongoUtils
@@ -43,6 +44,11 @@ class CommitteeLatLng {
List<AmapPoi> amapPoi = GaoDeUtils.searchPoi(city, address, obj.area_name, "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, "")
}
poi = amapPoi[0]
String[] locations = poi.location.split(",")
def lng = Double.valueOf(locations[0])
def lat = Double.valueOf(locations[1])
@@ -9,6 +9,7 @@ import com.fangjia.script.statistics.poi.AmapPoi
import com.fangjia.script.util.GeoHelper
import com.fangjia.script.util.HttpRequestUtil
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
import org.apache.commons.lang.StringUtils
import java.util.concurrent.atomic.AtomicInteger
@@ -175,7 +176,9 @@ class GaoDeUtils {
params.keywords = keywords
params.city = city
params.region = region
params.types = typecodes
if (StringUtils.isNotBlank(typecodes)) {
params.types = typecodes
}
params.put("extensions", "all")
params.put("citylimit","true")
params.put("offset","20")