<commit_before>goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.GeoJSON');
goog.require('ol.source.OSM');
goog.require('ol.style.DefaultStyleFunction');


var styleFunction = function(feature) {
  switch (feature.getGeometry().getType()) {
    case ol.geom.GeometryType.MULTI_LINE_STRING:
      return {
        stroke: {
          color: 'green',
          width: 1
        }
      };
    default:
      return ol.style.DefaultStyleFunction(feature);
  }
};

var geoJSONSource = new ol.source.GeoJSON(
    /** @type {ol.source.GeoJSONOptions} */ ({
      geoJSON: {
        'type': 'FeatureCollection',
        features: [
          {
            'type': 'Feature',
            'geometry': {
              'type': 'Point',
              'coordinates': [0, 0]
            }
          },
          {
            'type': 'Feature',
            'geometry': {
              'type': 'LineString',
              'coordinates': [[-1e7, -1e7], [1e7, 1e7]]
            }
          },
          {
            'type': 'Feature',
            'geometry': {
              'type': 'LineString',
              'coordinates': [[-1e7, 1e7], [1e7, -1e7]]
            }
          },
          {
            'type': 'Feature',
            'geometry': {
              'type': 'Polygon',
              'coordinates': [[[-5e6, -5e6], [0, 5e6], [5e6, -5e6]]]
            }
          },
          {
            'type': 'Feature',
            'geometry': {
              'type': 'MultiLineString',
              'coordinates': [
                [[-1e6, -7.5e5], [-1e6, 7.5e5]],
                [[1e6, -7.5e5], [1e6, 7.5e5]],
                [[-7.5e5, -1e6], [7.5e5, -1e6]],
                [[-7.5e5, 1e6], [7.5e5, 1e6]]
              ]
            }
          }
        ]
      }
    }));

var map = new ol.Map({
  layers: [
    new ol.layer.Tile({
      source: new ol.source.OSM()
    }),
    new ol.layer.Vector({
      source: geoJSONSource,
      styleFunction: styleFunction
    })
  ],
  renderer: ol.RendererHint.CANVAS,
  target: 'map',
  view: new ol.View2D({
    center: [0, 0],
    zoom: 2
  })
});<commit_msg>Add MultiPolygon to GeoJSON example<commit_after>goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.GeoJSON');
goog.require('ol.source.OSM');
goog.require('ol.style.DefaultStyleFunction');


var styleFunction = function(feature) {
  switch (feature.getGeometry().getType()) {
    case ol.geom.GeometryType.MULTI_LINE_STRING:
      return {
        stroke: {
          color: 'green',
          width: 1
        }
      };
    case ol.geom.GeometryType.MULTI_POLYGON:
      return {
        stroke: {
          color: 'yellow',
          width: 1
        }
      };
    default:
      return ol.style.DefaultStyleFunction(feature);
  }
};

var geoJSONSource = new ol.source.GeoJSON(
    /** @type {ol.source.GeoJSONOptions} */ ({
      geoJSON: {
        'type': 'FeatureCollection',
        features: [
          {
            'type': 'Feature',
            'geometry': {
              'type': 'Point',
              'coordinates': [0, 0]
            }
          },
          {
            'type': 'Feature',
            'geometry': {
              'type': 'LineString',
              'coordinates': [[-1e7, -1e7], [1e7, 1e7]]
            }
          },
          {
            'type': 'Feature',
            'geometry': {
              'type': 'LineString',
              'coordinates': [[-1e7, 1e7], [1e7, -1e7]]
            }
          },
          {
            'type': 'Feature',
            'geometry': {
              'type': 'Polygon',
              'coordinates': [[[-5e6, -5e6], [0, 5e6], [5e6, -5e6]]]
            }
          },
          {
            'type': 'Feature',
            'geometry': {
              'type': 'MultiLineString',
              'coordinates': [
                [[-1e6, -7.5e5], [-1e6, 7.5e5]],
                [[1e6, -7.5e5], [1e6, 7.5e5]],
                [[-7.5e5, -1e6], [7.5e5, -1e6]],
                [[-7.5e5, 1e6], [7.5e5, 1e6]]
              ]
            }
          },
          {
            'type': 'Feature',
            'geometry': {
              'type': 'MultiPolygon',
              'coordinates': [
                [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6], [-3e6, 6e6]]],
                [[[-2e6, 6e6], [-2e6, 8e6], [0e6, 8e6], [0e6, 6e6]]],
                [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6], [3e6, 6e6]]]
              ]
            }
          }
        ]
      }
    }));

var map = new ol.Map({
  layers: [
    new ol.layer.Tile({
      source: new ol.source.OSM()
    }),
    new ol.layer.Vector({
      source: geoJSONSource,
      styleFunction: styleFunction
    })
  ],
  renderer: ol.RendererHint.CANVAS,
  target: 'map',
  view: new ol.View2D({
    center: [0, 0],
    zoom: 2
  })
});
{'fraction_non_alphanumeric': 0.18092566619915848, 'fraction_numerical': 0.039871769184532155, 'mean_word_length': 1.4162633107454017, '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': '69607', 'n_tokens_mistral': 1769, 'n_tokens_neox': 1700, 'n_words': 290}