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

 
 

bug #36261: Division by zero in single page rendering

Submitted by:  David Mentré <dmentre>
Submitted on:  Sat 21 Apr 2012 10:25:37 AM UTC  
 
Category: ocitysmapSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Privacy: PublicAssigned to: David Mentré <dmentre>
Open/Closed: ClosedRelease: 2012.04

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sun 06 May 2012 02:23:58 PM UTC, comment #6:

Fixed on dev.m.o.

Patches:
http://git.savannah.gnu.org/cgit/maposmatic/ocitysmap.git/commit/?id=bf6e75b56ffc56eccc6b6584b5742678bb41b51b

http://git.savannah.gnu.org/cgit/maposmatic.git/commit/?id=4cd76c517c0eaf49d19f32c0bd89109fe1dab15a

David Mentré <dmentre>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project 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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 06 May 2012 02:24:41 PM UTCdmentreOpen/ClosedOpen=>Closed
    Sun 06 May 2012 02:23:58 PM UTCdmentreStatusConfirmed=>Fixed
    Mon 30 Apr 2012 07:08:53 AM UTCdmentreAssigned toNone=>dmentre
    Tue 24 Apr 2012 06:44:49 PM UTCmpetazzoniReleaseNone=>2012.04

    Back to the top


    Powered by Savane 3.1-cleanup