 --   ST_DistanceToNorthPole(geom_in)
 --
 -- DESCRIPTION:
---   Returns distance in meters to South Pole
+--   Returns distance in meters to South Pole - if error occurs returns 1000000001
 --
 -- USAGE:
 --   SELECT ST_DistanceToNorthPole(geom_in geometry);

                                text_var2 = PG_EXCEPTION_DETAIL,
                                text_var3 = PG_EXCEPTION_HINT;
        raise WARNING 'ST_DistanceToSouthPole: exception occured: Msg: %, detail: %, hint: %', text_var1, text_var1, text_var3;
        RETURN TRUE;

END
$$ LANGUAGE 'plpgsql' IMMUTABLE;

    ELSE

        -- AntiMeridian is crossed
        IF ST_IsPolygonCW(geom_in) AND abs(ST_XMax(geom_in) - ST_XMin(geom_in)) > 360 THEN
            --RAISE NOTICE 'Polygon is CW and abs > 360';
            RETURN TRUE;
        ELSIF ST_Intersects(geom_in::geography, blade) THEN
            --RAISE NOTICE 'Polygon intersects blade';
