> You can avoid Bursa Wolf problems if you use the findMathTransform like so:
>
> CRS.findMathTransform(outputCRS, mapCRS, false).
Aha, nice!! That is how the reprojector in visualization does, right?
> But as you noted that is not your issue. I don't have a solid answer
> yet but are you sure that your geometries are valid UTM zone 32 because
> if they are there shouldn't be a problem.
While writing you the answer to this I found the error. I'm so bad! The
crs were inverted.
Now it creates me the new geometry and I can create the new shape and
everything is magic, but... (obviously) it keeps the old crs (the prj
has the start wkt).
I guess this has to be set when I create the featuretype for the new
file, which I usually would do like this:
FeatureType ftype = source.getSchema();
How would I do to set the new crs? I found some things on the geotools
site, but they do not apply to the crs editing.
Perhaps this would all change with the migration to the 2.4? Which
raises my nice question to you: any news about the 3.3 sdk? :)
Ciao and thanks,
Andrea
>
> Jesse
>
>
> On Jul 8, 2007, at 11:05 AM, Andrea Antonello wrote:
>
>> I'm really no projection wizard and again and again bang my head against
>> that wall.
>> I'm creating an operation that would like to reproject feature layers
>> and dump them to shapefile.
>>
>> I'm going the usual way:
>>
>> CoordinateReferenceSystem mapCrs = activeMap.getViewportModel()
>> .getCRS();
>> CoordinateReferenceSystem outputCrs = CRS.parseWKT(crsString);
>> MathTransform mathTransform = CRS.findMathTransform(outputCrs,
>> mapCrs);
>>
>> aware of the fact that the bursa parameters could be problematic, I
>> decided to choose 2 projections that do not have towgs84 parameters: UTM
>> zone 32 on wgs84 and the latlong wgs84.
>>
>> The error is:
>> org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
>>
>> Longitude 703600°38.8'E is out of range (±180°).
>>
>> which tells me that i probably can't hope to project between metric and
>> lat-long, since it interprets the metric values as degrees. Is that
>> true? How should this be done?
>>
>> Also, since I didn't come to the end of the thing, I also would like to
>> ask if the following is ok to just change the geometries of a
>> featurecollection:
>>
>> FeatureIterator fReader = featureCollection.features();
>> while (fReader.hasNext()) {
>> Feature tmpFeature = fReader.next();
>> Geometry featureGeometry = tmpFeature.getDefaultGeometry();
>> Geometry tmpGeometry = JTS.transform(featureGeometry,
>> mathTransform);
>> tmpFeature.setDefaultGeometry(tmpGeometry);
>> }
>>
>>
>> Ciao,
>> Andrea
>>
>> _______________________________________________
>> 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