@overmap-ai/core 1.0.60-forms-removal.3 → 1.0.60-forms-removal.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -418,9 +418,6 @@ const literalToCoordinates = (literal) => {
418
418
  const flipCoordinates = (coordinates) => {
419
419
  return [coordinates[1], coordinates[0]];
420
420
  };
421
- const markerToCoordinates = (marker) => {
422
- return flipCoordinates(marker.geometry.coordinates);
423
- };
424
421
  function offsetPositionByMeters(originalPosition, latMeters, lngMeters) {
425
422
  const { lat, lng } = originalPosition;
426
423
  const earthRadius = 6378137;
@@ -429,19 +426,12 @@ function offsetPositionByMeters(originalPosition, latMeters, lngMeters) {
429
426
  const newLat = lat - latMeters / metersPerDegree;
430
427
  return { lat: newLat, lng: newLng };
431
428
  }
432
- const coordinatesToPointGeometry = (coordinates) => {
429
+ const createPointGeometry = (coordinates) => {
433
430
  return {
434
431
  type: "Point",
435
432
  coordinates
436
433
  };
437
434
  };
438
- const createPointMarker = (coordinates) => {
439
- return {
440
- type: "Feature",
441
- geometry: coordinatesToPointGeometry(coordinates),
442
- properties: {}
443
- };
444
- };
445
435
  const coordinatesAreEqual = (a, b) => {
446
436
  return a[0] === b[0] && a[1] === b[1];
447
437
  };
@@ -457,15 +447,6 @@ const coordinatesToUrlText = (coordinates) => {
457
447
  const { lat, lng } = coordinatesToLiteral(coordinates);
458
448
  return `${lat}%2C${lng}`;
459
449
  };
460
- const getMarkerCoordinates = (marker) => {
461
- return marker == null ? void 0 : marker.geometry.coordinates;
462
- };
463
- const markerCoordinatesToText = (marker, decimalPlaces) => {
464
- const coordinates = getMarkerCoordinates(marker);
465
- if (coordinates)
466
- return coordinatesToText(coordinates, decimalPlaces);
467
- return "(No location)";
468
- };
469
450
  const openCoordsInGoogleMaps = (coordinates) => {
470
451
  const url = `https://www.google.com/maps/search/?api=1&query=${coordinatesToUrlText(coordinates)}`;
471
452
  window.open(url);
@@ -476,10 +457,19 @@ const openDirectionsInGoogleMaps = (startingPoint, destination) => {
476
457
  const url = `https://www.google.com/maps/dir/?api=1&origin=${startingPointUrl}&destination=${destinationUrl}`;
477
458
  window.open(url);
478
459
  };
479
- const worldBounds = [
480
- [90, -180],
481
- [-90, 180]
482
- ];
460
+ const worldBounds = {
461
+ type: "MultiPoint",
462
+ coordinates: [
463
+ [90, -180],
464
+ [-90, 180]
465
+ ]
466
+ };
467
+ const createMultiPointGeometry = (coordinates) => {
468
+ return {
469
+ type: "MultiPoint",
470
+ coordinates
471
+ };
472
+ };
483
473
  function classNames(...args) {
484
474
  const classes = [];
485
475
  for (const arg of args) {
@@ -2344,7 +2334,7 @@ const projectFileSlice = createSlice({
2344
2334
  doesn't exist.`
2345
2335
  );
2346
2336
  }
2347
- state.projectFiles[activeProjectFileId].bounds = action.payload;
2337
+ state.projectFiles[activeProjectFileId].geo_bounds = action.payload;
2348
2338
  },
2349
2339
  // TODO: Move to MapContext. Should not be persisted.
2350
2340
  setActiveProjectFileId: (state, action) => {
@@ -5369,7 +5359,7 @@ class ProjectFileService extends BaseApiService {
5369
5359
  url: `/projects/${activeProjectId}/files/`,
5370
5360
  payload: {
5371
5361
  ...activeProjectFile,
5372
- bounds: JSON.stringify(activeProjectFile.bounds),
5362
+ geo_bounds: JSON.stringify(activeProjectFile.geo_bounds),
5373
5363
  ...fileProps
5374
5364
  },
5375
5365
  blockers: [activeProjectFileId],
@@ -5438,9 +5428,6 @@ class ProjectService extends BaseApiService {
5438
5428
  * @throws An APIError if the server returns an error, or any other error that may occur.
5439
5429
  */
5440
5430
  async add(project) {
5441
- if (!project.bounds) {
5442
- throw new Error("Project bounds were not set before trying to create a project");
5443
- }
5444
5431
  if (!project.owner_organization && !project.owner_user) {
5445
5432
  throw new Error("Project type was not chosen when trying to create a project");
5446
5433
  }
@@ -5453,10 +5440,7 @@ class ProjectService extends BaseApiService {
5453
5440
  url,
5454
5441
  payload: {
5455
5442
  name: project.name,
5456
- bounds: {
5457
- type: "MultiPoint",
5458
- coordinates: [project.bounds[0], project.bounds[1]]
5459
- },
5443
+ geo_bounds: project.geo_bounds,
5460
5444
  ...projectType
5461
5445
  },
5462
5446
  blockers: [],
@@ -5465,9 +5449,6 @@ class ProjectService extends BaseApiService {
5465
5449
  return result;
5466
5450
  }
5467
5451
  async update(project) {
5468
- if (!project.bounds) {
5469
- throw new Error("Project bounds were not set before trying to create a project");
5470
- }
5471
5452
  this.dispatch(updateOrCreateProject(project));
5472
5453
  return await this.enqueueRequest({
5473
5454
  description: "Update project",
@@ -5475,10 +5456,7 @@ class ProjectService extends BaseApiService {
5475
5456
  url: `/projects/${project.id}/`,
5476
5457
  payload: {
5477
5458
  name: project.name,
5478
- bounds: {
5479
- type: "MultiPoint",
5480
- coordinates: [project.bounds[0], project.bounds[1]]
5481
- }
5459
+ geo_bounds: project.geo_bounds
5482
5460
  },
5483
5461
  blockers: [project.id.toString()],
5484
5462
  blocks: [project.id.toString()]
@@ -7280,11 +7258,11 @@ export {
7280
7258
  constructUploadedFilePayloads,
7281
7259
  coordinatesAreEqual,
7282
7260
  coordinatesToLiteral,
7283
- coordinatesToPointGeometry,
7284
7261
  coordinatesToText,
7285
7262
  coordinatesToUrlText,
7263
+ createMultiPointGeometry,
7286
7264
  createOfflineAction,
7287
- createPointMarker,
7265
+ createPointGeometry,
7288
7266
  defaultBadgeColor,
7289
7267
  deleteAsset,
7290
7268
  deleteAssetAttachment,
@@ -7357,7 +7335,6 @@ export {
7357
7335
  getFileS3Key,
7358
7336
  getLocalDateString,
7359
7337
  getLocalRelativeDateString,
7360
- getMarkerCoordinates,
7361
7338
  getOutboxCoordinator,
7362
7339
  getRenamedFile,
7363
7340
  getStageColor,
@@ -7402,8 +7379,6 @@ export {
7402
7379
  logOnlyOnce,
7403
7380
  markAsDeleted,
7404
7381
  markForDeletion,
7405
- markerCoordinatesToText,
7406
- markerToCoordinates,
7407
7382
  memoize,
7408
7383
  moveDocument,
7409
7384
  offline,