mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
Add support for Geometry type, add Map Layout & Interface (#5684)
* Added map layout * Cleanup and bug fixes * Removed package-lock * Cleanup and fixes * Small fix * Added back package-lock * Saved camera, autofitting option, bug fixes * Refactor and ui improvements * Improvements * Added seled mode * Removed unused dependency * Changed selection behaviour, cleanup. * update import and dependencies * make custom style into drawer * remove unused imports * use lodash functions * add popups * allow header to become small * reorganize settings * add styling to popup * change default template * add projection option * add basic map interface * finish simple map * add mapbox style * support more mapbox layouts * add api key option * add mapbox backgrounds to layout * warn when no api key is set * fix for latest version * Improved map layout and interface, bug fixes, refactoring. . . * Added postgis geometry format, added marker icon shadow * Made map buttons bigger and their icons thinner. Added transition to header bar. * Bug fixes and error handling in map interface. * Moved box-select control out of the map component. Removed material icons sprite and use addImage for marker support. * Handle MultiGeometry -> Geometry interface error. * Removed hardcoded styles. Added migrations for basemap column. Lots of refactoring. Removed hardcoded styles. Added migrations for basemap column. Lots of refactoring. * Fixed style reloading error. Added translations. * Moved worker code to lib. * Removed worker code. Prevent Mapbox from removing access_token from the URL. * Refactoring. * Change basemap selection to in-map dropdown for layout and interface. * Touchscreen selection support and small fixes. * Small change. * Fixed unused imports. * Added support for PostgreSQL identity column * Renamed migration. Added crs translation. * Only show fields using the map interface in the map layout. * Removed logging. * Reverted Dockerfile change. * Improved crs support. * Fixed translations. * Check for schema identity before updating it. * Fixed popup not updating on feature hover. * Added feature hover styling. Fixed layer customization input. Added out of bounds error handling. * Added geometry type and support for database native geometries. * Fixed linting. * Fixed layout. * Fixed layout. * Actually fixed linting * Full support for native geometries Fixed basemap input Improved feature popup on hover Locked interfaced support * Fixed geometryType option not updating * Bug fixes in interface * Fixed crash when empty basemap settings. Fixed fitBounds option not updating. * Added back storage type option. Improved interface behaviour. * Dropped wkb because of vendor inconsistency with binary data * Updated layout to match new geometry type. Fixed geojson payload transform. * Added missing geometry_format attributes to local types. * Fixed typos & refactoring * Removed dependency on proj4 * Fix error when empty map interface options * Set geometry SRID to 4326 when inserting into the database * Add support for selectMode * Fix error on initial source load * Added geocoder, use GeoJSON for api i/o, removed geometry_format option, refactoring * Added geometry intersects filter. Created geometry helper class. * Fix error when null geometryOptions, added mapbox_key setting. * Moved all geometry parsing/serializing into processGeometries in `payload.ts`. Fixed type errors. * Migrate to Vue 3 * Use wellknown instead of wkx * Fixed basemap selection. * Added available operator for geometry type * Added nintersects filter, fixed map interface for filter input * Added intersects_bbox filter & bug fixes. * Fixed icons rendering * Fixed cursor icon in select mode * Added geometry aggregate function * Fixed geometry processing bug when imported from relational field. * Fixed error with geocoder instanciation * Removed @types/maplibre-gl dependency * Removed fitViewToData options * Merge remote-tracking branch 'upstream/main' into map-layout * Fixed style and geometryType in map interface options * Fixed style change on map interface. * Improved fitViewToData behaviour * Fixed type imports and previous merge conflict * Fixed linting * Added available operators * Fix and merge migrations * Remove outdated p-queue dep * Fix get-schema column extract * Replace pg with postgis for local debugging * Re-add missing import * Add mapbox as a basemap when key exists * Remove unused tz flag * Process delta in payloadservice * Set default map, add limit number styling * Default display template to just PK * Tweak styling of error dialog * Fix method usage in helpers * Move sdo_geo to oracle section * Remove extensions from ts config exclude * Move geo types to shared, remove _Geometry * Remove unused type * Tiny Tweaks * Remove fit to bounds option in favor of on * Validate incoming intersects query * Deepmap filter values * Add GraphQL support * No defaultValue for geometryType * Resolve c * Fix translations Co-authored-by: Nitwel <nitwel@arcor.de> Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
"vue-router": "4.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"geojson": "^0.5.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"rimraf": "3.0.2",
|
||||
"typescript": "4.3.5"
|
||||
|
||||
@@ -16,9 +16,21 @@ export const TYPES = [
|
||||
'uuid',
|
||||
'hash',
|
||||
'csv',
|
||||
'geometry',
|
||||
'unknown',
|
||||
] as const;
|
||||
|
||||
export const GEOMETRY_TYPES = [
|
||||
'Point',
|
||||
'LineString',
|
||||
'Polygon',
|
||||
'MultiPoint',
|
||||
'MultiLineString',
|
||||
'MultiPolygon',
|
||||
] as const;
|
||||
|
||||
export const GEOMETRY_FORMATS = ['native', 'geojson', 'wkt', 'lnglat'] as const;
|
||||
|
||||
export const LOCAL_TYPES = [
|
||||
'standard',
|
||||
'file',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { FilterOperator } from './filter';
|
||||
import { DeepPartial } from './misc';
|
||||
import { Column } from 'knex-schema-inspector/dist/types/column';
|
||||
import { LOCAL_TYPES, TYPES } from '../constants';
|
||||
import { LOCAL_TYPES, TYPES, GEOMETRY_TYPES, GEOMETRY_FORMATS } from '../constants';
|
||||
|
||||
type Translations = {
|
||||
language: string;
|
||||
@@ -13,6 +14,10 @@ export type Type = typeof TYPES[number];
|
||||
|
||||
export type LocalType = typeof LOCAL_TYPES[number];
|
||||
|
||||
export type GeometryType = typeof GEOMETRY_TYPES[number] | 'GeometryCollection' | undefined;
|
||||
|
||||
export type GeometryFormat = typeof GEOMETRY_FORMATS[number];
|
||||
|
||||
export type FieldMeta = {
|
||||
id: number;
|
||||
collection: string;
|
||||
@@ -38,7 +43,7 @@ export interface FieldRaw {
|
||||
collection: string;
|
||||
field: string;
|
||||
type: Type;
|
||||
schema: Column | null;
|
||||
schema: (Column & { geometry_type?: string }) | null;
|
||||
meta: FieldMeta | null;
|
||||
}
|
||||
|
||||
@@ -47,6 +52,8 @@ export interface Field extends FieldRaw {
|
||||
children?: Field[] | null;
|
||||
}
|
||||
|
||||
export type RawField = DeepPartial<Field> & { field: string; type: Type };
|
||||
|
||||
export type ValidationError = {
|
||||
code: string;
|
||||
field: string;
|
||||
|
||||
@@ -14,7 +14,11 @@ export type FilterOperator =
|
||||
| 'between'
|
||||
| 'nbetween'
|
||||
| 'empty'
|
||||
| 'nempty';
|
||||
| 'nempty'
|
||||
| 'intersects'
|
||||
| 'nintersects'
|
||||
| 'intersects_bbox'
|
||||
| 'nintersects_bbox';
|
||||
|
||||
export type ClientFilterOperator = FilterOperator | 'starts_with' | 'nstarts_with' | 'ends_with' | 'nends_with';
|
||||
|
||||
@@ -44,6 +48,10 @@ export type FieldFilterOperator = {
|
||||
_nbetween?: (string | number)[];
|
||||
_empty?: boolean;
|
||||
_nempty?: boolean;
|
||||
_intersects?: string;
|
||||
_nintersects?: string;
|
||||
_intersects_bbox?: string;
|
||||
_nintersects_bbox?: string;
|
||||
};
|
||||
|
||||
export type FieldValidationOperator = {
|
||||
|
||||
29
packages/shared/src/types/geometry.ts
Normal file
29
packages/shared/src/types/geometry.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
Point,
|
||||
Polygon,
|
||||
LineString,
|
||||
MultiPoint,
|
||||
MultiPolygon,
|
||||
MultiLineString,
|
||||
GeometryCollection,
|
||||
Geometry,
|
||||
Feature,
|
||||
FeatureCollection,
|
||||
} from 'geojson';
|
||||
import { GeometryType, GeometryFormat } from './fields';
|
||||
|
||||
export type GeometryOptions = {
|
||||
geometryField: string;
|
||||
geometryFormat: GeometryFormat;
|
||||
geometryType?: GeometryType;
|
||||
};
|
||||
|
||||
export type SimpleGeometry = Point | Polygon | LineString;
|
||||
export type MultiGeometry = MultiPoint | MultiPolygon | MultiLineString;
|
||||
|
||||
export type AnyGeometry = Geometry | GeometryCollection;
|
||||
export type AllGeoJSON = Geometry & GeometryCollection & Feature & FeatureCollection;
|
||||
export type GeoJSONParser = (entry: any) => AnyGeometry | undefined;
|
||||
export type GeoJSONSerializer = (entry: AllGeoJSON) => any;
|
||||
|
||||
export type Coordinate = [number, number];
|
||||
@@ -4,6 +4,7 @@ export * from './endpoints';
|
||||
export * from './extensions';
|
||||
export * from './fields';
|
||||
export * from './filter';
|
||||
export * from './geometry';
|
||||
export * from './hooks';
|
||||
export * from './interfaces';
|
||||
export * from './items';
|
||||
|
||||
@@ -40,6 +40,9 @@ export function getFilterOperatorsForType(type: Type): ClientFilterOperator[] {
|
||||
case 'time':
|
||||
return ['eq', 'neq', 'lt', 'lte', 'gt', 'gte', 'between', 'nbetween', 'empty', 'nempty', 'in', 'nin'];
|
||||
|
||||
case 'geometry':
|
||||
return ['eq', 'neq', 'intersects', 'nintersects', 'intersects_bbox', 'nintersects_bbox'];
|
||||
|
||||
default:
|
||||
return [
|
||||
'eq',
|
||||
|
||||
Reference in New Issue
Block a user