优化经纬度获取
This commit is contained in:
+6
@@ -1,5 +1,6 @@
|
|||||||
package com.fangjia.script.temp.shenjian.poi
|
package com.fangjia.script.temp.shenjian.poi
|
||||||
|
|
||||||
|
import com.fangjia.core.util.CosineSimilarAlgorithm
|
||||||
import com.fangjia.script.statistics.poi.AmapPoi
|
import com.fangjia.script.statistics.poi.AmapPoi
|
||||||
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
|
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
|
||||||
import com.fangjia.script.util.MongoUtils
|
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")
|
List<AmapPoi> amapPoi = GaoDeUtils.searchPoi(city, address, obj.area_name, "130106|130105|130104")
|
||||||
if (amapPoi && amapPoi.size() > 0) {
|
if (amapPoi && amapPoi.size() > 0) {
|
||||||
def poi = amapPoi[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(",")
|
String[] locations = poi.location.split(",")
|
||||||
def lng = Double.valueOf(locations[0])
|
def lng = Double.valueOf(locations[0])
|
||||||
def lat = Double.valueOf(locations[1])
|
def lat = Double.valueOf(locations[1])
|
||||||
|
|||||||
+4
-1
@@ -9,6 +9,7 @@ import com.fangjia.script.statistics.poi.AmapPoi
|
|||||||
import com.fangjia.script.util.GeoHelper
|
import com.fangjia.script.util.GeoHelper
|
||||||
import com.fangjia.script.util.HttpRequestUtil
|
import com.fangjia.script.util.HttpRequestUtil
|
||||||
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
|
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
|
||||||
|
import org.apache.commons.lang.StringUtils
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
|
||||||
@@ -175,7 +176,9 @@ class GaoDeUtils {
|
|||||||
params.keywords = keywords
|
params.keywords = keywords
|
||||||
params.city = city
|
params.city = city
|
||||||
params.region = region
|
params.region = region
|
||||||
params.types = typecodes
|
if (StringUtils.isNotBlank(typecodes)) {
|
||||||
|
params.types = typecodes
|
||||||
|
}
|
||||||
params.put("extensions", "all")
|
params.put("extensions", "all")
|
||||||
params.put("citylimit","true")
|
params.put("citylimit","true")
|
||||||
params.put("offset","20")
|
params.put("offset","20")
|
||||||
|
|||||||
Reference in New Issue
Block a user