Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Reprojection problem?

As far as I understand your code it creates a new featuretype / layer with the CRS of the current map.
What happens if the user changes the CRS manually?
Example: I create a temporary resource while the map is on WGS84. Adding some features with polygon tool, switching to WGS84_47N, trying do add further polygons will start confusion. Maybe switching to a third CRS.... some features aren't shown and adding not possible: The polygon tools draws a polygon and it creates a new feature but this is never shown in the map.

How does uDig/geoTools handle this inside? Is the reprojection / coordinate transformation done automatically? I tested this with uDig standalone and it seems to have problems with temporary resources.

Is this a general problem?

Would you suggest to avoid the usage of temporary resources when expecting a user switching the CRS?

Thank you,
Jürgen

andrea antonello schrieb:
I had this issue time ago and I solved it by creating a subtype:
http://jgrasstechtips.blogspot.com/2008/01/how-to-create-temporary-layer-with.html

Hope that helps,
Andrea


On Wed, Oct 22, 2008 at 4:35 PM, Jürgen Jacob <zoid.berg@xxxxxx> wrote:
I'm using several temporary resources in my application. These temporary
layers are created on a Map with CRS = WGS84.

Objects in my layers are Features on lat/lon and the edit tools are working.

Then I change the CRS to e.g. WGS84 47N using the Coordinate Systems dialog.
Using an edit tool again, example polygon tool for creating a new polygon
results in this exception:

org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
Longitude 1425336°19.9'W is out of range (±180°).
       at
org.geotools.referencing.operation.projection.MapProjection.transform(MapProjection.java:621)
       at
org.geotools.referencing.operation.projection.MapProjection.transform(MapProjection.java:678)
       at org.geotools.geometry.jts.JTS.xform(JTS.java:274)
       at org.geotools.geometry.jts.JTS.transform(JTS.java:168)
       at
org.geotools.geometry.jts.ReferencedEnvelope.transform(ReferencedEnvelope.java:230)
       at
net.refractions.udig.project.internal.impl.LayerImpl.getBounds(LayerImpl.java:2008)
       at
net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.validateBounds(BasicFeatureRenderer.java:407)
       at
net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:229)
       at
net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:199)
       at
net.refractions.udig.project.internal.render.impl.RenderJob.startRendering(RenderJob.java:103)
       at
net.refractions.udig.project.internal.render.impl.RenderJob.run(RenderJob.java:203)
       at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)



I checked my code and found

featureBuilder.addType(AttributeTypeFactory.newAttributeType(GEOMETRY_IDENTIFIER,
myGeometry, true, Integer.MAX_VALUE, null,DefaultGeographicCRS.WGS84));

I replaced DefaultGeographicCRS.WGS84 with null but the problem still
exists.

Can someone explain me this behaviour? Is it not possible to change the CRS
on temporary layers?

Thank you, Jürgen


_______________________________________________
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




Back to the top