Re: [udig-devel] How to create a grid of features in a polygone

```Just for an update: i (to be honest: a colleague) found this class:

http://udig.refractions.net/files/docs/api-geotools/org/geotools/referencing/GeodeticCalculator.html

i think this could help to do the job in a plugin source code.

greats ingmar

Am 30.03.2008 um 19:20 schrieb andrea antonello:
```
```Hi Ingmar,

```
Good idea with to intersection of the horizontal and vertical lines.
```But how do i create the lines with the constant spacing?

```
i manged to get the envelope from a polygone with 5 coordinates likes
```this:

(13.68264407681451, 53.818121066825206, NaN)
(14.101893321395334, 53.818121066825206, NaN)
(14.101893321395334, 54.112935604110326, NaN)
(13.68264407681451, 54.112935604110326, NaN)
(13.68264407681451, 53.818121066825206, NaN)

a nice bounding box. and now?

the first horizontal line is

(13.68264407681451, 54.112935604110326, NaN) (14.101893321395334,
54.112935604110326, NaN)

the upper left corner to the upper right corner. how do i get the
next
point for the Y coordinate with a distance of, lets say, 200m?

(13.68264407681451, ??, NaN) (14.101893321395334, ??, NaN)
```
```
```
You are dealing with lat-long coordinates, so it doesn't make sense to
```talk metric.
```
You could say: "...point for the Y coordinate with a distance of, lets
```say, 60'?"
If you need metric, you should first reproject the layer into your
local metric system and then do maths with your metric coordinates.

Is that the problem you have?
```
```
Yes, i think this is my problem. I can not deal with a distance of
60'. How can i do this projection? I am not realy good in this geo-
stuff. sorry.

lets resume what i should do:

```
i have lat/lon -> project in metric coodinates (km, meter) -> take the
```line and calculate a parallel line with distance of 200m -> reproject
to lat/lon to get the depending coordinates.

is this possible? how?
```
```
It is possible.
Load your shapefile or whatever. Export it. When you export it, you
can choose the CRS for the exported map. Choose the epsg for your
projection. That one you have to be aware of, because if you do not
have exactly the info required, you could have shifts and distortions.

```
Once exported it is also reprojected. Load the new shapefile and you are there.
```Now the part with the lines and 200m comes.

Onces you have the final points, you can reproject them nack, even if
they are reprojected *for visualization only* on the fly.

Andrea

```
```
Thanks forward.

```
```Ciao
Andrea

```
```
Thanks again. Ingmar

Am 30.03.2008 um 15:21 schrieb andrea antonello:

```
```i have a little "geospatial" question. I want to draw polygones
on a
polygone layer and then start a wizard which fills the polygone
with
features (with a point geometry). All features have the same
distance
(lets say 100m to each other) and all are in the area of the
polygone.

```
Sounds like a not so difficult problem, but i hope that there is a
```nice way to program this. perhaps i should use the gridcoverage
class?
i realy dont know where to start.
```
```
Hi Ingmar,
I think it is more a JTS related question.
```
What I would probably do (I'm writing as I'm thinking) is to create
```the grid of lines at the wanted distances one from the other.
```
The horizontal lines and vertical lines should stay in two different
```multilinestring geometries. Then through

resultPointGeom = horizontalLines.intersection(verticalLines)

you gain all the points you wanted to have into the resulting
geometry.
```
After that you will have to get from those only the ones inside the
```polygon, which I assume can be done through another intersection
between polygon and resultPointGeom.

Ciao
Andrea

```
```

Greats Ingmar
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

```
```_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
```
```
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

```
```_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
```
```
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

```
```_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
```
```

```