Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve SHPRead function ? #839

Closed
ebocher opened this issue Jun 27, 2017 · 17 comments
Closed

Improve SHPRead function ? #839

ebocher opened this issue Jun 27, 2017 · 17 comments
Assignees
Labels
Milestone

Comments

@ebocher
Copy link
Member

ebocher commented Jun 27, 2017

It would be nice if the SHPRead function returns a ValueResulSet as CSVRead function. So the user will be able to do something like

SELECT SUM(ST_AREA(THE_GEOM)) AS total from (SELECT * FROM SHPREAD('/tmp/myFile.shp')) GROUP BY CODE_INSEE;

It is closer to the SQL syntax than "CALL SHPRead".

@nicolas-f
Copy link
Member

SHPREAD must create a primary key column. This thing is not possible with table result set.

@ebocher
Copy link
Member Author

ebocher commented Jun 28, 2017

So you think that we cannot emulate a SERIAL column with a SimpleResultSet ?

@nicolas-f
Copy link
Member

SERIAL is not a column type its an alias for auto increment primary key when creating tables.

@ebocher
Copy link
Member Author

ebocher commented Jun 28, 2017

Ok. According to you it's not possible to do that ?

@nicolas-f
Copy link
Member

It should be another function name.

@ebocher
Copy link
Member Author

ebocher commented Jun 28, 2017

Maybe :

SHPREAD -> Read a file
SHPImport -> Import a file (previously SHPREAD)

@ebocher
Copy link
Member Author

ebocher commented Jun 28, 2017

@gpetit

@ebocher ebocher added this to the H2GIS 1.4.X milestone Aug 24, 2017
@gpetit
Copy link
Contributor

gpetit commented Feb 26, 2018

Ok to distinguish the behaviours.

  • SHPRead : the shape file is imported as a whole and there is no possibility to make query on it.
  • SHPImport : the shape file is imported and we can call it thanks to sub query

In both cases, a PK is added

@ebocher
Copy link
Member Author

ebocher commented Feb 26, 2018

When the SHP is imported the data are stored in the database so you can do what you want in SQL.

@gpetit
Copy link
Contributor

gpetit commented Feb 27, 2018

Yes I know but your initial question was to be able to make SQL selection during the import step (not once the shp is stored into a table) ? Isn't it ?

@ebocher
Copy link
Member Author

ebocher commented Apr 9, 2018

It would be nice to support this syntax for all driver functions

CALL SHPWRITE('/tmp/theshape.shp', '(SELECT * FROM geomtable where st_area(the_geom) >10000 )');

@nicolas-f nicolas-f removed their assignment May 18, 2018
@ebocher
Copy link
Member Author

ebocher commented Jan 15, 2019

CALL SHPWRITE('/tmp/theshape.shp', '(SELECT * FROM geomtable where st_area(the_geom) >10000 )'[,encoding] );

is now supported

@gpetit

@ebocher
Copy link
Member Author

ebocher commented Jan 23, 2019

@gpetit ping for doc

@gpetit
Copy link
Contributor

gpetit commented Jan 29, 2019

I'm on it

@ebocher ebocher added the Doc Documentation label Jun 29, 2020
@gpetit
Copy link
Contributor

gpetit commented Aug 26, 2020

The SHPWRITE function has been updated (in the code and the doc).
But what about the SHPREAD one ? Are we still planning to update it following @ebocher 's reflexions?

@ebocher
Copy link
Member Author

ebocher commented Aug 26, 2020

SHPREAD has been updated with the signature :

 addProperty(PROP_REMARKS, "Read a shape file and copy the content in the specified table."+
                "\n SHPRead(..."+
                "\n Supported arguments :" +
                "\n path of the file" +
                "\n path of the file, table name"+
                "\n path of the file, true for delete the table with the same file name"+
                "\n path of the file, table name, true to delete the table name"+
                "\n path of the file, table name, true to delete the table name"+
                "\n path of the file, table name, encoding chartset"+
                "\n path of the file, table name, encoding chartset, true to delete the table name");

Note that SHPRead doesn't support zip archive as entry

@gpetit
Copy link
Contributor

gpetit commented Aug 26, 2020

Ok thanks

@ebocher ebocher mentioned this issue Aug 26, 2020
8 tasks
@ebocher ebocher closed this as completed Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants