Re: [JPP-Devel] Improvement to GeoTIFF reader

2013-08-28 Thread Landon Blake
Great Changes Jukka. Thanks.

Landon


On Sat, Aug 24, 2013 at 3:09 PM, Rahkonen Jukka
jukka.rahko...@mmmtike.fiwrote:

 Hi,

 The Geotiff reader does now
 - examine if tiff image contains geotiff tags
 - if not, check if tfw file can be found
 - if not, send an error and quit.

 It would be often fine just to see the image, even if it is not
 georeferenced. How about to make OpenJUMP to use a default tfw file if
 image is not geotiff and tfw file is not found?

 The default TFW could be for example

 1
 0
 0
 -1
 0.5
 -0.5

 Image would be opened to have top left corner of the top left pixel at
 coordinates (0,0) and pixel size would be 1 by 1 units.

 -Jukka Rahkonen-

 --
 Introducing Performance Central, a new site from SourceForge and
 AppDynamics. Performance Central is your source for news, insights,
 analysis and resources for efficient Application Performance Management.
 Visit us today!
 http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Improvement to GeoTIFF reader

2013-08-28 Thread edgar . soldin
still in the pipeline. nothing to celebrate yet.  ..ede

On 28.08.2013 16:14, Landon Blake wrote:
 Great Changes Jukka. Thanks.
 
 Landon
 
 
 On Sat, Aug 24, 2013 at 3:09 PM, Rahkonen Jukka
 jukka.rahko...@mmmtike.fiwrote:
 
 Hi,

 The Geotiff reader does now
 - examine if tiff image contains geotiff tags
 - if not, check if tfw file can be found
 - if not, send an error and quit.

 It would be often fine just to see the image, even if it is not
 georeferenced. How about to make OpenJUMP to use a default tfw file if
 image is not geotiff and tfw file is not found?

 The default TFW could be for example

 1
 0
 0
 -1
 0.5
 -0.5

 Image would be opened to have top left corner of the top left pixel at
 coordinates (0,0) and pixel size would be 1 by 1 units.

 -Jukka Rahkonen-

 --
 Introducing Performance Central, a new site from SourceForge and
 AppDynamics. Performance Central is your source for news, insights,
 analysis and resources for efficient Application Performance Management.
 Visit us today!
 http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

 
 
 
 --
 Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
 Discover the easy way to master current and previous Microsoft technologies
 and advance your career. Get an incredible 1,500+ hours of step-by-step
 tutorial videos with LearnDevNow. Subscribe today and save!
 http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk
 
 
 
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
 

--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Improvement to GeoTIFF reader

2013-08-26 Thread Rahkonen Jukka
Hi,

I do not know for sure what happens here but I do not believe that it is 
possible to get a perfect match with pixels with that code. Here is an excerpt.

Geometry fence = SelectionTools.getFenceGeometry(context);
Envelope envWanted = fence.getEnvelopeInternal();
BufferedImage partOfImageWanted = rLayer.getTileAsImage(envWanted);
Raster partOfRasterWanted = rLayer.getTileAsRaster(envWanted); //[sstein 2 Aug 
2010] need to add as we have now the image for display plus the data
if (partOfImageWanted==null){
context.getWorkbenchFrame().warnUser(I18N.get(org.openjump.core.ui.plugin.layer.pirolraster.ExtractSelectedPartOfImage.fence-in-wrong-region));
return false;
}
boolean returnVal = this.putImageIntoMap(partOfImageWanted, partOfRasterWanted, 
envWanted, rLayer, context);
return returnVal;

And why not? Because our vector coordinates are doubles but raster images are 
tied to sort of binary world with raster size as a minimal step unit. If I can 
read the code, the writer believes that envWanted is same as the envelope of 
the returned pixels but it is impossible to crop an image to any imaginary 
envelope without doing resampling and I do not believe that getTileAsRaster is 
doing resampling. Envelope of the returned image can only be the same then the 
wanted envelope if coordinates in the envWanted match perfectly with the 
coordinates of pixel corners. In order to get a perfect match we should know 
the origin of the image and pixel size in X and Y directions. Based on those 
parameters it would be possible to count such an envWanted that matches 
perfectly with the pixels.
Another possibility would be to check the envelope of pixels which are really 
returned by the getTileAsRaster, make a new variable envelopeThatWeGot and 
use that one for georeferencing the clipped image.

I found some python code we have been using in a little bit similar task for 
extending bounding box to be full meters. It was enough for us because in that 
dataset the origins were always full meters and pixel size was either 0.5 or 
1.0 meters so we did not need to check those values from image info. The end 
result is minmax_wider.

minmax = get_minmax(tm32_coords)
   minmax_wider = [
   
(int(math.floor(minmax[0][0])), int(math.floor(minmax[0][1]))),
   (int(math.ceil 
(minmax[1][0])), int(math.ceil (minmax[1][1]))),
   ]

   log(Extents (min,max):  + str(minmax), outfilename)
   log(Widened extents (min,max):  + 
str(minmax_wider), outfilename)

-Jukka Rahkonen-

Lähettäjä: Giuseppe Aruta [mailto:giuseppe_ar...@yahoo.it]
Lähetetty: 25. elokuuta 2013 13:35
Vastaanottaja: OpenJump develop and use
Aihe: Re: [JPP-Devel] Improvement to GeoTIFF reader

Hi all,
this is an observation on class:
org.openjump.core.ui.plugin.layer.pirolraster.ExtractSelectedPartOfImage
the extracted part of the image has a shift.
I calculate that the pixel are shifted of -1/5 for Y and around 1/20 for X.
I attached a picture on this mail (green points, anchor points of pixe of the 
original image. Red points anchor points of the extracted part of the image)
[Immagine in linea 1]
This doesn't happen with the same tool on Sextante Toolbox (Basic Toos for 
Raster - Crop GRID with polygon) - f coarse if OJ is using Oracle Java.
Sextante Raster tools simply don't work if OJ is using OpenJDK 
(java.lang.ClassNotFoundException: com.sun.image.codec.jpeg.JPEGDecode) for the 
absence of TIF writer. Sextante for OJ probably requires a rework to use 
commons library instead of JAI (at least with Linux OpenJDK) at least to save 
results.
regards
Peppe




2013/8/25 Giuseppe Aruta 
giuseppe_ar...@yahoo.itmailto:giuseppe_ar...@yahoo.it
THis should be adopted also to OJ Sextante (Pirol) image reader
Peppe

2013/8/25 Rahkonen Jukka 
jukka.rahko...@mmmtike.fimailto:jukka.rahko...@mmmtike.fi
Hi,

The Geotiff reader does now
- examine if tiff image contains geotiff tags
- if not, check if tfw file can be found
- if not, send an error and quit.

It would be often fine just to see the image, even if it is not georeferenced. 
How about to make OpenJUMP to use a default tfw file if image is not geotiff 
and tfw file is not found?

The default TFW could be for example

1
0
0
-1
0.5
-0.5

Image would be opened to have top left corner of the top left pixel at 
coordinates (0,0) and pixel size would be 1 by 1 units.

-Jukka Rahkonen-
--
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
Jump-pilot-devel mailing list

Re: [JPP-Devel] Improvement to GeoTIFF reader

2013-08-26 Thread edgar . soldin
i see what i can do.. maybe together with a warning in the statusbar of the 
workbench.. ede

On 25.08.2013 00:09, Rahkonen Jukka wrote:
 Hi,
 
 The Geotiff reader does now
 - examine if tiff image contains geotiff tags
 - if not, check if tfw file can be found
 - if not, send an error and quit.
 
 It would be often fine just to see the image, even if it is not 
 georeferenced. How about to make OpenJUMP to use a default tfw file if image 
 is not geotiff and tfw file is not found?
 
 The default TFW could be for example
 
 1
 0
 0
 -1
 0.5
 -0.5
 
 Image would be opened to have top left corner of the top left pixel at 
 coordinates (0,0) and pixel size would be 1 by 1 units.
 
 -Jukka Rahkonen-

--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Improvement to GeoTIFF reader

2013-08-26 Thread Rahkonen Jukka
Hi,

I believe you can copy the GeoTIFF part and feed in the values manually if 
neither tags not tfw file is found.  At the same time you can correct the 
comments about anchor point in GeoTIFF

// These parameters are the same as those in a tfw file.
= These parameters are the same as those in a tfw file but the anchor point is 
shifted by half a pixel

// x-coordinate of the
// center of the upper
// left pixel

= X-coordinate in the GeoTIFF file of the default type PixelIsArea is the 
upper left corner of the upper left pixel

// Find the ModelTiePoints field
XTIFFField fieldModelTiePoints = dir.getField(XTIFF.TIFFTAG_GEO_TIEPOINTS);
if (fieldModelTiePoints == null) {
// try to read geotransform (tranformation matrix) information,
// if tiepoints are not used to georeference this image.
// These parameters are the same as those in a tfw file.
XTIFFField fieldModelGeoTransform = dir
.getField(XTIFF.TIFFTAG_GEO_TRANS_MATRIX);
if (fieldModelGeoTransform == null) {
throw new Exception(
Missing tiepoints-tag and tranformation matrix-tag parameters in file.\n
+ MSG_GENERAL);
}
double[] tags = new double[6];
tags[0] = fieldModelGeoTransform.getAsDouble(0); // pixel size in x
// direction
tags[1] = fieldModelGeoTransform.getAsDouble(1); // rotation about y-axis
tags[2] = fieldModelGeoTransform.getAsDouble(4); // rotation about x-axis
tags[3] = fieldModelGeoTransform.getAsDouble(5); // pixel size in the
// y-direction
tags[4] = fieldModelGeoTransform.getAsDouble(3); // x-coordinate of the
// center of the upper
// left pixel
tags[5] = fieldModelGeoTransform.getAsDouble(7); // y-coordinate of the
// center of the upper
// left pixel
// setCoorRasterTiff_tiepointLT(new Coordinate(-0.5, -0,5));
// setCoorModel_tiepointLT(new Coordinate(0, 0));
// setAffineTransformation(new AffineTransform(tags));
setEnvelope(tags);

-Jukka-

 -Alkuperäinen viesti-
 Lähettäjä: edgar.sol...@web.de [mailto:edgar.sol...@web.de]
 Lähetetty: 26. elokuuta 2013 12:54
 Vastaanottaja: OpenJump develop and use
 Aihe: Re: [JPP-Devel] Improvement to GeoTIFF reader
 
 i see what i can do.. maybe together with a warning in the statusbar of the
 workbench.. ede
 
 On 25.08.2013 00:09, Rahkonen Jukka wrote:
  Hi,
 
  The Geotiff reader does now
  - examine if tiff image contains geotiff tags
  - if not, check if tfw file can be found
  - if not, send an error and quit.
 
  It would be often fine just to see the image, even if it is not 
  georeferenced.
 How about to make OpenJUMP to use a default tfw file if image is not geotiff
 and tfw file is not found?
 
  The default TFW could be for example
 
  1
  0
  0
  -1
  0.5
  -0.5
 
  Image would be opened to have top left corner of the top left pixel at
 coordinates (0,0) and pixel size would be 1 by 1 units.
 
  -Jukka Rahkonen-
 
 --
 Introducing Performance Central, a new site from SourceForge and
 AppDynamics. Performance Central is your source for news, insights, analysis
 and resources for efficient Application Performance Management.
 Visit us today!
 http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Improvement to GeoTIFF reader

2013-08-26 Thread edgar . soldin
sorry.. can you provide a diff?  not sure what of the below is really a change 
and what not.. ede

On 26.08.2013 12:16, Rahkonen Jukka wrote:
 Hi,
 
 I believe you can copy the GeoTIFF part and feed in the values manually if 
 neither tags not tfw file is found.  At the same time you can correct the 
 comments about anchor point in GeoTIFF
 
 // These parameters are the same as those in a tfw file.
 = These parameters are the same as those in a tfw file but the anchor point 
 is shifted by half a pixel
 
 // x-coordinate of the
 // center of the upper
 // left pixel
 
 = X-coordinate in the GeoTIFF file of the default type PixelIsArea is the 
 upper left corner of the upper left pixel
 
 // Find the ModelTiePoints field
 XTIFFField fieldModelTiePoints = dir.getField(XTIFF.TIFFTAG_GEO_TIEPOINTS);
 if (fieldModelTiePoints == null) {
 // try to read geotransform (tranformation matrix) information,
 // if tiepoints are not used to georeference this image.
 // These parameters are the same as those in a tfw file.
 XTIFFField fieldModelGeoTransform = dir
 .getField(XTIFF.TIFFTAG_GEO_TRANS_MATRIX);
 if (fieldModelGeoTransform == null) {
 throw new Exception(
 Missing tiepoints-tag and tranformation matrix-tag parameters in file.\n
 + MSG_GENERAL);
 }
 double[] tags = new double[6];
 tags[0] = fieldModelGeoTransform.getAsDouble(0); // pixel size in x
 // direction
 tags[1] = fieldModelGeoTransform.getAsDouble(1); // rotation about y-axis
 tags[2] = fieldModelGeoTransform.getAsDouble(4); // rotation about x-axis
 tags[3] = fieldModelGeoTransform.getAsDouble(5); // pixel size in the
 // y-direction
 tags[4] = fieldModelGeoTransform.getAsDouble(3); // x-coordinate of the
 // center of the upper
 // left pixel
 tags[5] = fieldModelGeoTransform.getAsDouble(7); // y-coordinate of the
 // center of the upper
 // left pixel
 // setCoorRasterTiff_tiepointLT(new Coordinate(-0.5, -0,5));
 // setCoorModel_tiepointLT(new Coordinate(0, 0));
 // setAffineTransformation(new AffineTransform(tags));
 setEnvelope(tags);
 
 -Jukka-
 
 -Alkuperäinen viesti-
 Lähettäjä: edgar.sol...@web.de [mailto:edgar.sol...@web.de]
 Lähetetty: 26. elokuuta 2013 12:54
 Vastaanottaja: OpenJump develop and use
 Aihe: Re: [JPP-Devel] Improvement to GeoTIFF reader

 i see what i can do.. maybe together with a warning in the statusbar of the
 workbench.. ede

 On 25.08.2013 00:09, Rahkonen Jukka wrote:
 Hi,

 The Geotiff reader does now
 - examine if tiff image contains geotiff tags
 - if not, check if tfw file can be found
 - if not, send an error and quit.

 It would be often fine just to see the image, even if it is not 
 georeferenced.
 How about to make OpenJUMP to use a default tfw file if image is not geotiff
 and tfw file is not found?

 The default TFW could be for example

 1
 0
 0
 -1
 0.5
 -0.5

 Image would be opened to have top left corner of the top left pixel at
 coordinates (0,0) and pixel size would be 1 by 1 units.

 -Jukka Rahkonen-

 --
 Introducing Performance Central, a new site from SourceForge and
 AppDynamics. Performance Central is your source for news, insights, analysis
 and resources for efficient Application Performance Management.
 Visit us today!
 http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
 
 --
 Introducing Performance Central, a new site from SourceForge and 
 AppDynamics. Performance Central is your source for news, insights, 
 analysis and resources for efficient Application Performance Management. 
 Visit us today!
 http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
 

-- 
public class WhoDidIt{ // A comment. I love comments 
  private static Person sender;

  public static void main (String[] foo){

  sender = new Person();
  sender.setName(new String[]{Edgar, Soldin});

  Address address = new Address();
  address.setStreet(Stadtweg 119);
  address.setZip(39116);
  address.setCity(Magdeburg);
  address.setCountry(Germany);

  sender.setAddress(address);

  sender.setMobilePhone( +49(0)171-2782880 );
  sender.setWebSiteUrl( http://www.soldin.de );
  sender.setEmail( ed...@soldin.de );
  sender.setPGPPublicKey( http://www.soldin.de/edgar_soldin.asc );
  sender.setGender(true);

  System.out.println(sender.toString());
  }
}

--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis

Re: [JPP-Devel] Improvement to GeoTIFF reader

2013-08-26 Thread Rahkonen Jukka
I can try to describe

Instead of comment
// These parameters are the same as those in a tfw file.
write something like
= These parameters are the same as those in a tfw file but the anchor
 point is shifted by half a pixel

Instead of comment
 // x-coordinate of the
 // center of the upper
 // left pixel
write something like
 = X-coordinate in the GeoTIFF file of the default type PixelIsArea  is the 
upper left corner of the upper left pixel

And now the code picks the GeoTIFF tags as
double[] tags = new double[6];
tags[0] = fieldModelGeoTransform.getAsDouble(0); 
tags[1] = fieldModelGeoTransform.getAsDouble(1); 
tags[2] = fieldModelGeoTransform.getAsDouble(4);
tags[3] = fieldModelGeoTransform.getAsDouble(5);
tags[4] = fieldModelGeoTransform.getAsDouble(3);
tags[5] = fieldModelGeoTransform.getAsDouble(7);

If image is not georeferenced it might work to write hardcoded value for 
default georeferencing with rectangular pixels with size of 1 by 1 unit and the 
upper left corner of the upper left pixel places at (0,0)

double[] tags = new double[6];
tags[0] = 1; 
tags[1] = 0; 
tags[2] = 0;
tags[3] = -1;
tags[4] = 0;
tags[5] = 0;

-Jukka-




 -Alkuperäinen viesti-
 Lähettäjä: edgar.sol...@web.de [mailto:edgar.sol...@web.de]
 Lähetetty: 26. elokuuta 2013 13:30
 Vastaanottaja: OpenJump develop and use
 Aihe: Re: [JPP-Devel] Improvement to GeoTIFF reader
 
 sorry.. can you provide a diff?  not sure what of the below is really a 
 change and
 what not.. ede
 
 On 26.08.2013 12:16, Rahkonen Jukka wrote:
  Hi,
 
  I believe you can copy the GeoTIFF part and feed in the values
  manually if neither tags not tfw file is found.  At the same time you
  can correct the comments about anchor point in GeoTIFF
 
  // These parameters are the same as those in a tfw file.
  = These parameters are the same as those in a tfw file but the anchor
  point is shifted by half a pixel
 
  // x-coordinate of the
  // center of the upper
  // left pixel
 
  = X-coordinate in the GeoTIFF file of the default type PixelIsArea
  is the upper left corner of the upper left pixel
 
  // Find the ModelTiePoints field
  XTIFFField fieldModelTiePoints =
  dir.getField(XTIFF.TIFFTAG_GEO_TIEPOINTS);
  if (fieldModelTiePoints == null) {
  // try to read geotransform (tranformation matrix) information, // if
  tiepoints are not used to georeference this image.
  // These parameters are the same as those in a tfw file.
  XTIFFField fieldModelGeoTransform = dir
  .getField(XTIFF.TIFFTAG_GEO_TRANS_MATRIX);
  if (fieldModelGeoTransform == null) {
  throw new Exception(
  Missing tiepoints-tag and tranformation matrix-tag parameters in file.\n
  + MSG_GENERAL);
  }
  double[] tags = new double[6];
  tags[0] = fieldModelGeoTransform.getAsDouble(0); // pixel size in x //
  direction tags[1] = fieldModelGeoTransform.getAsDouble(1); // rotation
  about y-axis tags[2] = fieldModelGeoTransform.getAsDouble(4); //
  rotation about x-axis tags[3] = fieldModelGeoTransform.getAsDouble(5);
  // pixel size in the // y-direction tags[4] =
  fieldModelGeoTransform.getAsDouble(3); // x-coordinate of the //
  center of the upper // left pixel tags[5] =
  fieldModelGeoTransform.getAsDouble(7); // y-coordinate of the //
  center of the upper // left pixel // setCoorRasterTiff_tiepointLT(new
  Coordinate(-0.5, -0,5)); // setCoorModel_tiepointLT(new Coordinate(0,
  0)); // setAffineTransformation(new AffineTransform(tags));
  setEnvelope(tags);
 
  -Jukka-
 
  -Alkuperäinen viesti-
  Lähettäjä: edgar.sol...@web.de [mailto:edgar.sol...@web.de]
  Lähetetty: 26. elokuuta 2013 12:54
  Vastaanottaja: OpenJump develop and use
  Aihe: Re: [JPP-Devel] Improvement to GeoTIFF reader
 
  i see what i can do.. maybe together with a warning in the statusbar
  of the workbench.. ede
 
  On 25.08.2013 00:09, Rahkonen Jukka wrote:
  Hi,
 
  The Geotiff reader does now
  - examine if tiff image contains geotiff tags
  - if not, check if tfw file can be found
  - if not, send an error and quit.
 
  It would be often fine just to see the image, even if it is not 
  georeferenced.
  How about to make OpenJUMP to use a default tfw file if image is not
  geotiff and tfw file is not found?
 
  The default TFW could be for example
 
  1
  0
  0
  -1
  0.5
  -0.5
 
  Image would be opened to have top left corner of the top left pixel
  at
  coordinates (0,0) and pixel size would be 1 by 1 units.
 
  -Jukka Rahkonen-
 
  -
  - Introducing Performance Central, a new site from
  SourceForge and AppDynamics. Performance Central is your source for
  news, insights, analysis and resources for efficient Application
  Performance Management.
  Visit us today!
  http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.
  clktrk ___
  Jump-pilot-devel mailing list
  Jump-pilot-devel@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/jump-pilot

Re: [JPP-Devel] Improvement to GeoTIFF reader

2013-08-26 Thread edgar . soldin
thanks.. much more understandable.. will see to update the sources accordingly. 
..ede

On 26.08.2013 12:50, Rahkonen Jukka wrote:
 I can try to describe
 
 Instead of comment
 // These parameters are the same as those in a tfw file.
 write something like
 = These parameters are the same as those in a tfw file but the anchor
  point is shifted by half a pixel
 
 Instead of comment
  // x-coordinate of the
  // center of the upper
  // left pixel
 write something like
  = X-coordinate in the GeoTIFF file of the default type PixelIsArea  is 
 the upper left corner of the upper left pixel
 
 And now the code picks the GeoTIFF tags as
 double[] tags = new double[6];
 tags[0] = fieldModelGeoTransform.getAsDouble(0); 
 tags[1] = fieldModelGeoTransform.getAsDouble(1); 
 tags[2] = fieldModelGeoTransform.getAsDouble(4);
 tags[3] = fieldModelGeoTransform.getAsDouble(5);
 tags[4] = fieldModelGeoTransform.getAsDouble(3);
 tags[5] = fieldModelGeoTransform.getAsDouble(7);
 
 If image is not georeferenced it might work to write hardcoded value for 
 default georeferencing with rectangular pixels with size of 1 by 1 unit and 
 the upper left corner of the upper left pixel places at (0,0)
 
 double[] tags = new double[6];
 tags[0] = 1; 
 tags[1] = 0; 
 tags[2] = 0;
 tags[3] = -1;
 tags[4] = 0;
 tags[5] = 0;
 
 -Jukka-
 
 
 
 
 -Alkuperäinen viesti-
 Lähettäjä: edgar.sol...@web.de [mailto:edgar.sol...@web.de]
 Lähetetty: 26. elokuuta 2013 13:30
 Vastaanottaja: OpenJump develop and use
 Aihe: Re: [JPP-Devel] Improvement to GeoTIFF reader

 sorry.. can you provide a diff?  not sure what of the below is really a 
 change and
 what not.. ede

 On 26.08.2013 12:16, Rahkonen Jukka wrote:
 Hi,

 I believe you can copy the GeoTIFF part and feed in the values
 manually if neither tags not tfw file is found.  At the same time you
 can correct the comments about anchor point in GeoTIFF

 // These parameters are the same as those in a tfw file.
 = These parameters are the same as those in a tfw file but the anchor
 point is shifted by half a pixel

 // x-coordinate of the
 // center of the upper
 // left pixel

 = X-coordinate in the GeoTIFF file of the default type PixelIsArea
 is the upper left corner of the upper left pixel

 // Find the ModelTiePoints field
 XTIFFField fieldModelTiePoints =
 dir.getField(XTIFF.TIFFTAG_GEO_TIEPOINTS);
 if (fieldModelTiePoints == null) {
 // try to read geotransform (tranformation matrix) information, // if
 tiepoints are not used to georeference this image.
 // These parameters are the same as those in a tfw file.
 XTIFFField fieldModelGeoTransform = dir
 .getField(XTIFF.TIFFTAG_GEO_TRANS_MATRIX);
 if (fieldModelGeoTransform == null) {
 throw new Exception(
 Missing tiepoints-tag and tranformation matrix-tag parameters in file.\n
 + MSG_GENERAL);
 }
 double[] tags = new double[6];
 tags[0] = fieldModelGeoTransform.getAsDouble(0); // pixel size in x //
 direction tags[1] = fieldModelGeoTransform.getAsDouble(1); // rotation
 about y-axis tags[2] = fieldModelGeoTransform.getAsDouble(4); //
 rotation about x-axis tags[3] = fieldModelGeoTransform.getAsDouble(5);
 // pixel size in the // y-direction tags[4] =
 fieldModelGeoTransform.getAsDouble(3); // x-coordinate of the //
 center of the upper // left pixel tags[5] =
 fieldModelGeoTransform.getAsDouble(7); // y-coordinate of the //
 center of the upper // left pixel // setCoorRasterTiff_tiepointLT(new
 Coordinate(-0.5, -0,5)); // setCoorModel_tiepointLT(new Coordinate(0,
 0)); // setAffineTransformation(new AffineTransform(tags));
 setEnvelope(tags);

 -Jukka-

 -Alkuperäinen viesti-
 Lähettäjä: edgar.sol...@web.de [mailto:edgar.sol...@web.de]
 Lähetetty: 26. elokuuta 2013 12:54
 Vastaanottaja: OpenJump develop and use
 Aihe: Re: [JPP-Devel] Improvement to GeoTIFF reader

 i see what i can do.. maybe together with a warning in the statusbar
 of the workbench.. ede

 On 25.08.2013 00:09, Rahkonen Jukka wrote:
 Hi,

 The Geotiff reader does now
 - examine if tiff image contains geotiff tags
 - if not, check if tfw file can be found
 - if not, send an error and quit.

 It would be often fine just to see the image, even if it is not 
 georeferenced.
 How about to make OpenJUMP to use a default tfw file if image is not
 geotiff and tfw file is not found?

 The default TFW could be for example

 1
 0
 0
 -1
 0.5
 -0.5

 Image would be opened to have top left corner of the top left pixel
 at
 coordinates (0,0) and pixel size would be 1 by 1 units.

 -Jukka Rahkonen-

 -
 - Introducing Performance Central, a new site from
 SourceForge and AppDynamics. Performance Central is your source for
 news, insights, analysis and resources for efficient Application
 Performance Management.
 Visit us today!
 http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.
 clktrk ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel

Re: [JPP-Devel] Improvement to GeoTIFF reader

2013-08-25 Thread Giuseppe Aruta
THis should be adopted also to OJ Sextante (Pirol) image reader
Peppe


2013/8/25 Rahkonen Jukka jukka.rahko...@mmmtike.fi

 Hi,

 The Geotiff reader does now
 - examine if tiff image contains geotiff tags
 - if not, check if tfw file can be found
 - if not, send an error and quit.

 It would be often fine just to see the image, even if it is not
 georeferenced. How about to make OpenJUMP to use a default tfw file if
 image is not geotiff and tfw file is not found?

 The default TFW could be for example

 1
 0
 0
 -1
 0.5
 -0.5

 Image would be opened to have top left corner of the top left pixel at
 coordinates (0,0) and pixel size would be 1 by 1 units.

 -Jukka Rahkonen-

 --
 Introducing Performance Central, a new site from SourceForge and
 AppDynamics. Performance Central is your source for news, insights,
 analysis and resources for efficient Application Performance Management.
 Visit us today!
 http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel