Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [shp2pgsql]

Command line tool for converting shapefiles into database tables.

0
votes
1answer
27 views

shp2pgsql creates one dimensional shapes

I use shp2pgsql to import an .shp ESRI shapefile into PostgreSQL database. I use brew installed shp2pgsql. I used this command first: shp2pgsql -I -s 4326 /path/to/shape_file.shp public.os_gb | psql -...
0
votes
2answers
37 views

Using original shapefile vs osm for routing in South Australia using pgRouting?

I'm looking at building a simple routing application using pgRouting. I'm running on Windows 10 at the moment but could migrate to Windows Server at some point. I'm trying to figure out how best to ...
7
votes
1answer
127 views

Using shp2pgsql instead of ogr2ogr to import shapefile to PostGIS? [closed]

I may very well be doing something wrong here, but: If I import some shapefile to a PostGIS database using shp2pgsql, I have to first figure out the SRID/EPSG of that shapefile. I think this is, at ...
1
vote
1answer
84 views

Why does shp2pgsql generate a MultiPolygon from a Polygon shapefile?

I created a shapefile with a single Polygon in it using QGIS. When I test it with ogrinfo it says it is of type "Polygon". When I convert to GeoJSON using ogr2ogr it also comes out as Polygon. But ...
1
vote
1answer
330 views

Using Python Subprocess module to import shapefile into postgres

I am trying to use your mentioned code..but getting an error. The code used is mentioned below: import os import subprocess cmd = 'shp2pgsql -s 4326 E:\Forest\ForestFire\28052018\...
1
vote
1answer
70 views

Catching shp2psql errors from python's subprocess module

I'm importing data into postgresql with shp2psql and pyhton's subprocess module. command = 'shp2pgsql -s {SRID} -a -g geom -W "UTF-8" {SHP_path} {table_name} -I | ' \ 'psql -h {hostname} -p ...
1
vote
0answers
52 views

Shapefile export issue [closed]

Is there a geometry extension that can be enabled in PostGIS, in order to save Shapefile data in it? I imported Shapefile data in to PostGIS using shp2pgsql plugin, having the notion that PostGIS ...
2
votes
0answers
177 views

“DBF file can not be opened” error using shp2pgsql

I am trying to import a shapefile using shp2pgsql. I wrote this command: shp2pgsql -I -s 2154 -W "LATIN1" W:\IGN\BDPARCELLAIRE-RGF93-LB93-MAJ2013-V4\BDPV_1-2_SHP_LAMB93_D01\COMMUNE.shp CADASTRE....
0
votes
0answers
175 views

Can't open shp2pgsql on Windows 10

I am trying to open shp2pgsql.exe to import shapefile to PostgreSQL. But something happens because shp2pgsql never displays an opening window. For a very little time it seems it will open a window. ...
1
vote
0answers
303 views

shp2pgsql throws “ERROR: current transaction is aborted, commands ignored until end of transaction block”

I am trying to upload a shapefile to postgres using the command : shp2pgsql -I -s 4326 "/Users/abc/Landmark.shp" table_name | psql -U user_name --dbname=db_name I get the error : ERROR: ...
3
votes
1answer
132 views

PostGIS inserting shapefile with shp2pgsql, wrong coordinate system?

I'm trying to load a shapefile (link) into my database with shp2pgsql. shp2pgsql -D -W UTF8 -I -s 4326 scbel01012011_gen13.shp bel | psql -d stat no problem so far, but when I'm trying to get some ...
2
votes
1answer
512 views

How to specify a password with shp2pgsql using CentOS?

I'm developing a python script that uses shp2sql via subprocess.call(). The string I'm using works fine on Linux Mint: shp2pgsql -s 4326 ../data/download.shp ccd_hoods_new | psql -h hostname -d ...
4
votes
1answer
752 views

How to run shp2pgsql in python without reporting every row loaded?

I'm running shp2pgsql in python with a simple script, which works just fine: import os import subprocess cmd = 'shp2pgsql -s 4326 ../data/shp/statistical_neighborhoods.shp temp_table | psql -h ...
1
vote
2answers
160 views

Change decimal commas to points in QGIS created dbf-file

There is a bug in the QGIS desktop application where two merged shapefiles produce a dbf-file with commas as decimal separators. I need to have this merged file imported to PostGIS database, but the ...
0
votes
0answers
36 views

Data limits & runtime of shp2pgsql? [duplicate]

I am using shp2pgsql in a bash script to import shapefiles into postgres. I can successfully do this for shapefiles with hundreds of records however shapefiles with tens of thousands of records (in ...
0
votes
1answer
242 views

Shapefile failing to import using shp2pgsql?

I'm trying to import a shapefile (boundary.shp) using shp2pgsql. I'm using the following query shp2pgsql -I -s 4326 boundary ch01.test_boundary > psql -h 127.0.0.1 -d spatial_database -U postgres ...
1
vote
0answers
97 views

Syntax erro at or near “[” shp2pgsql

I am trying to import a shapefile into my database, but I got a error message when I typed the following command: shp2pgsql -I -s 0 /home/IC/Ferramenta_carga/shp/tl_2016_us_state/tl_2016_us_state.shp ...
5
votes
2answers
550 views

OSGeo4W does not add bin directory to Windows PATH

I am trying to run the following shp2pgsql cmd using the OSGeo4W shell: shp2pgsql -s 4269 -g geom_4269 -I -W "latin1" "tl_2012_states" staging.tl_2012_states | psql -h localhost -p 5432 -d dvdtwo -U ...
0
votes
1answer
137 views

Importing a shapefile with no specifed projection to Postgres?

I am working with a shapefile that does not come with a .prj file - only .shp, .shx and .dbf files. The file's accompanying README says: ALL DATA IS IN A GEOGRAPHIC COORDINATE SYSTEM (NOT PROJECTED) ...
0
votes
1answer
158 views

MULTIPOLYGONM vs MULTIPOLYGON with shp2pgsql

I have already seen this answer I am running the following: shp2pgsql -I -s 3401 -t 2D theShapeFile.shp table_name > file_name.sql And the response I see is: Shapefile type: PolygonM Postgis ...
2
votes
1answer
135 views

shapefile driver table name mismatch for ogr vs. shp2pgsql

I have a shapefile which if I convert to sql statements using shp2pgsql return table name all in lowercase, for e.g. 'liberia'. When I read the same shapefile using ogr and use layer.GetName() it ...
1
vote
0answers
58 views

PostGIS Batch File generation error

I am following the link : http://sharpmap-postgis.blogspot.in/ I have successfully setup my database as mentioned in the above link. I have downloaded and extracted all the source code from the link ...
7
votes
0answers
269 views

Pgadmin 4 doesn't integrate shp2pgsql in the menu? [duplicate]

Recently I updated my pgadmin to 4, and I still wanna use PostGIS Shapefile Import/Export Manager. I didn't find any method to make this happen and even if shp2pgsql-gui still works outside pgadmin, ...
1
vote
0answers
351 views

Password Authentication failed when using shp2psgsql

I want to load shp data in my postgis enabled database. I am typing the command: shp2pgsql -s 4326 -G -I "shapefile_name" public.table_name | psql -h localhost -p 5432 -d gis -U postgres and I am ...
2
votes
1answer
688 views

Importing shapefile issue PostGIS, no import made or recognized reference

I am doing an exercise where I am about to load shapefiles into a PostGIS-database. I am doing it from an already created database and schema, this will mean that the only new item is the table that ...
3
votes
1answer
900 views

How to use shp2pgsql to import a very large shapefile into PostGIS?

I need to import very large datasets into the Postgis server so I need to use the -D option in the prompt. Problem is that I'm getting an error no matter what I do. The command lines I'm using are: ...
3
votes
3answers
185 views

What is the easiest way to avoid shapefile columns being imported as PostGIS `numeric(p,s)` data type?

Considering the number of shapefiles I've imported to PostGIS (using shp2pgsql or ogr2ogr), I'm a little surprised I haven't come across this before. But I have a shapefile that has numeric columns ...
0
votes
2answers
663 views

shp2pgsql: how to know the schema.table?

I want to import a shapefile using shp2pgsql. I am using Mac with Postgis 2.2. Based on this reference: A conversion and upload can be done all in one step using a UNIX pipe: shp2pgsql -s <...
2
votes
1answer
991 views

Changing shapefile (.shp) format to Object File Format (.off) file?

I got a map and its format is .shp. What tool can be used to change it to one of the following file formats .off, .ply, .wrl, .obj, .m, .gim. ?
3
votes
0answers
208 views

Import Large Shapefile to Postgres

I'm trying to import a large dataset to Postgres, of about 600MB, that sits on a remote AWS server. But I get the following error Not enough memory to allocate requested memory (nRecords=26923892). ...
2
votes
2answers
2k views

libiconv-2.dll missing when running shp2pgsql

My system is Windows 7 with PostgreSQL 9.4 and PostGIS 2.2. I'm running shp2pgsql program from command line (cmd window, not PSQL interface). shp2pgsql "D:\file.shp" schema.table > file.sql I'm ...
1
vote
1answer
475 views

How to define the name of the table in shp2pgsql

I use shp2pgsql to append a shapefile to an existing table. How can I define the table where I want to append the shapefile in PostGIS? This is the command I execute with Python: command = "...
2
votes
0answers
374 views

How to install PostGIS shp2pgsql-gui on openSUSE 13.2?

I installed PostgreSQL 9.4.4 together with pgAdmin III (1.20.00) and the PostGIS extension (2.1.7, via the Stack Builder) from http://www.enterprisedb.com/products-services-training/pgdownload on my ...
4
votes
1answer
552 views

Updating SRID (Update_GeometrySRID) does not alter polygons (when it should)

I am trying to change the SRID of polygons layer, but I'm having trouble visualizing the result. I the SRID is misreported the shapefile I used to import into PostGIS. The metadata says the ...
1
vote
1answer
435 views

Why can't I import my shp file into a postgis database with SRID 102631 using shp2pgsql?

I have been trying to figure out the reason shp2pgsql isn't working when I try to import a shapefile with SRID=102631. I've had no problems with other SRIDs. For all shapefiles in 102631, I get this ...
9
votes
4answers
11k views

I have not found shp2pgsql in postgis installation

I have been installed postgis following this guide. All is OK. SELECT postgis_full_version(); "POSTGIS="2.1.7 r13414" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, ...
2
votes
2answers
2k views

Load a shapefile in PostgreSQL database with PHP

I am trying to load a shapefile in a PostGIS database using the exec() command. I have read the format I have to follow from here and I checked several similar questions from the forum. Based on the ...
1
vote
1answer
343 views

PostGIS without shp2pgsql

I recently reinstalled PostGIS on my pc, following these instructions link. The installation is successful, and for several days work using PostgreSQL and PostGIS without problems. Now, I need to ...
11
votes
1answer
590 views

Batch load multiple shapefiles to Postgis

According to the shp2pgsql help, the options drop, append, create and prepare are mutually exclusive. So, if I want to create a table from a shape and then append multiple other shapefiles, I do ...
1
vote
1answer
220 views

Incorrect lat / lon conversion from utm

I used this website to determine that the SRID for my shapefile is 3857. Following that information, I used the shp2pgsql utility to convert my shapefile into the sql I need to insert into PostreSQL (...
0
votes
1answer
89 views

shp2pgsql dumping double fields with comma separator instead of dot

I guess the source shapefile is the culprit, but is there any way to change to fix it through shp2pgsql? Obviously Postgres throw an error with: INSERT INTO "public"."a" ("area","perimeter", ...) ...
5
votes
1answer
411 views

How to Specify FID column name in shp2pgsql

In ogr2ogr I can specify the name of FID column using the option -lco FID={columnname} when importing a spatial data in PostGIS database. I am using shp2pgsql in case of shapefile and cannot find a ...
5
votes
2answers
5k views

How to create a missing dbf file for shapefile?

I have a shape file (shp) which is missing its dbf. I tried to load this into Postgis using shp2pgsql and got the error. could not open shapename.dbf I opened it in QGIS, without issue, and when I ...
1
vote
0answers
222 views

Loading TomTom Multinet with shp2pgsql accented characters

I am tasked with loading a new set of TomTom multinet shape files into a Postgres database using a bespoke tool for the process. The source data is supposedly in UTF-8. I have just realised that ...
1
vote
0answers
148 views

pgRouting with TomTom multiNet

I would like to use TomTom multiNet data with pgRouting to create drive time/distance polygons. I have gone through the documentation regarding network topology creation, but am still confused to ...
1
vote
1answer
1k views

st_startpoint(the_geom) returning empty values

When I upload a shapefile to PostgreSQL using the QGIS tool I can create the routing topology following this tutorial without any problem. But when I use the PostGis Shapefile Import/Export Manager ...
5
votes
2answers
465 views

NConverting Shapefile coordinates into lat/lon?

I'm having a little trouble importing a shapefile into PostgreSQL. Using shp2pgsql, I'm able to import the non-geometry data just fine. However, the geometry data is coming in based on some ...