views:

396

answers:

2

I have a java applet that allows users to import a jpeg and world file from the local system. The user can then "click" draw lines on the image that was imported. Each endpoint of each line contains a set of X/Y and Lat/Long values. The XY is standard java coordinate space, the applet uses an affine transform calculation with the world file to determine the lat/long for every point on the canvas.

I have a requirement that allows a user to type a distance into a text field and use the arrow key to draw a line in a certain direction (Up, Down, Left, Right) from a single selected point on the screen. I know how to determine the lat/long of a point given a source lat/long, distance, and bearing.

So a user types "100" in the text field and presses the Right arrow key a line should be drawn 100 feet to the right from the currently selected point.

My issue is I don't know how to convert the distance( which is in feet ) into the distance in pixels. This would then tell my where to plot the point.

A: 

tcarobruce, You are correct. The inverse transform algorithm is what I needed. Since I use java I was able to replace my "home made" transform algorithm with the java.awt.AffineTransform object which has an inverse transform function.

This seems to have solved my issue.

Thanks.

HeathLilley
A: 

I guess you are certain your users are always uploading a raster image that is in the lat/lon wgs84 projection? Because in that case you can set a fixed coordinate transformation.

If you consider ever digitizing images from other sources with other projections, you might want to take a look at the open source geotools library: http://www.geotools.org/

milovanderlinden
Yes this is a corporate environment where we have a specific process for users to upload a world file and matching jpg file.Thanks for the link, I have seen that API, while it looks like it could help, I am dealing with some legacy libraries that might not be exactly compatible with it and I am hoping to avoid a massive redesign.
HeathLilley