[geos-devel] [GEOS] #329: Improve formatting for IsValidReason

GEOS geos-trac at osgeo.org
Mon Feb 8 15:53:40 EST 2010


#329: Improve formatting for IsValidReason
-------------------------+--------------------------------------------------
 Reporter:  mwtoews      |       Owner:  geos-devel at lists.osgeo.org
     Type:  enhancement  |      Status:  new                       
 Priority:  minor        |   Milestone:                            
Component:  Default      |     Version:  3.2.0                     
 Severity:  Unassigned   |    Keywords:                            
-------------------------+--------------------------------------------------
 A message from PostGIS's ST_IsValidReason(geometry) shows the message:
 {{{
 Self-intersection[523991 6.5222e+06]
 }}}
 to describe a point with Easting/Northing coordinates. What I find odd is
 the mixed conventional numeric and exponential forms.

 I can't find the source code for this, but I'm certain there is a "%g %g"
 formatting code somewhere in there. Although %g is usually a nice
 formatter, it is unfortunate that it happens to change to exponential form
 at numbers >=1e+06, which is the range of many projected (i.e., UTM)
 coordinates (particularly northern ones). [Note, this is probably
 compiler/platform dependent.]

 To make consistent formatting of these coordinates across platforms, and
 to make it show projected coordinates nicely, I suggest using the
 formatting code: "%.7g %.7g"

 This will use exponential form for numbers >=1e+07, which most earth-based
 Easting/Northing coordinates fall within.

-- 
Ticket URL: <http://trac.osgeo.org/geos/ticket/329>
GEOS <http://geos.refractions.net/>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).


More information about the geos-devel mailing list