I'm trying to import WKT (http://polygons.openstreetmap.fr/get_wkt.py?id=2413177&params=0 - boundary of one of districts of Łódź) into PostGIS database and convert it to geometry. I've created table 'districts' with 'the_geom geometry', id and name of the district. When I tried to insert data with

INSERT INTO districts (name, the_geom) VALUES ('Polesie', ST_GeomFromText('<<<WKT goes here>>>', 4326))

the the_geom field is left empty. In fact, even query like SELECT ST_GeomFromText('...', 4326) returns empty query. I also tried to create text field in the table, insert WKT data in there and then run UPDATE districts SET the_geom=ST_GeomFromText('...', 4326) but it doesn't work. I tried to use query from http://www.postgis.org/docs/ST_GeomFromText.html and it worked.

Could anyone help me with this one? Am I doing something wrong, or the WKT is just too big?

Definition of my table:

CREATE TABLE dzielnice
  name character varying(30),
  the_geom geometry,
  wkt text,
  id bigserial NOT NULL,
  CONSTRAINT dzielnice_pkey PRIMARY KEY (id),
  CONSTRAINT dzielnice_id_key UNIQUE (id)
  • 1
    Have you tried "VALUES" in your insert? – user30184 Apr 27 '15 at 4:38
  • Sorry, I corrected that. I used VALUES of course, VALUE would throw an error AFAIR. Still, even SELECT ST_GeomFromText('...', 4326) doesn't work, and that's probably the simplest query you can make. I tried with different WKT (simple POINT and some small multipolygon) and my query worked perfectly. – Maciek Apr 27 '15 at 7:22
  • If SELECT ST_GeomFromText('POINT (1 1)',4326);does not return anything you must have something wrong in your installation. – user30184 Apr 27 '15 at 8:27

Do you get any error message? If not, there is no error and your data is there. It is just a limit how much data pgAdmin shows.

You can increase that value in options, I think default is 256 bytes or characters.

You can check if your geoemtry is there for instance by querying number of points


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.