remove whitespace before EOL

0.90.x
Rolf Eike Beer 2015-10-31 09:29:55 +01:00
parent 954495b384
commit 17605996d6
19 changed files with 56 additions and 56 deletions

View File

@ -13,9 +13,9 @@ Your pull requests will then be reviewed and discussed.
## History
To understand the osm2pgsql code, it helps to know some history on it. Osm2pgsql
was written in C in 2007 as a port of an older Python utility. In 2014 it was
was written in C in 2007 as a port of an older Python utility. In 2014 it was
ported to C++ by MapQuest and the last C version was released as 0.86.0. In it's
time, it has had varying contribution activity, including times with no
time, it has had varying contribution activity, including times with no
maintainer or active developers.
Parts of the codebase still clearly show their C origin and could use rewriting
@ -24,7 +24,7 @@ in modern C++, making use of data structures in the standard library.
## Versioning
Osm2pgsql uses a X.Y.Z version number, where Y tells you if you are on a stable
or development series. Like the Linux Kernel, even numbers are stable and
or development series. Like the Linux Kernel, even numbers are stable and
development versions are odd.
Bugs and known issues are fixed on the main branch only. Exceptions may be made
@ -32,7 +32,7 @@ for easy bug fixes, or if a patch backporting a fix is provided.
## Code style
The current codebase is a mix of styles, but new code should be written in the
The current codebase is a mix of styles, but new code should be written in the
[K&R 1TBS style](https://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS) with
4 spaces indentation. Tabs should never be used in the C++ code.
@ -111,5 +111,5 @@ needs testing in a pull request.
## Maintainers
The current maintainers of osm2pgsql are [Sarah Hoffmann](https://github.com/lonvia/)
and [Paul Norman](https://github.com/pnorman/). Sarah has more experience with
and [Paul Norman](https://github.com/pnorman/). Sarah has more experience with
the gazetteer backend and Paul with the pgsql and multi backends.

View File

@ -28,7 +28,7 @@ $ git clone git://github.com/openstreetmap/osm2pgsql.git
## Building ##
Osm2pgsql uses the [GNU Build System](http://www.gnu.org/software/automake/manual/html_node/GNU-Build-System.html)
to configure and build itself and requires
to configure and build itself and requires
* [expat](http://www.libexpat.org/)
* [geos](http://geos.osgeo.org/)

View File

@ -29,9 +29,9 @@ The second return value is `tags`, a transformed (or unchanged) set of tags.
`filter_tags_way` returns two additional flags. `poly` should be `1` if the way should be treated as a polygon, `0` as a line. `roads` should be `1` if the way should be added to the planet_osm_roads table, `0` otherwise.
function filter_tags_relation_member(tags, member_tags,
function filter_tags_relation_member(tags, member_tags,
roles, num_members)
return filter, tags, member_superseded, boundary,
return filter, tags, member_superseded, boundary,
polygon, roads
The function filter_tags_relation_member is more complex and can handle more advanced relation tagging, such as multipolygons that take their tags from the member ways.

View File

@ -5,7 +5,7 @@ to the standard [pgsql](pgsql.md) backend tables. It is intended to allow
the configuration of a custom set of tables with hopefully fewer rows and fewer
columns. This can be beneficial to queries in which some context (eg. zoom level)
could limit the number of tables that need to be queried. Addtionaly it would
allow more tables to be queried in parallel.
allow more tables to be queried in parallel.
## Database Layout ##
It connects to a PostgreSQL database and stores the data in one or more tables.
@ -40,7 +40,7 @@ Note that each table has a `name` and can target a single type of geometry
by setting the `type` to one of `point`, `line` or `polygon`. `tagtransform`
is used to set the name of the lua script to be used for custom tag processing.
Within the lua script you may define several methods that will be called
when processing various tags, these can be named via
when processing various tags, these can be named via
`tagtransform-node-function`, `tagtransform-way-function`,
`tagtransform-relation-function`, and `tagtransform-relation-member-function`.
As with the normal top level options within osm2pgsql you can specify any of the

View File

@ -32,7 +32,7 @@ http://download.geofabrik.de/osm/.
When operating in "slim" mode (and on a database created in "slim" mode!),
.B osm2pgsql
can also process OSM change files (osc files), thereby bringing an existing
database up to date.
database up to date.
.PP
.SH OPTIONS
These programs follow the usual GNU command line syntax, with long
@ -85,7 +85,7 @@ Use projection EPSG:num
Prefix for table names (default: planet_osm).
.TP
\fB\-r\fR|\-\-input\-reader format
Select format of the input file. Available choices are \fBauto\fR
Select format of the input file. Available choices are \fBauto\fR
(default) for autodetecting the format,
\fBxml\fR for OSM XML format files, \fBo5m\fR for o5m formatted files
and \fBpbf\fR for OSM PBF binary format.
@ -115,7 +115,7 @@ Only for slim mode: Use up to num many MB of RAM for caching nodes. Giving osm2p
to store all imported nodes typically greatly increases the speed of the import. Each cached node
requires 8 bytes of cache, plus about 10% \- 30% overhead. For a current OSM full planet import with
its ~ 3 billion nodes, a good value would be 27000 if you have enough RAM. If you don't have enough
RAM, it is likely beneficial to give osm2pgsql close to the full available amount of RAM. Defaults to 800.
RAM, it is likely beneficial to give osm2pgsql close to the full available amount of RAM. Defaults to 800.
.TP
\fB\ \fR\-\-cache\-strategy strategy
There are a number of different modes in which osm2pgsql can organize its

View File

@ -37,7 +37,7 @@ instead stored in a binary file.
3. If there are tags on a way in the style file as linear but without polygon
tags, they are written into the lines and, depending on tags, roads tables.
They are also stored by the middle layer.
4. Ways without tags or with polygon tags are stored as "pending" in the

View File

@ -30,7 +30,7 @@ that only impact performance.
store information about ways and relations too. The maximum RAM it is useful
to set this to in slim mode is 8 bytes * number of nodes / efficiency, where
efficiency ranges from 50% on small extracts to 80% for a planet.
* ``--number-processes`` sets the number of processes to use. This should
typically be set to the number of CPU threads, but gains in speed are minimal
past 8 threads.
@ -41,7 +41,7 @@ that only impact performance.
* ``--cache-strategy`` sets the cache strategy to use. The defaults are fine
here, and optimizied uses less RAM than the other options.
## Database options ##
osm2pgsql supports standard options for how to connect to PostgreSQL. If left
@ -69,7 +69,7 @@ database if the database server ever crashes, but are faster to import.
* ``--slim`` causes the middle layer to store node and way information in
database rather than in memory. It is required for updates and for large
extracts or the entire planet which will not fit in RAM.
* ``--drop`` discards the slim tables when they are no longer needed in the
import, significantly reducing disk requirements and saving the time of
building slim table indexes. A ``--slim --drop`` import is generally the
@ -102,21 +102,21 @@ osm2pgsql has five hstore options
a hstore column. With the standard stylesheet this would result in tags like
highway appearing in a conventional column while tags not in the style like
``name:en`` or ``lanes:forward`` would appear only in the hstore column.
* ``--hstore-all`` or ``-j`` adds all tags to a hstore column, even if they're
already stored in a conventional column. With the standard stylesheet this
would result in tags like highway appearing in conventional column and the
hstore column while tags not in the style like ``name:en`` or
``lanes:forward`` would appear only in the hstore column.
* ``--hstore-column`` or ``-z``, which adds an additional column for tags
starting with a specified string, e.g. ``--hstore-column 'name:'`` produces
a hstore column that contains all ``name:xx`` tags
* ``--hstore-match-only`` modifies the above options and prevents objects from
being added if they only have tags in the hstore column and no conventional
tags.
* ``--hstore-add-index`` adds a GIN index to the hstore columns. This can
speed up arbitrary queries, but for most purposes partial indexes will be
faster.
@ -141,7 +141,7 @@ reimporting the database, at the cost of a
MULTIPOLYGONs are split into multiple POLYGONs. ``--multi-geometry`` can be
used to [avoid some labeling issues at the cost of speed](http://paulnorman.ca/blog/2014/03/osm2pgsql-multipolygons/).
It is also typically required for [analysis](analysis.md).
* ``--keep-coastlines`` disables a hard-coded rule that would otherwise
discard ``natural=coastline`` ways.

View File

@ -1,5 +1,5 @@
# This osm2pgsql style file is one that will generate no columns from tags
# It is designed as a starting point for you to develop your own, or for
# It is designed as a starting point for you to develop your own, or for
# use where all OSM tags are in hstore.
# See default.style for documentation on all the flags

View File

@ -30,27 +30,27 @@ fi
echo "Initializing Spatial Extentions for postgresql 9.1"
file_postgis=/usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
file_spatial_ref=/usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
sudo -u postgres psql $DBNAME <$file_postgis >/dev/null 2>&1
sudo -u postgres psql $DBNAME <$file_spatial_ref >/dev/null 2>&1
echo "Spatial Extentions initialized"
echo "Initializing hstore"
echo "CREATE EXTENSION hstore;" | sudo -u postgres psql $DBNAME
else
echo "Initializing Spatial Extentions for postgresql 8.4"
file_postgis=/usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
file_spatial_ref=/usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
sudo -u postgres psql $DBNAME <$file_postgis >/dev/null 2>&1
sudo -u postgres psql $DBNAME <$file_spatial_ref >/dev/null 2>&1
echo "Spatial Extentions initialized"
echo "Initializing hstore"
file_hstore=/usr/share/postgresql/8.4/contrib/hstore.sql
sudo -u postgres psql $DBNAME <$file_hstore >/dev/null 2>&1
fi fi
echo "Setting ownership to user $DBOWNER"
echo 'ALTER TABLE geometry_columns OWNER TO ' $DBOWNER '; ALTER TABLE spatial_ref_sys OWNER TO ' $DBOWNER ';' | sudo -u postgres psql $DBNAME
@ -62,7 +62,7 @@ if [ -n "$GRANT_USER" ] ; then
if [ "$GRANT_USER" = "*" ] ; then
echo "GRANT Rights to every USER"
GRANT_USER=''
for user in `users` ; do
for user in `users` ; do
GRANT_USER="$GRANT_USER $user"
done
fi

View File

@ -15,7 +15,7 @@ if [ -n "$GRANT_USER" ] ; then
if [ "$GRANT_USER" = "*" ] ; then
echo "GRANT Rights to every USER"
GRANT_USER=''
for user in `users` ; do
for user in `users` ; do
GRANT_USER="$GRANT_USER $user"
done
fi

View File

@ -119,7 +119,7 @@ end
-- true
-- > = yesno("foo")
-- true
--
--
-- A typical usage would be on a tag like bridge, tunnel, or shelter, but not
-- a tag like oneway which could be yes, no, reverse, or unset
function yesno (v)

View File

@ -28,7 +28,7 @@
*
* If FIXED_POINT is enabled, it uses internally a more efficient
* representation as integer.
*/
*/
class ramNode {
public:
#ifdef FIXED_POINT

View File

@ -271,7 +271,7 @@ options_t::options_t():
droptemp(false), unlogged(false), hstore_match_only(false), flat_node_cache_enabled(false), excludepoly(false), flat_node_file(boost::none),
tag_transform_script(boost::none), tag_transform_node_func(boost::none), tag_transform_way_func(boost::none),
tag_transform_rel_func(boost::none), tag_transform_rel_mem_func(boost::none),
create(false), long_usage_bool(false), pass_prompt(false), output_backend("pgsql"), input_reader("auto"), bbox(boost::none),
create(false), long_usage_bool(false), pass_prompt(false), output_backend("pgsql"), input_reader("auto"), bbox(boost::none),
extra_attributes(false), verbose(false)
{
#ifdef HAVE_FORK

View File

@ -162,7 +162,7 @@ int output_pgsql_t::pgsql_out_relation(osmid_t id, const taglist_t &rel_tags,
taglist_t outtags;
//if its a route relation make_boundary and make_polygon will be false otherwise one or the other will be true
if (m_tagtransform->filter_rel_member_tags(rel_tags, xtags, xrole,
if (m_tagtransform->filter_rel_member_tags(rel_tags, xtags, xrole,
&(members_superseeded[0]), &make_boundary, &make_polygon, &roads,
*m_export_list.get(), outtags)) {
return 0;

View File

@ -1,7 +1,7 @@
-- For documentation of Lua tag transformations, see docs/lua.md.
-- Objects with any of the following keys will be treated as polygon
polygon_keys = { 'building', 'landuse', 'amenity', 'harbour', 'historic', 'leisure',
polygon_keys = { 'building', 'landuse', 'amenity', 'harbour', 'historic', 'leisure',
'man_made', 'military', 'natural', 'office', 'place', 'power',
'public_transport', 'shop', 'sport', 'tourism', 'waterway',
'wetland', 'water', 'aeroway' }
@ -20,9 +20,9 @@ delete_tags = { 'FIXME', 'note', 'source' }
-- Array used to specify z_order per key/value combination.
-- Each element has the form {key, value, z_order, is_road}.
-- If is_road=1, the object will be added to planet_osm_roads.
zordering_tags = {{ 'railway', nil, 5, 1}, { 'boundary', 'administrative', 0, 1},
zordering_tags = {{ 'railway', nil, 5, 1}, { 'boundary', 'administrative', 0, 1},
{ 'bridge', 'yes', 10, 0 }, { 'bridge', 'true', 10, 0 }, { 'bridge', 1, 10, 0 },
{ 'tunnel', 'yes', -10, 0}, { 'tunnel', 'true', -10, 0}, { 'tunnel', 1, -10, 0},
{ 'tunnel', 'yes', -10, 0}, { 'tunnel', 'true', -10, 0}, { 'tunnel', 1, -10, 0},
{ 'highway', 'minor', 3, 0}, { 'highway', 'road', 3, 0 }, { 'highway', 'unclassified', 3, 0 },
{ 'highway', 'residential', 3, 0 }, { 'highway', 'tertiary_link', 4, 0}, { 'highway', 'tertiary', 4, 0},
{ 'highway', 'secondary_link', 6, 1}, { 'highway', 'secondary', 6, 1},
@ -72,7 +72,7 @@ function filter_tags_generic(keyvalues, numberofkeys)
for i,k in ipairs(delete_tags) do
keyvalues[k] = nil
end
-- Filter out objects that do not have any of the keys in generic_keys
tagcount = 0
for k,v in pairs(keyvalues) do
@ -126,7 +126,7 @@ function filter_tags_way (keyvalues, numberofkeys)
break
end
end
-- Treat objects tagged as area=yes, area=1, or area=true as polygon,
-- and treat objects tagged as area=no, area=0, or area=false not as polygon
if ((keyvalues["area"] == "yes") or (keyvalues["area"] == "1") or (keyvalues["area"] == "true")) then
@ -155,7 +155,7 @@ function filter_tags_relation_member (keyvalues, keyvaluemembers, roles, memberc
-- Remove type key
keyvalues["type"] = nil
-- Relations with type=boundary are treated as linestring
if (type == "boundary") then
linestring = 1

View File

@ -651,7 +651,7 @@ unsigned int tagtransform::c_filter_basic_tags(OsmType type, const taglist_t &ta
break;
}
}
}
}
}
}

View File

@ -10,16 +10,16 @@ hstore-match-only commandline option we end up with a database containing
6 points, 7 polygons and 12 lines:
gis=> select count(*) from planet_osm_point;
count
count
6
(1 row)
gis=> select count(*) from planet_osm_polygon;
count
count
7
(1 row)
gis=> select count(*) from planet_osm_line;
count
count
12
(1 row)
-->

View File

@ -252,11 +252,11 @@ class SlimRenderingTestSuite(unittest.TestSuite):
self.addTest(BasicSlimTestCase("Hstore name column", ["-z", "name:"], [0,1,2,3],[6,7,8,9]))
self.addTest(BasicSlimTestCase("Hstore", ["-k"], [51,52,53,54],[55,56,57,58]))
self.addTest(BasicSlimTestCase("Hstore all", ["-j"], [51,52,53,54,93,94,95,96],[55,56,57,58, 97, 98, 99, 100]))
self.addTest(BasicSlimTestCase("Hstore index", ["--hstore", "--hstore-add-index"], [51,52,53,54],[55,56,57,58]))
self.addTest(BasicSlimTestCase("Hstore index", ["--hstore", "--hstore-add-index"], [51,52,53,54],[55,56,57,58]))
#tests dont check for osm_timestamp which is currently missing in the pbf parser
self.addTest(BasicSlimTestCase("Extra tags hstore match only", ["-x", "-k", "--hstore-match-only"], [0,1,2,3],[6,7,8,9]))
self.addTest(BasicSlimTestCase("Extra tags hstore all", ["-j", "-x"], [51,52,53,54,59,60,61],[55,56,57,58]))
self.addTest(BasicSlimTestCase("--tablespace-main-data", ["--tablespace-main-data", "tablespacetest"], [0,1,2,3,13,91,92],[6,7,8,9]))
self.addTest(BasicSlimTestCase("--tablespace-main-index", ["--tablespace-main-index", "tablespacetest"], [0,1,2,3,13,91,92],[6,7,8,9]))
self.addTest(BasicSlimTestCase("--tablespace-slim-data", ["--tablespace-slim-data", "tablespacetest"], [0,1,2,3,13,91,92],[6,7,8,9]))
@ -370,14 +370,14 @@ class BaseTestCase(unittest.TestCase):
#****************************************************************
class BaseNonSlimTestCase(BaseTestCase):
def setUpGeneric(self, parameters, file):
proc = subprocess.Popen([exe_path, "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [full_import_file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(outp, outerr) = proc.communicate()
self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql with options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
class BaseSlimTestCase(BaseTestCase):
class BaseSlimTestCase(BaseTestCase):
def setUpGeneric(self, parameters, file):
proc = subprocess.Popen([exe_path, "--slim", "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(outp, outerr) = proc.communicate()
@ -387,9 +387,9 @@ class BaseSlimTestCase(BaseTestCase):
proc = subprocess.Popen([exe_path, "--slim", "--append", "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(outp, outerr) = proc.communicate()
self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql --slim --append with options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
class BaseGazetteerTestCase(BaseTestCase):
class BaseGazetteerTestCase(BaseTestCase):
def setUpGeneric(self, parameters, file):
proc = subprocess.Popen([exe_path, "--slim", "-Ogazetteer", "-Sdefault.style", "-dosm2pgsql-test"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(outp, outerr) = proc.communicate()
@ -399,7 +399,7 @@ class BaseGazetteerTestCase(BaseTestCase):
proc = subprocess.Popen([exe_path, "--slim", "-Ogazetteer", "--append", "-Sdefault.style", "-dosm2pgsql-test"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(outp, outerr) = proc.communicate()
self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql --slim --append gazetteer options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
#****************************************************************
class BasicNonSlimTestCase(BaseNonSlimTestCase):

View File

@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
db->check_count(5, "select count(column_name) from information_schema.columns where table_name='osm2pgsql_test_polygon'");
db->check_count(5, "select count(column_name) from information_schema.columns where table_name='osm2pgsql_test_line'");
db->check_count(5, "select count(column_name) from information_schema.columns where table_name='osm2pgsql_test_roads'");
// the testfile contains 19 tagged ways and 7 tagged nodes
// out of them 18 ways and 6 nodes are interesting as specified by hstore-match-only.style
// as there is also one relation we should end up getting a database which contains:
@ -79,12 +79,12 @@ int main(int argc, char *argv[]) {
// 7 objects in osm2pgsql_test_polygon
// 12 objects in osm2pgsql_test_line
// 3 objects in osm2pgsql_test_roads
db->check_count(6, "select count(*) from osm2pgsql_test_point");
db->check_count(7, "select count(*) from osm2pgsql_test_polygon");
db->check_count(12, "select count(*) from osm2pgsql_test_line");
db->check_count(3, "select count(*) from osm2pgsql_test_roads");
return 0;
} catch (const std::exception &e) {