On 13 August 2012 17:00, bio_hazard <bio_haz...@bk.ru> wrote:
> Hello people!
>
> Could you tell me how to render a map from the MapContent  in the
> image(png,jpg,....) with the following parameters, the coordinates of the
> upper left corner(world coordinate), the map scale, and the picture size in
> pixels.
>

Hello,

The general idea is:

BufferedImage destinationImg = ...
MapContent myMap = ...

// calculate bounds for your desired origin and scale
ReferencedEnvelope paintArea = ...

StreamingRenderer renderer = new StreamingRenderer();
renderer.setMapContent(myMap);

Graphics2D gr = destinationImg.createGraphics();
Rectangle rect = new Rectangle(
        destinationImg.getMinX(), destinationImg.getMinY(),
        destinationImg.getWidth(), destinationImg.getHeight());

renderer.paint(gr, rect, paintArea);

Please see the javadocs for more info about the above classes.

Hope this helps,

Michael

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to