geoc_wgs84togcj02.sql 870 B

12345678910111213141516171819202122232425262728293031
  1. CREATE OR REPLACE FUNCTION "public"."geoc_wgs84togcj02"("geom" "public"."geometry")
  2. RETURNS "public"."geometry" AS $BODY$
  3. DECLARE
  4. i geometry;
  5. transform_i geometry;
  6. multiArr geometry[];
  7. BEGIN
  8. IF st_srid(geom) != 4490 and st_srid(geom) != 4326 THEN
  9. RETURN geom;
  10. end if;
  11. CASE ST_GeometryType(geom)
  12. when 'ST_LineString' then
  13. return geoc_wgs84togcj02_line(geom);
  14. when 'ST_MultiLineString' then
  15. return geoc_wgs84togcj02_multiline(geom);
  16. when 'ST_Point' then
  17. return geoc_wgs84togcj02_point(geom);
  18. when 'ST_MultiPoint' then
  19. return geoc_wgs84togcj02_multipoint(geom);
  20. when 'ST_Polygon' then
  21. return geoc_wgs84togcj02_polygon(geom);
  22. when 'ST_MultiPolygon' then
  23. return geoc_wgs84togcj02_multipolygon(geom);
  24. ELSE
  25. RETURN null;
  26. END CASE;
  27. END;
  28. $BODY$
  29. LANGUAGE plpgsql VOLATILE
  30. COST 100