<commit_before>package com.mapbox.rctmgl.utils;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.WritableNativeArray;
import com.facebook.react.bridge.WritableNativeMap;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.geometry.LatLngQuad;
import com.mapbox.services.commons.geojson.Feature;
import com.mapbox.services.commons.geojson.FeatureCollection;
import com.mapbox.services.commons.geojson.Geometry;
import com.mapbox.services.commons.geojson.LineString;
import com.mapbox.services.commons.geojson.Point;
import com.mapbox.services.commons.geojson.Polygon;
import com.mapbox.services.commons.models.Position;

import java.util.List;

/**
 * Created by nickitaliano on 11/7/17.
 */

public class GeoJSONUtils {
    public static WritableMap fromFeature(Feature feature) {
        WritableMap map = Arguments.createMap();
        map.putString("type", "Feature");

        WritableMap geometry = fromGeometry(feature.getGeometry());
        map.putMap("geometry", geometry);

        WritableMap properties = ConvertUtils.toWritableMap(feature.getProperties());
        map.putMap("properties", properties);

        return map;
    }

    public static WritableMap fromGeometry(Geometry geometry) {
        final String type = geometry.getType();

        switch (type) {
            case "Point":
                return fromPoint((Point) geometry);
            case "LineString":
                return fromLineString((LineString) geometry);
            case "Polygon":
                return fromPolygon((Polygon) geometry);
            default:
                return null;
        }<commit_msg>[Android] Updated GeoJSON serializer to include feature id<commit_after>package com.mapbox.rctmgl.utils;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.WritableNativeArray;
import com.facebook.react.bridge.WritableNativeMap;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.geometry.LatLngQuad;
import com.mapbox.services.commons.geojson.Feature;
import com.mapbox.services.commons.geojson.FeatureCollection;
import com.mapbox.services.commons.geojson.Geometry;
import com.mapbox.services.commons.geojson.LineString;
import com.mapbox.services.commons.geojson.Point;
import com.mapbox.services.commons.geojson.Polygon;
import com.mapbox.services.commons.models.Position;

import java.util.List;

/**
 * Created by nickitaliano on 11/7/17.
 */

public class GeoJSONUtils {
    public static WritableMap fromFeature(Feature feature) {
        WritableMap map = Arguments.createMap();
        map.putString("type", "Feature");
        map.putString("id", feature.getId());

        WritableMap geometry = fromGeometry(feature.getGeometry());
        map.putMap("geometry", geometry);

        WritableMap properties = ConvertUtils.toWritableMap(feature.getProperties());
        map.putMap("properties", properties);

        return map;
    }

    public static WritableMap fromGeometry(Geometry geometry) {
        final String type = geometry.getType();

        switch (type) {
            case "Point":
                return fromPoint((Point) geometry);
            case "LineString":
                return fromLineString((LineString) geometry);
            case "Polygon":
                return fromPolygon((Polygon) geometry);
            default:
                return null;
        }
{'fraction_non_alphanumeric': 0.10498549195462939, 'fraction_numerical': 0.002637826431020839, 'mean_word_length': 3.503562945368171, 'pattern_counts': {'":': 6, '<': 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': '5452789', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1047, 'n_words': 199}