crs-l2-fiji-antimeridian

Status: done
Score: 62
Duration: 3:58
Cost: 0.73¢
Model: google/gemma-4-26b-a4b-it

Map (reference ← swipe → agent)

0:00
I'm pulling together per-transect coverage figures for our survey report, but some of the lines in fiji_transects_wgs84.geojson render as arcs spanning the entire globe instead of short local segments. Can you fix the geometries so they render correctly, convert them to Fiji's national metric grid, and give me each transect as one MultiLineString feature with a length_m attribute in metres? Every feature must come out as a MultiLineString, so do not leave any transects as plain LineString, and the problematic ones must end up as multi-part geometries that faithfully represent the actual survey path. Carry the survey attributes (vessel and survey_date) through unchanged, use transect_id as the key field, and write the result as GeoJSON named fiji_transects_fmg.geojson.
0:00
System info
{
  "adapter": "openrouter",
  "model": "google/gemma-4-26b-a4b-it",
  "base_url": "https://openrouter.ai/api/v1"
}
0:03
Bash ls -F
fiji_transects_wgs84.geojson
0:05
Bash head -n 20 fiji_transects_wgs84.geojson
{
"type": "FeatureCollection",
"name": "fiji_transects_wgs84",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "transect_id": "T001", "vessel": "Taveuni II", "survey_date": "2025-08-15", "crosses_antimeridian_flag": true }, "geometry": { "type": "LineString", "coordinates": [ [ 178.941879580782086, -17.632301816020771 ], [ 179.456655009654696, -17.623768593111961 ], [ 179.971430438527307, -17.611072392823225 ], [ -179.513794132600054, -17.596198176111951 ], [ -178.999018703727444, -17.579632069513806 ], [ -178.484243274854833, -17.577321872344196 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T002", "vessel": "Bligh", "survey_date": "2025-08-12", "crosses_antimeridian_flag": true }, "geometry": { "type": "LineString", "coordinates": [ [ 179.070288824800542, -17.334767984150709 ], [ 179.725942881740252, -17.171343988196945 ], [ -179.618403061320009, -17.007726843860763 ], [ -178.962749004380299, -16.834850408534852 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T003", "vessel": "Lomaiviti", "survey_date": "2025-08-12", "crosses_antimeridian_flag": true }, "geometry": { "type": "LineString", "coordinates": [ [ 177.636947428758333, -17.358837040696127 ], [ 178.462815605623859, -17.416074837434927 ], [ 179.288683782489386, -17.471713663377283 ], [ -179.885448040645059, -17.527675804260884 ], [ -179.059579863779533, -17.590577543375694 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T004", "vessel": "Vanua I", "survey_date": "2025-08-15", "crosses_antimeridian_flag": true }, "geometry": { "type": "LineString", "coordinates": [ [ 178.873696381462679, -17.803295238757038 ], [ 179.542254331047587, -17.598477321703708 ], [ -179.789187719367533, -17.405549472537043 ], [ -179.120629769782624, -17.19411411231702 ], [ -178.452071820197745, -16.992332922174427 ], [ -177.783513870612836, -16.795171196845544 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T005", "vessel": "Bligh", "survey_date": "2025-08-19", "crosses_antimeridian_flag": true }, "geometry": { "type": "LineString", "coordinates": [ [ 177.596924830927293, -17.923255155112717 ], [ 178.160696712947697, -18.010328270600898 ], [ 178.724468594968101, -18.099224972140938 ], [ 179.288240476988506, -18.17532145144995 ], [ 179.85201235900891, -18.270380145331412 ], [ -179.584215758970686, -18.358875431719703 ], [ -179.020443876950281, -18.437390943572723 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T006", "vessel": "Cakaulevu", "survey_date": "2025-08-13", "crosses_antimeridian_flag": true }, "geometry": { "type": "LineString", "coordinates": [ [ 178.622166647099931, -18.382052393687179 ], [ 179.205668025282989, -18.184610858038685 ], [ 179.789169403466019, -17.991866703295319 ], [ -179.627329218350923, -17.789532271264445 ], [ -179.043827840167864, -17.595682751178369 ], [ -178.460326461984835, -17.393483000040479 ], [ -177.876825083801776, -17.203490564162109 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T007", "vessel": "Vanua I", "survey_date": "2025-08-19", "crosses_antimeridian_flag": true }, "geometry": { "type": "LineString", "coordinates": [ [ 177.920101619592742, -17.14979850360189 ], [ 178.697177550619955, -17.100522188212071 ], [ 179.474253481647168, -17.053867486482115 ], [ -179.74867058732562, -17.004197778897627 ], [ -178.971594656298407, -16.959481244370728 ], [ -178.194518725271195, -16.911697858015476 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T008", "vessel": "Taveuni II", "survey_date": "2025-08-12", "crosses_antimeridian_flag": true }, "geometry": { "type": "LineString", "coordinates": [ [ 179.401134548056262, -17.934415957637167 ], [ 179.67454249485786, -17.899654147497863 ], [ 179.947950441659486, -17.858130727687527 ], [ -179.778641611538916, -17.811143619533269 ], [ -179.50523366473729, -17.768768396969666 ], [ -179.231825717935692, -17.724708363613253 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T009", "vessel": "Vanua I", "survey_date": "2025-08-13", "crosses_antimeridian_flag": true }, "geometry": { "type": "LineString", "coordinates": [ [ 178.068433112639013, -16.657838811131668 ], [ 178.561564721122721, -16.689731320158675 ], [ 179.054696329606429, -16.72173241552732 ], [ 179.547827938090137, -16.748891897767297 ], [ -179.959040453426155, -16.775241845025921 ], [ -179.465908844942447, -16.799281899607834 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T010", "vessel": "Vanua I", "survey_date": "2025-08-15", "crosses_antimeridian_flag": true }, "geometry": { "type": "LineString", "coordinates": [ [ 177.602847396853463, -17.277026295424367 ], [ 179.128053569323441, -17.468285296635063 ], [ -179.346740258206609, -17.65419136085664 ], [ -177.82153408573663, -17.837325774502055 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T011", "vessel": "Taveuni II", "survey_date": "2025-08-20", "crosses_antimeridian_flag": false }, "geometry": { "type": "LineString", "coordinates": [ [ -176.863797870333627, -17.7932433540029 ], [ -176.985724572324699, -17.81273654528005 ], [ -177.107651274315742, -17.824236921378098 ], [ -177.229577976306814, -17.835861250474697 ], [ -177.351504678297886, -17.857559546831705 ], [ -177.473431380288929, -17.871769203842408 ], [ -177.595358082280001, -17.890225470404214 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T012", "vessel": "Taveuni II", "survey_date": "2025-08-20", "crosses_antimeridian_flag": false }, "geometry": { "type": "LineString", "coordinates": [ [ 176.312195951017685, -17.976122209608448 ], [ 176.362236324041447, -17.722210270969462 ], [ 176.412276697065209, -17.470306839752467 ], [ 176.462317070088972, -17.226475769084448 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T013", "vessel": "Bligh", "survey_date": "2025-08-19", "crosses_antimeridian_flag": false }, "geometry": { "type": "LineString", "coordinates": [ [ -176.70823848972006, -17.696306145080879 ], [ -177.205026853648661, -17.960082567744127 ], [ -177.701815217577291, -18.210737758337459 ], [ -178.198603581505893, -18.469124252379427 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T014", "vessel": "Lomaiviti", "survey_date": "2025-08-13", "crosses_antimeridian_flag": false }, "geometry": { "type": "LineString", "coordinates": [ [ 176.538496893308832, -16.594358164012139 ], [ 176.861572490827996, -16.71494251806207 ], [ 177.184648088347188, -16.832251271240672 ], [ 177.507723685866381, -16.976116506165042 ], [ 177.830799283385545, -17.090939089364483 ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T015", "vessel": "Vanua I", "survey_date": "2025-08-15", "crosses_antimeridian_flag": false }, "geometry": { "type": "LineString", "coordinates": [ [ -177.278377449219306, -16.724372731501912 ], [ -177.470251917030794, -16.761535677586746 ], [ -177.662126384842253, -16.787182414326686 ], [ -177.854000852653712, -16.818799270133983 ], [ -178.0458753204652, -16.856282470705128 ], [ -178.237749788276659, -16.891308864567598 ], [ -178.429624256088147, -16.914729063096839 ] ] } },
2:59
Write /work/solve.py
content · 169 lines · py
import geopandas as gpd
import pandas as pd
from shapely.geometry import LineString, MultiLineString
import numpy as np

def fix_antimeridian_line_strings(gdf):
    """
    Fixes LineStrings that cross the antimeridian by splitting them into MultiLineStrings.
    """
    new_features = []
    
    for _, row in gdf.iterrows():
        geom = row.geometry
        if geom.is_empty:
            new_features.append(row)
            continue
            
        coords = list(geom.coords)
        # Check if it crosses the antimeridian (jump from ~180 to ~-180 or vice versa)
        # A simple way to detect this in the context of Fiji is looking for 
        # a jump in longitude greater than 180 degrees.
        
        split_indices = []
        for i in range(len(coords) - 1):
            lon1, lat1 = coords[i][0], coords[i][1]
            lon2, lat2 = coords[i+1][0], coords[i+1][1]
            
            diff = lon2 - lon1
            if diff > 180:
                # Jump from -179 to 179 (not typical for Fiji, but let's be safe)
                # Actually, if diff > 180, it means we went the long way around.
                # But here the data shows [179, -179], so diff is -358.
                # Wait, if lon1 = 179 and lon2 = -179, diff = -358.
                # If lon1 = -179 and lon2 = 179, diff = 358.
                pass 
            
            # Let's use the logic: if abs(diff) > 180, it's a crossing.
            if abs(diff) > 180:
                split_indices.append(i + 1)
        
        if not split_indices:
            # No split needed, but we MUST return a MultiLineString as per instructions
            if isinstance(geom, LineString):
                new_geom = MultiLineString([geom])
            else:
                new_geom = geom
            row.geometry = new_geom
            new_features.append(row)
        else:
            # Split the coordinates into multiple LineStrings
            sub_lines = []
            start_idx = 0
            for idx in split_indices:
                # The segment is from start_idx to idx-1
                segment_coords = coords[start_idx:idx]
                # Adjust the longitude of the second part to be continuous
                # However, for a MultiLineString, we don't "fix" the coordinates to be 
                # continuous in a single plane, we just split them.
                # BUT, we want to represent the path. The path is split at the antimeridian.
                # So the first part ends at lon1, and the second part starts at lon2.
                # To make them "local", we might need to adjust the longitude of the second part.
                # BUT, the user said "so they render correctly". 
                # If we just split them, they will be in two pieces: one near 180 and one near -180.
                # That is exactly what a MultiLineString does.
                
                sub_lines.append(LineString(segment_coords))
                start_idx = idx
            
            # Last segment
            sub_lines.append(LineString(coords[start_idx:]))
            
            row.geometry = MultiLineString(sub_lines)
            new_features.append(row)

    return gpd.GeoDataFrame(new_features, crs=gdf.crs)

# A more robust way to handle the "long way around" longitude:
def split_and_normalize_antimeridian(gdf):
    new_rows = []
    for _, row in gdf.iterrows():
        coords = list(row.geometry.coords)
        segments = []
        current_segment = [coords[0]]
        
        for i in range(1, len(coords)):
            prev_lon, prev_lat = coords[i-1]
            curr_lon, curr_lat = coords[i]
            
            # Check for antimeridian crossing
            if abs(curr_lon - prev_lon) > 180:
                # Split here
                segments.append(LineString(current_segment))
                current_segment = [coords[i]]
            else:
                current_segment.append(coords[i])
        
        segments.append(LineString(current_segment))
        
        # Create a MultiLineString from segments
        if len(segments) > 1:
            new_geom = MultiLineString(segments)
        else:
            new_geom = MultiLineString([segments[0]])
            
        new_row = row.copy()
        new_row.geometry = new_geom
        new_rows.append(new_row)
        
    return gpd.GeoDataFrame(new_rows, crs=gdf.crs)

# Let's refine the logic: 
# When a segment crosses the antimeridian, e.g., 179 to -179.
# The MultiLineString will have one LineString ending at 179 and one starting at -179.
# This is correct for "rendering correctly" in most GIS tools (they won't draw the arc).

def solve():
    # Load the data
    gdf = gpd.read_file("fiji_transects_wgs84.geojson")
    
    # 1. Fix antimeridian geometries
    # We use the split logic.
    gdf_fixed = split_and_normalize_antimeridian(gdf)
    
    # 2. Convert to Fiji's national metric grid
    # Fiji's national grid is typically Fiji Grid (EPSG:2977 or similar, but let's check)
    # Common Fiji projection: EPSG:2977 (Fiji Grid)
    # However, for a general "national metric grid" in Fiji, let's check if there's a standard.
    # Looking up Fiji projection... EPSG:2977 is commonly used.
    # Let's use EPSG:3857 if 2977 is not available, but let's try 2977 first.
    # Actually, many use UTM zones. Fiji is mostly UTM 59S or 60S.
    # Let's check if 2977 is the standard.
    # Another option is a UTM projection.
    # Given the task asks for "Fiji's national metric grid", I'll use EPSG:2977.
    
    try:
        target_crs = "EPSG:2977"
        gdf_metric = gdf_fixed.to_crs(target_crs)
    except Exception as e:
        print(f"Error with EPSG:2977, trying UTM 60S (EPSG:32760): {e}")
        target_crs = "EPSG:32760"
        gdf_metric = gdf_fixed.to_crs(target_crs)

    # 3. Calculate length_m
    # Since it's in a metric CRS, length is in metres.
    gdf_metric['length_m'] = gdf_metric.geometry.length
    
    # 4. Ensure every feature is a MultiLineString
    # (Already handled in split_and_normalize_antimeridian, but let's be sure)
    def ensure_multilinestring(geom):
        if geom.geom_type == 'LineString':
            return MultiLineString([geom])
        return geom

    gdf_metric['geometry'] = gdf_metric.geometry.apply(ensure_multilinestring)
    
    # 5. Keep only required columns or ensure transect_id, vessel, survey_date are present
    # The prompt says "Carry the survey attributes (vessel and survey_date) through unchanged"
    # and "use transect_id as the key field".
    # We should also make sure we don't have extra junk if we want a clean output, 
    # but usually, keeping all is fine unless specified otherwise.
    # Let's check the input columns.
    
    # 6. Write to GeoJSON
    gdf_metric.to_file("fiji_transects_fmg.geojson", driver="GeoJSON")
    print("Successfully created fiji_transects_fmg.geojson")

if __name__ == "__main__":
    solve()
Wrote /work/solve.py (6949 chars).
3:01
Bash python solve.py
Successfully created fiji_transects_fmg.geojson
3:04
Bash head -n 20 fiji_transects_fmg.geojson
{
"type": "FeatureCollection",
"name": "fiji_transects_fmg",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::2977" } },
"features": [
{ "type": "Feature", "properties": { "transect_id": "T001", "vessel": "Taveuni II", "survey_date": "2025-08-15T00:00:00", "crosses_antimeridian_flag": true, "length_m": 242148.17462422862 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2577818.856368530075997, 7808045.933654122054577 ], [ -2517744.839244871865958, 7818720.514956817030907 ], [ -2457959.618174184113741, 7829649.209022815339267 ] ], [ [ -2398415.969535400625318, 7840591.110509933903813 ], [ -2339097.41476799082011, 7851489.390455325134099 ], [ -2279720.962942078709602, 7860430.453650631010532 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T002", "vessel": "Bligh", "survey_date": "2025-08-12T00:00:00", "crosses_antimeridian_flag": true, "length_m": 160320.4850304015 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2568571.367820397950709, 7846831.475579218938947 ], [ -2494815.333217027131468, 7878702.454537282697856 ] ], [ [ -2421194.358998955693096, 7910035.447528526186943 ], [ -2347860.87270077271387, 7941939.787312176078558 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T003", "vessel": "Lomaiviti", "survey_date": "2025-08-12T00:00:00", "crosses_antimeridian_flag": true, "length_m": 294940.81524541433 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2737259.021241321694106, 7816272.578033835627139 ], [ -2638431.858519812580198, 7825394.063890357501805 ], [ -2540319.581941521726549, 7834153.894859520718455 ] ], [ [ -2442858.046751129440963, 7842329.020383343100548 ], [ -2345905.603365982417017, 7849135.118691245093942 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T004", "vessel": "Vanua I", "survey_date": "2025-08-15T00:00:00", "crosses_antimeridian_flag": true, "length_m": 329398.56369994825 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2582407.215880405623466, 7785839.181658865883946 ], [ -2508233.587048316374421, 7823377.507483461871743 ] ], [ [ -2433906.987269802484661, 7858842.509372072294354 ], [ -2359990.324205772485584, 7895939.639540608972311 ], [ -2285968.765630466397852, 7931271.657026222907007 ], [ -2211945.76174630690366, 7965472.228640222921968 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T005", "vessel": "Bligh", "survey_date": "2025-08-19T00:00:00", "crosses_antimeridian_flag": true, "length_m": 337273.70270080835 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2730085.261179696302861, 7745776.327364278957248 ], [ -2661819.787075642962009, 7746489.832580281421542 ], [ -2593883.202560970094055, 7746760.809876747429371 ], [ -2526561.439846133813262, 7748375.548134338110685 ], [ -2459207.692624073475599, 7747464.851115341298282 ] ], [ [ -2392326.301384329795837, 7747142.532282743602991 ], [ -2325963.332817469257861, 7747812.099709572270513 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T006", "vessel": "Cakaulevu", "survey_date": "2025-08-13T00:00:00", "crosses_antimeridian_flag": true, "length_m": 362346.84209049359 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2599992.844046104233712, 7710152.494721526280046 ], [ -2535990.336608688347042, 7745663.094245363026857 ], [ -2471907.25352796446532, 7780096.101796898059547 ] ], [ [ -2408021.861625707242638, 7815198.070424247533083 ], [ -2343992.843024157453328, 7848789.023065808229148 ], [ -2280128.756940491497517, 7882913.996305481530726 ], [ -2216075.889947677496821, 7915112.088575566187501 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T007", "vessel": "Vanua I", "survey_date": "2025-08-19T00:00:00", "crosses_antimeridian_flag": true, "length_m": 368700.14341236703 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2707958.766985294874758, 7847662.46371332090348 ], [ -2617025.080956507474184, 7868560.6145184263587 ], [ -2526493.880338669288903, 7888512.674169298261404 ] ], [ [ -2436457.20139694493264, 7908226.102616477757692 ], [ -2346756.589748611208051, 7926750.916424177587032 ], [ -2257520.004844188690186, 7945076.104863223619759 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T008", "vessel": "Taveuni II", "survey_date": "2025-08-12T00:00:00", "crosses_antimeridian_flag": true, "length_m": 130059.39143118211 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2518182.288068630266935, 7779851.174654245376587 ], [ -2487017.445418053306639, 7789178.679573908448219 ], [ -2456022.297383859753609, 7799241.849767371080816 ] ], [ [ -2425166.019995931070298, 7809880.026913054287434 ], [ -2394257.700750786811113, 7819872.499677928164601 ], [ -2363415.248306552879512, 7829983.100506925024092 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T009", "vessel": "Vanua I", "survey_date": "2025-08-13T00:00:00", "crosses_antimeridian_flag": true, "length_m": 235691.09624016393 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2700142.167306652758271, 7911204.870228514075279 ], [ -2640985.695807782001793, 7916482.104912839829922 ], [ -2582072.975177893880755, 7921554.017558207735419 ], [ -2523489.242259116843343, 7927027.587514635175467 ] ], [ [ -2465150.952466951683164, 7932409.003623221069574 ], [ -2407078.076770230196416, 7937881.784215446561575 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T010", "vessel": "Vanua I", "survey_date": "2025-08-15T00:00:00", "crosses_antimeridian_flag": true, "length_m": 362782.57626249455 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2743004.244949294254184, 7825703.487932769581676 ], [ -2559206.512722389306873, 7831590.124320032075047 ] ], [ [ -2377995.683071207255125, 7836498.912986122071743 ], [ -2199142.433008900843561, 7840154.290191553533077 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T011", "vessel": "Taveuni II", "survey_date": "2025-08-20T00:00:00", "crosses_antimeridian_flag": false, "length_m": 85100.654515888978 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2090510.237545256037265, 7860563.718294717371464 ], [ -2104083.355092440266162, 7856360.095066314563155 ], [ -2117792.864098150283098, 7853092.239760281518102 ], [ -2131508.181665613316, 7849795.275641735643148 ], [ -2145064.558770742733032, 7845283.005933348089457 ], [ -2158751.349236745852977, 7841647.831423315219581 ], [ -2172374.122675319202244, 7837490.689390176907182 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T012", "vessel": "Taveuni II", "survey_date": "2025-08-20T00:00:00", "crosses_antimeridian_flag": false, "length_m": 96678.572314157165 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2881358.679590006358922, 7711997.136072006076574 ], [ -2881147.548506676219404, 7744723.712745074182749 ], [ -2880792.575384852476418, 7777199.373172726482153 ], [ -2880163.700538771227002, 7808666.804016925394535 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T013", "vessel": "Bligh", "survey_date": "2025-08-19T00:00:00", "crosses_antimeridian_flag": false, "length_m": 195242.20241007773 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2074347.516229145694524, 7874463.33793031796813 ], [ -2126661.583137985318899, 7835388.280761742964387 ], [ -2179084.771710069850087, 7797497.99072393681854 ], [ -2231266.005162506829947, 7758301.353639220818877 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T014", "vessel": "Lomaiviti", "survey_date": "2025-08-13T00:00:00", "crosses_antimeridian_flag": false, "length_m": 168768.7882640101 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2884554.542054513935, 7889146.833948561921716 ], [ -2843184.396975137759, 7880624.016131930053234 ], [ -2802044.054834145121276, 7872489.953316772356629 ], [ -2760519.013364502228796, 7861046.430769282393157 ], [ -2719749.847674670163542, 7853185.46901720110327 ] ] ] } },
{ "type": "Feature", "properties": { "transect_id": "T015", "vessel": "Vanua I", "survey_date": "2025-08-15T00:00:00", "crosses_antimeridian_flag": false, "length_m": 136075.16315041631 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -2154859.157849435694516, 7981607.483935452997684 ], [ -2176367.295431756414473, 7974281.162554035894573 ], [ -2198072.658420251682401, 7968293.111701854504645 ], [ -2219700.689059948083013, 7961552.54660858400166 ], [ -2241249.826771907042712, 7954069.077079316601157 ], [ -2262853.85095702810213, 7946839.612698352895677 ], [ -2284666.763064748141915, 7940965.200932309031487 ] ] ] } },
3:15
Bash # Let's check if the coordinates in the output make sense for Fiji.
# Let's check if the coordinates in the output make sense for Fiji.
# Fiji is roughly at -18 latitude, 178 longitude.
# EPSG:2977 is Fiji Grid.
# Let's check a point. 
# If longitude is 178, in 2977 it should be around a certain value.
# The output has -2577818, 7808045.
# Let's see if we can find the correct EPSG or if we should have used a different one.
# Actually, let's check the projection parameters of EPSG:2977 or 
# just use a known UTM zone if 2977 is problematic.
# Wait, the user said "Fiji's national metric grid". 
# Let's verify if EPSG:2977 is indeed the Fiji Grid.
# EPSG:2977 is Fiji Grid.
# Let's check the coordinates of a known Fiji point in EPSG:2977.
# Suva is approx -18.14, 178.44.
python -c "from pyproj import Transformer; t = Transformer.from_crs('EPSG:4326', 'EPSG:2977', always_xy=True); print(t.transform(178.44, -18.14))"
(-2626340.184234997, 7736157.053197812)
3:20
Bash python -c "from pyproj import Transformer; t = Transformer.from_crs('EPSG:4326',...
python -c "from pyproj import Transformer; t = Transformer.from_crs('EPSG:4326', 'EPSG:2977', always_xy=True); print(t.transform(179.45, -17.62))"
(-2518594.858817033, 7819056.677985735)
3:31
Bash # Now let's check our first feature in the output
# Now let's check our first feature in the output
# First feature: T001
# One of its points was [179.456655009654696, -17.623768593111961]
# The output for T001 has: [ -2517744.839244871865958, 7818720.514956817030907 ]
# This is very close to (-2518594.858817033, 7819056.677985735).
# So the projection is correct.
(no output)
3:56