-
Notifications
You must be signed in to change notification settings - Fork 41
/
README
295 lines (218 loc) · 9.37 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
glosm 0.0.3
=============
glosm is a framework for developing high-performance geospatial data
visualization applications of both interactive and batch nature
featuring OpenGL-based 3D first-person and tile renderers.
Features
========
* Basic OSM XML loader
* Basic geometry generator (renders buildings, barriers and roads
in 3D, other polygons as lines at ground level)
* Mercator and spherical projections
* Support for tracks in GPX format
* SRTM elevation data support
* First-person real-time 3D map viewer
* Command-line ortho tile renderer
* Extensible framework for building (other) 3D geodata
visualization applications
Requirements
============
Libraries:
* expat2
* OpenGL
* GLEW (only required on windows)
* SDL or GLUT (only required for viewer)
* SDL_gles (only required for viewer on OpenGL ES platforms)
* libpng (only required for tiler)
* X11 (only required for tiler)
Applications:
* CMake >= 2.6
since CMake builtin GLUT detection routine requires it for some
reason, you will also need libXmu and libXi installed.
Summarizing, for Debian-based systems, you'll need to run:
apt-get install cmake libexpat1-dev libglut3-dev libsdl1.2-dev \
libpng12-dev libxmu-dev libxi-dev
Installation
============
Compilation: cmake . && make
Installation: make install
Note that you don't need to install it to run programs, and in case
you really want to install it, you may need to tweak installation
prefix (either by providing -DCMAKE_INSTALL_PREFIX=... to cmake or
with ccmake as below). Also note that cmake doesn't provide
uninstall target.
You can use curses frontend for cmake (ccmake) to select optional
components interactively or specify -DBUILD_TILER=[YES|NO] and
-DBUILD_VIEWER=[YES|NO] in cmake arguments to enable/disable
building of specific applications. By default, viewer is always
built and tiler is only build on UNIX platforms.
If you plan to hack on glosm source, it's better idea to use
so-called out-of-source build to not pollute source tree with build
files. Here's how it's done:
mkdir build && cd build && cmake .. && make
On FreeBSD, glosm is also available from ports collection
(graphics/glosm, [1]).
Native build on Windows has not been tested yet, but
cross-compilation works (see [2]) and native compilation should work
similarily.
[1] http://www.freshports.org/graphics/glosm
[2] https://github.com/AMDmi3/glosm/wiki/CrossCompilation
Usage
=====
This package contains two applications: interactive map viewer
(glosm-viewer) and .png tile generator (glosm-tiler).
glosm-viewer
------------
glosm-viewer [-sfh] [-t <path>] [-l location] <file.osm|->
[<file.gpx> ...]
runs interactive 3D map viewer for a specified map dump. Dumps can
be obtained from OpenStreetMap editing applications (jOSM,
Mercator), via OpenStreetMap API, from third parties and in many
other ways. Sample (fake) .osm file is provided in this package
under testdata/ subdirectory.
If `-' is provided as filename, osm data is read from stdin.
Please be careful with large dumps, as the application requires
amount of RAM comparable to the .osm file size. It also takes some
time (under a minute, however) to load a large dump.
Options:
-s - enable spherical Earth view (instead of mercator)
-f - disable GLEW OpenGL version check (for testing purposes)
-h - show help
-t - specify path to directory with SRTM (*.hgt) files and
enable 3D terrain layer
-l - specify initial position and direction of viewer.
Argument is comma-separated list of floating-point values:
longitude, latitude, elevation, yaw and pitch. Each value
may be empty and extra values in the end may be omitted, in
which case program defaults are used. Values are specified
in decimal angles and meters.
example: -l 57.33,34.11,100
(55.33E, 34.11N, height = 100 meters)
example: -l ,,100,180,0
(default location, height = 100 meters,
look straight to south)
Controls:
W or Up - move forward
S or Down - move backward
A or Left - move left
D or Right - move right
C - move down
Space - move up
L - toggle height lock (useful for fly-by's)
H - same as L, but locks you at human height
+ - increase movement speed by 5x
- - decrease movement speed by 5x
Shift - increase movement speed by 5x when pressed (SDL only)
Ctrl - decrease movement speed by 5x when pressed (SDL only)
1 - toggle lowres (ground) layer
2 - toggle hires (buildings) layer
3 - toggle GPX layer
4 - toggle terrain layer
Q or Escape - close application
Right mouse button toggles mouse grab. When grab is off, view
may be dragged with left mouse button.
glosm-tiler
-----------
glosm-tiler [options] <file.osm|-> <outdir>
runs tile renderer for a specified dump, which are saved into outdir
in the same format as mapnik tiles (<outdir>/<zoom>/<x>/<y>.png).
If `-' is provided as filename, osm data is read from stdin.
Options:
-0..-9 - set png compression level (default 6)
-x minlon
-X maxlon
-y minlat
-Y maxlat - set bounding box for rendering. Units are floating
point degrees (e.g. 55.12345)
-z minzoom
-Z maxzoom - set zoom levels for rendering. Default 0 - 18
-s skew - set skew for pseudo-3D effect (default = 1.0, 0 =
no skew = map without 3D effect)
-m samples - specify number of samples for multisample antialiasing
(default = 4, use 1 if your drivers doesn't support
multisampling)
Note on optimizing tiles
------------------------
For optimal rendering speed and minimal space taken by tiles, it's
usually better to render tiles with -1 (minimal compression level),
and compress them by optipng afterwards:
find <outdir> -name "*.png" -print0 |
xargs -0 -n 64 -P <jobs> optipng -quiet -o1
where outdir is directory containing tiles and jobs is desired
number of jobs (probably # of cpus + 1).
OpenGL details
==============
Application requires OpenGL version >= 1.5. Currently, only notable
required feature is buffer objects support (glGenBuffers et al.)
When GLEW is used, two checks for required OpenGL functionality
are done: GLEW check for GL_VERSION_1_5 and check for required
functions != NULL. The first is disabled with -f option to viewer,
if this options makes viewer work for you, please report.
Additionally, glosm-tiler requires pbuffer support and that is
currently only available through GLX, thus X11 installation is
required to use glosm-tiler.
Multisampling support is also highly recommended.
OpenStreetMap tag support
=========================
There are some notable tags this software supports:
* height
* min_height
* building:levels
* building:min_level
* building:ground_level
* building:skipped_levels (see [3])
to determine height of 3D objects (buildings, barriers). See [2].
Height of one level is taken as 3 meters, for some 1-level buildings
1 meter is added for basement.
[2] http://wiki.openstreetmap.org/wiki/User%3AJongleur/MultiLevel_Building_Shapes
[3] http://wiki.openstreetmap.org/wiki/User_talk:Jongleur/MultiLevel_Building_Shapes
* building:roof:shape
* building:roof:orientation
* building:roof:angle
for specific roof shapes support. See [4]. Supported roof shapes
are: flat, pitched, hipped, pyramidal, conical (currently same as
pyramidal), crosspitched.
[4] http://wiki.openstreetmap.org/wiki/Proposed_features/Building_attributes
* width
* lanes
for highway widths.
API stability
=============
As the project is on early stages of development, neither API not
ABI compatibility is guaranteed, so for now use library on your own
risk. Because of that, neither versioned library (.so.N) nor includes
are currently installed.
Primary candidates for API change are:
* OsmDatasource interface
* GeometryGenerator (due to above)
* Geometry (material support, serialization)
Tests
=====
There are some tests under tests/ subdirectory, you can run them by
running `ctest' from your buildtree.
Documentation
=============
Doxygen is supported, just run `doxygen' from this directory to
generate class descriptions under doc/html/. There's also some more
documentation under doc/.
There are some simple examples of working with glosm under examples/
subdirectory.
License
=======
This software is distributed under the GNU Affero General Public
License version 3. Please read the COPYING file for more information.
Credits
=======
Author:
Dmitry Marakasov <[email protected]>
Contacts
========
Apart from emails above,
* Source code repository:
https://github.com/AMDmi3/glosm
* Wiki:
https://github.com/AMDmi3/glosm/wiki
* Demo of tiler-generated raster map:
http://glosm.amdmi3.ru
* Page on OSM wiki with some screenshots:
http://wiki.openstreetmap.org/wiki/Glosm