Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql postgis中的坐标类型_Postgresql_Postgis - Fatal编程技术网

Postgresql postgis中的坐标类型

Postgresql postgis中的坐标类型,postgresql,postgis,Postgresql,Postgis,尝试将数据插入postgis几何体列时出错 错误:坐标值超出地理类型的范围[-180-90,180-90] SQL状态:22023 我的插入查询是 INSERT INTO meter1(meter_id, meter_no,location,type) VALUES ('M1', 200,ST_GeographyFromText('SRID=3857; POINT(256300.11 9856321.09)'),'automatic' ); 首先,它看起来是一种可能不需

尝试将数据插入postgis几何体列时出错

错误:坐标值超出地理类型的范围[-180-90,180-90] SQL状态:22023

我的插入查询是

INSERT INTO meter1(meter_id, meter_no,location,type) 
 VALUES ('M1', 200,ST_GeographyFromText('SRID=3857;  
        POINT(256300.11 9856321.09)'),'automatic' );

首先,它看起来是一种可能不需要使用地理类型的情况

如果您的数据在地理上是紧凑的(包含在州、县或市内),请使用几何体类型和笛卡尔投影,这对您的数据是有意义的

话虽如此,如果您毕竟需要使用地理类型,您必须接受地理列只能以度而不能以米为单位保存值。因此,您需要将数据转换为支持lat、lng的空间参考系统。因此,您的查询需要更改如下:

INSERT INTO meter1(meter_id, meter_no,location,type)    
VALUES ('M1', 200,
    ST_Transform(ST_SetSrid(ST_GeomFromText('POINT(256300.11 9856321.09)'), 3587), 4326),
    'automatic' );

这里要使用的函数是

嗯,256300.11和9856321.09的误差似乎是不言自明的,恰好比180e4c5大得多,但是如何插入坐标或我要更改什么数据来自何处?e4c5是管网和仪表的一部分。。空间参考id为32737(UTM分区37南)。为各种实体提供以下信息。仪表仪表编号位置类型M1 20345(256 300.11,9 856 321.09)自动M2 20346(256 922.39,9 856 320.28)手动M3 20347(257 673.53,9 856 332.67)自动