Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha...

33
Geoprocessamento Transformações vetor x raster

Transcript of Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha...

Page 1: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Geoprocessamento

Transformações vetor x raster

Page 2: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Transformações

• Ponto vetor x ponto raster• Linha vetor x linha raster• Polígono vetor x polígono raster (algoritmo point in

polygon)

• No IDRISI estas transformações são feitas sobre imagem já existente

• Esta imagem pré-existente pode ser composta por zeros• Muitas vezes é necessário criar esta imagem com INITIAL

Page 3: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Transformação Vetor - raster

• Transformação de pontos• Pontos vetoriais podem ser transformados em pontos raster• Inicia com grade vazia • Tipos de transformações

– Registra a presença de 1 ou mais pontos numa célula (0 ou 1)– Conta a freqüencia de pontos dentro de uma célula– Assume o valor do ponto vetorial na célula– Registra o valor da soma dos identificadores dos pontos

• Utilidade: – semente para delimitação de bacia é um ponto; – estrada vetorial somente pode ser considerada em uma análise de caminho

ótimo se for rasterizada

Page 4: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Transformação ponto vetor x ponto raster

• Crie um raster vazio adequado (use Initial)• Extremos xmin, xmax, ymin, ymax

• Resolução

• Faça a operação vector to raster

Page 5: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.
Page 6: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Linha vetor x linha raster

Page 7: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Conversão de polígonos

Page 8: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

SPRING Básico 8

Conversão Vetor - Varredura

Page 9: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

O algoritmo Point in polygon

• Conversões vetor x raster

• Responder perguntas como:• Este posto pluviométrico está dentro da bacia?

• Este ponto em que foi identificado o mosquito da dengue está dentro do município?

• Este ponto de captação de água está na bacia A ou B?

• Quantos dos pontos do conjunto X estão dentro da região Y?

Page 10: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Point in polygon

• Point-In-Polygon Algorithm — Determining Whether A Point Is Inside A Complex Polygon©1998 Darel Rex Finley.  This complete article, unmodified, may be freely distributed for educational purposes.

http://www.alienryderflex.com/polygon/

Page 11: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Figure 1 demonstrates a typical case of a severely concave polygon with 14 sides. The red dot is a point which needs to be tested, to determine if it lies inside the polygon.

The solution is to compare each side of the polygon to the Y (vertical) coordinate of the test point, and compile a list of nodes, where each node is a point where one side crosses the Y threshold of the test point. In this example, 8 sides of the polygon cross the Y threshold, while the other 6 sides do not. Then, if there are an odd number of nodes on each side of the test point, then it is inside the polygon; if there are an even number of nodes on each side of the test point, then it is outside the polygon. In our example, there are 5 nodes to the left of the test point, and 3 nodes to the right. Since 5 and 3 are odd numbers, our test point is inside the polygon.

(Note: This algorithm does not care whether the polygon is traced in clockwise or counterclockwise fashion.)

Page 12: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Polígonos complexos

• Figure 2 shows what happens if the polygon crosses itself. In this example, a 10-sided polygon has lines which cross each other. The effect is much like "exclusive or", or XOR as it is known to assembly-language programmers. The portions of the polygon which overlap cancel each other out. So, the test point is outside the polygon, as indicated by the even number of nodes (2 and 2) on either side of it.

Page 13: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Interseção coincide com pontos

• In Figure 3, the 6-sided polygon does not overlap itself, but it does have lines that cross. This is not a problem; the algorithm still works fine.

Page 14: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Interseção coincide com segmento

• Figure 5 shows the case of a polygon in which one of its sides lies entirely on the threshold. Simply follow the rule as described concerning Figure 4. Side c generates a node, because it has one endpoint below the threshold, and its other endpoint on-or-above the threshold. Side d does not generate a node, because it has both endpoints on-or-above the threshold. And side e also does not generate a node, because it has both endpoints on-or-above the threshold.

Page 15: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Conversão polígono vetorial – polígono raster no Idrisi

Polígono vetor

Raster vazio (apenas zeros)

• Crie um raster vazio adequado (use Initial)• Extremos xmin, xmax, ymin, ymax

• Resolução

• Faça a operação vector to raster

Page 16: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Conversão polígono vetorial – polígono raster no Idrisi

Page 17: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Sobreposição perfeita!!!

Page 18: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Sobreposição perfeita???

Page 19: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Reversibilidade das transformações

• Transformações vetor x raster são reversíveis?

• Sim. Existem as operações inversas, mas parte da informação é perdida no caminho.

Page 20: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Operação inversaRaster x vetorLinhas não são iguais!

Experimente criar uma linhavetorial e transformar para umraster e depois transformar de voltapara um vetor. O resultado são duas linhasdiferentes!!

Page 21: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Operação inversa para polígonos

Page 22: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Polígono x vetor

• Transforme para vetor (polígono)

• Transforme de volta para raster

• Verifique diferenças

Arquivo raster Towns

Page 23: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Medição de distância de caminhos sobre arquivos raster

• Da figura ao lado pode-se ver que, embora seja boa a aproximação, a distância ao longo da linha preta é maior, porque ela é mais sinuosa.

• Isto ocorre sempre!

Page 24: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

ERRORS IN RIVER LENGTHS DERIVED FROM RASTER DIGITAL ELEVATION MODELS

• Adriano Rolim da Paz*; Walter Collischonn; Alfonso Risso; Carlos André Bulhões Mendes• Instituto de Pesquisas Hidráulicas, Universidade Federal do Rio Grande do Sul, Caixa Postal 15029,

Porto Alegre, RS, CEP 91501-970, Brazil. Email address: [email protected]; {collischonn,risso,mendes}@iph.ufrgs.br. *Corresponding author: tel.: +55 51 3308 7511; fax: +55 51 3308 7285.

• Abstract• Length of river reaches is one of the most important characteristics of stream networks when

applying hydrological or environmental simulation models. A common method of obtaining estimates of river lengths is based on deriving flow directions, accumulated area and drainage lines from raster digital elevation models (DEM). This method leads to length estimates with variable accuracy, which depends on DEM horizontal resolution, flatness of terrain, DEM vertical accuracy, the algorithm used to obtain flow directions and the way by which distances are calculated over raster structures. We applied an automatic river length extraction method for eight river reaches in the River Uruguay basin (206 000 km2), in Southern Brazil, and compared its results to the lengths obtained from drainage vector lines digitalized over satellite images. Our results show that relative errors can be higher than 30% in flat regions with relatively low DEM resolution. Preprocessing of DEM by the method known as stream burning greatly improves results, reducing errors to the range 1.9% to 7.4%. Further improved estimates were obtained by applying optimized values for the length of orthogonal and diagonal steps called Distance Transforms, reducing the errors to the range -2.0% to 3.3%.

A ser publicado em Computers and Geosciences

Page 25: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

• Distance calculations over raster DEMs are normally done step-by-step, accumulating Euclidean distances which depend on the size of the cells and on the travel direction between cells. The distance of a step connecting two orthogonal cells is considered equal to the cell size, while a diagonal step is considered to have a distance equal to 1.414 (square root of 2) times cell size (Burrough and McDonnel, 1998; Fairfield and Leymarie, 1991; Kennedy, 2006). The distance from cell B2 to cell E4 in the example shown in Figure 1-a is calculated by adding the distances of step B2 to C2, plus C2 to D3, plus D3 to E3, plus E3 to E4. If the cell size is 100 m than the total length would be 100+100(21/2)+100+100, or nearly 441 m.

Page 26: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

• As pointed out by De Smith (2004), this ordinary way of calculating length or distance leads to errors, even when using a high-resolution raster. Consider the three examples shown in Figure 1-b.

• The line from cell A6 to cell A1 follows an orthogonal direction on the raster grid and for this reason is perfectly approximated by the raster structure.

• The line from cell A6 to cell F1 follows a diagonal direction (45o) and can also be correctly approximated by the raster structure.

• In the case of the line connecting cell A6 to cell F4, however, the best approximation one can obtain is the sinuous path shown by the dashed segments connecting cell centers. Length will be calculated without error for line segments A6-A1 and A6-F1. If we consider a cell side of 1 unit, then the line segment A6-F4, which correct length is close to 5.38 units, will be calculated as having a length of 3+2.(21/2), or close to 5.83 units. In this case, an error of about 8% in calculated length would have been made.

Page 27: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

• Falar de Distance transforms

Page 28: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.
Page 29: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Tema interessante para trabalho:

• Caminhos de mínima distância em polígonos vetoriais

Page 30: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

Shortest Path Through A Concave Polygon With Holes

©2006 Darel Rex Finley.  This complete article, unmodified, may be

freely distributed for educational purposes.

Page 31: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

• The shortest path between two points inside a polygon may be a straight line:

Or, it may have to go around an obstacle:

Often, the shortest path will hug the wall of the polygon for part of its journey:

In fact, the shortest path will always consist of the startpoint and the endpoint, connected by a list of corners from the polygon.  (The above examples use 0, 1, and 4 corners of their polygons, respectively.)

Page 32: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

•If the polygon has "holes" — interior polygons of exclusion — then the shortest path may have to dodge them:

Note that in this example, the shortest path is not the simplest.  The green line represents a simpler way through the obstacles, but the blue path is shorter.How can we find the shortest path for any polygon (with or without holes) and any startpoint and endpoint?  As far as I know, an exhaustive search is required.  However, the search can be optimized a bit so that it doesn't take as long as testing every possible path.

Page 33: Geoprocessamento Transformações vetor x raster. Transformações Ponto vetor x ponto raster Linha vetor x linha raster Polígono vetor x polígono raster.

The technique used in the below code sample is to grow a spanning tree of points, starting at the startpoint, where every point in the tree is connected back to the startpoint by the shortest possible path.  When this tree reaches the endpoint, the solution is found.

Each tree-growing step adds not the closest connectible point, but rather the point that can be connected back to the startpoint by the shortest possible total path.  For example, the red point is closer to the tree than the green point, but the green point gives a shorter total path back to the startpoint.  Adding nodes to the spanning tree in this manner ensures that every point is connected back to the startpoint by the shortest possible path, and therefore that when we reach the endpoint, we will have reached it by the shortest possible path.