Re: [Flightgear-devel] shape-decode crash

2009-08-07 Thread Maxime Guillaud

Hi all,

I tracked down my problem with shape-decode to a case of uncaught 
parallel lines in the function getIntersection in util.cxx. The 
resulting computed intersection point was obviously very distant, 
creating the strange coordinates that Curt noticed.
I fixed it by raising the "epsilon" constant from 1e-14 to 1e-12 (patch 
attached).


Regards,
Maxime


Maxime Guillaud wrote:

Curtis Olson wrote:
  
A bucket coordinate of -593:2 suggests that this shapefile may contain 
some bogus data. (or there could be a bug leading up to this) but I 
believe the portion prior to the ":" represents a whole degree 
coordinate of the bucket, so this should range from -180 to +179 for 
latitude and -90 to +89 for longitude.  -593 is completely outside of 
possible reality.  So the question is, is this a problem with the 
shapefile data, or some problem processing the data in the 
shape-decode code.
 
Regards,


Curt.



Thanks for spotting this, Curt ! Looking at the output of shape-decode, 
it looks like the data read from the shapefile is reasonable:


   Point 5 (0.609977, 46.997)
   Point 6 (0.605342, 46.9964)
   Point 7 (0.601051, 46.9955)

However, in the following processing steps the coordinates for point 7 
appear wrong:


point = 6
 0.605333, 46.9964, 0  -  -2828.93, -570.523, 0

The relevant excerpt of the log is here: http://www.mguillaud.net/fg/log2
Anyone familiar with the internals of shape-decode (I am not) can 
comment on this ?


Regards,
Maxime



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
  


--- terragear-cs/src/Lib/Geometry/util.cxx.orig	2009-08-06 09:46:41.0 +0200
+++ terragear-cs/src/Lib/Geometry/util.cxx	2009-08-07 22:14:43.0 +0200
@@ -24,7 +24,7 @@
 		 const Point3D &p2, const Point3D &p3,
 		 Point3D &intersection)
 {
-const double my_eps = 0.01;
+const double my_eps = 0.0001;
 
 double u_num =
 ((p3.x()-p2.x())*(p0.y()-p2.y()))-((p3.y()-p2.y())*(p0.x()-p2.x()));
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] shape-decode crash

2009-08-04 Thread Maxime Guillaud
Curtis Olson wrote:
>
> A bucket coordinate of -593:2 suggests that this shapefile may contain 
> some bogus data. (or there could be a bug leading up to this) but I 
> believe the portion prior to the ":" represents a whole degree 
> coordinate of the bucket, so this should range from -180 to +179 for 
> latitude and -90 to +89 for longitude.  -593 is completely outside of 
> possible reality.  So the question is, is this a problem with the 
> shapefile data, or some problem processing the data in the 
> shape-decode code.
>  
> Regards,
>
> Curt.

Thanks for spotting this, Curt ! Looking at the output of shape-decode, 
it looks like the data read from the shapefile is reasonable:

   Point 5 (0.609977, 46.997)
   Point 6 (0.605342, 46.9964)
   Point 7 (0.601051, 46.9955)

However, in the following processing steps the coordinates for point 7 
appear wrong:

point = 6
 0.605333, 46.9964, 0  -  -2828.93, -570.523, 0

The relevant excerpt of the log is here: http://www.mguillaud.net/fg/log2
Anyone familiar with the internals of shape-decode (I am not) can 
comment on this ?

Regards,
Maxime



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] shape-decode crash

2009-08-04 Thread Curtis Olson
On Tue, Aug 4, 2009 at 8:11 AM, Maxime Guillaud  wrote:

> Hi all,
>
> shape-decode has been crashing on me for a certain shapefile and I can
> not figure out why. I am using terragear-cs downloaded today from the
> GIT repository. The rest of the toolchain runs fine.
>
> shape-decode runs for a while and stops with the following error:
>
> [...]
> distance = 239.828
> 0.623843, 46.9914, 0
> distance = 7.9
> 0.626076, 46.9898, 0
>  min = -2930.42, -592.671, 200 max = 0.62615, 46.997, -200
>  Bucket min = -180:0, -593:2


A bucket coordinate of -593:2 suggests that this shapefile may contain some
bogus data. (or there could be a bug leading up to this) but I believe the
portion prior to the ":" represents a whole degree coordinate of the bucket,
so this should range from -180 to +179 for latitude and -90 to +89 for
longitude.  -593 is completely outside of possible reality.  So the question
is, is this a problem with the shapefile data, or some problem processing
the data in the shape-decode code.

Regards,

Curt.



>  Bucket max = 0:2, 46:7
>  polygon spans tile boundaries
>  dx = 722  dy = 5117
> terminate called after throwing an instance of 'sg_exception'
> Aborted
>
>
> A run under gdb yielded the following:
>
> (gdb) run --max-segment 500 --line-width 6
>
> /storage1/flightgear/scenery-dev/terrain/custom_road_rail_from_OSM/france/fg_railways
>
> Railroad  Railroad > log 2> log2
> Starting program:
>
> /storage1/flightgear/scenery-dev/terragear/install/terragear-cs/bin/shape-decode
>
> --max-segment 500 --line-width 6
>
> /storage1/flightgear/scenery-dev/terrain/custom_road_rail_from_OSM/france/fg_railways
>
> Railroad  Railroad > log 2> log2
> [Thread debugging using libthread_db enabled]
> [New Thread 0x7f866f54b6f0 (LWP 10926)]
>
> Program received signal SIGABRT, Aborted.
> [Switching to Thread 0x7f866f54b6f0 (LWP 10926)]
> 0x7f866e447015 in raise () from /lib/libc.so.6
>
> (gdb) bt
> #0  0x7f866e447015 in raise () from /lib/libc.so.6
> #1  0x7f866e448b83 in abort () from /lib/libc.so.6
> #2  0x7f866ecebf94 in __gnu_cxx::__verbose_terminate_handler () from
> /usr/lib/libstdc++.so.6
> #3  0x7f866ecea396 in ?? () from /usr/lib/libstdc++.so.6
> #4  0x7f866ecea3c3 in std::terminate () from /usr/lib/libstdc++.so.6
> #5  0x7f866ecea4aa in __cxa_throw () from /usr/lib/libstdc++.so.6
> #6  0x0041175a in tgChopNormalPolygon (pa...@0x7fff7756f220,
> poly_ty...@0x7fff7756f130, sha...@0x7fff7756eda0, preserve3d=false) at
> chop-bin.cxx:222
> #7  0x00405b50 in processLine (psShape=0x202d870,
> work_d...@0x7fff7756f220, poly_ty...@0x7fff7756f130, linewidth=6) at
> shape-decode.cxx:545
> #8  0x0040a5f1 in main (argc=4, argv=0x7fff7756f3c8) at
> shape-decode.cxx:920
> (gdb) list *0x0041175a
> 0x41175a is in tgChopNormalPolygon(std::string const&, std::string
> const&, TGPolygon const&, bool) (chop-bin.cxx:208).
> 203 SG_LOG( SG_GENERAL, SG_DEBUG, "  Bucket min = " << b_min );
> 204 SG_LOG( SG_GENERAL, SG_DEBUG, "  Bucket max = " << b_max );
> 205
> 206 if ( b_min == b_max ) {
> 207 // shape entirely contained in a single bucket, write
> and bail
> 208 clip_and_write_poly( path, index, poly_type, b_min,
> shape, preserve3d );
> 209 return;
> 210 }
> 211
> 212 SGBucket b_cur;
>
>
> This happens with the following shapefile:
> http://www.mguillaud.net/fg/fg_railways.tgz
> Note that I can run some other shapefiles through shape-decode without
> problem. That particular file was generated by PostGIS using  pgsql2shp.
> It does not appear to be invalid.
>
> Any advice ?
> Regards,
> Maxime
>
>
>
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Flightgear-devel mailing list
> Flightgear-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
>



-- 
Curtis Olson: http://baron.flightgear.org/~curt/
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] shape-decode crash

2009-08-04 Thread Maxime Guillaud
Hi all,

shape-decode has been crashing on me for a certain shapefile and I can
not figure out why. I am using terragear-cs downloaded today from the
GIT repository. The rest of the toolchain runs fine.

shape-decode runs for a while and stops with the following error:

[...]
distance = 239.828
0.623843, 46.9914, 0
distance = 7.9
0.626076, 46.9898, 0
  min = -2930.42, -592.671, 200 max = 0.62615, 46.997, -200
  Bucket min = -180:0, -593:2
  Bucket max = 0:2, 46:7
  polygon spans tile boundaries
  dx = 722  dy = 5117
terminate called after throwing an instance of 'sg_exception'
Aborted


A run under gdb yielded the following:

(gdb) run --max-segment 500 --line-width 6
/storage1/flightgear/scenery-dev/terrain/custom_road_rail_from_OSM/france/fg_railways
 

Railroad  Railroad > log 2> log2
Starting program:
/storage1/flightgear/scenery-dev/terragear/install/terragear-cs/bin/shape-decode
 

--max-segment 500 --line-width 6
/storage1/flightgear/scenery-dev/terrain/custom_road_rail_from_OSM/france/fg_railways
 

Railroad  Railroad > log 2> log2
[Thread debugging using libthread_db enabled]
[New Thread 0x7f866f54b6f0 (LWP 10926)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7f866f54b6f0 (LWP 10926)]
0x7f866e447015 in raise () from /lib/libc.so.6

(gdb) bt
#0  0x7f866e447015 in raise () from /lib/libc.so.6
#1  0x7f866e448b83 in abort () from /lib/libc.so.6
#2  0x7f866ecebf94 in __gnu_cxx::__verbose_terminate_handler () from
/usr/lib/libstdc++.so.6
#3  0x7f866ecea396 in ?? () from /usr/lib/libstdc++.so.6
#4  0x7f866ecea3c3 in std::terminate () from /usr/lib/libstdc++.so.6
#5  0x7f866ecea4aa in __cxa_throw () from /usr/lib/libstdc++.so.6
#6  0x0041175a in tgChopNormalPolygon (pa...@0x7fff7756f220,
poly_ty...@0x7fff7756f130, sha...@0x7fff7756eda0, preserve3d=false) at
chop-bin.cxx:222
#7  0x00405b50 in processLine (psShape=0x202d870,
work_d...@0x7fff7756f220, poly_ty...@0x7fff7756f130, linewidth=6) at
shape-decode.cxx:545
#8  0x0040a5f1 in main (argc=4, argv=0x7fff7756f3c8) at
shape-decode.cxx:920
(gdb) list *0x0041175a
0x41175a is in tgChopNormalPolygon(std::string const&, std::string
const&, TGPolygon const&, bool) (chop-bin.cxx:208).
203 SG_LOG( SG_GENERAL, SG_DEBUG, "  Bucket min = " << b_min );
204 SG_LOG( SG_GENERAL, SG_DEBUG, "  Bucket max = " << b_max );
205
206 if ( b_min == b_max ) {
207 // shape entirely contained in a single bucket, write
and bail
208 clip_and_write_poly( path, index, poly_type, b_min,
shape, preserve3d );
209 return;
210 }
211
212 SGBucket b_cur;


This happens with the following shapefile:
http://www.mguillaud.net/fg/fg_railways.tgz
Note that I can run some other shapefiles through shape-decode without
problem. That particular file was generated by PostGIS using  pgsql2shp.
It does not appear to be invalid.

Any advice ?
Regards,
Maxime




--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel