Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7428433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:44:42+00:00 2026-05-29T08:44:42+00:00

I’m trying to correctly render some features I read from a featuretable of a

  • 0

I’m trying to correctly render some features I read from a featuretable of a PostGIS enabled database with GeoTools to an image.

My configuration:

  • PostgreSQL 8.4
  • PostGIS 1.5
  • Osmosis 0.40.1
  • OSMembrane build 845
  • GeoTools 2.7.4

Rendering some features inside a bounding box works fine so far.
The issue: I get a result that is

  1. rotated 90° (clockwise)
  2. mirrored on the y-axis

The features I want to render are based on this CoordinateReferenceSystem

GEOGCS["WGS 84", 
  DATUM["World Geodetic System 1984", 
    SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], 
    AUTHORITY["EPSG","6326"]], 
  PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
  UNIT["degree", 0.017453292519943295], 
  AXIS["Geodetic latitude", NORTH], 
  AXIS["Geodetic longitude", EAST], 
  AUTHORITY["EPSG","4326"]]

I’m aware of excuting an affine transformation, so I have written the following piece of code:

public void render(final MapContext mapContext, final Graphics2D graphics) throws IOException 
{
    Rectangle renderingArea = new Rectangle(this.mapWidth, this.mapHeight);

    GTRenderer renderer = new StreamingRenderer();
    renderer.setContext(mapContext);

    //move the result to a visisble area
    AffineTransform translate = AffineTransform.getTranslateInstance(mapHeight, mapWidth);
    //rotate 180° anti-clockwise
    AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI);
    //exchange x and y 
    AffineTransform mirror = new AffineTransform(0, 1, 1, 0, 0, 0);

    AffineTransform transform = new AffineTransform(translate);
    transform.concatenate(rotate);
    transform.concatenate(mirror);

    graphics.transform(transform);

    renderer.paint(graphics, renderingArea, mapContext.getAreaOfInterest());
}

This works and makes the features look fine! On the other hand, this does not feel quite right. The question is, why I can’t use the same transformation I applied on the graphics-object as a method parameter of the renderer’s paint-method?

e.g.

//move the result to a visisble area
AffineTransform translate = AffineTransform.getTranslateInstance(mapHeight, mapWidth);
//rotate 180° anti-clockwise
AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI);
//exchange x and y 
AffineTransform mirror = new AffineTransform(0, 1, 1, 0, 0, 0);

AffineTransform transform = new AffineTransform(translate);
transform.concatenate(rotate);
transform.concatenate(mirror);

renderer.paint(graphics, renderingArea, mapContext.getAreaOfInterest(), transform);

This always leads to an empty screen. I think, it is rendered somewhere outside the visible area. I know about the tutorials at the geotools website, but I miss some place where everything is put together.

I’m looking forward to any helpful hints.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:44:42+00:00Added an answer on May 29, 2026 at 8:44 am

    The most likely problem is Axis-Order, read this page http://docs.geotools.org/latest/userguide/library/referencing/order.html and see if that solves your problem. If that isn’t the issue then you’ll probably want to look at the referencing faq – I’ve never had to write my own affine transform to render features so I would expect the issue to be answered there or in one of the other tutorials.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.