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

Syntax error when loading shapefile #8

Open
jakerbrown opened this issue Aug 14, 2020 · 15 comments
Open

Syntax error when loading shapefile #8

jakerbrown opened this issue Aug 14, 2020 · 15 comments

Comments

@jakerbrown
Copy link

I have progressed to the end of this help page: https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/PostGIS-on-FASRC

But when running the last command, loading the shapefile, I get the following error:

usvotersdb=# shp2pgsql -I US_place_2010.shp US_place_2010 | psql -d usvotersdb -h localhost -p 8521;
ERROR: syntax error at or near "shp2pgsql"
LINE 1: shp2pgsql -I US_place_2010.shp US_place_2010 | psql -d usvot...
^
Time: 2.448 ms

@dkakkar
Copy link
Collaborator

dkakkar commented Aug 14, 2020

I have progressed to the end of this help page: https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/PostGIS-on-FASRC

But when running the last command, loading the shapefile, I get the following error:

usvotersdb=# shp2pgsql -I US_place_2010.shp US_place_2010 | psql -d usvotersdb -h localhost -p 8521;
ERROR: syntax error at or near "shp2pgsql"
LINE 1: shp2pgsql -I US_place_2010.shp US_place_2010 | psql -d usvot...
^
Time: 2.448 ms

You don't need to do this step. It is just for reference in case you want to upload a shapefile. In your case we are using database dumps.

@jakerbrown
Copy link
Author

Thank you. As a clarification, each time I want to run some knn analysis in postgis on the FASRC, I need to run through the instructions from this page: https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/PostGIS-on-FASRC , and then move to this page https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/KNN-calculation ?

@dkakkar
Copy link
Collaborator

dkakkar commented Aug 14, 2020

Thank you. As a clarification, each time I want to run some knn analysis in postgis on the FASRC, I need to run through the instructions from this page: https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/PostGIS-on-FASRC , and then move to this page https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/KNN-calculation ?

Please follow the order:
Launch PostGIS: https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/PostGIS-on-FASRC
Import Database:https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/Loading-and-Exporting-US-voters-database
Run KNN: https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/KNN-calculation

@jakerbrown
Copy link
Author

Okay, thank you. I imported the database (2012 US voterfile) prior to launching PostGIS. Was this incorrect?

@jakerbrown
Copy link
Author

Also, importing the database took approximately 10 hours. So when asking for time from FASRC, I need to budget time for this each time? I apologize if my questions are unclear.

@dkakkar
Copy link
Collaborator

dkakkar commented Aug 14, 2020

Okay, thank you. I imported the database (2012 US voterfile) prior to launching PostGIS. Was this incorrect?

Launch Postgis is the first step in Import instructions. Wondering how you imported without launching PostGIS?

@dkakkar
Copy link
Collaborator

dkakkar commented Aug 14, 2020

Also, importing the database took approximately 10 hours. So when asking for time from FASRC, I need to budget time for this each time? I apologize if my questions are unclear.

It Should not take that long. It took me an hour or so for 2018. How big is 2012?

@dkakkar
Copy link
Collaborator

dkakkar commented Aug 14, 2020

Also, importing the database took approximately 10 hours. So when asking for time from FASRC, I need to budget time for this each time? I apologize if my questions are unclear.

It should not take that long. It took me an hour or so for 2018. How big is 2012? How many voters? How many fields?

@jakerbrown
Copy link
Author

I might be using the terminology wrong here. I thought the "Importing Database" link you shared referred to creating the pgsql dump?

@dkakkar
Copy link
Collaborator

dkakkar commented Aug 14, 2020

I might be using the terminology wrong here. I thought the "Importing Database" link you shared referred to creating the pgsql dump?

Importing refers to importing to Postgis using CSV file. Once you have imported we export and store as psql dump to use the dump for future imports as it is faster. Since FASRC resource is temporary you might have to import multiple times. Please use 256 GB RAM and 168:00:00 hours (7 days) and 2 CPU device as your POSTGIS parameters when you are ready to do the work, for testing you could use smaller values. These are maximum values of the parameters. However, make sure you use them otherwise your credit on FASRC will go down if you keep them idle for long.

@jakerbrown
Copy link
Author

So the instructions in "Loading and Exporting US voters database"
(https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/Loading-and-Exporting-US-voters-database) do not refer to creating the dump? I was under the impression yesterday that I was running those instructions to create the dump, which we discussed in a different issue (#4). But if not, I am confused as to what I was doing.

@dkakkar
Copy link
Collaborator

dkakkar commented Aug 14, 2020 via email

@jakerbrown
Copy link
Author

Thanks for the continued help on this!

So based on the order above:

Launch PostGIS: https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/PostGIS-on-FASRC
Import Database:https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/Loading-and-Exporting-US-voters-database
Run KNN: https://github.com/cga-harvard/GIS_Apps_on_HPC/wiki/KNN-calculation

I was able to get through all of "Launch PostGIS", but if I used "Import Database" to create the dump yesterday, what is it I need to do with those instructions now? Re-run them, but this time it does something different?

@dkakkar
Copy link
Collaborator

dkakkar commented Aug 14, 2020 via email

@jakerbrown
Copy link
Author

Does importing the database refer to the instructions in "Launch PostGIS" where we are restoring the database from the dump? Or the running of import.sql in "Import Database"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants