Hello,

The answer is "it depends" :)

Each square in the grid is represented by a SimpleFeature having, as
its geometry attribute, a JTS Polygon. You can retrieve the vertex
coordinates of the polygon using the Polygon.getCoordinates()
method...

http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Polygon.html#getCoordinates()

If you used Grids.createSquareGrid( env, sideLen ) to create the grid,
then the polygons will just have corner vertices. However, if you
requested "densified" squares (e.g. suitable for reprojection) using
createSquareGrid( env, sideLen, vertexSpacing ) then you will have
vertices for corners plus additional vertices along each side. In that
case you could just search for the vertex with the minimum X and  Y
ordinates and just calculate the others with simple arithmetic.

The above assumes that the squares are in the same reference system
used when creating the grid. However, if you have densified squares
which you have re-projected, and you want to be able to query the
coordinates of the corners in the new reference system, then it might
be easier to create the grid with a custom feature type which includes
attributes for the corner coords. There should be enough info in the
user manual and the javadocs for you to do this:

http://docs.geotools.org/latest/userguide/extension/grid.html#working-with-a-user-defined-feature-type

http://docs.geotools.org/latest/javadocs/org/geotools/grid/GridElement.html

Hope that helps.

Michael


On 11 July 2013 00:34, ChangWook Kim <hyper...@gmail.com> wrote:
> Hi all,
>
> I am trying to get coordinates of vertex for square (latitude, longitude)
> with createSquareGrid().
> Is it possible, and how can I achieve it?
>
> Basically, I want to divide U.S land into square and get coordinates of
> vertex for each square.
>
> Regards,
> Chang Wook
>
>
>
> --
> View this message in context: 
> http://osgeo-org.1560.x6.nabble.com/Get-coordinates-of-square-grid-tp5065446.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to