新增小区geohash
This commit is contained in:
+4
-8
@@ -5,10 +5,6 @@ import com.fangjia.script.util.DbUtils
|
|||||||
import com.mongodb.BasicDBObject
|
import com.mongodb.BasicDBObject
|
||||||
import com.mongodb.DBObject
|
import com.mongodb.DBObject
|
||||||
|
|
||||||
import java.util.concurrent.CountDownLatch
|
|
||||||
import java.util.concurrent.ExecutorService
|
|
||||||
import java.util.concurrent.Executors
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小区geohash导出
|
* 小区geohash导出
|
||||||
*
|
*
|
||||||
@@ -18,10 +14,10 @@ import java.util.concurrent.Executors
|
|||||||
class SeaweedGeoHashExport {
|
class SeaweedGeoHashExport {
|
||||||
|
|
||||||
static void main(String[] args) {
|
static void main(String[] args) {
|
||||||
Set<String> set = new HashSet<>()
|
List<String> list = new ArrayList<>()
|
||||||
|
|
||||||
DBObject query = new BasicDBObject()
|
DBObject query = new BasicDBObject()
|
||||||
query.append("cat", "district").append("visible", 0)
|
query.append("cat", "district").append("visible", 0).append("city", "上海").append("region", "长宁")
|
||||||
|
|
||||||
DBObject filter = new BasicDBObject()
|
DBObject filter = new BasicDBObject()
|
||||||
filter.put("lng", 1)
|
filter.put("lng", 1)
|
||||||
@@ -31,12 +27,12 @@ class SeaweedGeoHashExport {
|
|||||||
if (obj.lng && obj.lat) {
|
if (obj.lng && obj.lat) {
|
||||||
def lon = obj.lng
|
def lon = obj.lng
|
||||||
def lat = obj.lat
|
def lat = obj.lat
|
||||||
set.add(SeaweedUtils.encodeByGeoHash(SeaweedUtils.formatLatLng(lon), SeaweedUtils.formatLatLng(lat),7))
|
list.add(SeaweedUtils.encodeByGeoHash(SeaweedUtils.formatLatLng(lon), SeaweedUtils.formatLatLng(lat),7))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def ret = []
|
def ret = []
|
||||||
ret << ['小区geohash']
|
ret << ['小区geohash']
|
||||||
for (String val : set) {
|
for (String val : list) {
|
||||||
ret << [val]
|
ret << [val]
|
||||||
}
|
}
|
||||||
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\基础建设\\geohash.xlsx", ret, "geohash");
|
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\基础建设\\geohash.xlsx", ret, "geohash");
|
||||||
|
|||||||
Reference in New Issue
Block a user