RE: [OpenMap Users] Displaying Streetnames - Beginner

From: Rick Lane <>
Date: Thu, 27 Oct 2005 07:40:47 -0400



There certainly may be a much easier way to do this, but if not, one
approach could be:


1) Find the two closest lat/lon points of the road from the center of
the lat/lon point for the name of the road.

a. You could also take a larger sample of points, and find the
best-fit line amongst those points.

2) Determine the slope (and ultimately the angle) between the two (or
more) lat/lon points (you could even use Cartesian coordinates, by using the
Projection.forward(lat, lon) method).

3) Once you have the angle determined, you can apply a
java.awt.geom.AffineTransform to the graphics context used to draw the
street name that rotates the context the same amount that that particular
section of road is rotated. Of course, this won't guarantee the name will
be above the line of the road, but it will be parallel; you can apply
similar AffineTransforms to translate the name so that it is sitting nicely
on the road line.





From: [] On
Behalf Of su mo
Sent: Thursday, October 27, 2005 7:15 AM
To: Don Dietrick
Subject: Re: [OpenMap Users] Displaying Streetnames - Beginner


Hi Don

Thanks for your help. It worked. I can see the streetnames horizontally.

I have used FontSizer now to take care of zooming.

But I am still not able to find way a to set the orientation of text in
with the actual road display.

Thanks in advance


On 10/26/05, Don Dietrick <> wrote:

Hi Sump,

For EsriPolyLine you'd need to ask a different question, like
getLatLonArray(). Watch out, the float[] returned is in radians.
You can use the ProjMath class to convert them to decimal degrees,
but you'll want to copy them to a new array first. Converting them
to decimal degrees will mess up the EsriPolyLine for display.

The getLat() and getLon() methods are for lines with

Hope this helps,


On Oct 25, 2005, at 9:00 AM, su mo wrote:

> Hi,
> I am using latest openmap. I need to display street name from the
> DBF file.
> My questions are:
> 1. How do I get the lat/long for the street name?
> I think they are stored in shp file. But when I use
> EsriGraphicList.iterator().next(),
> I get EsriPolyLine. But the EsriPolyLine.getLat() and getLong()
> always return 0.0, 0.0
> even after tried to set the RenderType to latlong on the EsriPolyLine.
> 2. How do I take care of orientation of street name display and
> zoom changes on main
> map?
> -Thanks in advance
> -Sumo


[To unsubscribe to this list send an email to ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Oct 27 2005 - 07:49:26 EDT

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