ee.Filter.hasType

Creates a unary or binary filter that passes if the left operand has the type, or is a subtype of the type named in the right operand.

UsageReturns
ee.Filter.hasType(leftField, rightValue, rightField, leftValue)Filter
ArgumentTypeDetails
leftFieldString, default: nullA selector for the left operand. Should not be specified if leftValue is specified.
rightValueObject, default: nullThe value of the right operand. Should not be specified if rightField is specified.
rightFieldString, default: nullA selector for the right operand. Should not be specified if rightValue is specified.
leftValueObject, default: nullThe value of the left operand. Should not be specified if leftField is specified.

Examples

Code Editor (JavaScript)

var fc = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Rectangle([0, 0, 1, 1]), {'x': 0}),
  ee.Feature(ee.Geometry.Rectangle(0, 0, 3, 3), {'x': 'foo'}),
  ee.Feature(ee.Geometry.Point(0, 0))]);

// The third feature has a Point geometry.
print(fc.filter(ee.Filter.hasType({leftField: '.geo', rightValue: 'Point'})));

// The first two features have a Polygon geometry.
print(fc.filter(ee.Filter.hasType({leftField: '.geo', rightValue: 'Polygon'})));

// The first feature has property x with type Number.
print(fc.filter(ee.Filter.hasType({leftField: 'x', rightValue: 'Number'})));

// The second feature has property x with type String.
print(fc.filter(ee.Filter.hasType({leftField: 'x', rightValue: 'String'})));