<commit_before>var util = require('util')
  , geoJsonValidator = require('geojson-validation')
  , Field = require('./field');

function GeometryField(fieldDefinition, observation) {
  GeometryField.super_.call(this, fieldDefinition, observation.geometry);
}
util.inherits(GeometryField, Field);

GeometryField.prototype.validate = function() {
  GeometryField.super_.prototype.validate.call(this);

  if (!this.value) return;

  if (!geoJsonValidator.isPoint(this.value)) {
    throw new Error("cannot create observation, '" + this.definition.title + "' property must be a valid GeoJson point");
  }
};

module.exports = GeometryField;<commit_msg>validate for valid geometries instead of points<commit_after>var util = require('util')
  , geoJsonValidator = require('geojson-validation')
  , Field = require('./field');

function GeometryField(fieldDefinition, observation) {
  GeometryField.super_.call(this, fieldDefinition, observation.geometry);
}
util.inherits(GeometryField, Field);

GeometryField.prototype.validate = function() {
  GeometryField.super_.prototype.validate.call(this);

  if (!this.value) return;

  if (!geoJsonValidator.isGeometryObject(this.value)) {
    throw new Error("cannot create observation, '" + this.definition.title + "' property must be a valid GeoJson geometry");
  }
};

module.exports = GeometryField;
{'fraction_non_alphanumeric': 0.13114754098360656, 'fraction_numerical': 0.0, 'mean_word_length': 5.748743718592965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4792209', 'n_tokens_mistral': 380, 'n_tokens_neox': 358, 'n_words': 81}