Browse Source

Merge branch 'master' of https://github.com/geocompass/pg-coordtransform

liuhang 6 năm trước cách đây
mục cha
commit
9e07d0ff9c

+ 1 - 1
geoc-pg-coordtransform.sql

@@ -207,7 +207,7 @@ BEGIN
     FOR single_polygon IN SELECT ST_ExteriorRing ((st_dumprings($1)).geom) as geom LOOP				
         source_npoints := ST_NPoints(single_polygon); 
         single_line  := ST_RemovePoint(single_polygon, source_npoints - 1);  
-        single_line_trans := geoc_ws84tobd09_line(single_line);  
+        single_line_trans := geoc_wgs84tobd09_line(single_line);  
         target_parts := array_append(target_parts, ST_AddPoint(single_line_trans, ST_PointN(single_line_trans, 1)));  
     END LOOP;
     SELECT ST_MakePolygon(target_parts[1], target_parts[2:array_upper(target_parts, 1)]) INTO final_geom;  

+ 3 - 6
src/geoc_bd09togcj02.sql

@@ -6,12 +6,9 @@ DECLARE
 		multiArr          geometry[]; 
 	
 BEGIN
--- 	IF st_srid(geom) != '4490' THEN
--- 			RETURN geom;
--- 	end if;
--- 	IF st_srid(geom) != '4326' THEN
--- 			RETURN geom;
--- 	end if;
+IF st_srid(geom) != '4490' and  st_srid(geom) != '4326'THEN
+        RETURN null;
+	end if;
  	CASE ST_GeometryType(geom)
     	when 'ST_LineString' then 
 			return geoc_bd09togcj02_line(geom);

+ 3 - 6
src/geoc_bd09towgs84.sql

@@ -6,12 +6,9 @@ DECLARE
 		multiArr          geometry[]; 
 	
 BEGIN
--- 	IF st_srid(geom) != '4490' THEN
--- 			RETURN geom;
--- 	end if;
--- 	IF st_srid(geom) != '4326' THEN
--- 			RETURN geom;
--- 	end if;
+	IF st_srid(geom) != '4490' and  st_srid(geom) != '4326'THEN
+        RETURN null;
+	end if;
  	CASE ST_GeometryType(geom)
     	when 'ST_LineString' then 
 			return geoc_bd09towgs84_line(geom);

+ 3 - 6
src/geoc_gcj02tobd09.sql

@@ -2,12 +2,9 @@ CREATE OR REPLACE FUNCTION "public"."geoc_gcj02tobd09"("geom" "public"."geometry
   RETURNS "public"."geometry" AS $BODY$
 DECLARE
 BEGIN
--- IF st_srid(geom) != '4490' THEN
---         RETURN null;
--- end if;
--- IF st_srid(geom) != '4326' THEN
---         RETURN null;
--- end if;
+IF st_srid(geom) != '4490' and  st_srid(geom) != '4326'THEN
+        RETURN null;
+end if;
 case ST_GeometryType(geom)
     when 'ST_LineString' then 
 			return geoc_gcj02tobd09_line(geom);

+ 1 - 1
src/geoc_gcj02towgs84.sql

@@ -2,7 +2,7 @@ CREATE OR REPLACE FUNCTION "public"."geoc_gcj02towgs84"("geom" "public"."geometr
   RETURNS "public"."geometry" AS $BODY$
 DECLARE
 BEGIN
-IF st_srid(geom) != 4490 and  st_srid(geom) != 4326 THEN
+IF st_srid(geom) != '4490' and  st_srid(geom) != '4326'THEN
         RETURN null;
 end if;
 case ST_GeometryType(geom)

+ 3 - 6
src/geoc_wgs84tobd09.sql

@@ -2,12 +2,9 @@ CREATE OR REPLACE FUNCTION "public"."geoc_wgs84tobd09"("geom" "public"."geometry
   RETURNS "public"."geometry" AS $BODY$
 DECLARE
 BEGIN
--- IF st_srid(geom) != '4490' THEN
---         RETURN null;
--- end if;
--- IF st_srid(geom) != '4326' THEN
---         RETURN null;
--- end if;
+IF st_srid(geom) != '4490' and  st_srid(geom) != '4326'THEN
+        RETURN null;
+end if;
 case ST_GeometryType(geom)
   when 'ST_LineString' then 
 		return geoc_wgs84tobd09_line(geom);

+ 1 - 1
src/geoc_wgs84tobd09_polygon.sql

@@ -16,7 +16,7 @@ BEGIN
     FOR single_polygon IN SELECT ST_ExteriorRing ((st_dumprings($1)).geom) as geom LOOP				
         source_npoints := ST_NPoints(single_polygon); 
         single_line  := ST_RemovePoint(single_polygon, source_npoints - 1);  
-        single_line_trans := geoc_ws84tobd09_line(single_line);  
+        single_line_trans := geoc_wgs84tobd09_line(single_line);  
         target_parts := array_append(target_parts, ST_AddPoint(single_line_trans, ST_PointN(single_line_trans, 1)));  
     END LOOP;
     SELECT ST_MakePolygon(target_parts[1], target_parts[2:array_upper(target_parts, 1)]) INTO final_geom;  

+ 3 - 3
src/geoc_wgs84togcj02.sql

@@ -6,9 +6,9 @@ DECLARE
 		multiArr          geometry[]; 
 	
 BEGIN
-	IF st_srid(geom) != 4490 and st_srid(geom) != 4326 THEN
-			RETURN null;
-	end if;
+IF st_srid(geom) != '4490' and  st_srid(geom) != '4326'THEN
+        RETURN null;
+end if;
  	CASE ST_GeometryType(geom)
     	when 'ST_LineString' then 
 			return geoc_wgs84togcj02_line(geom);