the solution is the following :

let's say x is your simple feature then you would go

Geometry geom = (Geometry) x.getDefaultGeometry();

(you could replace geometry by point or multilinestring or polygon depending
on your geometry)

then to get the coordinates use Coordinate[] array_of_coords
=geom.getCoordinates() <=== check the syntax

now you will have them in an array to get x and y alone use for example

array_of_coords[0].x;  <====get the first coordinate's x

Good luck :D

On Wed, Mar 30, 2011 at 1:25 PM, mravojed <[email protected]> wrote:

> Hi,
>
> I am new to geotools and I am trying to get the coordinates of all vertices
> from an object of type SimpleFeature.
> I could convert the geometry attribute to string and parse it but there
> must
> be a smarter solution than that, right?
>
> Thanks
>
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Retrieving-SimpleFeature-s-coordinates-tp6224860p6224860.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Create and publish websites with WebMatrix
> Use the most popular FREE web apps or write code yourself;
> WebMatrix provides all the features you need to develop and
> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to