[postgis-users] Error while importing data
strk at refractions.net
strk at refractions.net
Mon Mar 14 04:56:51 PST 2005
On Mon, Mar 14, 2005 at 12:40:10PM +0000, Nigel Kukard wrote:
> sorry, forgot to mention that
>
> i have thousands of shapfiles for air transport... the first one I
> import creates the table, the second i append ...
>
> here is the statements created when I imported the very first shapefile..
>
> BEGIN;
> CREATE TABLE "air_transport_area" (gid serial, "gdo_gid" int8, "tag"
> varchar, "feat_type" varchar, "geom_type" varchar, "mapsheet" varchar,
> "row_status" varchar, "lock_date" varchar(8), "selection_" varchar,
> "version_nu" numeric, "version_da" varchar(8), "version_st" varchar,
> "modified_b" varchar, "retired_da" varchar(8), "original_g" numeric,
> "create_dat" varchar(8), "data_sourc" varchar, "est_revisi" varchar(8),
> "source_ver" int8, "source_pro" int8, "source_pro__19" int8,
> "source_con" varchar, "capture_in" int8, "descriptio" varchar);
> SELECT
> AddGeometryColumn('','air_transport_area','the_geom','-1','MULTIPOLYGON',4);
Here you specify that the geometry column will store geometries with
4 dimensions (XYZM). If you want to be free to add other-dimensioned
geometries an option you have is to drop the enforce_dims_the_geom constraint
on your table. Note that in that case your geometry_columns entry will
contain a non-true specification. You might want to use a fake value
there, as a notice of 'freely-dimensioned', like '-1'.
Maybe we should support -1 as a dimension value to specify this, like
we do for SRID...
--strk;
> COPY "air_transport_area"
> (gid,"gdo_gid","tag","feat_type","geom_type","mapsheet","row_status","lock_date","selection_","version_nu","version_da","version_st","modified_b","retired_da","original_g","create_dat","data_sourc","est_revisi","source_ver","source_pro","source_pro__19","source_con","capture_in","descriptio","the_geom")
> FROM stdin;
>
> I have this shapefile if you need it aswell.
>
> -Nigel
>
> strk at refractions.net wrote:
>
> >On Mon, Mar 14, 2005 at 12:01:14PM +0000, Nigel Kukard wrote:
> >...
> >
> >
> >>commands i used are.. (cvs snapshot of postgis-1.0.0, RCSID: $Id:
> >>shp2pgsql.c,v 1.81 2005/03/08 11:06:33 strk Exp $)
> >>
> >>shp2pgsql -a -D 2327BD_AIR_TRANSPORT_AREA_ALLFEATTYPES.shp all >
> >>/tmp/air_transport.sql
> >>psql -U postgres all < /tmp/air_transport.sql
> >>
> >>
> >
> >Nigel, you are "appending" to an existing table (all).
> >
> >How did you create that table ?
> >You probably run AddGeometryColumn() once, specifying a different
> >dimension then '2', which is required by your shapefile.
> >I tried both creating and appending the shapefile and it works.
> >
> >The "dimensions" constraint was not enforced in postgis 0.x, and
> >this seems to give problem to more then a user...
> >
> >Do people think the check is better avoid ?
> >
> >--strk;
> >
> >
> >
> >>here is the error....
> >>
> >>BEGIN
> >>ERROR: new row for relation "air_transport_area" violates check
> >>constraint "enforce_dims_the_geom"
> >>CONTEXT: COPY air_transport_area, line 1: "12006587 12006587
> >>LANDING STRIP AREA 2327BD A 0 \N
> >>000000000000000000000001 0 \N MDP_2 0 0
> >>20020522 ..."
> >>ROLLBACK
> >>
> >>
> >>attached is the shapefiles i am trying to import.
> >>
> >>Thanks for your help!!!
> >>
> >>Regards
> >>Nigel
> >>
> >>
> >>
> >>>The message says you're trying to load a differently-dimensioned geometry
> >>>in a table you created with a dimension constraint.
> >>>The dimension constraint is added by AddGeometryColumn().
> >>>
> >>>If shp2pgsql did the whole thing (call AddGeometryColumn() and feed
> >>>the geoms) we have a big bad bug, and having your case's shapefile
> >>>would help fixing it.
> >>>
> >>>--strk;
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>Regards
> >>>>Nigel
> >>>>
> >>>>strk at refractions.net wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>On Thu, Mar 10, 2005 at 06:00:20AM +0000, Nigel Kukard wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Hi Guys,
> >>>>>>
> >>>>>>I'm new to postgis. I got shape files from our local government,
> >>>>>>containing all data for South Afica.
> >>>>>>
> >>>>>>I installed postgresql 8.0.0, postgis 1.0.0-rc3, proj 4.4.9, gdal
> >>>>>>1.2.5,
> >>>>>>php-5.0.3 & mapserver 4.4.1
> >>>>>>
> >>>>>>The first thing i did is pipe lwpostgis.sql & spatial_ref_sys.sql into
> >>>>>>pgsql.
> >>>>>>
> >>>>>>I continued to run shp2pgsql on one of the shape files to insert it
> >>>>>>into
> >>>>>>my database with
> >>>>>>shp2pgsql -d drainagexxxxx.shp drainage > /tmp/postgis.sql
> >>>>>>
> >>>>>>I then tried to pipe the /tmp/postgis.sql into postgresql, but got
> >>>>>>the
> >>>>>>following error...
> >>>>>>
> >>>>>>BEGIN
> >>>>>>NOTICE: CREATE TABLE will create implicit sequence "drainage_gid_seq"
> >>>>>>for serial column "drainage.gid"
> >>>>>>CREATE TABLE
> >>>>>> addgeometrycolumn
> >>>>>>---------------------------------------------------------------------------------------
> >>>>>>public.drainage.the_geom SRID:-1 TYPE:MULTILINESTRING DIMS:4
> >>>>>>geometry_column fixed:0
> >>>>>>(1 row)
> >>>>>>
> >>>>>>ERROR: Invalid type in wbk
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>Nigel, we have fixed a (Multi)LineString-related bug in shp2pgsql.
> >>>>>If you can test a CVS snapshot that would help us release RC4.
> >>>>>
> >>>>>--strk;
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>ERROR: current transaction is aborted, commands ignored until end of
> >>>>>>transaction block
> >>>>>>ERROR: current transaction is aborted, commands ignored until end of
> >>>>>>transaction block
> >>>>>>ERROR: current transaction is aborted, commands ignored until end of
> >>>>>>transaction block
> >>>>>>ROLLBACK
> >>>>>>
> >>>>>>
> >>>>>>most of the shape files import fine, there are a couple of types which
> >>>>>>give me the above error.
> >>>>>>
> >>>>>>any help would greatly be appreciated, if need be I can attach the
> >>>>>>actual sql file or any other info needed.
> >>>>>>
> >>>>>>Regards
> >>>>>>Nigel Kukard
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>_______________________________________________
> >>>>>>postgis-users mailing list
> >>>>>>postgis-users at postgis.refractions.net
> >>>>>>http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>_______________________________________________
> >>>>>postgis-users mailing list
> >>>>>postgis-users at postgis.refractions.net
> >>>>>http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >>_______________________________________________
> >>postgis-users mailing list
> >>postgis-users at postgis.refractions.net
> >>http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>
> >>
> >
> >_______________________________________________
> >postgis-users mailing list
> >postgis-users at postgis.refractions.net
> >http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
>
> --
> Nigel Kukard, PhD CompSc
> (Chief Executive Officer)
> Linux Based Systems Design
> Web: www.lbsd.net Email: nkukard at lbsd.net
> Tel: (+27) 023 349 8000 Cell: (+27) 082 333 3723
> Fax: (+27) 023 349 1395 Support: 086 747 7600
> Address: LIGT House, 2 Klipdrift Rd, Rawsonville
> Linux Systems Design & Technology Solutions
>
>
> The best language to use is the language that was designed for
> what you want to use it for.
>
>
> =====================================================================
>
> Disclaimer
> ----------
> The contents of this message and any attachments are intended
> solely for the addressee's use and may be legally privileged and/or
> confidential information. This message may not be retained,
> distributed, copied or used if you are not he addressee of this
> message. If this message was sent to you in error, please notify
> the sender immediately by reply e-mail and then destroy the message
> and any copies thereof.
>
> Opinions, conclusions and other information in this message may be
> personal to the sender and is not that of Linux Based Systems Design,
> LinuxRulz or any of it's subsideries, associated companies or
> principals and is therefore not endorsed by Linux Based Systems
> Design or LinuxRulz. Due to e-maill communication being insecure,
> Linux Based Systems Design and LinuxRulz do not guarantee
> confidentiality, security, accuracy or performance of the e-mail.
> Any liability for viruses is excluded to the fullest extent.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list