geoc_bd09towgs84_point.sql 598 B

12345678910111213141516171819202122232425
  1. CREATE OR REPLACE FUNCTION "public"."geoc_bd09towgs84_point"("geom" "public"."geometry")
  2. RETURNS "public"."geometry" AS $BODY$
  3. DECLARE
  4. x numeric;
  5. y numeric;
  6. gcj_point geometry;
  7. wgs_point geometry;
  8. BEGIN
  9. if st_geometrytype(geom) != 'ST_Point' then
  10. return null;
  11. end if;
  12. x := st_x(geom);
  13. y := st_y(geom);
  14. if (geoc_is_in_china_bbox(x, y) = false) then
  15. return geom;
  16. end if;
  17. gcj_point = geoc_bd09togcj02_point(geom);
  18. wgs_point = geoc_gcj02towgs84_point(gcj_point);
  19. return wgs_point;
  20. END;
  21. $BODY$
  22. LANGUAGE plpgsql VOLATILE
  23. COST 100