Hi ! I got a problem with your answer :
public void circle(Feature feature){
Geometry geom = feature.getDefaultGeometry();
}
getDefaultGeometry(); is undefined and cast feature to SimpleFeature doesn't
work . O_o
Regards.
Date: Mon, 30 Apr 2012 21:49:23 +1000
From: [email protected]
To: [email protected]
CC: [email protected]
Subject: Re: [Geotools-gt2-users] Geologie France
Opps - please keep discussion on the email list. That way
more people are able to take part and possibly help you?
I think what you may want to do is:
1) Get the geometry for your selected feature
Geometry geom = feature.getDefaultGeometry();
2) Take the centre
Coordiante centre = geom.getCentriod();
3) turn that back into a geometry
Point point = geometryFactory.createPoint( centre );
4) And then …. buffer the point to obtain a Polygon (it will be a circle)
point.buffer( amount )
The tricky part is determining what the amount should be.
Jody
On Saturday, 28 April 2012 at 11:56 PM, jérémy lacombe wrote:
Good afternoon,
In reality, i just want to select a feature and draw a circle around this
feature. But, i don't know how to do that. and i just want to have the property
of the feature selected ^^
Regards ,
ptitdje
Date: Sat, 28 Apr 2012 22:27:12 +1000
From: [email protected]
To: [email protected]
CC: [email protected]
Subject: Re: [Geotools-gt2-users] Geologie France
The tutorials are written for GeoTools 8.
-
http://docs.geotools.org/latest/userguide/tutorial/map/style.html
What is the link to "opensourcejavaphp.net you found? The web is a strange
place …
You can find the older (i.e. stable) copy of the tutorials here:-
http://docs.geotools.org/stable/tutorials/
Please keep in mind that "selection" is a concept for your application.
GeoTools is just providing the ability to work with features; and draw
features. That selection tutorial focuses on "draw" some features that have
been considered selected in that example. You may wish to handle the idea of
selection in the same manner for your application?
Jody
Moving to the small problem I encountered:
-----> I followed the tutorial for display and loading the shapefile. PERFECT =
D
------> I took a second tutorial (
http://www.opensourcejavaphp.net/java/geotools/org/geotools/demo/SelectionLab.java.html)
to select one feature at a click on the JMapPane. NOT PERFECT = / Let me
explain I have a compilation error in this online tutorial:
mapFrame = new JMapFrame (map);
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users