# Path: src/formpack/utils/exceptions.py
# class FormPackGeoJsonError(Exception):
#     pass


from geojson_rewind import rewind
from .exceptions import FormPackGeoJsonError
            raise FormPackGeoJsonError('Cannot parse coordinates')
        try:
            coordinates = list(map(float, point_components))
        except ValueError:
            raise FormPackGeoJsonError('Non-numeric data for a coordinate')

        # Swap the coordinates because that's what GeoJSON wants 🙄
        latitude, longitude, altitude, accuracy = coordinates
        return longitude, latitude, altitude

    geometry = {}

    if field.data_type == 'geopoint':
        geometry['type'] = 'Point'
        geometry['coordinates'] = split_geopoint_str(response)
    elif field.data_type == 'geotrace':
        geometry['type'] = 'LineString'
        geometry['coordinates'] = [
            split_geopoint_str(point) for point in response.split(';')
        ]
        if len(geometry['coordinates']) < 2:
            raise FormPackGeoJsonError('Too few points for a line')
    elif field.data_type == 'geoshape':
        geometry['type'] = 'Polygon'
        geometry['coordinates'] = [
            [split_geopoint_str(point) for point in response.split(';')],
            # We don't specify any holes in the `Polygon`, but if we did,
            # they'd go in another list here
        ]
        if len(geometry['coordinates'][0]) < 4:

# Path: src/formpack/utils/exceptions.py
# class FormPackGeoJsonError(Exception):
#     pass


# Path: src/formpack/utils/geojson.py
from geojson_rewind import rewind
from .exceptions import FormPackGeoJsonError

            raise FormPackGeoJsonError('Cannot parse coordinates')
        try:
            coordinates = list(map(float, point_components))
        except ValueError:
            raise FormPackGeoJsonError('Non-numeric data for a coordinate')

        # Swap the coordinates because that's what GeoJSON wants 🙄
        latitude, longitude, altitude, accuracy = coordinates
        return longitude, latitude, altitude

    geometry = {}

    if field.data_type == 'geopoint':
        geometry['type'] = 'Point'
        geometry['coordinates'] = split_geopoint_str(response)
    elif field.data_type == 'geotrace':
        geometry['type'] = 'LineString'
        geometry['coordinates'] = [
            split_geopoint_str(point) for point in response.split(';')
        ]
        if len(geometry['coordinates']) < 2:
            raise FormPackGeoJsonError('Too few points for a line')
    elif field.data_type == 'geoshape':
        geometry['type'] = 'Polygon'
        geometry['coordinates'] = [
            [split_geopoint_str(point) for point in response.split(';')],
            # We don't specify any holes in the `Polygon`, but if we did,
            # they'd go in another list here
        ]
        if len(geometry['coordinates'][0]) < 4:

            raise FormPackGeoJsonError('Too few points for a shape')