def load_location_data(
    samples,
    geojson_or_path,
    location_field=None,
    skip_missing=True,
    progress=None,
):
    """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)
        progress (None): whether to render a progress bar (True/False), use the
            default value ``fiftyone.config.show_progress_bars`` (None), or a
            progress callback function to invoke instead
    """
    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

    locations = {}

    try:
        logger.info("Loading location data...")
        with fou.ProgressBar(progress=progress) as pb:
            for key in pb(found_keys):
                sample_id = lookup[key]
                geometry = geometries[key]
                locations[sample_id] = location_cls.from_geo_json(geometry)
    finally:
        logger.info("Saving location data...")
        samples.set_values(
            location_field, locations, key_field="id", progress=progress
        )
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)
        progress (None): whether to render a progress bar (True/False), use the
            default value ``fiftyone.config.show_progress_bars`` (None), or a
            progress callback function to invoke instead
    
fiftyone/utils/geojson.py