Skip to content

Commit

Permalink
Merge pull request #58 from JoaoVitor123/master
Browse files Browse the repository at this point in the history
Joao's updates to GPM version - 0.3
  • Loading branch information
pedro-andrade-inpe authored Jan 13, 2017
2 parents 9c8d605 + 8ca6f70 commit 28aeb14
Show file tree
Hide file tree
Showing 31 changed files with 5,473 additions and 299 deletions.
19 changes: 15 additions & 4 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,19 @@ data{
file = "farms_cells2.shp",
attributes = {
id = "Character identifier",
col = "number of columns",
row = "number of line"
col = "Number of columns",
row = "Number of line"
},
summary = "A shapefile describing the farms.",
source = "TerraME team"
}

data{
file = "farms_cells3.shp",
attributes = {
id = "Character identifier",
col = "Number of columns",
row = "Number of line"
},
summary = "A shapefile describing the farms.",
source = "TerraME team"
Expand All @@ -38,8 +49,8 @@ data{
file = "farms_cells.shp",
attributes = {
id = "Character identifier",
col = "number of columns",
row = "number of line"
col = "Number of columns",
row = "Number of line"
},
summary = "A shapefile describing the farms.",
source = "TerraME team"
Expand Down
Binary file added data/farms_cells2.qix
Binary file not shown.
Binary file added data/farms_cells3.dbf
Binary file not shown.
Binary file added data/farms_cells3.qix
Binary file not shown.
Binary file added data/farms_cells3.shp
Binary file not shown.
Binary file added data/farms_cells3.shx
Binary file not shown.
15 changes: 5 additions & 10 deletions examples/area.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
-- @example GPM Implementation strategy 'area' and creating map.
-- Create a map based on the cells and polygons.
-- @image cellID_farms.bmp

-- import gpm
import("gpm")

-- create the CellularSpace
local farms = CellularSpace{
file = filePath("farms_cells.shp", "gpm"),
file = filePath("farms_cells3.shp", "gpm"),
geometry = true
}

Expand All @@ -15,22 +16,16 @@ local farmsPolygon = CellularSpace{
geometry = true
}

-- creating a GPM with the distance of the entry points for the routes
-- creating a GPM
local gpm = GPM{
origin = farms,
distance = "distance",
relation = "community",
output = {
id = "id1",
distance = "distance"
},
destination = farmsPolygon
}

-- creating Map with values ​​GPM
map = Map{
target = gpm.origin,
select = "cellID",
value = {1, 2, 3, 4},
color = {"red", "blue", "green", "black"}
slices = 10,
color = "RdYlGn"
}
9 changes: 4 additions & 5 deletions examples/border.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ local farmsNeighbor = CellularSpace{
geometry = true
}

-- creating a GPM with the distance of the entry points for the routes
-- creating a GPM
local gpm = GPM{
origin = farmsNeighbor,
distance = "distance",
relation = "community",
strategy = "border"
strategy = "border",
progress = false
}

forEachCell(gpm.origin, function(polygon)
print(polygon.NOME_UF)
forEachElement(polygon.neighbors, function(polygonNeighbor)
print(" "..polygon.neighbors[polygonNeighbor].NOME_UF.."("..polygon.perimeterBorder[polygon.neighbors[polygonNeighbor]]..")")
print(" "..polygon.neighbors[polygonNeighbor].NOME_UF.." ("..polygon.perimeterBorder[polygon.neighbors[polygonNeighbor]]..")")
end)
end)
32 changes: 32 additions & 0 deletions examples/contains.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- @example GPM Implementation strategy 'contains' and creating map.
-- Create a map based on relations between a set of polygons and a set of points which the predicate contains is applied.
-- @image contains.bmp

-- import gpm
import("gpm")

-- create the CellularSpace
local farms = CellularSpace{
file = filePath("farms_cells.shp", "gpm"),
geometry = true
}

local communitiesPoints = CellularSpace{
file = filePath("communities.shp", "gpm"),
geometry = true
}

-- creating a GPM with the distance of the entry points for the routes
GPM{
origin = farms,
strategy = "contains",
destination = communitiesPoints
}

-- creating Map with values ​​GPM
map = Map{
target = farms,
select = "counterContains",
value = {0, 1},
color = {"lightGray", "blue"}
}
13 changes: 6 additions & 7 deletions examples/distance.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- @example GPM Implementation strategy 'distance' and creating map.
-- Create a map based on the endpoints, and the cells.
-- @image polygon_farms_quantity.bmp

-- import gpm
import("gpm")
Expand Down Expand Up @@ -34,23 +35,21 @@ local network = Network{
outside = function(distance) return distance * 2 end
}

-- creating a GPM with the distance of the entry points for the routes
-- creating a GPM Only with distance
GPM{
network = network,
origin = farms,
distance = "distance",
relation = "community",
output = {
id = "id1",
distance = "distance"
},
maxDist = 2000
distance = 2000
}

-- creating Map with values ​​GPM
map = Map{
target = farms,
select = "pointID",
value = {1, 2, 3, 4},
color = {"red", "blue", "green", "black"}
}
value = {0, 1, 2, 3, 4},
color = {"lightGray", "red", "blue", "green", "black"}
}
8 changes: 3 additions & 5 deletions examples/farms.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
-- Creates maps based on distance routes, entry points and exit points.
-- This test has commented lines, to create and validate files.
-- This example creates a 'gpm.gpm' file if you have another file with this name will be deleted.
-- @image id_farms.bmp

-- import gpm
import("gpm")
Expand Down Expand Up @@ -37,17 +38,14 @@ local network = Network{
progress = true
}

-- creating a GPM with the distance of the entry points for the routes
-- creating a GPM
local gpm = GPM{
network = network,
origin = farms,
distance = "distance",
relation = "community",
output = {
id = "id1",
distance = "distance"
},
progress = true
}
}

-- creating Map with values ​​GPM
Expand Down
32 changes: 32 additions & 0 deletions examples/length.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- @example GPM Implementation strategy 'length' and creating map.
-- Create relations between objects whose intersection is a line.
-- @image length.bmp

-- import gpm
import("gpm")

-- create the CellularSpace
local farms = CellularSpace{
file = filePath("roads.shp", "gpm"),
geometry = true
}

local farms_cells = CellularSpace{
file = filePath("farms_cells3.shp", "gpm"),
geometry = true
}

-- creating a GPM
GPM{
origin = farms_cells,
strategy = "length",
destination = farms
}

-- creating Map with values ​​GPM
map = Map{
target = farms_cells,
select = "length",
value = {1, 2},
color = {"green", "blue"}
}
Binary file added images/cellID_farms.bmp
Binary file not shown.
Binary file added images/contains.bmp
Binary file not shown.
Binary file added images/id_farms.bmp
Binary file not shown.
Binary file added images/length.bmp
Binary file not shown.
Binary file added images/polygon_farms_quantity.bmp
Binary file not shown.
Loading

0 comments on commit 28aeb14

Please sign in to comment.