Calculate the buffer to save in one place

Fix #1665

[Test](http://mf-geoadmin3.dev.bgdi.ch/teo_extent/mobile.html?lang=fr&topic=ech&bgLayer=ch.swisstopo.pixelkarte-farbe&X=187500.00&Y=628500.00&zoom=4&mobile=true)