terrame / gpm Goto Github PK
View Code? Open in Web Editor NEWA TerraME package to implement GPM
License: GNU General Public License v3.0
A TerraME package to implement GPM
License: GNU General Public License v3.0
Add an additional argument to type Network with a maximum tolerance to connect the points of lines as nodes. As default, it should be zero (two points must be exactly in the same place to be connected).
Translate all values and names of attributes of shape files to english. Use also better attribute names. Update tests. For example:
roads:get(id).CD_PAVIMEN == "pavimentada"
should be
roads:get(id).status == "paved"
Implement a strategy "distance" to GPM that compute relations based on their euclidean distances. One can choose a maximum distance
as argument or a maximum quantity
. Note that these two arguments cannot be used at the same time.
Add a function to connect closer points in a network according to a maximum tolerance. Return the number of connected points (and possibly where they were located).
Implement a function to validade a network. It must be possible to go from any node to any node of the network. It should stop with an error if it is not possible. In the error, show the number of separate networks found.
Add a new argument progress
to GPM
to print
as values are being processed, such as:
gpm = GPM{
-- ...
progress = true
}
will show the following output:
Processing origin 1/4
Processing origin 2/4
Processing origin 3/4
Processing origin 4/4
It can import several network formats.
Krajzewicz, D.; Eedmann, J.; Behrisch, M.; Bieker, L. (2012). Recent Development and Applications of SUMO - Simulation of Urban MObility. International Journal On Advances in Systems and Measurements, (v.3-4, n.5, p.128–138).
Add basic data to work with GPM in the package.
Implement a strategy to create a neighbourhood of cells that have touching relations and share the same road.
Output is an optional value.
Add an argument to receive the output value of the GPM.
Type Network should verify if all the Network is connected. Otherwise, an error should be prompted.
Verify the indentation of all usage of the package.
Think in a way to allow saving an attribute of GPM. There are three possibilities:
Adding references to identify the points.
Add the data from aRT package related to gpm algorithms to this package.
Add strategies, and check documentation.
strategy 'relations': Creates networks between polygons and cells.
strategy 'distanceFromTarget': Returns the cells within the distance of the target.
Add a second argument to GPM:save
to indicate the number of decimal places to save weights. The default value should be 5.
The calculation of the geometry and the entry point does not considering the distance to the end point.
Add to calculate the distance to the end point.
How to build packages: https://github.com/TerraME/terrame/wiki/Packages
Source code conventions: https://github.com/TerraME/terrame/wiki/developing#Code
GPM working: aRTgpm.pdf
Create an example that uses data stored in angles, such as polyconic projection. Ensure that distances are computed in meters, and not in angles in the Network and in GPM.
Add an argument destination
to Network
, in order to say how many destinations will be computed. When this argument is missing (default), the algorithm will compute the distance to all destinations (which belong to the target). Therefore there will exist three algorithms:
This algorithm will be useful to create neighbourhoods between objects.
Add a new argument progress
to Network
to print
as values are being processed, such as:
net = Network{
-- ...
progress = true
}
will show the following output:
Reducing distances 1/4
Reducing distances 2/4
Reducing distances 3/4
It is not possible to reduce distances anymore
4 in this case is the number of lines.
Implement method save with an option to save a GAL file. See documentation in http://www.leg.ufpr.br/~pedro/aRT/doc/aRTgpm.html#x1-90008
Implement type GPM, to compute a generalised proximity matrix from a Network. It gets a Network and a target as parameters and compute the distance from the targets to the targets of the Network. It will return an object of type "GPM".
The implementation of this function must have an optional argument "strategy" to allow having different behaviour to be implemented in future versions. For now, it is only required to follow the TerraME standard for this kind of type. See the documentation of CellularSpace:createNeighborhood of Society:createSocialNetwork as examples. The only strategy
available in version 0.1 will be "network"
.
Create relations between a set of polygons and a set of points which the predicate contains is applied.
Add an error argument to connect the lines in the Network:
network = Network{
target = communities,
lines = roads,
error = 10, -- 10m
weight = function(cell, distance)
local roadtype = cell.CD_PAVIMENT
if roadtype == "paved" then
return distance / 5
else
return distance / 2
end
end
}
Verify if all end points of each line of the network can be connected to an end point of another line.
Verify if all the lines belong to the same network (from each line it is possible to reach all other lines in the network).
GPM:output
with an attribute that already exists should stop with an error. Note that this verification must be executed before creating GPM.
Instead of using
t = {"a", "b", "c"}
use
t = {
a = true,
b = true,
c = true
}
to simplify access.
Add an optional argument buffer
to GPM. When using this argument, all polygons from the target will be converted to their buffers, according to the values in the argument.
Implement method save with an option to save a GWT file. See documentation in http://www.leg.ufpr.br/~pedro/aRT/doc/aRTgpm.html#x1-90008
Study the document below. It might bring interesting ideas on how to improve GPM package:
http://www.teses.usp.br/teses/disponiveis/3/3138/tde-24062016-111306/pt-br.php
Implement a function to create an open network
roads = CellularSpace{
project = "my project",
layer = "roads",
geometry = true
}
network = Network{
strategy = "open",
target = communities,
lines = roads,
weight = function(cell, distance)
local roadtype = cell.CD_PAVIMENT
if roadtype == "paved" then
return distance / 5
else
return distance / 2
end
end
}
Check if the CellularSpaces used in the Network were loaded with geometry. See TerraME/terrame#956.
Add an argument to Network described as a function to compute the distance outside the Network. This function is useful as usually the starting and ending points are not connected to the network. In this case, this function should take the euclidean distance and id of the object as argument and return the real distance. This is an optional function and should have as default a function that returns zero.
Add an argument outside
to Network
, a user-defined function that computes the distance based on an Euclidean to enter and to leave the Network
.
network = Network{
strategy = "open",
target = communities,
lines = roads,
outside = function(d)
return d * 2
end,
weight = function(cell, distance)
local roadtype = cell.CD_PAVIMENT
if roadtype == "paved" then
return distance / 5
else
return distance / 2
end
end
}
As default, this function is a function that returns the distance itself:
if data.outside == nil then
data.outside = function(d) return d end
end
Implement method save with an option to save a GPM file. See documentation in http://www.leg.ufpr.br/~pedro/aRT/doc/aRTgpm.html#x1-90008
Update all the package to use TerraLib facade instead of using them directly.
Implement a new strategy "area" for GPM, which calculates neighbourhoods according to the intersection area. It can compute relations to all polygons that have some intersection area or limit a given quantity (argument quantity
, optional).
Implement an example that uses data in the package to create a GPM and display in a Map the closest destination point using a Cellular Data.
Review the data available in the package. Remove some useless attributes and rename the others.
All the elements belonging to the source of a Network must be converted into centroids if they are not point data. Investigate how to do so using TerraLib algorithms.
Implement functionalities as well as scripts to rebuild all neighborhood files from base package:
./cabecadeboi-neigh.gpm
./gpmlinesDbEmas.gpm
./test/brazil.gal
./test/cabecadeboi-neigh.gal
./test/cabecadeboi-neigh.gwt
./test/emas-distance.gal
./test/emas-distance.gpm
./test/emas-distance.gwt
./test/emas-pollin.gpm
./test/gpmAreaCellsPols.gpm
./test/gpmdistanceDbEmasCells.gpm
Implement a strategy "length", that create relations between objects whose intersection is a line. For example, between a polygon and a line, or between two polygons that share some border. This relation can be created according to a maximum quantity
or a minimum length
. Note that these two arguments cannot be used at the same time.
target
must be a CellularSpace
with pointslines
must be a CellularSpace
with linesweight
must be a functionAdd alternative tests
Avoid concatenating strings several times when creating a GPM. Create an auxiliary table that stores all strings, indexed by x and y locations, such as table[x][y]
to get such string.
Add a new argument to Network to set the desired distance between two points within each line. If two consecutive points from a line have more than the desired distance, a new point should be created in the middle of them. If three or more consecutive points fit in the desired distance, the intermediate points can be removed.
Code enhancement, and correction in the calculation of the distance.
After creating any neighbourhood, verify if any object does not have at least one connection and show a warning in this case.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.