Skip to content

The package provides afHiddenInput type field for translating string values of Lat and Lng into GeoJSON Point object on form submission.

License

Notifications You must be signed in to change notification settings

espressolocator/autoform-geojson-point

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

autoform-geojson-point

The package provides afHiddenInput type field for translating string values of Lat and Lng into GeoJSON Point object on submission.

Defining the schema

It makes sense using SimpleShema sub-schema for defining GeoJSON Point type.

// Define SimpleSchema sub-schema to store GeoJSON objects.
var geoJsonSchemaObject = {
  type: {
    type: String
  },
  coordinates: {
    type: [Number],
    decimal: true
  }
};

geoJsonSchema = new SimpleSchema(geoJsonSchemaObject);

Effectively above is provided by simple-schema-geojson package.

Using the schema

It now can be used in your schema as follows:

mapCoordinates: {
  type: geoJsonSchema,
  index: "2dsphere",
  optional: true,
  autoform: {
    type: 'geojson-point',
    template: 'afInputHiddenGeoJsonPoint',
  }
}

About

The package provides afHiddenInput type field for translating string values of Lat and Lng into GeoJSON Point object on form submission.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published