Thanks Fred this work like a charm...

 

Feras

 

From: Fred Lehodey [mailto:[email protected]] 
Sent: Wednesday, September 01, 2010 12:48 PM
To: geotools geotools-gt2-us...@lists. sourceforge. net
Subject: [Geotools-gt2-users] Fwd: Zoom to a feature

 

 

---------- Forwarded message ----------
From: Fred Lehodey <[email protected]>
Date: Wed, Sep 1, 2010 at 10:33 AM
Subject: Re: [Geotools-gt2-users] Zoom to a feature
To: Feras Odeh <[email protected]>


Hi,

expandBy() is your friend:

myBBoxSelect.expandBy(your value here);


Fred

 

On Wed, Sep 1, 2010 at 10:32 AM, Feras Odeh <[email protected]> wrote:

Thanks Fred  This solves the problem but this zooms to selected feature and
make it at full zoom what if I want to get more features around it?

I have tried this code but It doesn't work am I doing something wrong?

 

 

  public void zoomToFeature(SimpleFeature feature) {

        ReferencedEnvelope myBBoxSelect = (ReferencedEnvelope)
feature.getBounds();

 

Envelope enlargedEnvelope = new
ReferencedEnvelope(myBBoxSelect.getMinX()*2,myBBoxSelect.getMaxX()*2,myBBoxS
elect.getMinY()*2,myBBoxSelect.getMaxY()*2,myBBoxSelect.getCoordinateReferen
ceSystem());

 

        map.getMapPane().setDisplayArea(enlargedEnvelope);

 

    }

 

 

 

From: Fred Lehodey [mailto:[email protected]] 
Sent: Wednesday, September 01, 2010 11:45 AM
To: Feras Odeh
Subject: Re: [Geotools-gt2-users] Zoom to a feature

 

Hi,

You can select features with a filter, get bounds and set mappane display
area:


            FeatureCollection selectedFeatures =
                    selectionLayer.getFeatureSource().getFeatures(myFilter);

            ReferencedEnvelope myBBoxSelect = selectedFeatures.getBounds();
            
            mapPane.setDisplayArea(myBBoxSelect);


Fred.




On Wed, Sep 1, 2010 at 8:34 AM, Feras Odeh <[email protected]> wrote:

Hello..

 

How could I zoom to a feature in geo tools?

 

Thanks 

Feras


----------------------------------------------------------------------------
--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

 

 

 

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to