Skip to content

Commit 6fb0e8a

Browse files
authored
Merge pull request #1346 from joto/docs
Various cleanups in man page and README
2 parents 80301bd + 430fb14 commit 6fb0e8a

File tree

3 files changed

+49
-92
lines changed

3 files changed

+49
-92
lines changed

README.md

Lines changed: 40 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
# osm2pgsql #
1+
# osm2pgsql
22

33
https://osm2pgsql.org
44

55
osm2pgsql is a tool for loading OpenStreetMap data into a PostgreSQL / PostGIS
66
database suitable for applications like rendering into a map, geocoding with
77
Nominatim, or general analysis.
88

9+
See the [documentation](https://osm2pgsql.org/doc/) for instructions on how
10+
to install and run osm2pgsql.
11+
912
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/7abwls7hfmb83axj/branch/master?svg=true)](https://ci.appveyor.com/project/openstreetmap/osm2pgsql/branch/master)
1013
[![Github Actions Build Status](https://github.com/openstreetmap/osm2pgsql/workflows/CI/badge.svg?branch=master)](https://github.com/openstreetmap/osm2pgsql/actions)
1114
[![Packaging Status](https://repology.org/badge/tiny-repos/osm2pgsql.svg)](https://repology.org/project/osm2pgsql/versions)
1215

13-
## Features ##
16+
## Features
1417

1518
* Converts OSM files to a PostgreSQL DB
1619
* Conversion of tags to columns is configurable in the style file
@@ -22,24 +25,24 @@ Nominatim, or general analysis.
2225
* Support for hstore field type to store the complete set of tags in one database
2326
field if desired
2427

25-
## Installing ##
28+
## Installing
2629

2730
Most Linux distributions include osm2pgsql. It is also available on macOS with [Homebrew](https://brew.sh/).
2831

2932
Unoffical builds for Windows are available from [AppVeyor](https://ci.appveyor.com/project/openstreetmap/osm2pgsql/history) but you need to find the right build artifacts.
3033
Builds for releases may also be downloaded from the [OpenStreetMap Dev server](https://lonvia.dev.openstreetmap.org/osm2pgsql-winbuild/releases/).
3134

32-
## Building ##
35+
## Building
3336

3437
The latest source code is available in the osm2pgsql git repository on GitHub
3538
and can be downloaded as follows:
3639

3740
```sh
38-
$ git clone git://github.com/openstreetmap/osm2pgsql.git
41+
git clone git://github.com/openstreetmap/osm2pgsql.git
3942
```
4043

4144
Osm2pgsql uses the cross-platform [CMake build system](https://cmake.org/)
42-
to configure and build itself and requires
45+
to configure and build itself.
4346

4447
Required libraries are
4548

@@ -97,7 +100,8 @@ pkg install devel/cmake devel/boost-libs textproc/expat2 \
97100
databases/postgresql94-client graphics/proj lang/lua52
98101
```
99102

100-
Once dependencies are installed, use CMake to build the Makefiles in a separate folder
103+
Once dependencies are installed, use CMake to build the Makefiles in a separate
104+
folder:
101105

102106
```sh
103107
mkdir build && cd build
@@ -114,76 +118,27 @@ When the Makefiles have been successfully built, compile with
114118
make
115119
```
116120

117-
The compiled files can be installed with
118-
119-
```sh
120-
sudo make install
121-
```
122-
123-
By default, the Release build with debug info is created and no tests are compiled.
124-
You can change that behavior by using additional options like following:
125-
126-
```sh
127-
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON
128-
```
129-
130-
## Usage ##
131-
132-
This is only a short introduction. There is extensive documentation available
133-
on [osm2pgsq.org](https://osm2pgsql.org/doc/).
134-
135-
Osm2pgsql has one program, the executable itself, which has a lot of command
136-
line options.
137-
138-
Before loading into a database, the database must be created and the PostGIS
139-
and optional hstore extensions must be loaded. A full guide to PostgreSQL
140-
setup is beyond the scope of this readme, but with reasonably recent versions
141-
of PostgreSQL and PostGIS this can be done with
121+
The man page can be rebuilt with:
142122

143123
```sh
144-
createdb gis
145-
psql -d gis -c 'CREATE EXTENSION postgis; CREATE EXTENSION hstore;'
124+
make man
146125
```
147126

148-
A basic invocation to load the data into the database `gis` for rendering would be
127+
The compiled files can be installed with
149128

150129
```sh
151-
osm2pgsql --create --database gis data.osm.pbf
130+
sudo make install
152131
```
153132

154-
This will load the data from `data.osm.pbf` into the `planet_osm_point`,
155-
`planet_osm_line`, `planet_osm_roads`, and `planet_osm_polygon` tables.
156-
157-
When importing a large amount of data such as the complete planet, a typical
158-
command line would be
133+
By default, the Release build with debug info is created and no tests are
134+
compiled. You can change that behavior by using additional options like
135+
following:
159136

160137
```sh
161-
osm2pgsql -c -d gis --slim -C <cache size> \
162-
--flat-nodes <flat nodes> planet-latest.osm.pbf
138+
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON
163139
```
164-
where
165-
* `<cache size>` is about 75% of memory in MiB, to a maximum of about 30000. Additional RAM will not be used.
166-
* `<flat nodes>` is a location where a 50GiB+ file can be saved.
167-
168-
Many different data files (e.g., .pbf) can be found at [planet.osm.org](https://planet.osm.org/).
169-
170-
The databases from either of these commands can be used immediately by
171-
[Mapnik](https://mapnik.org/) for rendering maps with standard tools like
172-
[renderd/mod_tile](https://github.com/openstreetmap/mod_tile),
173-
[TileMill](https://tilemill-project.github.io/tilemill/), [Nik4](https://github.com/Zverik/Nik4),
174-
among others.
175-
176-
## Alternate outputs (backends) ##
177140

178-
In addition to the standard pgsql output designed for rendering there is also
179-
the gazetteer output for geocoding, principally with
180-
[Nominatim](https://www.nominatim.org/), and the null output for testing.
181-
182-
Also available is the new flex output. It is much more flexible than the other
183-
outputs. IT IS CURRENTLY EXPERIMENTAL AND SUBJECT TO CHANGE. The flex output is
184-
only available if you have compiled osm2pgsql with Lua support.
185-
186-
## Projection Support ##
141+
### Using the PROJ library
187142

188143
Osm2pgsql has builtin support for the Latlong (WGS84, EPSG:4326) and the
189144
WebMercator (EPSG:3857) projection. If you need other projections you have to
@@ -194,22 +149,24 @@ above) are supported. Usually the CMake configuration will find a suitable
194149
version and use it automatically, but you can set the `USE_PROJ_LIB` CMake
195150
cache variable to choose between the following behaviours:
196151

197-
* `4`: Look for PROJ library with API version 4. If it is not found, stop with error.
198-
* `6`: Look for PROJ library with API version 6. If it is not found, stop with error.
152+
* `4`: Look for PROJ library with API version 4. If it is not found, stop with
153+
error.
154+
* `6`: Look for PROJ library with API version 6. If it is not found, stop with
155+
error.
199156
* `off`: Build without PROJ library.
200157
* `auto`: Choose API 4 if available, otherwise API 6. If both are not available
201158
build without PROJ library. (This is the default.)
202159

203-
## LuaJIT support ##
160+
## Using LuaJIT
204161

205-
To speed up Lua tag transformations, [LuaJIT](https://luajit.org/) can be optionally
206-
enabled on supported platforms. Performance measurements have shown about 25%
207-
runtime reduction for a planet import, with about 40% reduction on parsing time.
162+
To speed up Lua tag transformations, [LuaJIT](https://luajit.org/) can be
163+
optionally enabled on supported platforms. This can speed up processing
164+
considerably.
208165

209-
On a Debian or Ubuntu system, this can be done with:
166+
On a Debian or Ubuntu system install the LuaJIT library:
210167

211168
```sh
212-
sudo apt install libluajit-5.1-dev
169+
sudo apt-get install libluajit-5.1-dev
213170
```
214171

215172
Configuration parameter `WITH_LUAJIT=ON` needs to be added to enable LuaJIT.
@@ -219,23 +176,20 @@ Otherwise make and installation steps are identical to the description above.
219176
cmake -D WITH_LUAJIT=ON ..
220177
```
221178

222-
Use `osm2pgsql --version` to verify that the build includes LuaJIT support:
179+
Use `osm2pgsql --version` to verify that the build includes LuaJIT support.
180+
The output should show something like
223181

224-
```sh
225-
./osm2pgsql --version
226-
osm2pgsql version 1.2.0
227-
228-
Compiled using the following library versions:
229-
Libosmium 2.15.6
182+
```
230183
Lua 5.1.4 (LuaJIT 2.1.0-beta3)
231184
```
232185

233-
## Contributing ##
186+
## Help/Support
187+
188+
If you have problems with osm2pgsql or want to report a bug, go to
189+
https://osm2pgsql.org/support/ .
234190

235-
We welcome contributions to osm2pgsql. If you would like to report an issue,
236-
please use the [issue tracker on GitHub](https://github.com/openstreetmap/osm2pgsql/issues).
191+
## Contributing
237192

238-
More information can be found in [CONTRIBUTING.md](CONTRIBUTING.md).
193+
We welcome contributions to osm2pgsql. See [CONTRIBUTING.md](CONTRIBUTING.md)
194+
and https://osm2pgsql.org/contribute/ for information on how to contribute.
239195

240-
General queries can be sent to the tile-serving@ or dev@
241-
[mailing lists](https://wiki.openstreetmap.org/wiki/Mailing_lists).

docs/osm2pgsql.1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
osm2pgsql \- Openstreetmap data to PostgreSQL converter
55
.SH SYNOPSIS
66
.PP
7-
\f[B]osm2pgsql\f[] [\f[I]OPTIONS\f[]] OSM\-FILE
7+
\f[B]osm2pgsql\f[] [\f[I]OPTIONS\f[]] OSM\-FILE\&...
88
.SH DESCRIPTION
99
.PP
1010
\f[B]osm2pgsql\f[] imports OpenStreetMap data into a PostgreSQL/PostGIS
@@ -14,6 +14,7 @@ geocoder and other applications processing OSM data.
1414
.PP
1515
\f[B]osm2pgsql\f[] can run in either \[lq]create\[rq] mode (the default)
1616
or in \[lq]append\[rq] mode (option \f[B]\-a, \-\-append\f[]).
17+
.PP
1718
In \[lq]create\[rq] mode osm2pgsql will create the database tables
1819
required by the configuration and import the OSM file(s) specified on
1920
the command line into those tables.

docs/osm2pgsql.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ osm2pgsql - Openstreetmap data to PostgreSQL converter
44

55
# SYNOPSIS
66

7-
**osm2pgsql** \[*OPTIONS*\] OSM-FILE
7+
**osm2pgsql** \[*OPTIONS*\] OSM-FILE...
88

99
# DESCRIPTION
1010

@@ -13,10 +13,12 @@ is an essential part of many rendering toolchains, the Nominatim geocoder and
1313
other applications processing OSM data.
1414

1515
**osm2pgsql** can run in either "create" mode (the default) or in "append" mode
16-
(option **-a, \--append**). In "create" mode osm2pgsql will create the database
17-
tables required by the configuration and import the OSM file(s) specified on
18-
the command line into those tables. Note that you also have to use the
19-
**-s, \--slim** option if you want your database to be updateable.
16+
(option **-a, \--append**).
17+
18+
In "create" mode osm2pgsql will create the database tables required by the
19+
configuration and import the OSM file(s) specified on the command line into
20+
those tables. Note that you also have to use the **-s, \--slim** option if you
21+
want your database to be updateable.
2022

2123
In "append" mode osm2pgsql will update the database tables with the data from
2224
OSM change files specified on the command line.

0 commit comments

Comments
 (0)