Hello,
I am having some troube trying to define a CARTESIAN_2D crs in a udig map, and
I would really appreaciate any idea about what I could be doing wrong
I am building a mapviewer which has a JPG image as base layer (which is not
really georeferenced, but I added a worldfile to georeference it by using its
pixels), and over it I have some overlays layers coming from mapserver with
polygons and points, like for example POINT (282.4230769230767
-876.2142857142861) . This works if I deal with the map and the layers as they
were WGS84 :)
layer.setCRS(DefaultGeographicCRS.WGS84);
The problem about this workaround is that if use WGS84, when I try to filter
the layer by bbox, I have seen that only features which intersect with
(-180,180, -90,90) are returned, those who are out of (-180,180, -90,90) are
never returned, as if they dont exist...
ReferencedEnvelope bbox = new ReferencedEnvelope(new Envelope
(40, 60, 40 ,60),DefaultGeographicCRS.WGS84);
FeatureSource<SimpleFeatureType, SimpleFeature> source =
layer.getResource( FeatureSource.class, null );
FilterFactory2 ff = (FilterFactory2)
CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
Geometry geom = new GeometryFactory().toGeometry(bbox);
Intersects bboxFilter =
ff.intersects(ff.property("msGeometry"), ff.literal(geom));
FeatureCollection<SimpleFeatureType, SimpleFeature> results;
So now I am trying to define the map with a CARTESIAN_2D crs, and layers :
map = (Map) ProjectFactory.eINSTANCE.createMap();
map.getViewportModelInternal().setCRS(DefaultEngineeringCRS.CARTESIAN_2D);
.....
.....
layer.setCRS(DefaultEngineeringCRS.CARTESIAN_2D);
But then, the wfs layers coming from mapserver are not rendered and this
message appears in the log:
net.refractions.udig.project.render.RenderException: Problem rendering: Error
transforming bbox
at
net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:388)
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.Exception: Error transforming bbox
at
org.geotools.renderer.lite.StreamingRenderer.getLayerQuery(StreamingRenderer.java:992)
at
org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1916)
at
org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:773)
at
org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:581)
at
net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:359)
... 4 more
Caused by: org.opengis.referencing.operation.OperationNotFoundException: No
transformation available from system "EngineeringCRS[Cartesian 2D]" to
"GeographicCRS[WGS 84]".
at
org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperation(DefaultCoordinateOperationFactory.java:387)
at
org.geotools.referencing.operation.BufferedCoordinateOperationFactory.createOperation(BufferedCoordinateOperationFactory.java:254)
at
org.geotools.geometry.jts.ReferencedEnvelope.transform(ReferencedEnvelope.java:629)
at
org.geotools.renderer.lite.StreamingRenderer.getLayerQuery(StreamingRenderer.java:975)
... 8 more
Why would udig want to transform anything to WGS 84? I guess I have not defined
the crs correctly, right?
If you have any idea, I would really appreciate it
Thank you very much :)
______________________
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