2

I am trying to import a shapefile into PgAdmin4. I do it with PostGis Shapefile Import/Export Manager. I have a « connection failed » message with no explanation so I do no know where to search … PostGis Shapefile Import/Export Manager message My datatable does not seem to have encoding problem anymore, my path neither .. And I can open the shapefile in arcgis/qgis. shapefile table

Does someone has a suggestion ?

UPDATE I set the correct SRID, still not working.PostGis Shapefile Import/Export Manager message with correct SRID

J.Delannoy
  • 505
  • 2
  • 18
  • 2
    did you tried to define the SRID? – Moh Apr 25 '18 at 15:21
  • 1
    What happens when you open the connection detail and click ok? (it should attempt to connect to the DB) – JGH Apr 25 '18 at 15:41
  • @JGH I succeeded in connecting to the DB, which is empty. But then I can't import the shp – J.Delannoy Apr 26 '18 at 06:43
  • @User2009 Indeed srid=0, my SRID is defined for mon shapefile but not while importing. In the tutorials I red, thez said to define it after importing the shapefile – J.Delannoy Apr 26 '18 at 06:44
  • @User2009 my Postgis database is in UTF8 and my shapefile too, according to my cpg file – J.Delannoy Apr 26 '18 at 09:30
  • @J.Delannoy SRID can be define by uploading .prj in this link and it will give you the number (SRID) – Moh Apr 26 '18 at 10:12
  • @User2009, thank you, My SRID is 2154. I set it , still not working – J.Delannoy Apr 26 '18 at 10:28
  • @J.Delannoy you don't need any SRID for the database, this SRID (2154) just for importing your shape file – Moh Apr 26 '18 at 10:31
  • @User2009 Yes I understood that few minutes layer, sorry. I updated my post, still not working – J.Delannoy Apr 26 '18 at 10:35
  • Try from the Options button, click on (Loading data using copy, create spatial automatically) – Moh Apr 26 '18 at 10:36
  • both are already checked – J.Delannoy Apr 26 '18 at 10:37
  • oh, that's strange. Anyway you can use (shp2pgsql) from this answer. Sorry but this is actually what can I help with. good luck – Moh Apr 26 '18 at 10:39
  • thanks, can you just say me where to execute this line ? I am not working from the shell and I have WIndows – J.Delannoy Apr 26 '18 at 11:43
  • It might be worth checking in the DB: has the layer been created? (if yes, change the 'create' option). If not, can the user create a table in the public schema? Do you have PostGIS enabled in this DB? – JGH Apr 26 '18 at 12:26
  • no it is not already created (even if I tried both). The user is me right ? Yes I can create tables and postgis is enabled – J.Delannoy Apr 26 '18 at 12:31
  • It was so stupid ... I didn't enabled postgis in this DB but in another .. That xas the problem !! Thank you very much ! – J.Delannoy Apr 26 '18 at 12:34

1 Answers1

3

Finally, that was quite a simple stupid error : I forgot to enable postgis in this specific Database, as JGH mentionned !

If you have the same problem, run "CREATE EXTENSION postgis", and everything should work !

J.Delannoy
  • 505
  • 2
  • 18