How to importing Geospatial data

I finished reading the article about importing geospatial data,but I still can’t understand.I’ve been following his steps, but I reported a mistake.

Hi @misill_zhu,

Welcome to the community.

Could you share the article you are referring to and your use case with us?

Are we talking about this one?

Regards,
Candido

Hi @candido.dessanti
I’ve come to this step.


But something went wrong “Session not valid”
Regards,
Misill

Hi,

the “session not valid” error comes out when the session is disconnected for whatever reason or when you never connected to the database(for example when you typed the wrong password at login, or in the case of EE/FREE edition when the license is expired/not entered).

Could please be sure that you can connect freely to the database and run other queries without any errors?

I tried the example of our docs and it worked flawlessly.

omnisql> create table test_geo (p point, l linestring,po polygon);
omnisql> insert into test_geo values('POINT(20 20)', 'LINESTRING(40 0, 40 40)', 
..> 'POLYGON(( 0 0, 40 0, 40 40, 0 40, 0 0 ))');
omnisql> select * from test_geo;
p|l|po
POINT (20 20)|LINESTRING (40 0,40 40)|POLYGON ((0 0,40 0,40 40,0 40,0 0))

Regards,
Candido

Hi, @candido.dessanti
I reconnected the database and it’s OK,
but the next step went wrong again.


Regards,
Misill

Hi,

That command has to be run from the shell and not from the omnisql, but it looks that something got mixed up into the docs and it looks confusing.

The omnisql is used to to run sql statement in the database and other commands like copy.

So to follow the example you should create a file like the geo.csv using a unix shell, and then ingest data into the database using omnisql and the copy command.

Anyway that’s only an example to explain how to load a delmited file that contains geometries; you can use alternate methods depending on where your data is.

Candido