code: def load_location_data(
      samples, geojson_or_path, location_field=None, skip_missing=True
  ):
      """Loads geolocation data for the given samples from the given GeoJSON
      data.
  
      The GeoJSON data must be a ``FeatureCollection`` whose features have their
      ``filename`` properties populated, which are used to match the provided
      samples.
  
      Example GeoJSON data::
  
          {
              "type": "FeatureCollection",
              "features": [
                  {
                      "type": "Feature",
                      "geometry": {
                          "type": "Point",
                          "coordinates": [
                              -73.99496451958454,
                              40.66338032487842
                          ]
                      },
                      "properties": {
                          "filename": "b1c66a42-6f7d68ca.jpg"
                      }
                  },
                  {
                      "type": "Feature",
                      "geometry": {
                          "type": "LineString",
                          "coordinates": [
                              [
                                  -73.80992143421788,
                                  40.65611832778962
                              ],
                              [
                                  -74.02930609818584,
                                  40.60505054722865
                              ]
                          ]
                      },
                      "properties": {
                          "filename": "/path/to/b1c81faa-3df17267.jpg"
                      }
                  },
              ]
          }
  
      Args:
          samples: a :class:`fiftyone.core.collections.SampleCollection`
          geojson_or_path: a GeoJSON ``FeatureCollection`` dict or the path to
              one on disk
          location_field (None): the name of the location field in which to store
              the location data, which can be either a
              :class:`fiftyone.core.labels.GeoLocation` or
              :class:`fiftyone.core.labels.GeoLocations` field. If not specified,
              then, if there is an existing
              :class:`fiftyone.core.labels.GeoLocation` field, that field is
              used, else a new "location" field is created
          skip_missing (True): whether to skip GeoJSON features with no
              ``filename`` properties (True) or raise an error (False)
      """
      if location_field is None:
          try:
              location_field = samples._get_geo_location_field()
          except:
              location_field = "location"
              samples._dataset.add_sample_field(
                  "location",
                  fof.EmbeddedDocumentField,
                  embedded_doc_type=fol.GeoLocation,
              )
  
      fov.validate_collection_label_fields(
          samples, location_field, (fol.GeoLocation, fol.GeoLocations)
      )
  
      location_cls = samples._get_label_field_type(location_field)
  
      if etau.is_str(geojson_or_path):
          d = etas.read_json(geojson_or_path)
      else:
          d = geojson_or_path
  
      _ensure_type(d, "FeatureCollection")
  
      geometries = {}
      for feature in d.get("features", []):
          properties = feature["properties"]
          if "filename" in properties:
              key = properties["filename"]
          elif not skip_missing:
              raise ValueError(
                  "Found feature with no `filename` property"
              )
          else:
              continue
  
          geometries[key] = feature["geometry"]
  
      lookup = {}
      for _id, filepath in zip(
          samples.values("id"), samples.values("filepath")
      ):
          filename = os.path.basename(filepath)
          lookup[filepath] = _id
          lookup[filename] = _id
  
      found_keys = set(lookup.keys()) & set(geometries.keys())
  
      if not found_keys:
          logger.info("No matching location data found")
          return
  
      logger.info(
          "Loading location data for %d samples...", len(found_keys)
      )
      _samples = samples.select_fields(location_field)
      with fou.ProgressBar() as pb:
          for key in pb(found_keys):
              sample_id = lookup[key]
              geometry = geometries[key]
              sample = _samples[sample_id]
              sample[location_field] = location_cls.from_geo_json(
                  geometry
              )
              sample.save()
  
imports: import logging
  import os
  import eta.core.serial
  import eta.core.utils
  import fiftyone.core.fields
  import fiftyone.core.labels
  from fiftyone.core.sample import Sample
  import fiftyone.core.storage
  import fiftyone.core.utils
  import fiftyone.core.validation
  import fiftyone.utils.data
label_desc: Use image node_id 1 for calling a global function with example usage: load_location_data(samples, geojson_or_path, location_field, skip_missing) without return types