Hi Eduardo,
I'd suggest you to open a ticket in JIra,
osgeo-org.atlassian.net/projects/GEOT , I'm not sure the imagemosaic-jdbc
author reads this list

Cheers
Andrea

On Fri, Jan 13, 2017 at 1:40 PM, Eduardo Suarez-Santana <
e.suarezsant...@gmail.com> wrote:

> Sorry about this. Please keep 'y' computation as is, otherwise weird
> results:
>
> diff --git a/modules/plugin/imagemosaic-jdbc/src/main/java/org/
> geotools/gce/imagemosaic/jdbc/ImageDecoderThread.java
> b/modules/plugin/imagemosaic-jdbc/src/main/java/org/
> geotools/gce/imagemosaic/jdbc/ImageDecoderThread.java
> index ff55c89..7fee122 100644
> --- a/modules/plugin/imagemosaic-jdbc/src/main/java/org/
> geotools/gce/imagemosaic/jdbc/ImageDecoderThread.java
> +++ b/modules/plugin/imagemosaic-jdbc/src/main/java/org/
> geotools/gce/imagemosaic/jdbc/ImageDecoderThread.java
> @@ -138,12 +138,8 @@ public class ImageDecoderThread extends
> AbstractThread {
>   .round((savedTileEnvelope.getMaximum(1) - tileEnvelope
>   .getMaximum(1))
>   / scaleY));
> - int width = (int) (Math.round(bufferedImage.getWidth()
> - / savedTileEnvelope.getSpan(0)
> - * tileEnvelope.getSpan(0)));
> - int height = (int) (Math.round(bufferedImage.getHeight()
> - / savedTileEnvelope.getSpan(1)
> - * tileEnvelope.getSpan(1)));
> + int width = bufferedImage.getWidth() - x;
> + int height = bufferedImage.getHeight() - y;
>
>   if ((width > 0) && (height > 0)) {
>
>
> On Fri, Jan 13, 2017 at 12:15 PM, Eduardo Suarez-Santana <
> e.suarezsant...@gmail.com> wrote:
>
>> I think I found it.
>>
>> Let the saved tile be 10x10 pixels from 0 to 10, scale = 1 in both x and
>> y, and let's try to get a tile described by the corners (2.5,2.5) and
>> (12.5,12.5). In this case, x=round((2.5-1)/1)=3 and width=round(10-2.5)=8.
>> But 3+8>10 pixels of our saved tile. Hence the error.
>>
>> So this is my proposed solution:
>>
>> diff --git a/modules/plugin/imagemosaic-jdbc/src/main/java/org/geotools
>> /gce/imagemosaic/jdbc/ImageDecoderThread.java
>> b/modules/plugin/imagemosaic-jdbc/src/main/java/org/geotools
>> /gce/imagemosaic/jdbc/ImageDecoderThread.java
>> index ff55c89..1181321 100644
>> --- a/modules/plugin/imagemosaic-jdbc/src/main/java/org/geotools
>> /gce/imagemosaic/jdbc/ImageDecoderThread.java
>> +++ b/modules/plugin/imagemosaic-jdbc/src/main/java/org/geotools
>> /gce/imagemosaic/jdbc/ImageDecoderThread.java
>> @@ -135,15 +135,11 @@ public class ImageDecoderThread extends
>> AbstractThread {
>>   .getMinimum(0))
>>   / scaleX));
>>   int y = (int) (Math
>> - .round((savedTileEnvelope.getMaximum(1) - tileEnvelope
>> - .getMaximum(1))
>> + .round((tileEnvelope.getMinimum(1) - savedTileEnvelope
>> + .getMinimum(1))
>>   / scaleY));
>> - int width = (int) (Math.round(bufferedImage.getWidth()
>> - / savedTileEnvelope.getSpan(0)
>> - * tileEnvelope.getSpan(0)));
>> - int height = (int) (Math.round(bufferedImage.getHeight()
>> - / savedTileEnvelope.getSpan(1)
>> - * tileEnvelope.getSpan(1)));
>> + int width = bufferedImage.getWidth() - x;
>> + int height = bufferedImage.getHeight() - y;
>>
>>   if ((width > 0) && (height > 0)) {
>>
>> The computation of 'y' may be kept as already is, or may be changed as
>> proposed.
>>
>> Error has disappeared.
>>
>>
>> On Fri, Jan 13, 2017 at 10:06 AM, Eduardo Suarez-Santana <
>> e.suarezsant...@gmail.com> wrote:
>>
>>> I'm getting this error while trying to seed some layers in geoserver/gwc
>>> via imagemosaicjdbc:
>>>
>>> ene 13 09:06:41 windserver server[805]: Exception in thread
>>> "pool-21-thread-1"
>>> java.awt.image.RasterFormatException: (parentX + width) is outside
>>> raster
>>> ene 13 09:06:41 windserver server[805]: at java.awt.image.WritableRaster.
>>> createWritableChild(WritableRaster.java:228)
>>> ene 13 09:06:41 windserver server[805]: at java.awt.image.BufferedImage.g
>>> etSubimage(BufferedImage.java:1202)
>>> ene 13 09:06:41 windserver server[805]: at org.geotools.gce.imagemosaic.j
>>> dbc.ImageDecoderThread.run(ImageDecoderThread.java:150)
>>> ene 13 09:06:41 windserver server[805]: at java.util.concurrent.ThreadPoo
>>> lExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>> ene 13 09:06:41 windserver server[805]: at java.util.concurrent.ThreadPoo
>>> lExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>> ene 13 09:06:41 windserver server[805]: at java.lang.Thread.run(Thread.ja
>>> va:745)
>>>
>>> and looking at the source it doesn't look good to me:
>>>
>>> diff --git a/modules/plugin/imagemosaic-jdbc/src/main/java/org/geotools
>>> /gce/imagemosaic/jdbc/ImageDecoderThread.java
>>> b/modules/plugin/imagemosaic-jdbc/src/main/java/org/geotools
>>> /gce/imagemosaic/jdbc/ImageDecoderThread.java
>>> index ff55c89..b45368f 100644
>>> --- a/modules/plugin/imagemosaic-jdbc/src/main/java/org/geotools
>>> /gce/imagemosaic/jdbc/ImageDecoderThread.java
>>> +++ b/modules/plugin/imagemosaic-jdbc/src/main/java/org/geotools
>>> /gce/imagemosaic/jdbc/ImageDecoderThread.java
>>> @@ -135,8 +135,8 @@ public class ImageDecoderThread extends
>>> AbstractThread {
>>>   .getMinimum(0))
>>>   / scaleX));
>>>   int y = (int) (Math
>>> - .round((savedTileEnvelope.getMaximum(1) - tileEnvelope
>>> - .getMaximum(1))
>>> + .round((savedTileEnvelope.getMinimum(1) - tileEnvelope
>>> + .getMinimum(1))
>>>   / scaleY));
>>>   int width = (int) (Math.round(bufferedImage.getWidth()
>>>   / savedTileEnvelope.getSpan(0)
>>>
>>> Could you please check it out?
>>>
>>
>>
>
> ------------------------------------------------------------
> ------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today. http://sdm.link/xeonphi
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>


-- 
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility  for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to