[JPP-Devel] [jump-pilot:bugs] #512 Georeferenced RasterImage : useless dialog to create a worlfile

2020-11-15 Thread michael michaud via Jump-pilot-devel
Thanks for the reminder Peppe. It was useful.
Initial statement should be fixed in r6623.
I did not understand your last statement. Can you tell if it is solved by 
r6623, and if not, elaborate.


---

** [bugs:#512] Georeferenced RasterImage : useless dialog to create a worlfile**

**Status:** open
**Milestone:** OJ_1.16
**Created:** Wed Nov 11, 2020 08:29 AM UTC by michael michaud
**Last Updated:** Thu Nov 12, 2020 04:48 PM UTC
**Owner:** nobody


Trying to open a georeferenced GeoTiff  as a (Sextante) RasterImage , I'm 
invited to define the worldfile through a dialog box. Whatever I enter in the 
diaog box, the image will be georeferenced using the geotags of the geotiff, 
which is fine, but the dialogbox is misleading and will create a tfw file which 
is inconsistant with the geotiff tags.


---

Sent from sourceforge.net because jump-pilot-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/jump-pilot/bugs/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/jump-pilot/admin/bugs/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] SVN: [6623] core/trunk

2020-11-15 Thread jump-pilot-svn--- via Jump-pilot-devel
Revision: 6623
  http://sourceforge.net/p/jump-pilot/code/6623
Author:   michaudm
Date: 2020-11-15 09:42:42 + (Sun, 15 Nov 2020)
Log Message:
---
fix #512 about georeferencing (introduced by r6523)

Modified Paths:
--
core/trunk/ChangeLog
core/trunk/src/org/openjump/core/rasterimage/AddRasterImageLayerWizard.java

Modified: core/trunk/ChangeLog
===
--- core/trunk/ChangeLog2020-11-11 22:01:40 UTC (rev 6622)
+++ core/trunk/ChangeLog2020-11-15 09:42:42 UTC (rev 6623)
@@ -4,10 +4,13 @@
 # 3. be concise but convey the change in a way that ordinary users understand
 #< 80 chars -->
 
+2020-11-15 mmichaud
+  * fix #512 about georeferencing (introduced by r6523)
+
 2020-10-25 Giuseppe Aruta
-   * Updated CadTool plugin to ver. 1.0: activated Add and remove area plugin
- from Kosmo to test complementary edition on polygons touching the edited
- one. Minor corrections of bugs on the block panel
+  * Updated CadTool plugin to ver. 1.0: activated Add and remove area plugin
+from Kosmo to test complementary edition on polygons touching the edited
+one. Minor corrections of bugs on the block panel
 
 2020-10-25 mmichaud
   * fix #508 : java2xml with setInteriorBorder/hasInteriorBorder property

Modified: 
core/trunk/src/org/openjump/core/rasterimage/AddRasterImageLayerWizard.java
===
--- core/trunk/src/org/openjump/core/rasterimage/AddRasterImageLayerWizard.java 
2020-11-11 22:01:40 UTC (rev 6622)
+++ core/trunk/src/org/openjump/core/rasterimage/AddRasterImageLayerWizard.java 
2020-11-15 09:42:42 UTC (rev 6623)
@@ -295,8 +295,11 @@
 if (fileName.toLowerCase().endsWith(".tif")
 || fileName.toLowerCase().endsWith(".tiff")) {
 // logger.printDebug("checking for GeoTIFF");
-  
-  TiffUtilsV2.getEnvelope(new File(fileName));
+env = TiffUtilsV2.getEnvelope(new File(fileName));
+// TiffUtilsV2 returns an enveloppe even if no geotags are 
found
+// If env = image size, image is not considered as 
georeferenced
+isGeoTiff = env.getWidth() != imageDimensions.getX() ||
+env.getHeight() != imageDimensions.getY();
 
 //Coordinate tiePoint = null, pixelOffset = null, pixelScale = 
null;
 //double[] doubles = null;



___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] Half-pixel is back

2020-11-15 Thread Michaud Michael


Hi jumpers,I fixed the half-pixel shift problem again. I found much help in geotiff or gdal forums, and most of the time, useful discussions were initiated or documented by Jukka ;-)Please test and report any problem (r6624+).Michaƫl

___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] SVN: [6624] core/trunk

2020-11-15 Thread jump-pilot-svn--- via Jump-pilot-devel
Revision: 6624
  http://sourceforge.net/p/jump-pilot/code/6624
Author:   michaudm
Date: 2020-11-15 17:54:16 + (Sun, 15 Nov 2020)
Log Message:
---
Fix more deeply and document the half pixel shift problem

Modified Paths:
--
core/trunk/ChangeLog

core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoImage.java

core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoReferencedRaster.java

Modified: core/trunk/ChangeLog
===
--- core/trunk/ChangeLog2020-11-15 09:42:42 UTC (rev 6623)
+++ core/trunk/ChangeLog2020-11-15 17:54:16 UTC (rev 6624)
@@ -6,6 +6,7 @@
 
 2020-11-15 mmichaud
   * fix #512 about georeferencing (introduced by r6523)
+  * fix #503 again (half-pixel shift)
 
 2020-10-25 Giuseppe Aruta
   * Updated CadTool plugin to ver. 1.0: activated Add and remove area plugin

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoImage.java
===
--- 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoImage.java   
2020-11-15 09:42:42 UTC (rev 6623)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoImage.java   
2020-11-15 17:54:16 UTC (rev 6624)
@@ -148,7 +148,7 @@
 
   // First, scale the original image
   double scaleX = scale * gtr.getDblModelUnitsPerRasterUnit_X();
-  double scaleY = scale * gtr.getDblModelUnitsPerRasterUnit_Y();
+  double scaleY = scale * 
Math.abs(gtr.getDblModelUnitsPerRasterUnit_Y());
 
   // calculate predicted dimensions
   double scaledW = scaleX * src_img.getWidth();

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoReferencedRaster.java
===
--- 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoReferencedRaster.java
2020-11-15 09:42:42 UTC (rev 6623)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoReferencedRaster.java
2020-11-15 17:54:16 UTC (rev 6624)
@@ -71,9 +71,25 @@
   Envelope envModel_image;
   Envelope envModel_image_backup;
 
+  // To be removed in 2.0
+  @Deprecated
   Coordinate coorRasterTiff_tiepointLT;
+  @Deprecated
   Coordinate coorModel_tiepointLT;
 
+  public enum AreaOrPoint {AREA,POINT}
+  AreaOrPoint areaOrPoint = AreaOrPoint.AREA;
+
+  //https://trac.osgeo.org/gdal/ticket/4977
+  boolean honourNegativeScaleY = false;
+
+  // Rename upper left image coordinate with more expressive names
+  // Remarks in GeoTIFF, rasterULPixelCenter is
+  // 0.5, 0.5 in  AREA_OR_POINT=Area (default)
+  // 0,   0   in  AREA_OR_POINT=Point
+  private Coordinate rasterULPixelCenter;
+  private Coordinate modelULPixelCenter;
+
   private double dblModelUnitsPerRasterUnit_X;
   private double dblModelUnitsPerRasterUnit_Y;
 
@@ -127,23 +143,18 @@
 + 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));
+  // pixel size in x direction (x-scale)
+  tags[0] = fieldModelGeoTransform.getAsDouble(0);
+  // rotation about y-axis
+  tags[1] = fieldModelGeoTransform.getAsDouble(1);
+  // rotation about x-axis
+  tags[2] = fieldModelGeoTransform.getAsDouble(4);
+  // pixel size in the y-direction (y-scale)
+  tags[3] = fieldModelGeoTransform.getAsDouble(5);
+  // x-ordinate of the center of the upper left pixel
+  tags[4] = fieldModelGeoTransform.getAsDouble(3);
+  // y-ordinate of the center of the upper left pixel
+  tags[5] = fieldModelGeoTransform.getAsDouble(7);
   Logger.debug("gtiff trans: " + Arrays.t

Re: [JPP-Devel] Half-pixel is back

2020-11-15 Thread edgar . soldin
On 15.11.2020 19:24, Michaud Michael wrote:
> Hi jumpers,
>
> I fixed the half-pixel shift problem again. I found much help in geotiff or 
> gdal forums, and most of the time, useful discussions were initiated or 
> documented by Jukka ;-)
>
> Please test and report any problem (r6624+).

hmm, svn mail is still pending on this. so i do this manually

GeoImage.java lines 149ff

 // First, scale the original image
 double scaleX = scale * gtr.getDblModelUnitsPerRasterUnit_X();
 double scaleY = scale * Math.abs(gtr.getDblModelUnitsPerRasterUnit_Y());

as the negative scale or not code seems to be located in 
GeoReferencedRaster.java mostly it might make sense to keep modification of 
these values in there as well or? also why only Y? ..ede



___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel