[英]Insert data in a column geometry on redshift
I created this table on a database in redshift;我在 redshift 的数据库上创建了这个表; and try to insert data.
并尝试插入数据。 Do you know how to insert the point coordinate into the column geometry?
你知道如何将点坐标插入到柱几何中吗?
CREATE TABLE airports_data (
airport_code character(3),
airport_name character varying,
city character varying,
coordinates geometry,
timezone timestamp with time zone
);
INSERT INTO airports_data(airport_code,airport_name,city,coordinates,timezone)
VALUES ('YKS','Yakutsk Airport','129.77099609375, 62.093299865722656', 'AsiaYakutsk');
I had an error when trying to make this insert.尝试制作此插入时出现错误。
Query ELAPSED TIME: 13 m 05 s ERROR: Compass I/O exception: Invalid hexadecimal character(s) found
查询 ELAPSED TIME: 13 m 05 s ERROR: Compass I/O exception: Invalid hexadecimal character(s) found
In Redshift, make your longitude and latitude values into a geometry object. Use:在 Redshift 中,将您的经度和纬度值转换为几何 object。使用:
ST_Point(longitude, latitude) -- for an XY point
ST_GeomFromText('LINESTRING(4 5,6 7)') -- for other geometries
You're missing city in your INSERT VALUES and 'AsiaYakutsk' is not a valid datetime value - see https://docs.aws.amazon.com/redshift/latest/dg/r_Datetime_types.html#r_Datetime_types-timestamptz您在 INSERT VALUES 中缺少城市并且“AsiaYakutsk”不是有效的日期时间值 - 请参阅https://docs.aws.amazon.com/redshift/latest/dg/r_Datetime_types.html#r_Datetime_types-timestamptz
Ignoring your timezone column and adding city into values, use this:忽略您的时区列并将城市添加到值中,使用:
INSERT INTO airports_data(airport_code,airport_name,city,coordinates)
VALUES ('YKS','Yakutsk Airport','Yakutsk',ST_Point(129.77099609375, 62.093299865722656));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.