Re: [OpenMap Users] Discovering the minimum scale at which an RPF layer will show

From: Don Dietrick <>
Date: Thu, 3 Mar 2005 09:52:41 -0500

Hi Laura,

On Mar 3, 2005, at 5:48 AM, Laura Paterson wrote:

> Hi,
> I want to automatically zoom into areas of interest on my map, but
> only to
> the level where I have either ASRP or CADRG showing.
> However, I can't work out how to get the minimum scale from the
> layers...
> I use the following code to discover the minimum scale that will
> result in
> CADRG showing at that point:

This code doesn't do what you think it does. Layer.getProjection()
returns the projection that the MapBean has provided the layer, so you
are asking the current Projection what it's minimum scale is, which
means how far the projection will let you zoom in.

> float minScale = Float.MAX_VALUE;
> Layer[] layers = layerHandler.getMapLayers();
> for (int i = 0; i < layers.length; i++) {
> if (layers[i] instanceof RpfLayer) {
> float minRPFScale =
> layers[i].getProjection().getMinScale();
> minScale = Math.min(minScale, minRPFScale);
> System.out.println(layers[i].getName() + "
> minScale
> = "+minScale);
> }
> }
> My CADRG prints that its minimum scale is 500.0, however, on the map
> it does
> not show at all until 1:125K. Using the CADRG coverage tool, it
> reports
> that at this point I have TPC (1:500K) and ONC (1:1M) , I also have
> other
> data that shows at higher scales, which is not reported by the coverage
> tool.

You can ask the RpfLayer for it's RpfCoverageProvider, and then ask it
for it's coverage over a specific area. Those coverages will tell you
what scale you need to view that data. The coverage will viewable at
that scale * or / by the scaleFactor of that value.

If your coverage of the higher (smaller) scales covers then entire
hemisphere, you might be seeing a problem with the coverage not knowing
how to draw a rectangle that wraps entirely around the earth without
having intermediate points to let it know which way around the earth it

> Does anyone have any ideas what's going on? Does the 500.0
> representing
> 500,000? If so, is the scale always factored by one thousand? Or is
> there
> another way to discover the minimum showing scale...?

No, 500 is 1:500.

- Don

Don Dietrick,
BBN Technologies, Cambridge, MA

[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 Mar 03 2005 - 09:54:19 EST

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