This commit is contained in:
Tyrel Souza 2023-08-18 01:20:42 -04:00
parent cfc128ed70
commit 2329d789e9
No known key found for this signature in database
GPG Key ID: F3614B02ACBE438E
2 changed files with 60 additions and 0 deletions

45
mongo/pipeline1.py Normal file
View File

@ -0,0 +1,45 @@
pipeline = [
{
'$addFields': {
'location': {
'type': 'Point',
'coordinates': [
{
'$toDouble': '$latdec'
}, {
'$toDouble': '$londec'
}
]
}
}
}, {
'$match': {
'location': {
'$geoWithin': {
'$centerSphere': [
[
35.9, -78.9
], 100 / 3963.2
]
}
}
}
}, {
'$project': {
'_id': 1,
'recrd': 1,
'vesslterms': 1,
'feature_type': 1,
'chart': 1,
'latdec': 1,
'londec': 1,
'gp_quality': 1,
'depth': 1,
'sounding_type': 1,
'history': 1,
'quasou': 1,
'watlev': 1,
'coordinates': 1
}
}
]

15
mongo/pipeline2.py Normal file
View File

@ -0,0 +1,15 @@
pipeline = [
{
'$geoNear': {
'near': {
'type': 'Point',
'coordinates': [
-78.9, 35.9
]
},
'distanceField': 'distance',
'maxDistance': 160934.4,
'spherical': True
}
}
]