bugMapOSMatic - Bugs: bug #36261, Division by zero in single page...

 
 

bug #36261: Division by zero in single page rendering

Submitter:  David Mentré <dmentre>
Submitted:  Sat 21 Apr 2012 10:25:37 AM UTC
   
 
Category:  ocitysmap Severity:  3 - Normal
Priority:  * 5 - Normal Status:  Fixed
Privacy:  Public Assigned to:  dmentre
Open/Closed:  Closed Release:  2012.04
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 06 May 2012 02:23:58 PM UTC, comment #6: 
David Mentré <dmentre>
Group administrator
Mon 30 Apr 2012 07:21:44 AM UTC, comment #5: 

Patches for maposmatic and ocitysmap submitted on 2012-04-30 to dev@.

David Mentré <dmentre>
Group administrator
Mon 23 Apr 2012 01:19:33 PM UTC, comment #4: 

Hello Jeroen,

I agree that ocitysmap should be protected against such error.

But having a strong MapOSMatic web service is the first priority. So I'll try to fix the maposmatic front-end first. Feel free to submit a patch. ;-)

Regarding, the check of Lat1 - Lat2 == 0 or Lon1 - Lon2 == 0, I personally much prefer systems that are not too smart and just report the error. IMHO, it is better for the human user to let him/her know there is an issue rather than trying to silently fix it.

Regarding the minimum height/width in km of the mapped area, I don't see the usefulness of such restriction. Apart from exactly equal Lat1,Lat2, ocitysmap map is able to render any area, whatever small it is (and I used it from time to time to render just a few streets).

Best regards,
d.

David Mentré <dmentre>
Group administrator
Sat 21 Apr 2012 05:21:30 PM UTC, comment #3: 

Apart from figuring out why MapOSMatic passed those parameters for this job and preventing that, I think this kind of error should probably also be checked for in OcitySMap.

Some people might prefer to use the latter with a different front-end or straight up from the command-line, in which case a fix in the former doesn't do anything.

As far as the OcitySMap part goes, rather than checking if Lat1 - Lat2 == 0 or Lon1 - Lon2 == 0, how about that bit of code that adjusts the bounding box to accommodate the paper size check for this error? Maybe it can also enforce a minimum height/width in km of the mapped area?

Jeroen van Rijn <jvrnix>
Group Member
Sat 21 Apr 2012 05:14:07 PM UTC, comment #2: 

I don't know how to fix properly this bug: should we filter such cases in maposmatic front-end or return an error in ocitysmap back-end?

Current view: filter such cases in maposmatic.

David Mentré <dmentre>
Group administrator
Sat 21 Apr 2012 05:03:14 PM UTC, comment #1: 

On the job request, the two latitudes are the same:
"""
lat_bottom_right: 49.16597
lat_upper_left: 49.16597
"""

Way to reproduce the error:
  ocitysmap2-render -b 49.16597,6.11746 49.16597,6.08437  -p /tmp/saulny -f png -f csv -L fr_FR.UTF-8 --orientation=landscape


David Mentré <dmentre>
Group administrator
Sat 21 Apr 2012 10:25:37 AM UTC, original submission:  

A division by zero occurred with following job:

"""
An error occured while rendering job #44517!

Traceback (most recent call last):
 File "/home/maposmatic/maposmatic-prod/maposmatic/scripts/render.py", line 334, in run
   output_formats, prefix)
 File "/home/maposmatic/maposmatic-prod/ocitysmap/ocitysmap2/__init__.py", line 465, in render
   file_prefix)
 File "/home/maposmatic/maposmatic-prod/ocitysmap/ocitysmap2/__init__.py", line 520, in _render_one
   renderer = renderer_cls(self._db, config, tmpdir, dpi, file_prefix)
 File "/home/maposmatic/maposmatic-prod/ocitysmap/ocitysmap2/layoutlib/single_page_renderers.py", line 617, in _init_
   SinglePageRenderer.__init__(self, db, rc, tmpdir, dpi, file_prefix, 'bottom')
 File "/home/maposmatic/maposmatic-prod/ocitysmap/ocitysmap2/layoutlib/single_page_renderers.py", line 146, in _init_
   dpi )
 File "/home/maposmatic/maposmatic-prod/ocitysmap/ocitysmap2/layoutlib/abstract_renderer.py", line 202, in _create_map_canvas
   width, height, dpi)
 File "/home/maposmatic/maposmatic-prod/ocitysmap/ocitysmap2/maplib/map_canvas.py", line 84, in _init_
   graphical_ratio)
 File "/home/maposmatic/maposmatic-prod/ocitysmap/ocitysmap2/maplib/map_canvas.py", line 112, in _fix_bbox_ratio
   cur_ratio = float(width)/height
ZeroDivisionError: float division


Job information:

 administrative_city:
 administrative_osmid: None
 endofrendering_time: None
 id: 44517
 index_queue_at_submission: 2
 lat_bottom_right: 49.16597
 lat_upper_left: 49.16597
 layout: single_page_index_bottom
 lon_bottom_right: 6.11746
 lon_upper_left: 6.08437
 map_language: fr_FR.UTF-8
 maptitle: Saulny, Moselle, Lorraine, 57140, France
 nonce: XXXXXXXXXXXX
 paper_height_mm: 297
 paper_width_mm: 420
 resultmsg: None
 startofrendering_time: 2012-04-21 10:40:36.698110
 status: 1
 stylesheet: Default
 submission_time: 2012-04-21 10:36:37.385867
 submitterip: XXXXXXXXXXXX

You can view the job page at <http://www.maposmatic.org/jobs/44517>.

"""

David Mentré <dmentre>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mpetazzoni (Updated the item)
  • -email is unavailable- added by jvrnix (Posted a comment)
  • -email is unavailable- added by dmentre (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-05-06 dmentre Open/ClosedOpen Closed
    2012-05-06 dmentre StatusConfirmed Fixed
    2012-04-30 dmentre Assigned toNone dmentre
    2012-04-24 mpetazzoni ReleaseNone 2012.04

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code