[postgis-devel] Bad proj4text strings in spatial_ref_sys?

Michael Fuhr mike at fuhr.org
Sat Nov 4 11:14:09 PST 2006


I wrote a function to look for unusable SRIDs and it found 29 in
the latest spatial_ref_sys.  Below are the function and output --
am I doing something wrong or are these proj4text strings incorrect
because they're missing a +proj= parameter?

CREATE FUNCTION srid_test(OUT bad_srid integer, OUT error text)
RETURNS SETOF record
AS $$
DECLARE
    geom  geometry := GeomFromEWKT('SRID=4326;POINT(-100 40)');
    rec   record;
BEGIN
    FOR rec IN SELECT srid FROM spatial_ref_sys LOOP
        BEGIN
            PERFORM transform(geom, rec.srid);
        EXCEPTION
          WHEN others THEN
            bad_srid := rec.srid;
            error := SQLERRM;
            RETURN NEXT;
        END;
    END LOOP;
END;
$$ LANGUAGE plpgsql STABLE;

SELECT * FROM srid_test() ORDER BY bad_srid;
 bad_srid |                                                              error                                                              
----------+---------------------------------------------------------------------------------------------------------------------------------
     2046 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ': projection not named
     2047 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ': projection not named
     2048 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ': projection not named
     2049 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ': projection not named
     2050 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ': projection not named
     2051 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ': projection not named
     2052 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ': projection not named
     2053 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ': projection not named
     2054 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ': projection not named
     2055 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ': projection not named
    22275 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.145 +b=6356514.966398753 +units=m +no_defs ': projection not named
    22277 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.145 +b=6356514.966398753 +units=m +no_defs ': projection not named
    22279 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.145 +b=6356514.966398753 +units=m +no_defs ': projection not named
    22281 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.145 +b=6356514.966398753 +units=m +no_defs ': projection not named
    22283 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.145 +b=6356514.966398753 +units=m +no_defs ': projection not named
    22285 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.145 +b=6356514.966398753 +units=m +no_defs ': projection not named
    22287 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.145 +b=6356514.966398753 +units=m +no_defs ': projection not named
    22289 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.145 +b=6356514.966398753 +units=m +no_defs ': projection not named
    22291 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.145 +b=6356514.966398753 +units=m +no_defs ': projection not named
    22293 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.145 +b=6356514.966398753 +units=m +no_defs ': projection not named
    22300 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+a=6378249.2 +b=6356515 +pm=paris +units=km +no_defs ': projection not named
    29371 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=bess_nam +to_meter=1.0000135965 +no_defs ': projection not named
    29373 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=bess_nam +to_meter=1.0000135965 +no_defs ': projection not named
    29375 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=bess_nam +to_meter=1.0000135965 +no_defs ': projection not named
    29377 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=bess_nam +to_meter=1.0000135965 +no_defs ': projection not named
    29379 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=bess_nam +to_meter=1.0000135965 +no_defs ': projection not named
    29381 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=bess_nam +to_meter=1.0000135965 +no_defs ': projection not named
    29383 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=bess_nam +to_meter=1.0000135965 +no_defs ': projection not named
    29385 | AddToPROJ4SRSCache: couldn't parse proj4 string: '+ellps=bess_nam +to_meter=1.0000135965 +no_defs ': projection not named
(29 rows)

-- 
Michael Fuhr



More information about the postgis-devel mailing list