MCPcopy Create free account
hub / github.com/IQEngine/IQEngine / process_geolocation

Function process_geolocation

api/database/metadata_repo.py:132–157  ·  view source on GitHub ↗
(target: str, geolocation: str)

Source from the content-addressed store, hash-verified

130
131
132async def process_geolocation(target: str, geolocation: str):
133 try:
134 geo_long_str, geo_lat_str, geo_radius_str = geolocation.split(",")
135 geo_long = float(geo_long_str)
136 geo_lat = float(geo_lat_str)
137 geo_radius = float(geo_radius_str)
138 target_field = ""
139 if target == "captures":
140 target_field = "captures.core:geolocation"
141 if target == "annotations":
142 target_field = "annotations.core:geolocation"
143
144 return {
145 target_field: {
146 "$near": {
147 "$geometry": {
148 "type": "Point",
149 "coordinates": [geo_long, geo_lat],
150 },
151 "$maxDistance": geo_radius,
152 }
153 }
154 }
155
156 except Exception:
157 raise InvalidGeolocationFormat()
158
159
160async def query_metadata(

Callers 1

query_metadataFunction · 0.85

Calls 1

Tested by

no test coverage detected