Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model/schema for feature attribute data #3107

Open
raitisbe opened this issue Jun 8, 2022 · 0 comments
Open

Model/schema for feature attribute data #3107

raitisbe opened this issue Jun 8, 2022 · 0 comments
Assignees
Milestone

Comments

@raitisbe
Copy link
Collaborator

raitisbe commented Jun 8, 2022

Feature Request

Is your feature request related to a problem? Please describe.
Currently when user draws new features all attribute keys-value pairs need to be retyped manually. This is tedious and we dont provide any checking for key names, if values correspond to a type (number, date etc.), but treat everything as a string. Also we don't check if mandatory attributes are present.

Describe the solution you'd like

  1. A new layer level string property "schema" in json schema format which describes the properties.

Currently GEOSON schema doesn't restrict what's inside "properties" - see {type: 'object'} which is basically any in typescript.

properties: {
      oneOf: [{type: 'null'}, {type: 'object'}]
    },

This type: 'object' would be possible to substitute with our schema such as:

properties: {
      oneOf: [{type: 'null'}, {
  title: 'Allowed attributes',
  type: 'object',
  required: ['name', 'type', 'amount'],
  properties: {
    name: {
      type: 'string',
    },
    type: {
      type: 'string',
      enum: ['Type1', 'Type2']
    },
    amount: {
      type: 'number',
    },
  }
}]
    },

  1. An editor panel/dialog callable from our query panel or layer editor panel which would list and provide editing of all the possible feature attributes by parsing the aforementioned schema string, their type, limits in case of number, mandatory/optional status etc.
  2. Validator functions in query panel which check if user enters the data correctly, if some attribute is not missing etc. We could also use the schema to generate the placeholder textboxes for newly drawn features.

Describe alternatives you've considered
none so far

Additional context
There has been some work done from others: https://theodi.org/article/geojson-schema-publishing-a-prototype/
A couple npm packages are dealing with json schema in general: https://www.npmjs.com/search?q=json-schema-editor
We would be interested only in a part of this schema - the one describing "properties" of a feature.

@jmacura jmacura added this to the Future milestone Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants