Re: [OpenMap Users] Converting distance to pixels?

From: Don Dietrick <dietrick_at_bbn.com>
Date: Sun, 27 Jun 2004 13:09:51 -0700

Hi Shahak,

You'd have to do the calculations to figure this out. First, you would
have to use the methods in the com.bbn.openmap.proj.GreatCircle class
to figure out a lat/lon point that is a certain distance away from a
lat/lon point on the line (perpendicular to the line). The
spherical_between method will give you that lat/lon point, given a
starting point and an azimuth and a distance.

Then, you would use the projection class forward method to find out the
pixel locations of the two points, and then calculate the pixel
distance between them. Double that distance would be the stroke width.

Depending on the orientation and length of the line, however, that
width may not be accurate for the entire length of the line, since the
pixel/distance ratio changes depending on the projection type and
location of the line. In that case, you'd have to do the algorithm for
many points on the line, and draw the different thicknesses as required
(not using stroke, but calling java.awt.Graphics methods).

Hope this helps,

- Don

On Jun 23, 2004, at 11:50 AM, <Shahak.Nagiel_at_ngc.com> wrote:

> I'm trying to render an OMPoly (series of lines), with each line
> representing an area of interest. Each line has a given half-width
> (in KM or NM), and I'd like to represent that second-dimension with
> the line width. However, it's not obvious to me how to compute the
> number of pixels required for the line stroke given the (half-)width.
> I'm assuming it would be based on the scale and projection. (I'd be
> content with a fixed line width even though, accurately, it would
> fluctuate along certain routes of cylindrical projections.)
>
> Thanks,
> Shahak Nagiel
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
>
>


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Sun Jun 27 2004 - 18:29:35 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:05 EDT