How can I get the data from an area in my shapefile??

7 messages Options
Embed this post
Permalink
dadar

How can I get the data from an area in my shapefile??

Reply Threaded More More options
Print post
Permalink
I need to gain data from an area in my shapefile when i clicked it
does anybody know which function and how can I get the data??
and how can I get the center point (x,y) from a polygon??

Darmawan
Jody Garnett-2

Re: How can I get the data from an area in my shapefile??

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
A bounding box query (matching the area the person clicked) will do.

There is an example in the user guide http://docs.codehaus.org/display/GEOTDOC/Filter+Examples 

Under "What did I click on":

ReferencedEnvelope pixels = new ReferencedEnvelope( x-1,y-1, x+1, y+1, screenCRS );
MathTransform screen2world= CRS.findMathTransform(screenCRS, dataCRS);

ReferencedEnvelope selected = JTS.transform( pixels, null, screen2world, 10 );

FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2( GeoTools.getDefaultHints );
Filter filter = ff.bbox( ff.property("THE_GEOM" ), ff.literal( selected ) );


Jody

On 05/10/2009, at 4:15 PM, dadar wrote:


I need to gain data from an area in my shapefile when i clicked it
does anybody know which function and how can I get the data??
and how can I get the center point (x,y) from a polygon??

Darmawan
--
View this message in context: http://n2.nabble.com/How-can-I-get-the-data-from-an-area-in-my-shapefile-tp3766988p3766988.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Jody Garnett-2

Re: How can I get the data from an area in my shapefile??

Reply Threaded More More options
Print post
Permalink
In reply to this post by dadar
You will find that geometry has a getCentroid() method which will work  
to find the centre point of a polygon.

Jody
On 05/10/2009, at 4:15 PM, dadar wrote:

>
> I need to gain data from an area in my shapefile when i clicked it
> does anybody know which function and how can I get the data??
> and how can I get the center point (x,y) from a polygon??
>
> Darmawan
> --
> View this message in context: http://n2.nabble.com/How-can-I-get-the-data-from-an-area-in-my-shapefile-tp3766988p3766988.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9-12, 2009. Register  
> now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Geotools-gt2-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
dadar

Re: How can I get the data from an area in my shapefile??

Reply Threaded More More options
Print post
Permalink
Thx Jody
I'll try the code to my netbeans :)

Darmawan

Jody Garnett-2 wrote:
You will find that geometry has a getCentroid() method which will work  
to find the centre point of a polygon.

Jody
On 05/10/2009, at 4:15 PM, dadar wrote:

>
> I need to gain data from an area in my shapefile when i clicked it
> does anybody know which function and how can I get the data??
> and how can I get the center point (x,y) from a polygon??
>
> Darmawan
> --
> View this message in context: http://n2.nabble.com/How-can-I-get-the-data-from-an-area-in-my-shapefile-tp3766988p3766988.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9-12, 2009. Register  
> now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
dadar

Re: How can I get the data from an area in my shapefile??

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jody Garnett-2
so with that source I can access the data?
how I put the data into array if there is 2 or more data in where I clicked the area?

Darmawan

Jody Garnett-2 wrote:
A bounding box query (matching the area the person clicked) will do.

There is an example in the user guide http://docs.codehaus.org/display/GEOTDOC/Filter+Examples

Under "What did I click on":

ReferencedEnvelope pixels = new ReferencedEnvelope( x-1,y-1, x+1, y+1,  
screenCRS );
MathTransform screen2world= CRS.findMathTransform(screenCRS, dataCRS);

ReferencedEnvelope selected = JTS.transform( pixels, null,  
screen2world, 10 );

FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2
( GeoTools.getDefaultHints );
Filter filter = ff.bbox( ff.property("THE_GEOM" ), ff.literal
( selected ) );


Jody

On 05/10/2009, at 4:15 PM, dadar wrote:

>
> I need to gain data from an area in my shapefile when i clicked it
> does anybody know which function and how can I get the data??
> and how can I get the center point (x,y) from a polygon??
>
> Darmawan
> --
> View this message in context: http://n2.nabble.com/How-can-I-get-the-data-from-an-area-in-my-shapefile-tp3766988p3766988.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9-12, 2009. Register  
> now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Jody Garnett-2

Re: [Geotools-gt2-users] How can I get the data from an area in my shapefile??

Reply Threaded More More options
Print post
Permalink
You will get a feature collection of all the features where the user
clicked; you can go through the feature collection if you like and
copy them into a feature collection.

Jody

On Tue, Oct 6, 2009 at 12:18 AM, dadar (via Nabble)
<[hidden email]> wrote:

> so with that source I can access the data?
> how I put the data into array if there is 2 or more data in where I clicked
> the area?
>
> Darmawan
>
> Jody Garnett-2 wrote:
> A bounding box query (matching the area the person clicked) will do.
>
> There is an example in the user guide
> http://docs.codehaus.org/display/GEOTDOC/Filter+Examples
>
> Under "What did I click on":
>
> ReferencedEnvelope pixels = new ReferencedEnvelope( x-1,y-1, x+1, y+1,
> screenCRS );
> MathTransform screen2world= CRS.findMathTransform(screenCRS, dataCRS);
>
> ReferencedEnvelope selected = JTS.transform( pixels, null,
> screen2world, 10 );
>
> FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2
> ( GeoTools.getDefaultHints );
> Filter filter = ff.bbox( ff.property("THE_GEOM" ), ff.literal
> ( selected ) );
>
>
> Jody
>
> On 05/10/2009, at 4:15 PM, dadar wrote:
>
>>
>> I need to gain data from an area in my shapefile when i clicked it
>> does anybody know which function and how can I get the data??
>> and how can I get the center point (x,y) from a polygon??
>>
>> Darmawan
>> --
>> View this message in context:
>> http://n2.nabble.com/How-can-I-get-the-data-from-an-area-in-my-shapefile-tp3766988p3766988.html
>> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart
>> your
>> developing skills, take BlackBerry mobile applications to market and
>> stay
>> ahead of the curve. Join us from November 9-12, 2009. Register
>> now!
>> http://p.sf.net/sfu/devconf
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Geotools-gt2-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
> ________________________________
> This email was sent by Jody Garnett-2 (via Nabble)
> Your replies will appear at
> http://n2.nabble.com/How-can-I-get-the-data-from-an-area-in-my-shapefile-tp3766988p3768757.html
> To receive all replies by email, subscribe to this discussion
>
>
Jody Garnett-2

Re: How can I get the data from an area in my shapefile??

Reply Threaded More More options
Print post
Permalink
In reply to this post by dadar
You will get a feature collection of all the features where the user
clicked; you can go through the feature collection if you like and
copy them into a feature collection.

Jody

On Tue, Oct 6, 2009 at 12:18 AM, dadar (via Nabble)
<[hidden email]> wrote:

> so with that source I can access the data?
> how I put the data into array if there is 2 or more data in where I clicked
> the area?
>
> Darmawan
>
> Jody Garnett-2 wrote:
> A bounding box query (matching the area the person clicked) will do.
>
> There is an example in the user guide
> http://docs.codehaus.org/display/GEOTDOC/Filter+Examples
>
> Under "What did I click on":
>
> ReferencedEnvelope pixels = new ReferencedEnvelope( x-1,y-1, x+1, y+1,
> screenCRS );
> MathTransform screen2world= CRS.findMathTransform(screenCRS, dataCRS);
>
> ReferencedEnvelope selected = JTS.transform( pixels, null,
> screen2world, 10 );
>
> FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2
> ( GeoTools.getDefaultHints );
> Filter filter = ff.bbox( ff.property("THE_GEOM" ), ff.literal
> ( selected ) );
>
>
> Jody
>
> On 05/10/2009, at 4:15 PM, dadar wrote:
>
>>
>> I need to gain data from an area in my shapefile when i clicked it
>> does anybody know which function and how can I get the data??
>> and how can I get the center point (x,y) from a polygon??
>>
>> Darmawan
>> --
>> View this message in context:
>> http://n2.nabble.com/How-can-I-get-the-data-from-an-area-in-my-shapefile-tp3766988p3766988.html
>> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart
>> your
>> developing skills, take BlackBerry mobile applications to market and
>> stay
>> ahead of the curve. Join us from November 9-12, 2009. Register
>> now!
>> http://p.sf.net/sfu/devconf
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Geotools-gt2-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
> ________________________________
> This email was sent by Jody Garnett-2 (via Nabble)
> Your replies will appear at
> http://n2.nabble.com/How-can-I-get-the-data-from-an-area-in-my-shapefile-tp3766988p3768757.html
> To receive all replies by email, subscribe to this discussion
>
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users