zoom function and put a label in map

4 messages Options
Embed this post
Permalink
dadar

zoom function and put a label in map

Reply Threaded More More options
Print post
Permalink
when I'm open a shapfile how can i set the zoom focus into some area automatically, so i don't need to using the zoom tool to displaying the area that i want??

and when I give a color to some feature, how can i put some label above the area?? it's like i give an area a color then i put the name or number in that area

can somebody help me with this problem please
Thank you

Darmawan
Jody Garnett-2

Re: [Geotools-gt2-users] zoom function and put a label in map

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
You can change the "Extent" or Bounds of your map context. Use new ReferencedEnvelope( ... ) to sort out the area of the world you want to show.

Jody

On 23/10/2009, at 1:25 AM, dadar [via OSGeo.org] wrote:

when I'm open a shapfile how can i set the zoom focus into some area automatically, so i don't need to using the zoom tool to displaying the area that i want??

and when I give a color to some feature, how can i put some label above the area?? it's like i give an area a color then i put the name or number in that area

can somebody help me with this problem please
Thank you

Darmawan

dadar

Re: [Geotools-gt2-users] zoom function and put a label in map

Reply Threaded More More options
Print post
Permalink

Jody Garnett-2 wrote:
< You can change the "Extent" or Bounds of your map context.

this is to put a label in a map or zoom ??

 Use new ReferencedEnvelope( ... ) to sort out the area of the world you want  
to show.

Jody

On 23/10/2009, at 1:25 AM, dadar [via OSGeo.org] wrote:

> when I'm open a shapfile how can i set the zoom focus into some area  
> automatically, so i don't need to using the zoom tool to displaying  
> the area that i want??
>
> and when I give a color to some feature, how can i put some label  
> above the area?? it's like i give an area a color then i put the  
> name or number in that area
>
> can somebody help me with this problem please
> Thank you
>
> Darmawan
>
> This email was sent by Jody Garnett-2 (via Nabble)
> Your replies will appear at http://n2.nabble.com/zoom-function-and-put-a-label-in-map-tp3872634p3872634.html
> To receive all replies by email, subscribe to this discussion
>
dadar

Re: [Geotools-gt2-users] zoom function and put a label in map

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jody Garnett-2
oh btw jody, if i already create referencedenvelope so where i must put it and how to set it?
am i must set the featureSource with ReferencedEnvelope after this code
featureSource = store.getFeatureSource();

and is this the right method for it?
FeatureCollection grabFeaturesInBoundingBox( double x1, double y1, double x2, double y2) throws Exception {
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2( null );
    FeatureType schema = featureSource.getSchema();
   
    // usually "THE_GEOM" for shapefiles
    String geometryPropertyName = schema.getGeometryDescriptor().getLocalName();
    CoordinateReferenceSystem crs = schema.getGeometryDescriptor().getCoordinateReferenceSystem();
   
    ReferencedEnvelope bbox = new ReferencedEnvelope( x1,y1, x2, y2, crs );
   
    Filter filter = ff.bbox( ff.property( geometryPropertyName ), bbox );
    return featureSource.getFeatures( filter );
}

sorry for troubling you. i still not understand about this ReferencedEnvelope.
i hope i didn't bored you because i ask too much question :)
thank you

Darmawan

Jody Garnett-2 wrote:
You can change the "Extent" or Bounds of your map context. Use new  
ReferencedEnvelope( ... ) to sort out the area of the world you want  
to show.

Jody

On 23/10/2009, at 1:25 AM, dadar [via OSGeo.org] wrote:

> when I'm open a shapfile how can i set the zoom focus into some area  
> automatically, so i don't need to using the zoom tool to displaying  
> the area that i want??
>
> and when I give a color to some feature, how can i put some label  
> above the area?? it's like i give an area a color then i put the  
> name or number in that area
>
> can somebody help me with this problem please
> Thank you
>
> Darmawan
>
> This email was sent by Jody Garnett-2 (via Nabble)
> Your replies will appear at http://n2.nabble.com/zoom-function-and-put-a-label-in-map-tp3872634p3872634.html
> To receive all replies by email, subscribe to this discussion
>