# GeoJSONWriter

#### GeoJSONWriter()
Widgets/TransformEditor/turfEx.js 30573

### Members

#### innerbuffer
Widgets/TransformEditor/turfEx.js 43105

Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees. When using a negative radius, the resulting geometry may be invalid if it's too small compared to the radius magnitude. If the input is a FeatureCollection, only valid members will be returned in the output FeatureCollection - i.e., the output collection may have fewer members than the input, or even be empty.

##### Example:

    var point = turfEx.point([-90.548630, 14.616599]);
    var buffered = turfEx.buffer(point, 500, {units: 'miles'});

    //addToMap
    var addToMap = [point, buffered]

#### innerdifference
Widgets/TransformEditor/turfEx.js 41507

Finds the difference between two `polygons` by clipping the second polygon from the first.

##### Example:

    var polygon1 = turfEx.polygon([[
      [128, -26],
      [141, -26],
      [141, -21],
      [128, -21],
      [128, -26]
    ]], {
      "fill": "#F00",
      "fill-opacity": 0.1
    });
    var polygon2 = turfEx.polygon([[
      [126, -28],
      [140, -28],
      [140, -20],
      [126, -20],
      [126, -28]
    ]], {
      "fill": "#00F",
      "fill-opacity": 0.1
    });

    var difference = turfEx.difference(polygon1, polygon2);

    //addToMap
    var addToMap = [polygon1, polygon2, difference];

#### innerdissolve
Widgets/TransformEditor/turfEx.js 43495

Dissolves a FeatureCollection of `polygon` features, filtered by an optional property name:value. Note that `mulitpolygon` features within the collection are not supported

##### Example:

    var features = turfEx.featureCollection([
      turfEx.polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]], {combine: 'yes'}),
      turfEx.polygon([[[0, -1], [0, 0], [1, 0], [1, -1], [0,-1]]], {combine: 'yes'}),
      turfEx.polygon([[[1,-1],[1, 0], [2, 0], [2, -1], [1, -1]]], {combine: 'no'}),
    ]);

    var dissolved = turfEx.dissolve(features, {propertyName: 'combine'});

    //addToMap
    var addToMap = [features, dissolved]

#### innerhexGrid
Widgets/TransformEditor/turfEx.js 43607

Takes a bounding box and the diameter of the cell and returns a `FeatureCollection` of flat-topped hexagons or triangles (`Polygon` features) aligned in an "odd-q" vertical grid as described in [Hexagonal Grids](http://www.redblobgames.com/grids/hexagons/).

##### Example:

    var bbox = [-96,31,-84,40];
    var cellSide = 50;
    var options = {units: 'miles'};

    var hexgrid = turfEx.hexGrid(bbox, cellSide, options);

    //addToMap
    var addToMap = [hexgrid];

#### innerinterpolate
Widgets/TransformEditor/turfEx.js 44190

Takes a set of points and estimates their 'property' values on a grid using the [Inverse Distance Weighting (IDW) method](https://en.wikipedia.org/wiki/Inverse_distance_weighting).

##### Example:

    var points = turfEx.randomPoint(30, {bbox: [50, 30, 70, 50]});

    // add a random property to each point
    turfEx.featureEach(points, function(point) {
        point.properties.solRad = Math.random() * 50;
    });
    var options = {gridType: 'points', property: 'solRad', units: 'miles'};
    var grid = turfEx.interpolate(points, 100, options);

    //addToMap
    var addToMap = [grid];

#### innerintersect
Widgets/TransformEditor/turfEx.js 43336

Takes two `polygons` and finds their intersection. If they share a border, returns the border; if they don't intersect, returns undefined.

##### Example:

    var poly1 = turfEx.polygon([[
      [-122.801742, 45.48565],
      [-122.801742, 45.60491],
      [-122.584762, 45.60491],
      [-122.584762, 45.48565],
      [-122.801742, 45.48565]
    ]]);

    var poly2 = turfEx.polygon([[
      [-122.520217, 45.535693],
      [-122.64038, 45.553967],
      [-122.720031, 45.526554],
      [-122.669906, 45.507309],
      [-122.723464, 45.446643],
      [-122.532577, 45.408574],
      [-122.487258, 45.477466],
      [-122.520217, 45.535693]
    ]]);

    var intersection = turfEx.intersect(poly1, poly2);

    //addToMap
    var addToMap = [poly1, poly2, intersection];

#### innermask
Widgets/TransformEditor/turfEx.js 43802

Takes any type of `polygon` and an optional mask and returns a `polygon` exterior ring with holes.

##### Example:

    var polygon = turfEx.polygon([[[112, -21], [116, -36], [146, -39], [153, -24], [133, -10], [112, -21]]]);
    var mask = turfEx.polygon([[[90, -55], [170, -55], [170, 10], [90, 10], [90, -55]]]);

    var masked = turfEx.mask(polygon, mask);

    //addToMap
    var addToMap = [masked]

#### innersquareGrid
Widgets/TransformEditor/turfEx.js 43980

Creates a square grid from a bounding box, `Feature` or `FeatureCollection`.

##### Example:

    var bbox = [-95, 30 ,-85, 40];
    var cellSide = 50;
    var options = {units: 'miles'};

    var squareGrid = turfEx.squareGrid(bbox, cellSide, options);

    //addToMap
    var addToMap = [squareGrid]

#### innertriangleGrid
Widgets/TransformEditor/turfEx.js 44065

Takes a bounding box and a cell depth and returns a set of triangular `polygons` in a grid.

##### Example:

    var bbox = [-95, 30 ,-85, 40];
    var cellSide = 50;
    var options = {units: 'miles'};

    var triangleGrid = turfEx.triangleGrid(bbox, cellSide, options);

    //addToMap
    var addToMap = [triangleGrid];

#### innerunion
Widgets/TransformEditor/turfEx.js 43290

Takes two or more `polygons` and returns a combined polygon. If the input polygons are not contiguous, this function returns a `MultiPolygon` feature.

##### Example:

    var poly1 = turfEx.polygon([[
        [-82.574787, 35.594087],
        [-82.574787, 35.615581],
        [-82.545261, 35.615581],
        [-82.545261, 35.594087],
        [-82.574787, 35.594087]
    ]], {"fill": "#0f0"});
    var poly2 = turfEx.polygon([[
        [-82.560024, 35.585153],
        [-82.560024, 35.602602],
        [-82.52964, 35.602602],
        [-82.52964, 35.585153],
        [-82.560024, 35.585153]
    ]], {"fill": "#00f"});

    var union = turfEx.union(poly1, poly2);

    //addToMap
    var addToMap = [poly1, poly2, union];

### Methods

#### write(geometry) → Object
Widgets/TransformEditor/turfEx.js 30602

Converts a `Geometry` to its GeoJSON representation.

Name | Type | Description
--- | --- | ---
`geometry` | Geometry | a `Geometry` to process.

##### Returns:

The GeoJSON representation of the Geometry.