[udig-devel] Create Polygon Geometries
Jesse Eichar
jeichar at refractions.net
Thu Nov 15 10:15:52 PST 2007
Hi, Here's a polygon layer that I've been able to edit with RC12:
-- Table: polygon_layer
-- DROP TABLE polygon_layer;
CREATE TABLE polygon_layer
(
polygon_layer_fid serial NOT NULL,
name varchar(256),
the_geom geometry,
CONSTRAINT polygon_layer_pkey PRIMARY KEY (polygon_layer_fid),
CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'POLYGON'::text OR the_geom IS NULL)
)
WITH OIDS;
ALTER TABLE polygon_layer OWNER TO test;
-- Index: spatial_polygon_layer_the_geom
-- DROP INDEX spatial_polygon_layer_the_geom;
CREATE INDEX spatial_polygon_layer_the_geom
ON polygon_layer
USING gist
(the_geom);
The version is 8.0.6 and I'm not sure what version of PostGIS. One
thought. Maybe the bug is if you create the polygon outside of the
bounds of the original layer. Try creating a polygon within the current
layer bounds. I thought I fixed this issue but it may have shown up
again. I will try out your table definition now.
Jesse
On 12-Nov-07, at 4:37 AM, Kurucz Péter wrote:
> Hello,
>
> Jesse Eichar, could you try to create a new polygon with my database
> settings? Dou you have any idea what can be the reason that it doesn't
> work at me?
> Can you send me your database table definition? It this case I could
> compare the to tables as well.
>
> Thank you!
>
> Bye
> P
>
>
>
>
> Hi,
>
> yes I have defined a primary key.
> Here is the whole table definition:
>
> CREATE TABLE "test"."areas" (
> "name" VARCHAR,
> "valid_from" TIMESTAMP WITHOUT TIME ZONE,
> "valit_until" TIMESTAMP WITHOUT TIME ZONE,
> "style" VARCHAR,
> "customer_id" INTEGER DEFAULT 1,
> "the_geom" "public"."geometry",
> "areas_id" SERIAL,
> CONSTRAINT "areas_pkey" PRIMARY KEY("areas_id"),
> CONSTRAINT "enforce_dims_the_geom" CHECK (ndims(the_geom)
> = 2),
> CONSTRAINT "enforce_geotype_the_geom" CHECK
> ((geometrytype(the_geom) = 'MULTIPOLYGON'::text) OR
> (the_geom IS NULL)),
> CONSTRAINT "enforce_srid_the_geom" CHECK (srid(the_geom) =
> 4326)
> ) WITHOUT OIDS;
>
> Is it correct this way?
>
> Bye
> P
>
> Jesse Eichar <jeichar at refractions.net <javascript:void(0)>> írta:
>
> > I have done this often. Do you have a primary key on the
> table?
> >
> > Jesse
> >
> > On 31-Oct-07, at 2:35 AM, Kurucz Péter wrote:
> >
> > >
> > > Thanks for your answer but I think it's not so simple. I
> have
> > > already removed the not_null constraint from database
> column. In
> > > this case the sql insert will be proceed but after an
> insert some
> > > select will be performed and the code will crash at the
> first sql
> > > select. That's why I think the database manipulation
> will be
> > > performed in one transaction block and the whole will be
> rollbacked.
> > > Can anybody create a new polygon? Without a not_null
> restriction
> > > should it really work right?
> > >
> > > Bye
> > > P
> > >
> > >
> > >
> > > Jesse Eichar <jeichar at refractions.net <javascript:void(0)>> írta:
> > >
> > > Hi I know exactly the problem.
> > >
> > > The postgis has a restraint on one of the columns that
> it can not be
> > > null and uDig is not respecting that. A quick fix is to
> remove that
> > > restraint on the postgis column. But in the long term
> this is a bug
> > > with Geotools and a bug report will need to be filled
> out with
> > > geotools to fix this issue.
> > >
> > > Jesse
> > >
> > > On Oct 30, 2007, at 10:04 AM, Kurucz Péter wrote:
> > >
> > >> Hi,
> > >>
> > >> I try to use thy uDig (version 1.1-RC12) and I got a
> problem. It is
> > >> not possible to create a new polygon. The drawing is
> working but
> > >> the new polygon will not be saved in the postGIS
> database. I have
> > >> downloaded the eclipse environment and debugged a bit
> the tool. My
> > >> feeling is that the problem isn't located in uDig
> application but
> > >> in a bottom layer in postGIS or pastrgres. I suppose
> that a
> > >> database transaction will not be closed correctly or
> not at all,
> > >> and the tool want to make a new one, and this occur a
> database
> > >> exception. The whole transaction will be rollbacked and
> my new
> > >> polygon will miss from GUI.
> > >> The strange thing is that Create Polygon must be a
> basic feature
> > >> but i t doesn't work for me. Have anybody idea what can
> be bad? Is
> > >> my feeling is right about database transaction error?
> > >>
> > >> Thanks in advance!
> > >> P
> > >>
> > >> The exception is following:
> > >> 2007.10.30. 17:54:15
> org.geotools.data.jdbc.JDBCTextFeatureWriter
> > >> doInsert
> > >>
> > >> SEVERE: SQL Exception writing geometry columnERROR:
> null value in
> > >> column "customer_id" violates not-null constraint
> > >>
> > >> org.postgresql.ut il.PSQLException: ERROR: null value
> in column
> > >> "customer_id" violates not-null constraint
> > >>
> > >> at
> > >> org
> > >> .postgresql
> > >> .core
> > >>
> .v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:
>
> > >> 1525)
> > >>
> > >> at
> > >> org
> > >> .postgresql
> > >>
> .core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:
>
> > >> 1309)
> > >>
> > >> at
> > >> org
> > >> .postgresql
> > >>
> .core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
> > >>
> > >> at
> > >>
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2S
>
> > >> tatement.java:452)
> > >>
> > >> at
> > >> org
> > >> .postgresql
> > >> .jdbc2
> > >> .AbstractJdbc2Statement
> > >> .executeWithFlags(AbstractJdbc2Statement.java:340)
> > >>
> > >> at
> > >> org
> > >> .postgresql
> > >> .jdbc2
> > >>
> .AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:
>
> > >> 286)
> > >>
> > >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > >>
> > >> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> Source)
> > >>
> > >> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > >>
> > >> at java.lang.reflect.Method.invoke(Unknown Source)
> > >>
> > >> at org.postgresql.ds.common.PooledConnectionImpl
> > >> $StatementHandler.invoke(PooledConnectionImpl.java:474)
> > >>
> > >> at $Proxy1.executeUpdate(Unknown Source)
> > >>
> > >> at
> > >> org
> > >> .geotools
> > >> .data
> > >>
> .jdbc.JDBCTextFeatureWriter.doInsert(JDBCTextFeatureWriter.java:110)
> > >>
> > >> at
> > >> org
> > >>
> .geotools.data.jdbc.JDBCFeatureWriter.write(JDBCFeatureWriter.java:
>
> > >> 220)
> > >>
> > >> at org.geotools.data.InProce ssLockingManager
> > >> $1.write(InProcessLockingManager.java:331)
> > >>
> > >> at
> > >> org
> > >> .geotools
> > >>
> .data.jdbc.JDBCFeatureStore.addFeatures(JDBCFeatureStore.java:400)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >> .project
> > >>
> .internal.impl.UDIGFeatureStore.addFeatures(UDIGFeatureStore.java:
>
> > >> 163)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >> .project
> > >> .internal
> > >>
> .commands.edit.AddFeatureCommand.run(AddFeatureCommand.java:120)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >> .tools
> > >> .edit
> > >>
> .commands.CreateAndSetNewFeature.run(CreateAndSetNewFeature.java:67)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >>
> .project.command.UndoableComposite.execute(UndoableComposite.java:81)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >>
> .udig.tools.edit.BehaviourCommand.execute(BehaviourCommand.java:65)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >>
> .project.command.UndoableComposite.execute(UndoableComposite.java:78)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >> .tools
> > >> .edit
> > >> .behaviour
> > >> .AcceptWhenOverFirstVertexBehaviour
> > >> .getCommand(AcceptWhenOverFirstVertexBehaviour.java:87)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >> .tools
> > >> .edit
> > >> .OrderedCompositeEventBehavior
> > >> .getCommand(OrderedCompositeEventBehavior.java:59)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >> .tools
> > >> .edit
> > >> .MutualExclusiveEventBehavior
> > >> .getCommand(MutualExclusiveEventBehavior.java:57)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >>
> .tools.edit.EditToolHandler.runEventBehaviours(EditToolHandler.java:
>
> > >> 269)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >>
> .udig.tools.edit.EditToolHandler.handleEvent(EditToolHandler.java:
>
> > >> 229)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >>
> .tools.edit.AbstractEditTool.onMouseReleased(AbstractEditTool.java:
>
> > >> 250)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >>
> .udig.project.ui.tool.SimpleTool.mouseReleased(SimpleTool.java:153)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >> .project
> > >> .ui
> > >> .internal
> > >> .render
> > >>
> .displayAdapter.impl.EventJob.sendMouseReleased(EventJob.java:296)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >> .udig
> > >> .project
> > >> .ui
> > >> .internal
> > >>
> .render.displayAdapter.impl.EventJob.runEvent(EventJob.java:87)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >>
> .udig.project.ui.internal.render.displayAdapter.impl.EventJob.access
>
> > >> $2(EventJob.java:72)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >>
> .udig.project.ui.internal.render.displayAdapter.impl.EventJob
> > >> $1.run(EventJob.java:135)
> > >>
> > >> at
> org.eclipse.swt.widgets.Display.runTimer(Display.java:3745)
> > >>
> > >> at
> org.eclipse.swt.widgets.Display.messageProc(Display.java:2967)<
> /
> > >> p>
> > >>
> > >> at
> org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native
> Method)
> > >>
> > >> at
> org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2265)
> > >>
> > >> at
> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3291)
> > >>
> > >> at
> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:
> > >> 2389)
> > >>
> > >> at org.eclipse.ui.internal.Workbench.runUI(Workbench.j
> ava:2353)
> > >>
> > >> at
> org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
> > >>
> > >> at
> org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
> > >>
> > >> at
> > >> org
> > >> .eclipse
> > >>
> .core.databinding.observable.Realm.runWithDefault(Realm.java:289)
> > >>
> > >> at
> > >> org
> > >>
> .eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:
>
> > >> 461)
> > >>
> > >> at org.eclipse.ui.Platfo
> rmUI.createAndRunWorkbench(PlatformUI.java:
> > >> 149)
> > >>
> > >> at
> > >> net
> > >> .refractions
> > >>
> .udig.internal.ui.UDIGApplication.run(UDIGApplication.java:41)
> > >>
> > >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > >>
> > >> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> Source)
> > >>
> > >> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > >>
> > >> at java.lang.reflect.Method.invoke(Unknown Source)
> > >>
> > >> at org.eclipse.e
> > >> quinox
> > >> .internal
> > >>
> .app.EclipseAppContainer.callMethod(EclipseAppContainer.java:572)
> > >>
> > >> at
> > >> org
> > >> .eclipse
> > >>
> .equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:171)
> > >>
> > >> at
> > >> org
> > >> .eclipse
> > >> .core
> > >> .runtime
> > >> .internal
> > >>
> .adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:
>
> > >> 106)
> > >>
> > >> at
> > >> org
> > >> .eclipse
> > >> .core
> > >> .runtime
> > >>
> .internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:
>
> > >> 76)
> > >>
> > >> at
> > >> org
> > >> .eclipse
> > >> .core.runtime.adaptor.EclipseStarter
> .run(EclipseStarter.java:363)
> > >>
> > >> at
> > >> org
> > >> .eclipse
> > >>
> .core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> > >>
> > >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > >>
> > >> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> Source)
> > >>
> > >> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > >>
> > >> at java.lang.reflect.Method.invoke(Unknown Source)
> > >>
> > >> at org.eclipse.equinox.launcher.Mai
> n.invokeFramework(Main.java:508)
> > >>
> > >> at
> org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
> > >>
> > >> at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
> > >>
> > >> at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
> > >>
> > >> 2007.10.30. 17:54:15
> org.geotools.data.jdbc.JDBCFeatureWriter close
> > >>
> > >> WARNING: Feature writer calling close when queryData is
> already
> > >> closed
> > >>
> > >>
> > >>
> > >> _______________________________________________
> > >> User-friendly Desktop Internet GIS (uDig)
> > >> http://udig.refractions.net
> > >> http://lists.refractions.net/mailman/listinfo/udig-devel
> > >
> > > _______________________________________________
> > > User-friendly Desktop Internet GIS (uDig)
> > > http://udig.refractions.net
> > > http://lists.refractions.net/mailman/listinfo/udig-devel
> > >
> > > _______________________________________________
> > > User-friendly Desktop Internet GIS (uDig)
> > > http://udig.refractions.net
> > > http://lists.refractions.net/mailman/listinfo/udig-devel
> >
> >
>
> SMS-ÉRTESÍTŐ - Fontos levelet vársz? Nem kell folyamatosan a gép
> elött ülnöd!
> ________________________________________________________
> http://cthandler.adverticum.net/?cturl=http%3A%2F%2Fwww.freemail.hu%3Flevelalja
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.refractions.net/pipermail/udig-devel/attachments/20071115/678d78c4/attachment-0001.html
More information about the udig-devel
mailing list