Skip to main content
10 events
when toggle format what by license comment
Sep 15, 2016 at 13:16 comment added user82538 I want to according to this result to calculate the Hilbert value,so I want to added this result to the table or have any others idea to connect the ogc_fid and the MBR ?
Sep 15, 2016 at 10:46 comment added Matte Usually you would not add it to this table as it is a new geometry. When you have your select-statement in order just create a new table or view with it. That you can use to visualize or use it for other tasks (e.g. calculating the area).
Sep 15, 2016 at 10:25 comment added user82538 but I don't know if I calculate the MBR,what should I do to add the result to the table?
Sep 15, 2016 at 5:36 comment added user82538 I load the data directly to new table by ogr2ogr ,and when I running Select ST_Envelope(St_GeomFromWKB(wkb_geometry, '4326')) from test_1 where ogc_fid=1; it show WARNING: OGC WKB expected, EWKB provided - use GeometryFromEWKB() for this st_envelope -------------------------------------------------------------------------------- 010300……(1 row) so I guess the Before error is because of load data ,but why have the warning?
Sep 15, 2016 at 1:49 comment added user82538 I already run CREATE table test2( WKT text,fnode_ integer,tnode_ integer,lpoly_ integer,rpoly_ integer,length double precision,riverf_ integer,riverf_id integer,code integer,gb integer,hydc text,tn integer,name text); and COPY test2 FROM '/home/pj/Desktop/test1.csv' CSV header; but prompt error: ERROR: extra data after last expected column CONTEXT: COPY test2, line 2: ""LINESTRING (121.28987121582 31.852741241455099,121.286529541015994 31.8526306152344,121.28036499023..."
Sep 15, 2016 at 0:39 comment added user82538 yep,I know use COPY should have same column, first I using ogr2ogr load the table(new table,named test),and I go to 【pgAdmin】to see the SQL of the table scheme. And I create new table(named test1) column and create column the same as the test. So I think the table(test1) have the same column .(Because the next step I want to using cities,so I must create new table)
Sep 14, 2016 at 13:18 comment added Matte How did you bring the .csv into the database? Because it has WKT as geometry format and your column wkb. I guess that the error lies there. When you import the csv you need to have the same columns. Lets test the following: Create a new table with all columns named like the ones in your .csv file. The WKT-Column as text. Then COPY new_table FROM "file" . The copy command needs the same amount of columns in the input and output table. Try your query with the new table.
Sep 14, 2016 at 11:59 comment added user82538 and when I running:` Select ST_GeomFromText(wkb_geometry,0) from test1;` the prompt > ERROR: function st_geomfromtext(bytea, integer) does not exist LINE > 1: Select ST_GeomFromText(wkb_geometry,0) from test1; > ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. I have already don't know what the wkb_geometry format –
Sep 14, 2016 at 11:58 comment added user82538 I load the data by ogr2ogr(.shp -----> .csv ) and when I running Select ST_Envelope(St_GeomFromWKB(wkb_geometry, 4326)) from test1; The prompt: ERROR: Invalid endian flag value encountered. and when I running: SELECT wkb_geometry From test1 where fnode_=1; the web_geometry is \x4c494e45535452494e4720283132312e32393636373932373136333234‌​39392033312e38353239‌​34383130313631323438‌​2c3132312e3239353838‌​333137383731 > 3039382033312e38343933353536393736333137393729
Sep 14, 2016 at 6:09 history answered Matte CC BY-SA 3.0