Uploading imagery to old MongoDB API manually #242
spwoodcock
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
1. Download Source
curl -L "https://drive.usercontent.google.com/download?id=FILE_ID&export=download&confirm=t" -o freetown.tif2. Convert to COG
3. Upload to S3
4. Extract Metadata
5. Get User ID
userstable6. Insert into MongoDB
metastableThis is the only relevant collection we need. The
imagesanduploadscollections are simply used to track upload and processing progress.user = 5eb37b4700afed00060e6dfe
image = 690585b76415e43597ffd7ea
meta uuid = 690585b76415e43597ffd7eb
Insert as a JSON!
{ "_id": { "$oid": "690588216415e43597ffd157" }, "uuid": "https://oin-hotosm-temp.s3.us-east-1.amazonaws.com/690585b76415e43597ffd7ea/0/690585b76415e43597ffd7eb.tif", "meta_uri": "https://oin-hotosm-temp.s3.us-east-1.amazonaws.com/690585b76415e43597ffd7ea/0/690585b76415e43597ffd7eb_meta.json", "user": { "$oid": "5eb37b4700afed00060e6dfe" }, "title": "Freetown Urban with Sensitive Areas Blurred", "projection": "\nPROJCRS[\"WGS 84 / UTM zone 28N\",\n BASEGEOGCRS[\"WGS 84\",\n DATUM[\"World Geodetic System 1984\",\n ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n LENGTHUNIT[\"metre\",1]]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n ID[\"EPSG\",4326]],\n CONVERSION[\"UTM zone 28N\",\n METHOD[\"Transverse Mercator\",\n ID[\"EPSG\",9807]],\n PARAMETER[\"Latitude of natural origin\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8801]],\n PARAMETER[\"Longitude of natural origin\",-15,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8802]],\n PARAMETER[\"Scale factor at natural origin\",0.9996,\n SCALEUNIT[\"unity\",1],\n ID[\"EPSG\",8805]],\n PARAMETER[\"False easting\",500000,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8806]],\n PARAMETER[\"False northing\",0,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8807]]],\n CS[Cartesian,2],\n AXIS[\"(E)\",east,\n ORDER[1],\n LENGTHUNIT[\"metre\",1]],\n AXIS[\"(N)\",north,\n ORDER[2],\n LENGTHUNIT[\"metre\",1]],\n USAGE[\n SCOPE[\"Navigation and medium accuracy spatial referencing.\"],\n AREA[\"Between 18°W and 12°W, northern hemisphere between equator and 84°N, onshore and offshore. Gambia. Greenland. Guinea. Guinea-Bissau. Iceland. Ireland - offshore Porcupine Basin. Mauritania. Morocco. Senegal. Sierra Leone. Western Sahara.\"],\n BBOX[0,-18,84,-12]],\n ID[\"EPSG\",32628]]", "bbox": [ { "$numberDouble": "-13.2991565" }, { "$numberDouble": "8.5004312" }, { "$numberDouble": "-13.1252206" }, { "$numberDouble": "8.3971738" } ], "footprint": "POLYGON ((-13.2991565 8.5004312, -13.2996055 8.3979653, -13.1252206 8.3971738, -13.1247257 8.49963, -13.2991565 8.5004312))", "gsd": { "$numberDouble": "0.0394" }, "file_size": { "$numberInt": "53193085" }, "acquisition_start": { "$date": { "$numberLong": "1761105600000" } }, "acquisition_end": { "$date": { "$numberLong": "1761109200000" } }, "platform": "uav", "provider": "DroneTM", "contact": "Ivan Gayton,ivan.gayton@hotosm.org", "geojson": { "type": "MultiPolygon", "coordinates": [ [ [ [ { "$numberDouble": "-13.2991565" }, { "$numberDouble": "8.5004312" } ], [ { "$numberDouble": "-13.2996055" }, { "$numberDouble": "8.3979653" } ], [ { "$numberDouble": "-13.1252206" }, { "$numberDouble": "8.3971738" } ], [ { "$numberDouble": "-13.1247257" }, { "$numberDouble": "8.49963" } ], [ { "$numberDouble": "-13.2991565" }, { "$numberDouble": "8.5004312" } ] ] ] ], "bbox": [ { "$numberDouble": "-13.299349" }, { "$numberDouble": "8.398019" }, { "$numberDouble": "-13.124724" }, { "$numberDouble": "8.500431" } ] }, "properties": { "license": "CC-BY 4.0", "sensor": "DJI Mini 4 Pro", "url": "s3://oin-hotosm-temp/690585b76415e43597ffd7ea/0/690585b76415e43597ffd7eb.tif", "filename": "690585b76415e43597ffd7eb.tif", "dimensions": [ { "$numberInt": "486906" }, { "$numberInt": "287291" } ], "bands": { "$numberInt": "3" }, "dtype": "uint8", "crs": "EPSG:32628", "colorinterp": [ "red", "green", "blue" ], "resolution": [ { "$numberDouble": "0.039447879950861" }, { "$numberDouble": "0.039447979351589" } ], "resolution_in_meters": { "$numberDouble": "0.03944787995086" }, "thumbnail": "https://oin-hotosm-temp.s3.us-east-1.amazonaws.com/690585b76415e43597ffd7ea/0/690585b76415e43597ffd7eb.png", "tms": "https://tiles.openaerialmap.org/690585b76415e43597ffd7ea/0/690585b76415e43597ffd7eb/{z}/{x}/{y}", "wmts": "https://tiles.openaerialmap.org/690585b76415e43597ffd7ea/0/690585b76415e43597ffd7eb/wmts", "tilejson": "https://tiles.openaerialmap.org/cog/tilejson.json?url=https%3A%2F%2Foin-hotosm-temp.s3.us-east-1.amazonaws.com%690585b76415e43597ffd7ea%2F0%690585b76415e43597ffd7eb.tif" }, "uploaded_at": { "$date": { "$numberLong": "1761970209234" } }, "__v": { "$numberInt": "0" } }Note
None of the other tables seem to be necessary.
I don't think the
uploadstable is needed either.6. Ensure the COG is present in the location specified in the Mongo metadata
7. Create a thumnail & upload to S3
All reactions