I solved my problem, the result of the transform 
DefaultGeographicCRS.CARTESTIAN produces x, y, z tuples where y points East, 
and z points North (spelled out clearly in the javadoc).  Applying a 
CoordinateSequenceFilter which sets the Y value to Z, to the geometry returned 
by JTS.transform() fixed the issue.   Thanks to Oleksandr Huziy who pointed me 
in the right direction.

----- Start Original Message -----
Sent: Wed, 22 Feb 2012 15:18:00 -0400 (AST)
From: <davidmor...@runbox.com>
To: "geotools-gt2-users" <geotools-gt2-users@lists.sourceforge.net>
Subject: [Geotools-gt2-users] Transforming a polygon which crosses the
 equator from WGS84 to CARTESIAN

> When I transform a polygon which crosses the equator from WGS84 to CARTESIAN 
> the transformed polygon looks like its twisted around points that cross the 
> equator.  I'm transforming to CARTESIAN so I can use GeoTools 2.7.4/JTS 1.11 
> to check for interactions between the polygon and a number of line strings. 
> 
> Here is basically how I obtain the transform:
> 
> DefaultGeocentricCRS cartesianCRS = DefaultGeographicCRS.CARTESIAN;
> DefaultGeographicCRS worldCRS = DefaultGeographicCRS.WGS84;
> MathTransform coordinateTransform = CRS.findMathTransform(worldCRS, 
> cartesianCRS, false);
> 
> and I transform the polygon and line strings like so:
> 
> transformedGeometry = JTS.transform(geometry, coordinateTransform);
> 
> Any pointers or comments would be appreciated. 
> 
> WKT for a sample of the exterior ring of an untransformed polygon, and the 
> transformed exterior ring follow at the end of this email.
> 
> 
> Untransformed 
> -----------------------
> LINEARRING (-18.28915904203494 18.57593737240903, -18.79687541772243 
> 18.260179390288762, -19.304591793409923 17.944421408168495, 
> -19.812308169097413 17.628663426048227, -20.320024544784907 
> 17.31290544392796, -20.827740920472397 16.99714746180769, -21.33545729615989 
> 16.68138947968742, -21.84317367184738 16.365631497567154, -22.350890047534875 
> 16.049873515446887, -22.858606423222366 15.73411553332662, -23.36632279890986 
> 15.418357551206352, -23.87403917459735 15.102599569086085, 
> -24.381755550284844 14.786841586965815, -24.889471925972334 
> 14.471083604845548, -25.397188301659824 14.15532562272528, 
> -25.904904677347318 13.839567640605013, -26.412621053034812 
> 13.523809658484744, -26.920337428722302 13.208051676364477, 
> -27.428053804409792 12.89229369424421, -27.935770180097286 
> 12.576535712123942, -28.44348655578478 12.260777730003674, -28.95120293147227 
> 11.945019747883407, -29.45891930715976 11.629261765763138, 
> -29.966635682847254 11.313503783642869, -30.47435205853475 
> 10.997745801522601, -30.98206843422224 10.681987819402334, -31.48978480990973 
> 10.366229837282066, -31.997501185597223 10.050471855161799, 
> -32.50521756128471 9.734713873041532, -33.0129339369722 9.418955890921263, 
> -33.5206503126597 9.103197908800997, -34.02836668834719 8.787439926680728, 
> -34.536083064034685 8.471681944560459, -35.04379943972217 8.155923962440193, 
> -35.551515815409665 7.840165980319924, -36.05923219109716 7.524407998199655, 
> -36.566948566784646 7.208650016079389, -37.07466494247214 6.89289203395912, 
> -37.582381318159634 6.577134051838854, -38.09009769384713 6.261376069718587, 
> -38.59781406953462 5.945618087598318, -39.105530445222115 5.62986010547805, 
> -39.6132468209096 5.314102123357783, -40.12096319659709 4.998344141237514, 
> -40.62867957228458 4.682586159117246, -41.136395947972076 4.366828176996979, 
> -41.64411232365957 4.05107019487671, -42.151828699347064 3.735312212756442, 
> -42.65954507503456 3.419554230636173, -43.167261450722044 3.103796248515909, 
> -43.67497782640954 2.78803826639564, -44.182694202097025 2.472280284275371, 
> -44.69041057778452 2.1565223021551034, -45.19812695347201 1.840764320034836, 
> -45.70584332915951 1.5250063379145686, -46.21355970484699 1.2092483557943012, 
> -46.72127608053449 0.893490373674034, -46.22281285395169 0.5986669762699581, 
> -45.72434962736889 0.3038435788658821, -45.22588640078608 0.0090201814618061, 
> -44.72742317420328 -0.2858032159422699, -44.22895994762048 
> -0.5806266133463458, -43.73049672103768 -0.875450010750422, 
> -43.23203349445488 -1.1702734081544979, -42.73357026787208 
> -1.4650968055585738, -42.235107041289275 -1.7599202029626497, 
> -41.736643814706476 -2.0547436003667254, -41.238180588123676 
> -2.3495669977708014, -40.739717361540876 -2.644390395174878, 
> -40.24125413495807 -2.939213792578954, -39.74279090837527 -3.23403718998303, 
> -39.24432768179247 -3.528860587387106, -38.74586445520967 -3.823683984791182, 
> -38.24740122862687 -4.118507382195258, -37.74893800204407 -4.413330779599334, 
> -37.25047477546127 -4.70815417700341, -36.752011548878464 -5.002977574407486, 
> -36.253548322295664 -5.2978009718115615, -35.755085095712865 
> -5.592624369215637, -35.256621869130065 -5.887447766619713, 
> -34.75815864254726 -6.18227116402379, -34.25969541596446 -6.477094561427866, 
> -33.76123218938166 -6.771917958831942, -33.26276896279886 -7.066741356236018, 
> -33.35347185605454 -7.656066252246138, -33.44417474931022 -8.245391148256257, 
> -33.5348776425659 -8.834716044266376, -33.625580535821584 -9.424040940276496, 
> -33.716283429077265 -10.013365836286615, -33.806986322332946 
> -10.602690732296734, -33.897689215588635 -11.192015628306855, 
> -33.988392108844316 -11.781340524316974, -34.0790950021 -12.370665420327093, 
> -34.16979789535568 -12.959990316337214, -34.26050078861136 
> -13.54931521234733, -34.35120368186704 -14.138640108357452, 
> -34.44190657512272 -14.72796500436757, -33.84286747350742 
> -14.736324779736961, -33.24382837189211 -14.74468455510635, -32.6447892702768 
> -14.75304433047574, -32.0457501686615 -14.761404105845129, 
> -31.446711067046188 -14.76976388121452, -30.847671965430884 
> -14.778123656583908, -30.248632863815576 -14.786483431953299, 
> -29.64959376220027 -14.794843207322689, -29.050554660584964 
> -14.803202982692078, -28.451515558969657 -14.811562758061468, 
> -27.85247645735435 -14.819922533430857, -27.253437355739045 
> -14.828282308800247, -26.654398254123738 -14.836642084169636, 
> -26.05535915250843 -14.845001859539027, -25.456320050893122 
> -14.853361634908417, -24.857280949277815 -14.861721410277806, 
> -24.25824184766251 -14.870081185647196, -23.659202746047207 
> -14.878440961016585, -23.060163644431896 -14.886800736385975, 
> -22.46112454281659 -14.895160511755364, -21.862085441201287 
> -14.903520287124755, -21.263046339585976 -14.911880062494145, 
> -20.664007237970672 -14.920239837863534, -20.06496813635537 
> -14.928599613232924, -19.465929034740057 -14.936959388602313, 
> -18.866889933124753 -14.945319163971703, -18.267850831509445 
> -14.953678939341094, -17.66881172989414 -14.962038714710483, 
> -17.069772628278834 -14.970398490079873, -16.470733526663523 
> -14.978758265449262, -15.871694425048219 -14.987118040818652, 
> -15.272655323432911 -14.99547781618804, -14.673616221817607 
> -15.003837591557431, -14.0745771202023 -15.012197366926822, 
> -13.475538018586995 -15.02055714229621, -12.876498916971688 
> -15.028916917665601, -12.277459815356384 -15.03727669303499, 
> -11.678420713741072 -15.04563646840438, -11.079381612125765 
> -15.053996243773769, -10.48034251051046 -15.06235601914316, 
> -10.614977278295365 -14.482385443426743, -10.749612046080271 
> -13.902414867710325, -10.884246813865175 -13.322444291993909, 
> -11.01888158165008 -12.742473716277491, -11.153516349434984 
> -12.162503140561075, -11.28815111721989 -11.582532564844659, 
> -11.422785885004794 -11.00256198912824, -11.557420652789698 
> -10.422591413411823, -11.692055420574604 -9.842620837695407, 
> -11.826690188359509 -9.26265026197899, -11.961324956144413 
> -8.682679686262572, -12.095959723929319 -8.102709110546156, 
> -12.230594491714223 -7.522738534829738, -12.365229259499127 
> -6.942767959113322, -12.499864027284033 -6.362797383396904, 
> -12.634498795068938 -5.782826807680486, -12.769133562853842 
> -5.20285623196407, -12.903768330638748 -4.622885656247654, 
> -13.038403098423652 -4.042915080531236, -13.173037866208556 
> -3.4629445048148195, -13.30767263399346 -2.8829739290984033, 
> -13.442307401778367 -2.3030033533819854, -13.57694216956327 
> -1.7230327776655692, -13.711576937348175 -1.143062201949153, 
> -13.846211705133081 -0.5630916262327332, -13.980846472917985 
> 0.016878949483683, -14.11548124070289 0.5968495252001009, -14.250116008487794 
> 1.1768201009165153, -14.3847507762727 1.756790676632935, -14.519385544057604 
> 2.3367612523493513, -14.654020311842508 2.9167318280657675, 
> -14.788655079627414 3.496702403782187, -14.923289847412319 4.0766729794986, 
> -15.057924615197223 4.65664355521502, -15.192559382982129 5.236614130931432, 
> -15.327194150767033 5.816584706647852, -15.461828918551937 6.396555282364268, 
> -15.596463686336843 6.976525858080688, -15.731098454121748 7.556496433797108, 
> -15.865733221906652 8.13646700951352, -16.000367989691554 8.716437585229937, 
> -16.13500275747646 9.296408160946353, -16.269637525261366 9.876378736662772, 
> -16.404272293046272 10.456349312379189, -16.53890706083118 
> 11.036319888095608, -16.67354182861608 11.616290463812021, 
> -16.808176596400987 12.19626103952844, -16.94281136418589 12.776231615244853, 
> -17.077446131970795 13.356202190961273, -17.2120808997557 13.936172766677693, 
> -17.346715667540604 14.516143342394106, -17.48135043532551 
> 15.096113918110525, -17.615985203110412 15.676084493826941, 
> -17.75061997089532 16.25605506954336, -17.885254738680224 16.836025645259774, 
> -18.019889506465127 17.41599622097619, -18.154524274250033 
> 17.995966796692606, -18.28915904203494 18.57593737240903) 
> 
> Transformed
> ------------------------
> LINEARRING (5742394.576803977 -1897910.1489289345, 5735804.718617136 
> -1952278.159466298, 5728528.451972086 -2006617.5449205688, 5720566.032504855 
> -2060918.770902156, 5711917.851397722 -2115172.3071147697, 5702584.435302291 
> -2169368.6292894017, 5692566.446235037 -2223498.2211168488, 5681864.681445385 
> -2277551.5761783896, 5670480.073256308 -2331519.1998742223, 5658413.688877549 
> -2385391.6113492856, 5645666.730191431 -2439159.34541606, 5632240.5335113825 
> -2492812.9544739896, 5618136.5693131685 -2546343.010425103, 5603356.441938939 
> -2599740.1065854854, 5587901.889274111 -2652994.8595921914, 5571774.78239721 
> -2706097.9113052366, 5554977.125202694 -2759039.9307042686, 5537511.053996878 
> -2811811.6157795507, 5519378.837067025 -2864403.695416875, 5500582.874223707 
> -2916806.931276028, 5481125.696316535 -2969012.1196624297, 5461009.964723334 
> -3021010.093391576, 5440238.470812922 -3072791.7236459143, 5418814.135381548 
> -3124347.921823772, 5396740.008063134 -3175669.641379966, 5374019.26671347 
> -3226747.8796577537, 5350655.216768434 -3277573.6797117107, 5326651.290576407 
> -3328138.132121225, 5302011.046705017 -3378432.3767941934, 5276738.169222353 
> -3428447.604760608, 5250836.466952789 -3478175.059955636, 5224309.872707575 
> -3527606.040991859, 5197162.442490365 -3576731.902920319, 5169398.354677821 
> -3625544.058979989, 5141021.909175487 -3674033.9823353793, 5112037.526549078 
> -3722193.2078018584, 5082449.747131389 -3770013.333558409, 5052263.230104984 
> -3817486.022847436, 5021482.752560864 -3864603.005661313, 4990113.208533294 
> -3911356.080415304, 4958159.608010992 -3957737.115606559, 4925627.075924902 
> -4003738.0514588277, 4892520.851112696 -4049350.901552569, 4858846.2852602815 
> -4094567.754440147, 4824608.8418204915 -4139380.7752457573, 4789814.094909183 
> -4183782.207249806, 4754467.728178958 -4227764.373457388, 4718575.533670771 
> -4271319.678150585, 4682143.41064358 -4314440.60842424, 4645177.364382381 
> -4357119.735704933, 4607683.5049847495 -4399349.717252833, 4569668.046126245 
> -4441123.297646131, 4531137.303804829 -4482433.310247779, 4492097.695064627 
> -4523272.678654199, 4452555.736699236 -4563634.418125713, 4412518.043934861 
> -4603511.636998396, 4371991.329093558 -4642897.538077063, 4412511.44793971 
> -4604993.254285052, 4452585.832280538 -4566615.226020087, 4492208.269825293 
> -4527769.367996887, 4531372.629447809 -4488461.679040005, 4570072.8623329885 
> -4448698.240962145, 4608303.003107819 -4408485.217426909, 4646057.170956717 
> -4367828.852796155, 4683329.570720975 -4326735.470962173, 4720114.4939821325 
> -4285211.47416493, 4756406.320129033 -4243263.341794572, 4792199.517408414 
> -4200897.629179415, 4827488.643958784 -4158120.9663596633, 4862268.348827435 
> -4114940.056847059, 4896533.372970374 -4071361.6763707236, 4930278.550235004 
> -4027392.671609392, 4963498.808325355 -3983039.958910302, 4996189.1697497 
> -3938310.5229949625, 5028344.75275037 -3893211.4156520446, 5059960.772215587 
> -3847749.7544176374, 5091032.5405731695 -3801932.7212431184, 
> 5121555.468665908 -3755767.5611508824, 5151525.066608476 -3709261.5808781735, 
> 5180936.9446257055 -3662422.1475092806, 5209786.813872052 -3615256.687096354, 
> 5238070.4872321375 -3567772.6832690802, 5265783.880102168 -3519977.675833497, 
> 5292923.011152121 -3471879.259360188, 5280444.905918786 -3475662.723162534, 
> 5267413.519964669 -3479049.0976001215, 5253831.409509169 -3482036.259819401, 
> 5239701.191150981 -3484622.134088752, 5225025.541505176 -3486804.6922193347, 
> 5209807.196835632 -3488581.953982212, 5194048.952682742 -3489951.9875216545, 
> 5177753.663486417 -3490912.9097645665, 5160924.242204367 -3491462.8868259755, 
> 5143563.659925634 -3491600.1344104926, 5125674.945479358 -3491322.918209703, 
> 5107261.185038768 -3490629.554295372, 5088325.521720359 -3489518.409508421, 
> 5124335.015042438 -3435998.1745554423, 5159781.517221284 -3382106.363085437, 
> 5194661.194211626 -3327848.89787877, 5228970.27428286 -3273231.7412744854, 
> 5262705.048427177 -3218260.894514629, 5295861.870760795 -3162942.39708435, 
> 5328437.158918252 -3107282.326047863, 5360427.394439699 -3051286.795380354, 
> 5391829.123151183 -2994961.955295892, 5422638.955537845 -2938313.9915714143, 
> 5452853.5671100225 -2881349.124866888, 5482469.6987621905 -2824073.610041681, 
> 5511484.157124726 -2766493.735467256, 5539893.8149084365 -2708615.822336242, 
> 5567695.611241831 -2650446.223967961, 5594886.552001098 -2591991.3251104965, 
> 5621463.710132736 -2533257.5412393683, 5647424.225968817 -2474251.317852895, 
> 5672765.3075348595 -2414979.1297643287, 5697484.230850245 
> -2355447.4803908286, 5721578.340221182 -2295662.9010393596, 5745045.048526162 
> -2235631.950189586, 5767881.837493877 -2175361.2127738534, 5790086.257973594 
> -2114857.2994543226, 5811655.930197923 -2054126.8458973425, 5832588.544037971 
> -1993176.512045142, 5852881.859250853 -1932012.981384916, 5872533.705719532 
> -1870642.9602153976, 5891541.983684953 -1809073.176910976, 5909904.663970459 
> -1747310.3811834657, 5927619.788198465 -1685361.3433415913, 5944685.468999353 
> -1623232.8535482672, 5961099.890212577 -1560931.7210757744, 5976861.307079961 
> -1498464.7735588893, 5991968.046431154 -1435838.856246067, 6006418.506861235 
> -1373060.83124875, 6020211.158900446 -1310137.576788891, 6033344.545176029 
> -1247075.986444765, 6045817.280566164 -1183882.9683951659, 6057628.052345973 
> -1120565.4446620557, 6071060.603976212 -1137810.7641894307, 6083826.817777949 
> -1155007.9324322017, 6095925.780174907 -1172152.1726146133, 6107356.661671751 
> -1189238.7088374307, 6118118.71685406 -1206262.7668999406, 6128211.284379276 
> -1223219.5751216053, 6137633.786958729 -1240104.3651632895, 
> 6146385.7313307645 -1256912.372847987, 6154466.708225081 -1273638.838980982, 
> 6161876.392318277 -1290279.0101693512, 6168614.542180738 -1306828.139640761, 
> 6174681.000214861 -1323281.4880614672, 6180075.692584695 -1339634.3243534523, 
> 6184798.629137057 -1355881.9265106318, 6188849.903314148 -1372019.5824140564, 
> 6192229.69205777 -1388042.590646039, 6194938.255705103 -1403946.2613031361, 
> 6196975.937876187 -1419725.9168079162, 6198343.165353067 -1435376.8927194367, 
> 6199040.447950696 -1450894.538542375, 6199068.378379596 -1466274.218534724, 
> 6198427.632100349 -1481511.3125139994, 6197118.967169906 -1496601.2166618737, 
> 6195143.224079783 -1511539.3443271792, 6192501.325586163 -1526321.1268271983, 
> 6189194.276531915 -1540942.0142471779, 6185223.163660561 -1555397.4762379914, 
> 6180589.1554222265 -1569683.0028118768, 6175293.501771582 -1583794.105136182, 
> 6169337.533957778 -1597726.3163250377, 6162722.664306422 -1611475.1922288917, 
> 6155450.385993573 -1625036.312221822, 6147522.272811809 -1638405.2799865634, 
> 6138939.978928308 -1651577.7242971591, 6129705.238635031 -1664549.2997991752, 
> 6119819.866090943 -1677315.6877873845, 6109285.755056304 -1689872.5969808563, 
> 6098104.878619034 -1702215.7642953626, 6086279.288913133 -1714340.9556130215, 
> 6073811.116829164 -1726243.9665491018, 6060702.571716792 -1737920.6232158986, 
> 6046955.941079354 -1749366.7829836016, 6032573.590260486 -1760578.3352380663, 
> 6017557.962122761 -1771551.2021354076, 6001911.576718334 -1782281.3393533244, 
> 5985637.030951601 -1792764.736839063, 5968736.998233816 -1802997.4195539395, 
> 5951214.228129687 -1812975.4482143195, 5933071.545995908 -1822694.9200289631, 
> 5914311.852611616 -1832151.969432651, 5894938.123800751 -1841342.768815982, 
> 5874953.41004628 -1850263.5292512558, 5854360.836096302 -1858910.5012143329, 
> 5833163.600561952 -1867279.9753023828, 5811364.9755071355 
> -1875368.2829474057, 5788968.306030009 -1883171.797125436, 5765977.009836243 
> -1890686.9330613157, 5742394.576803977 -1897910.1489289345)
> 
> 
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing 
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

----- End Original Message -----
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to