Re: [OpenMap Users] Zoom extents

From: Don Dietrick <>
Date: Thu, 25 Aug 2005 11:23:28 -0400

Hi Cap,

On Aug 25, 2005, at 9:07 AM, Cap Romano (IMBEL) wrote:
> Don Dietrick escreveu:
>> Hi Cap,
>> On Aug 18, 2005, at 2:42 PM, Cap Romano (IMBEL) wrote:
>>> Hello all,
>>> is it possible to perform a zoom to map full extents?
>> Yes, you need to set the scale of the Projection object on the
>> MapBean. You can ask a Projection object what it's scale would
>> need to
>> be to encompass a coordinate box (getScale(...)).
> But how do I get a coordinate box the fits all my layers?

You have to poll your layers to find that information out, and they
have to be written to answer that question (what their data bounds
are). That's not a general question that all layers will answer.
There is a com.bbn.openmap.util.DataBounds object that
com.bbn.openmap.util.DataBoundsProviders can be asked for, so you
probably want to make your layers DataBoundsProviders. Then you need
to make an object ask your layers what your data bounds are, and then
contact the MapBean. The MapBean can tell it what it's current
Projection is, and then you can figure out what the scale is that you
need to fit all the data on the map. The does something like
this, but only for one layer at a time.

>>> I think that I need to grab the extents of all layer. First
>>> question,
>>> is is possible? Is there a MapBean.getEnvelope or
>>> MapBean.getDataBounds
>>> method?
>> The Projection object of the MapBean will tell you that information.
> How?

See above answer. Sorry, I was answering a different question before.

> A new question: I have a shapefile that is saved using a specific
> coordinate
> system. Its coordinate system is saved in a shape.prj file, but I
> noticed
> OpenMap does not load this file and the ShapeLayer Projection
> object is always
> null before I add it to the MapBean.
> The question is, how is OpenMap´s support to coordinate system?

It doesn't, OpenMap layers current expect all layers to be displaying
decimal degree lat/lon coordinates.

> Can I set a coordinate system to a layer different than the one I
> set to the MapBean?

Not at the moment, but we hope to be implementing some sort of
translation mechanism soon.

> Will it reproject the layer´s geometry coordinates before drawing?

No, but that's part of the plan mentioned above.



>>> Also I will need to reproject the map. Why there is no setXXX
>>> methods in
>>> Projection interface?
>> The Projection class is what is passed to layers, and they are not
>> allowed to manage it independently from the MapBean, because that
>> would
>> mess up the other layers. You need to make the settings on the
>> MapBean, and the changes will flow to the layers.
>>> Is there a reproject( Databounds ) method in Proj class?
>> That would be the getScale(..) method that takes arguments, and then
>> you would set the MapBean's scale to that.

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 Aug 25 2005 - 11:24:11 EDT

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