Re: [OpenMap Users] setCenter()

From: Phil Deccan <phildeccan@hotmail.com>
Date: Fri Mar 21 2003 - 10:50:54 EST

----- Original Message -----
From: "Don Dietrick" <dietrick@bbn.com>
To: "Phil Deccan" <phildeccan@hotmail.com>
Cc: <openmap-users@bbn.com>
Sent: Friday, March 21, 2003 3:21 PM
Subject: Re: [OpenMap Users] setCenter()

> Hi Phil,
>
> I'm not sure I understand what you are really asking. The map view is
> controlled by the Projection object in the MapBean. The MapBean has
> convenience methods to help set parameters in its Projection.
>
> I'm guessing that you want to recenter the map over the data. If you
> want to set the view based on the contents of a shape file, you have to
> set the center of the projection to the coordinates over your data.
> Using the average of the min and max of the bounding box sounds
> reasonable, but it would probably depend on where you got the
> ESRIBoundingBox.
>
> In playing around with this, I had to make a couple of modifications to
> the SpatialIndex and ShapeLayer classes, which I've included. I don't
> know if they will compile with 4.5.4 (I'm running against the 4.6
> beta), but I've marked the places in the two files that I changed to
> get a "recenter over data" button on the layer's palette. Look for
> ////// CHANGED FROM/TO HERE /////////// comments.
>
> Hope this helps,
>
> Don
>

hello,
     thanks for writing back. I'm new to OpenMap so please forgive me
sounding stupid. Please bear with me.
I'm trying to learn how to use OpenMap by trying to load my own shapefiles,
using the examples that came with OpenMap.
I can follow mostly everything, thanks to the documentation on the OpenMap
website and the FAQs. But I can't work
out how to calculte the Centre parameter for the Projection.

In the example Crew.java, you have the lines:
// Create the MapBean.
 MapBean map = new MapBean();
 // Set the map's center property
 map.setCenter(new LatLonPoint(43.0f, -95.0f));

And I'm just wondering how did you calculate these co-ordinates, because
I've never come across shapefiles that had
information about their Center in for example their metadata. And I don't
know what co-ordinates to enter in for my
own shapefiles.

I was trying to calculate the Center by creating an ESRIBoundingBox using
the ShapeFile.java. As far as I can tell it creates
a Bounding Box from the header information stored in the shapefile. When I
tried to calculate the Center for
dcwpo-browse.shp, I got (0.0, -3.2). From the Crew.java example, it should
be (43.0, -95.0).

So could you help please ? Thanks for modifying the SpatialIndex and
ShapeLayer classes (BTW when I ran them my
compiler barfed because it said that the package
com.bbn.openmap.layer.policy did not exist.)

Thanks,
Phil.

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Mar 21 10:51:54 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:35 EDT