Hi folks,

We've been getting strange errors in uDig when rendering from PostGIS (and possibly others). Everything appeared to draw correctly, but some exceptions occurred including this:

Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.geotools.renderer.lite.LiteShape2.getBounds2D(LiteShape2.java:538)
   at sun.java2d.pipe.AlphaPaintPipe.startSequence(Unknown Source)
at sun.java2d.pipe.SpanShapeRenderer$Composite.startSequence(Unknown Source)
   at sun.java2d.pipe.SpanShapeRenderer.renderSpans(Unknown Source)

It turns out that the decimator was reducing geometries down to a point or zero length line, and the getEnvelope method was returning an unexpected single coordinate instead of 5 coordinates as one would expect for an envelope. My understanding is that the geometry isn't relevant (incredibly small in contrast to our bbox), so it should be approximated away.

The actual reduction was taking place here:
Line 82 of org.geotools.renderer.lite.Decimator

here are the parameters and some results.

decimator:
spanx= 1735.4640560498228
spany= 4459.834663945716

geometries:
after decimation:
geometry= POLYGON ((371.1821518726456 257.48731842821735, 371.1821518726456 257.48731842821735))

before:
MULTIPOLYGON (((1477615.2218454846 469175.17166099045, 1477745.4825444575 469214.65571489185, 1477919.7807593197 468927.48498062976, 1477969.8528404355 468818.0049648937, 1478011.7284851405 468709.5105803376, 1478194.201895452 468517.98600566294, 1478193.9772841232 468415.2857901836, 1478117.865123242 468354.40667696577, 1478170.321485953 468137.5217748834, 1478238.647530919 468035.36440508347, 1478541.5191640307 468122.6622347776, 1478796.6832695315 468292.55929470155, 1478863.3525996725 468372.3869243795, 1478821.7150299242 468519.16123440117, 1478889.7430130139 468628.35081162397, 1479039.384361268 468642.0820898507, 1479295.699527227 468666.17062211316, 1479346.761199392 468580.9734557634, 1479318.2114595103 468527.0635735942, 1479509.7032213411 468545.03706498165, 1479549.5311105016 468187.6577363359, 1479722.1479424688 468203.2644469859, 1479733.5049643456 467976.1924967328, 1479462.9032765087 467961.3845828846, 1479536.3756330267 467641.44418686815, 1479664.6604609597 467648.4714136515, 1479670.8993770792 467526.45055045746, 1479671.5234575176 467513.4432325987, 1479676.391633086 467410.3757445188, 1479370.8881696789 467408.30431078374, 1479298.1001864877 467465.6115700174, 1479007.5996645929 467569.1003571311, 1478849.4734263632 467719.38540598005, 1478722.0545306858 467729.57989721093, 1478615.363082244 467791.6959488727, 1478283.7982984053 467723.952449508, 1478187.428064557 467727.97485588305, 1478110.7956281113 467767.68914341833, 1478020.8911947464 467736.28558699414, 1477777.157076939 467531.58991804905, 1477663.1602755946 467499.17965187505, 1477656.0903286838 467459.0369626684, 1477942.9937632165 467319.86301490664, 1478038.7741605043 467175.85282696225, 1478062.1517368509 467037.8640569467, 1478151.0848165292 466972.51470341533, 1478229.6015064481 466837.4129617736, 1478217.448519992 466757.3771737153, 1478279.3336572926 466577.91496907733, 1478153.7813977636 466565.193952607, 1478096.7604875606 466649.64239593036, 1477876.2193113856 466565.6259017056, 1477792.3627655702 466703.0775970323, 1477637.8535009557 466792.41608849354, 1477617.8407517788 466879.49131595343, 1477562.081575073 466873.5075962506, 1477222.8653492252 467156.1025165627, 1477145.219711788 467292.32081682514, 1476793.7732193698 467278.46038279403, 1476868.9206000913 466599.39287489, 1476822.3660022337 466520.07850317564, 1476976.542808525 466224.35386517085, 1477125.6410954376 465864.581159913, 1477192.265480352 465566.94283922296, 1477321.5822108972 465388.89022222906, 1477330.6670675226 465292.3945368519, 1476586.1667394228 465194.04116891976, 1476492.640329827 465255.7955662636, 1476359.47481049 465440.41190651245, 1476276.5249846836 465393.7796687819, 1476148.237255321 465394.8114559911, 1476150.395542861 465811.78914804757, 1476182.6845889443 465811.8100952478, 1476007.0474955596 465997.14362005703, 1475965.423080817 466111.7052397765, 1475913.1431864826 466094.08052614797, 1475579.2163293445 466688.36498296354, 1475752.1467656419 467015.02606367413, 1475634.495093144 467260.977840011, 1475259.1804203163 468040.3238858571, 1474642.4782261061 469344.04669830576, 1475358.1256199805 468819.7358662309, 1475605.5566736711 469147.69381416123, 1475857.2000551138 468919.53992542624, 1475976.5362506506 468941.5457006134, 1476022.49198297 468905.0300962981, 1476016.6842837783 468766.40013842937, 1476146.473087369 468689.0581017649, 1476159.038312018 468580.9159108531, 1476332.5563088502 468428.5296296235, 1476384.3639167487 468321.2808267176, 1476566.7643577652 468451.850736971, 1476605.0063515452 468484.82913864776, 1476612.5704917351 468537.1130731506, 1476548.8530837875 468586.5004168749, 1476744.6546054832 468763.0413225377, 1476838.433242736 468675.1461427389, 1477281.679083753 469099.12833716255, 1477344.6614469343 469007.3721617386, 1477507.193906828 469119.3501138631, 1477614.8578680712 469137.88199126534, 1477614.8504602015 469170.09211768396, 1477615.2218454846 469175.17166099045)))

I added a little hack to work around this (null is returned instead of an exception being thrown). Please see r19245 on 2.2.x -- is this a reasonable fix, or is there a better way?

Cheers,
Cory.


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to