Hi,
I found out that uDig fails to render a wfs layer from mapserver if it was
empty when creating the layer. I have some mapserver layers taking the features
from database tables, and when a table does not contain any features, then the
layer is not correctly created and it cannot be render, throwing the following
error:
net.refractions.udig.project.render.RenderException: class
java.lang.NullPointerException occured during rendering: null
at
net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:368)
at
net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:222)
at
net.refractions.udig.project.internal.render.impl.RenderJob.startRendering(RenderJob.java:108)
at
net.refractions.udig.project.internal.render.impl.RenderJob.run(RenderJob.java:213)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.NullPointerException
at com.vividsolutions.jts.geom.Envelope.init(Envelope.java:254)
at com.vividsolutions.jts.geom.Envelope.<init>(Envelope.java:186)
at
org.geotools.geometry.jts.ReferencedEnvelope.<init>(ReferencedEnvelope.java:246)
at
org.geotools.data.wfs.v1_0_0.WFS_1_0_0_DataStore.getBounds(WFS_1_0_0_DataStore.java:829)
at
org.geotools.data.wfs.v1_0_0.WFSFeatureSource.getBounds(WFSFeatureSource.java:198)
at
org.geotools.data.wfs.v1_0_0.WFSFeatureSource.getBounds(WFSFeatureSource.java:191)
at org.geotools.map.FeatureLayer.getBounds(FeatureLayer.java:166)
at org.geotools.map.MapContext.getLayerBounds(MapContext.java:463)
at
org.geotools.map.DefaultMapContext.getViewport(DefaultMapContext.java:524)
at org.geotools.map.MapContent.<init>(MapContent.java:207)
at org.geotools.map.MapContext.<init>(MapContext.java:170)
at org.geotools.map.DefaultMapContext.<init>(DefaultMapContext.java:98)
at
net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.prepareDraw(BasicFeatureRenderer.java:166)
at
net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:245)
... 4 more
and the following message in the status bar , "Coordinate Reference System of
data is unknown. Unexpected behaviour may result if it is not set".
So I set programatically the CRS by using:
layer.setCRS(DefaultGeographicCRS.WGS84);
And then the message changes to "A problem ourred during rendering. Try a
refresh or zoom to the layer to see if problem will fix itself"
My guess is that udig builds the layer obtaining the layer information from one
of its features, and there arent any, so I tried to set the parameters
programatically
layer.setBounds(new ReferencedEnvelope(new Envelope (-180, 180, -90, 90),
DefaultGeographicCRS.WGS84));
But it is still not enough. is this issue familiar to you? do you know what
layer parameters I would have to set programaticallly so the layer is able to
render?
Thanks,
Joaquín
______________________
This message including any attachments may contain confidential
information, according to our Information Security Management System,
and intended solely for a specific individual to whom they are addressed.
Any unauthorised copy, disclosure or distribution of this message
is strictly forbidden. If you have received this transmission in error,
please notify the sender immediately and delete it.
______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
puede contener informacion clasificada por su emisor como confidencial
en el marco de su Sistema de Gestion de Seguridad de la
Informacion siendo para uso exclusivo del destinatario, quedando
prohibida su divulgacion copia o distribucion a terceros sin la
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje
erroneamente, se ruega lo notifique al remitente y proceda a su borrado.
Gracias por su colaboracion.
______________________
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel