Place
Find places
Get a list of places.
const response = await geocore.Place.placeList({
name: "name",
area: {
north: 1,
south: 2,
west: 3,
east: 4,
};
tags: ["string"],
createdRange: {
start: "2025-01-01",
end: "2025-01-01",
}
updatedRange: {
start: "2025-01-01",
end: "2025-01-01",
},
createdBy: ["string"],
groupIds: ["string"],
semanticSearchText: "string",
isPublic: true,
});
Parameters
name type data type description name optional string Search by place name area[north] optional number Longitude of north west point area[south] optional number Latitude of north west point area[west] optional number Longitude of north east point area[east] optional number Latitude of north east point tags optional array<string> Search by place tags createdRange[start] optional date Search by createdAttimestampcreatedRange[end] optional date Search by createdAttimestampupdatedRange[start] optional date Search by modifiedAttimestampupdatedRange[end] optional date Search by modifiedAttimestampcreatedBy optional array<string> Search by creator of places groupIds optional array<string> Search by groups that places belong to semanticSearchText optional string Search place by semantic description isPublic optional boolean Search place by public status prefectures optional array<string> Search by prefecture of places districts optional array<string> Search by districts of places municipalities optional array<string> Search by municipalities of places page optional number Page ordinal number, default is 1 limit optional number Number of records per page, default is 20
Get a place
Create place
Create a new place.
// If you want to upload large video files, use the file upload API
const { data: { fileId, fileKey, parts }} = await geocore.File.generateMultipartUploadPresignedUrls({
fieldName: 'video',
fileName: 'fileName.mp4',
numberOfParts: 4,
});
// Upload using the presigned URLs in `parts` array...
// After uploading, call `completeMultipartUpload` API to get the uploaded file ID in Geocore system
const { data: { file: fileSave }} = await geocore.File.completeMultipartUpload({
fieldName: 'video',
fileKey,
fileId,
fileType: 'video/mp4',
parts: [{
PartNumber: 1,
ETag: 'string',
}]
});
const formData = new FormData();
formData.append('name', name);
formData.append('description', description);
formData.append('tags[]', tagIds);
formData.append('location[type]', 'Point');
formData.append('location[coordinates]', 12);
formData.append('location[coordinates]', 34);
formData.append('photo', photoFile);
formData.append('videos[]', fileSave._id);
const response = await geocore.Place.createPlace(formData);
Prerequisites
Successfully get the IdToken with user access level from login API.
Parameters
name type data type description name required string Place name description required string Place description tags required string Place tags location[type] required string Value must be "Point" location[coordinates] required array<number> Location of place photo optional binary Photo files of place videos optional array<string> Video file IDs of place
Image notes
- Maximum number of photos allowed is 10.
- Maximum photo size: 20MB.
- When uploading a place photo, that photo will be resized in 2 sizes: small (width 300px) and medium (width 1200px).
- These resized images path will be stored in the database.
- Only photos with width larger than these sizes will be resized.
Update place
Update a place.
const formData = new FormData();
formData.append('name', name);
formData.append('description', description);
formData.append('tags[]', tagIds);
formData.append('location[type]', 'Point');
formData.append('location[coordinates]', 12);
formData.append('location[coordinates]', 34);
formData.append('retainedPhotoIds[]', photoId);
formData.append('retainedVideoIds[]', videoId);
formData.append('photo', photoFile);
formData.append('videos[]', videoFileId);
if (isNewFile) {
formData.append('order[]', `${file?.uid}-${file?.name}`);
} else {
formData.append('order[]', file?.uid);
}
const response = await geocore.Place.updatePlace(placeId, formData);
Prerequisites
Successfully get the IdToken with user access level from login API.
Parameters
name type data type description placeId required string Place ID name required string Place name description required string Place description tags required string Place tags location[type] required string Value must be "Point" location[coordinates] required array<number> Location of place order[] optional array<string> Photo IDs order retainedPhotoIds[] optional array<string> Photo IDs that user wants to keep retainedVideoIds[] optional array<string> Video IDs that user wants to keep photo optional binary Photo files of place videos optional array<string> Video file IDs of place
Delete place
Change publicity
Change public status of a place
const response = await geocore.Place.changePublicity(
placeId,
{
isPublic: true,
}
);
Prerequisites
Successfully get the IdToken with companyAdmin access level from login API.
Parameters
name type data type description placeId required string Place ID isPublic required boolean Public status
Import places
Import places from a CSV file.
const formData = new FormData();
formData.append('csv', csvFile);
const response = await geocore.Place.import(formData);
Prerequisites
Successfully get the IdToken with companyAdmin access level from login API.
Parameters
name type data type description csv required string CSV file with place information