# coding=utf-8 __author__ = 'wygdove' __time__ = '2018/5/31 11:46' from doveutils import dmongo coll = dmongo.get_coll('10.1.234.150', '37017', 'dss001', 'dss001user', 'dss001pwd', 'gisfs') coordinates = [[[117.338301, 39.176059], [117.395218, 39.161289], [117.41304, 39.199772], [117.338301, 39.176059]]] query = { "geom": { "$geoWithin": { "$geometry": { "type": "Polygon", "coordinates": coordinates } } } } print dmongo.find_many(coll, query)
# coding=utf-8 __author__ = 'wygdove' __time__ = '2018/10/16 18:32' from doveutils import dmongo from bson.objectid import ObjectId coll = dmongo.get_coll('10.19.10.79', '38017', 'dss001', 'dss001user', 'dss001pwd', 'gisfs') type = "GIS-BUSICIRCLE" query = {"tYPE": type} # res=dmongo.find_one(coll,{"tYPE":type}) # res=dmongo.find_many(coll,{"tYPE":type}) # print res # res=dmongo.delete_many(coll,query) # if res!=None:print json.loads(res).__len__() res = dmongo.find_many(coll, query) print res # id="5bc5c3e31bc137e93e2fe524" # print coll.delete_one({"_id":ObjectId(id)}) # res=dmongo.find_withid(coll,id) # print res
coordinates = latlngs["geom"]["coordinates"] # query={"geom":{"$geoWithin":{"$geometry":{"type":"Polygon","coordinates":coordinates}}},"tYPE":"CALCULATE-PERIPHERAL-CHANNEL"} query = { "geom": { "$geoWithin": { "$geometry": { "type": "Polygon", "coordinates": coordinates } } }, "tYPE": "CALCULATE-CHANNEL" } # arealatlngs=dmongo.find_many(coll,query) try: arealatlngs = dmongo.find_many(coll, query) except: print json.dumps(latlngs) continue arealatlngs = json.loads(arealatlngs) print arealatlngs.__len__() for data in arealatlngs: v_id = data["bUSIID"] data["rEGGRIDCODE"] = ins[1] data["rEGCOUNTYCODE"] = ins[3] v_gislatlngs = json.dumps(data) sql = "update gis_area_latlng_detail set city_code='" + ins[ 5] + "',city_name='" + ins[6] + "',county_code='" + ins[ 3] + "',county_name='" + ins[4] + "',area_code='" + ins[ 1] + "',area_name='" + ins[ 2] + "',gislatlngs='" + v_gislatlngs + "' where id='" + str(
# coding=utf-8 __author__ = 'wygdove' __time__ = '2018/6/25 14:33' from doveutils import dmongo import json coll = dmongo.get_coll('10.1.234.150', '37017', 'dss001', 'dss001user', 'dss001pwd', 'gisfs') mongocnt = 0 # res=dmongo.find_one(coll,{"tYPE":"CALCULATE-PERIPHERAL_CHANNEL"}) res = dmongo.find_many(coll, {"tYPE": "CALCULATE-PERIPHERAL_CHANNEL"}) # res=dmongo.delete_many(coll,{"tYPE":"CALCULATE-PERIPHERAL_CHANNEL"}) # print res if res != None: mongocnt = json.loads(res).__len__() print mongocnt print '\n\n\n'
import cx_Oracle import json import os os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8' # connurl='tj_chan_gis/[email protected]:8899/cmchl' # dbconn=cx_Oracle.connect(connurl) # crusor=dbconn.cursor() # # # sql='''insert into gis_area_latlng_detail values('2','typekey','source','100100','DX1001','测试渠道','0022','天津市','B2','南开红桥分公司','WGB2001','测试网格','101.101,102.102','{"name":"测试","msg":"啦啦啦"}','')''' # res=crusor.execute(sql) # dbconn.commit() # print res # # sql='select * from gis_area_latlng_detail' # rs=crusor.execute(sql) # print rs.fetchall() # # crusor.close() # dbconn.close() coll = dmongo.get_coll('10.1.234.150', '37017', 'dss001', 'dss001user', 'dss001pwd', 'gisfs') # res=dmongo.find_one(coll,{"tYPE":"CALCULATE-PERIPHERAL-CHANNEL"}) # res=dmongo.delete_many(coll,{"tYPE":"CALCULATE-CHANNEL"}) # print res res = dmongo.find_many(coll, {"tYPE": "CALCULATE-CHANNEL"}) print json.loads(res).__len__() # print res