1

I am new to both PostgreSQL and GeoJson. While following some of the tutorials online and some answer over here I wrote this line to import my geojson file:

ogr2ogr -f "PostgreSQL" PG:"dbname=In user=postgres" "C:\Users\hp\Downloads\red\map.geojson" -nln locations -append

But this line produces a syntax errorERROR: syntax error at or near "ogr2ogr"

I also followed the instructions on this answer Store GeoJson with Feature Collection

The data is shown but only on running the query given in the answer above. But how do I store this data. I am not able to find it by doing select * from table _name. Also the answer given on the above link shows data as expected but It is only shown the data and not storing it.

If anyone can help me insert the geojson file either by using the ogr2ogr or by helping me to insert data in table by using the link above.

asked Feb 12, 2018 at 4:11
3
  • Where did you type your command? It is a shell command, use cmd or powershell window. Donot forget to install gdal/ogr utilities. Commented Feb 12, 2018 at 7:07
  • i am running it in cmd. Also, Do I need to run it in postgresql env or jusr in cmd(if postgre is added to path variables) Commented Feb 12, 2018 at 8:14
  • 1
    if you installed PostgreSQL/PostGIS via EnterpriseDB or BigSQL distributions, GDAL should have come shipped with the installation. you should find the ogr2ogr.exe in ./path/to/postgres/PostgreSQL/<your_version>/bin if I'm not mistaken (not 100% sure, you might need to search the installation path). see if you can execute your command in a cmd from within that folder containing the .exe. this folder needs to be added to PATH for windows to find it. Commented Feb 12, 2018 at 10:17

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.