﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
24607	Needed an easy way to render TMS layer on BufferedImage in a plugin	zkir	team	"Hello!

I'm the developer of the UrbanEye3D plugin (https://github.com/Zkir/UrbanEye3D) and I'm currently working on a new feature: displaying satellite imagery in the 3D window (see the attached screenshot).

[[Image(https://josm.openstreetmap.de/raw-attachment/ticket/24607/ue3d_bug_report.png)]]

I've managed to get the imagery to display using some tricks with the MapView and JosmMapViewer classes. However, rendering in the 3D window conflicts with rendering the same imagery in the 2D window: tiles reload multiple times and the 2D window flashes. The reason is pretty obvious — MapView is a descendant of javax.swing.JComponent and is tightly coupled with the GUI.

What I need is just a simple way to render a TMS layer into a BufferedImage, given pixel dimensions and geographical bounds, without it affecting any GUI elements.

{{{
public BufferedImage renderLayerToImage(TMSLayer layer, Bounds bounds, int textureWidth, int textureHeight){
    // ...
}
}}}


I've already spent several days on this and am completely stuck.
Please advise — maybe I'm missing something obvious.

Best regards,
Kirill (aka Zkir)
"	defect	new	normal		Core	tested		Satellite imagery, TMS, plugin	
