Thanks Jodi, I followed your instructions and I finally I made it
works with your help. The thing is that my "prj" file has the
parameter "Central_Parallel" and it seems like it is not supported by
GeoTools, when I parse it I get invalid property, Is it?
Another question, I have been debuging the source code of the transform
logic to understand a little and I founded this functionality in
the MapProjection class :
public final Point2D transform(final Point2D ptSrc, Point2D ptDst)
throws ProjectionException
{
final double x0 = ptSrc.getX();
final double y0 = ptSrc.getY();
ptDst = inverseTransformNormalized((x0 - falseEasting ) /
globalScale,
(y0 - falseNorthing) /
globalScale, ptDst);
/*
* Makes sure that the longitude after conversion stay within
+/- PI radians. As a
* special case, we do not check the range if no rotation were
applied on the longitude.
* This is because the user may have a big area ranging from
-180° to +180°. With the
* slight rounding errors related to map projections, the 180°
longitude may be slightly
* over the limit. Rolling the longitude would changes its
sign. For example a bounding
* box from 30° to +180° would become 30° to -180°, which is
probably not what the user
* wanted.
*/
final double x = toDegrees(centralMeridian != 0 ?
rollLongitude(ptDst.getX() + centralMeridian)
: ptDst.getX());
final double y = toDegrees(ptDst.getY());
ptDst.setLocation(x,y);
if (verifyCoordinateRanges()) {
if (verifyGeographicRanges(this, x, y)) {
warningLogged();
}
}
assert checkReciprocal(ptDst, (ptSrc!=ptDst) ? ptSrc : new
Point2D.Double(x0, y0), false);
return ptDst;
}
In the previous code, the "x" coordinate it is converted by
the centralMeridian value, but there is no conversion for the
"y" coordinate , Should it be a functionality with a "Central_Parallel"
parameter?
I am apology if I am making an error on the logic interpretation.
Thank you!
salu2...
masch...
On Sun, Dec 11, 2011 at 11:58, the.masch <[email protected]> wrote:
> Hi Jodi, thank you replay and for the tip I will read it, but for your
> information I have corresponding ".prj", here it is:
> http://pastebin.com/wUv3zCyG
>
> Thank you!
> salu2...
> masch...
>
>
> On Sun, Dec 11, 2011 at 10:47, Jody Garnett <[email protected]>wrote:
>
>> Hi Masch:
>>
>> This is going to be a very hard one for anyone to help you with ...
>> unless your shapefile has a ".prj" file. Can you check?
>>
>> The thing is the shapefile is recorded against a specific model of the
>> world described by a CoordinateReferenceSystem. GeoTools can help transform
>> your geometry into lat/lon - but you need to tell it what your data is
>> measured in first.
>>
>> Do you mind going through the tutorials on this topic; and then coming
>> back if you have any more questions? (The tutorials have pictures and
>> everything):
>> -
>> http://docs.geotools.org/latest/userguide/tutorial/geometry/geometrycrs.html
>> - slides:
>> http://how2map.blogspot.com/2011/11/osdc-2011-geospatial-for-java-workshop.html
>>
>> Best of luck
>> --
>> Jody Garnett
>>
>> On Sunday, 11 December 2011 at 4:44 PM, the.masch wrote:
>>
>> Hello, first at all, this is my first time with geography data, so I am
>> sorry if I am asking something wrong. The thing that I used your web page
>> to parse some SHAPE file It is working fine, but I do not understand the
>> data format from the Geometry source. This is an example:
>>
>> SimpleFeatureIterator iterator = features.features();
>> try {
>> while (iterator.hasNext()) {
>> SimpleFeature feature = iterator.next();
>> Geometry geom = (Geometry) feature.getDefaultGeometry();
>> Point centroid = geom.getCentroid();
>> /*
>> Value of centroid -> POINT (107780.29096944424
>> 105247.95770896814)
>> */
>> }
>> } finally {
>> iterator.close(); // IMPORTANT
>> }
>>
>> Could you help me to convert that value to Decimal Latitude and
>> Longitude, please? I am searching on "Google", but I cannot find how to
>> convert it.
>>
>> Thank you very much I am sorry if I am asking something that it is
>> not strictly geotools functionality.
>>
>> salu2...
>> masch...
>>
>> ------------------------------------------------------------------------------
>> Learn Windows Azure Live! Tuesday, Dec 13, 2011
>> Microsoft is holding a special Learn Windows Azure training event for
>> developers. It will provide a great way to learn Windows Azure and what
>> it
>> provides. You can attend the event by watching it streamed LIVE online.
>> Learn more at http://p.sf.net/sfu/ms-windowsazure
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>>
>>
>
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users