Modify

Opened 13 years ago

Closed 13 years ago

#6162 closed defect (fixed)

Error: NaN in greatCircleDistance for some images

Reported by: *Martin* Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: Cc: *Martin*

Description

Hello

I am getting "Error: NaN in greatCircleDistance" for some images (example attached). The image is not then displayed in the map view. JOSM revision is 3969.

Stacktrace on that message:

Thread [AWT-EventQueue-0] (Suspended (breakpoint at line 173 in org.openstreetmap.josm.data.coor.LatLon))	
	org.openstreetmap.josm.data.coor.LatLon.greatCircleDistance(org.openstreetmap.josm.data.coor.LatLon) line: 173	
	org.openstreetmap.josm.gui.MapView(org.openstreetmap.josm.gui.NavigatableComponent).zoomTo(org.openstreetmap.josm.data.coor.EastNorth, double) line: 315	
	org.openstreetmap.josm.gui.MapView(org.openstreetmap.josm.gui.NavigatableComponent).zoomTo(org.openstreetmap.josm.data.ProjectionBounds) line: 431	
	org.openstreetmap.josm.gui.MapView.recalculateCenterScale(org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor) line: 609	
	org.openstreetmap.josm.actions.AutoScaleAction.autoScale() line: 151	
	org.openstreetmap.josm.actions.AutoScaleAction.autoScale(java.lang.String) line: 75	
	org.openstreetmap.josm.gui.MapView$2.componentResized(java.awt.event.ComponentEvent) line: 221	
	org.openstreetmap.josm.gui.MapView(java.awt.Component).processComponentEvent(java.awt.event.ComponentEvent) line: 6115	
	org.openstreetmap.josm.gui.MapView(java.awt.Component).processEvent(java.awt.AWTEvent) line: 6069	
	org.openstreetmap.josm.gui.MapView(java.awt.Container).processEvent(java.awt.AWTEvent) line: 2041	
	org.openstreetmap.josm.gui.MapView(java.awt.Component).dispatchEventImpl(java.awt.AWTEvent) line: 4652	
	org.openstreetmap.josm.gui.MapView(java.awt.Container).dispatchEventImpl(java.awt.AWTEvent) line: 2099	
	org.openstreetmap.josm.gui.MapView(java.awt.Component).dispatchEvent(java.awt.AWTEvent) line: 4482	
	java.awt.EventQueue.dispatchEventImpl(java.awt.AWTEvent, java.lang.Object) line: 644	
	java.awt.EventQueue.access$000(java.awt.EventQueue, java.awt.AWTEvent, java.lang.Object) line: 85	
	java.awt.EventQueue$1.run() line: 603	
	java.awt.EventQueue$1.run() line: 601	
	java.security.AccessController.doPrivileged(java.security.PrivilegedAction<T>, java.security.AccessControlContext) line: not available [native method]	
	java.security.AccessControlContext$1.doIntersectionPrivilege(java.security.PrivilegedAction<T>, java.security.AccessControlContext, java.security.AccessControlContext) line: 87	
	java.security.AccessControlContext$1.doIntersectionPrivilege(java.security.PrivilegedAction<T>, java.security.AccessControlContext) line: 98	
	java.awt.EventQueue$2.run() line: 617	
	java.awt.EventQueue$2.run() line: 615	
	java.security.AccessController.doPrivileged(java.security.PrivilegedAction<T>, java.security.AccessControlContext) line: not available [native method]	
	java.security.AccessControlContext$1.doIntersectionPrivilege(java.security.PrivilegedAction<T>, java.security.AccessControlContext, java.security.AccessControlContext) line: 87	
	java.awt.EventQueue.dispatchEvent(java.awt.AWTEvent) line: 614	
	java.awt.EventDispatchThread.pumpOneEventForFilters(int) line: 269	
	java.awt.EventDispatchThread.pumpEventsForFilter(int, java.awt.Conditional, java.awt.EventFilter) line: 184	
	java.awt.EventDispatchThread.pumpEventsForHierarchy(int, java.awt.Conditional, java.awt.Component) line: 174	
	java.awt.EventDispatchThread.pumpEvents(int, java.awt.Conditional) line: 169	
	java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional) line: 161	
	java.awt.EventDispatchThread.run() line: 122	
martin@bono:~$ exiftool a.jpg
ExifTool Version Number         : 8.15
File Name                       : a.jpg
Directory                       : .
File Size                       : 256 kB
File Modification Date/Time     : 2011:03:29 22:32:38+02:00
File Permissions                : rw-r--r--
File Type                       : JPEG
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Little-endian (Intel, II)
Compression                     : Uncompressed
Photometric Interpretation      : RGB
Make                            : NIKON CORPORATION
Camera Model Name               : NIKON D5000
Planar Configuration            : Chunky
Software                        : Adobe Bridge CS5
Modify Date                     : 2011:03:20 11:23:01
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/200
F Number                        : 7.1
Exposure Program                : Program AE
ISO                             : 200
Exif Version                    : 0221
Date/Time Original              : 2011:03:12 15:36:11
Shutter Speed Value             : 1/200
Aperture Value                  : 7.1
Exposure Compensation           : 0
Max Aperture Value              : 3.5
Subject Distance                : 4294967295 m
Metering Mode                   : Multi-segment
Light Source                    : Unknown
Flash                           : No Flash
Focal Length                    : 18.0 mm
Exif Image Width                : 4288
Exif Image Height               : 2848
Sensing Method                  : One-chip color area
File Source                     : Digital Camera
Scene Type                      : Directly photographed
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : 1
Focal Length In 35mm Format     : 27 mm
Scene Capture Type              : Standard
Gain Control                    : None
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
Subject Distance Range          : Unknown
GPS Altitude Ref                : Above Sea Level
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Thumbnail Offset                : 962
Thumbnail Length                : 6035
Profile CMM Type                : Lino
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 1998:02:09 06:49:00
Profile File Signature          : acsp
Primary Platform                : Microsoft Corporation
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : IEC
Device Model                    : sRGB
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : HP
Profile ID                      : 0
Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
Profile Description             : sRGB IEC61966-2.1
Media White Point               : 0.95045 1 1.08905
Media Black Point               : 0 0 0
Red Matrix Column               : 0.43607 0.22249 0.01392
Green Matrix Column             : 0.38515 0.71687 0.09708
Blue Matrix Column              : 0.14307 0.06061 0.7141
Device Mfg Desc                 : IEC http://www.iec.ch
Device Model Desc               : IEC 61966-2.1 Default RGB colour space - sRGB
Viewing Cond Desc               : Reference Viewing Condition in IEC61966-2.1
Viewing Cond Illuminant         : 19.6445 20.3718 16.8089
Viewing Cond Surround           : 3.92889 4.07439 3.36179
Viewing Cond Illuminant Type    : D50
Luminance                       : 76.03647 80 87.12462
Measurement Observer            : CIE 1931
Measurement Backing             : 0 0 0
Measurement Geometry            : Unknown (0)
Measurement Flare               : 0.999%
Measurement Illuminant          : D65
Technology                      : Cathode Ray Tube Display
Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
XMP Toolkit                     : XMP Core 4.1.1
Create Date                     : 2011:03:12 15:36:11.00+01:00
Creator Tool                    : Adobe Bridge CS5
Metadata Date                   : 2011:03:20 10:07:16+01:00
Rating                          : 0
Serial Number                   : 6607572
Lens Info                       : 180/10 550/10 35/10 56/10
Lens                            : 18.0-55.0 mm f/3.5-5.6
Lens ID                         : 154
Image Number                    : 181
Approximate Focus Distance      : 4294967295
Instance ID                     : xmp.iid:9C120C69D152E011AEE5D499A47E1392
Document ID                     : xmp.did:9C120C69D152E011AEE5D499A47E1392
Original Document ID            : xmp.did:9C120C69D152E011AEE5D499A47E1392
Image Width                     : 858
Image Height                    : 570
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Aperture                        : 7.1
GPS Altitude                    : 324.1 m Above Sea Level
GPS Latitude                    : 48 deg 53' 19.41" N
GPS Latitude Ref                : North
GPS Longitude                   : 21 deg 2' 35.70" E
GPS Longitude Ref               : East
GPS Position                    : 48 deg 53' 19.41" N, 21 deg 2' 35.70" E
Image Size                      : 858x570
Scale Factor To 35 mm Equivalent: 1.5
Shutter Speed                   : 1/200
Thumbnail Image                 : (Binary data 6035 bytes, use -b option to extract)
Circle Of Confusion             : 0.020 mm
Depth Of Field                  : inf (2.28 m - inf)
Field Of View                   : 67.4 deg
Focal Length                    : 18.0 mm (35 mm equivalent: 27.0 mm)
Hyperfocal Distance             : 2.28 m
Light Value                     : 12.3

After starting JOSM, opening the a.jpg and adding new layer, I am getting this exception:

java.lang.NullPointerException
	at org.openstreetmap.josm.data.osm.QuadBuckets.search(QuadBuckets.java:733)
	at org.openstreetmap.josm.data.osm.DataSet.searchNodes(DataSet.java:193)
	at org.openstreetmap.josm.gui.NavigatableComponent.getNearestNodesImpl(NavigatableComponent.java:519)
	at org.openstreetmap.josm.gui.NavigatableComponent.getNearestNode(NavigatableComponent.java:625)
	at org.openstreetmap.josm.gui.NavigatableComponent.getNearestNode(NavigatableComponent.java:663)
	at org.openstreetmap.josm.actions.mapmode.DrawAction.computeHelperLine(DrawAction.java:648)
	at org.openstreetmap.josm.actions.mapmode.DrawAction.mouseMoved(DrawAction.java:601)
	at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:313)
	at java.awt.Component.processMouseMotionEvent(Component.java:6334)
	at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3285)
	at java.awt.Component.processEvent(Component.java:6058)
	at java.awt.Container.processEvent(Container.java:2041)
	at java.awt.Component.dispatchEventImpl(Component.java:4652)
	at java.awt.Container.dispatchEventImpl(Container.java:2099)
	at java.awt.Component.dispatchEvent(Component.java:4482)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4251)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
	at java.awt.Container.dispatchEventImpl(Container.java:2085)
	at java.awt.Window.dispatchEventImpl(Window.java:2478)
	at java.awt.Component.dispatchEvent(Component.java:4482)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
	at java.awt.EventQueue.access$000(EventQueue.java:85)
	at java.awt.EventQueue$1.run(EventQueue.java:603)
	at java.awt.EventQueue$1.run(EventQueue.java:601)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
	at java.awt.EventQueue$2.run(EventQueue.java:617)
	at java.awt.EventQueue$2.run(EventQueue.java:615)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Thanks in advance for fixing.

Attachments (3)

a.jpg (256.2 KB ) - added by *Martin* 13 years ago.
sample geotagged image
geoimage.patch (1.8 KB ) - added by *Martin* 13 years ago.
patch
geoimage.2.patch (2.9 KB ) - added by *Martin* 13 years ago.
improved patch

Download all attachments as: .zip

Change History (10)

by *Martin*, 13 years ago

Attachment: a.jpg added

sample geotagged image

comment:1 by bastiK, 13 years ago

In [4009/josm]:

see #6162 - Error: NaN in greatCircleDistance for some images

comment:2 by bastiK, 13 years ago

Resolution: othersoftware
Status: newclosed

The lib we are using fails to read the gps coordinates from exif. This probably means your image header is broken.

Last edited 13 years ago by bastiK (previous) (diff)

comment:3 by *Martin*, 13 years ago

Resolution: othersoftware
Status: closedreopened

Attaching patch for JOSM.

by *Martin*, 13 years ago

Attachment: geoimage.patch added

patch

comment:4 by bastiK, 13 years ago

The position of your photo is 48 deg 53' 19.41" N, 21 deg 2' 35.70" E

With the patch it will be displayed at 48 deg 53' 0.0" N, 21 deg 2' 0.0" E which is quite a few meters off. Personally I would prefer no georeferencing at all or at least a warning but not plain wrong position.

comment:5 by *Martin*, 13 years ago

It will not. In this case "min" contains also the precision of the "sec". exiftool utility handles it exactly as my patch does. And the image a.jpg is once exactly on the correct coordinates (on the rails in this case). Just try it and you'll be surprised. I am serious :-).

comment:6 by *Martin*, 13 years ago

... one more improvment: I also suggest to make "deg" as double, because some software may try to put all just to deg and NaN to both min and sec. Like this:

deg = components[0].doubleValue();
min = components[1].doubleValue();
sec = components[2].doubleValue();

One never knows. Thanks.

by *Martin*, 13 years ago

Attachment: geoimage.2.patch added

improved patch

comment:7 by bastiK, 13 years ago

Resolution: fixed
Status: reopenedclosed

In [4010/josm]:

fixed #6162 - Error: NaN in greatCircleDistance for some images (patch by m.zdila)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.