Import osm2pgsql 0.88.1.

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

From Patrick Keshishian with tweaks by sthen@ & myself
ok sthen@
This commit is contained in:
landry 2015-10-30 17:18:53 +00:00
parent e4c7f6ca3c
commit 4d029997a7
10 changed files with 213 additions and 0 deletions

68
geo/osm2pgsql/Makefile Normal file
View File

@ -0,0 +1,68 @@
# $OpenBSD: Makefile,v 1.1.1.1 2015/10/30 17:18:53 landry Exp $
COMMENT = OSM data to PostgreSQL converter
GH_TAGNAME = 0.88.1
GH_PROJECT = osm2pgsql
GH_ACCOUNT = openstreetmap
DISTNAME = osm2pgsql-${GH_TAGNAME}
CATEGORIES = geo databases
HOMEPAGE = http://wiki.openstreetmap.org/wiki/Osm2pgsql
# GPLv2
PERMIT_PACKAGE_CDROM = Yes
CONFIGURE_STYLE = autoconf
AUTOMAKE_VERSION = 1.14
AUTOCONF_VERSION = 2.69
USE_GMAKE = Yes
WANTLIB += boost_filesystem boost_system boost_system-mt
WANTLIB += boost_thread-mt bz2 c crypto geos lzma
WANTLIB += m pq proj protobuf-c pthread ssl stdc++ xml2 z ${MODLUA_WANTLIB}
MODULES = converters/libiconv \
databases/postgresql \
gcc4 \
lang/python \
lang/lua
LIB_DEPENDS = databases/postgresql \
devel/proj \
devel/protobuf-c \
geo/geos \
textproc/libxml \
devel/boost \
BUILD_DEPENDS = ${MODGNU_AUTOCONF_DEPENDS} \
${MODGNU_AUTOMAKE_DEPENDS} \
devel/libtool \
TEST_DEPENDS = databases/py-psycopg2 \
geo/postgis
MODGCC4_ARCHS = *
MODGCC4_LANGS += c++
MODPY_ADJ_FILES = tests/regression-test.py
MODLUA_VERSION = 5.1
MODLUA_SA = Yes
CONFIGURE_ENV += CXXFLAGS="${CXXFLAGS} -D_GLIBCXX_USE_DEPRECATED"
CONFIGURE_ENV += LUA=${MODLUA_BIN}
CONFIGURE_ENV += LUA_INCLUDE=-I${MODLUA_INCL_DIR}
CONFIGURE_ENV += LUA_LIB=${MODLUA_LIB}
CONFIGURE_ENV += LDFLAGS=-L${LOCALBASE}/lib
CONFIGURE_ENV += AUTOCONF_VERSION=${AUTOCONF_VERSION}
CONFIGURE_ENV += AUTOMAKE_VERSION=${AUTOMAKE_VERSION}
post-patch:
cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} \
autoreconf -vfi
@${SUBST_CMD} ${WRKSRC}/docs/osm2pgsql.1
.include <bsd.port.mk>

2
geo/osm2pgsql/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (osm2pgsql-0.88.1.tar.gz) = COwzyDN2jeyYVvU3u/RBatRYN+4IUe7qsAgce77TRJ4=
SIZE (osm2pgsql-0.88.1.tar.gz) = 2140606

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-configure_ac,v 1.1.1.1 2015/10/30 17:18:53 landry Exp $
Check for POSIX_TERMIOS and define HAVE_TERMIOS_H for sprompt.cpp
to not echo passwords.
--- configure.ac.orig Fri Aug 14 22:28:11 2015
+++ configure.ac Thu Sep 10 22:33:32 2015
@@ -26,6 +26,12 @@ AC_GNU_SOURCE
AC_HEADER_SYS_WAIT
AC_FUNC_MMAP
+AC_SYS_POSIX_TERMIOS
+if test "$ac_cv_sys_posix_termios" = "yes"
+then
+ AC_DEFINE([HAVE_TERMIOS_H], [1], [termios.h])
+fi
+
dnl Find C compiler
dnl AC_PROG_CC_C99

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-docs_osm2pgsql_1,v 1.1.1.1 2015/10/30 17:18:53 landry Exp $
--- docs/osm2pgsql.1.orig Sat Aug 15 07:28:11 2015
+++ docs/osm2pgsql.1 Fri Oct 30 17:45:53 2015
@@ -111,14 +111,14 @@ to be able to update your database, as these tables ar
.TP
\fB\-S\fR|\-\-style /path/to/style
Location of the osm2pgsql style file. This specifies which tags from the data get
-imported into database columns and which tags get dropped. Defaults to /usr/share/osm2pgsql/default.style.
+imported into database columns and which tags get dropped. Defaults to ${TRUEPREFIX}/share/osm2pgsql/default.style.
.TP
\fB\-C\fR|\-\-cache num
Only for slim mode: Use up to num many MB of RAM for caching nodes. Giving osm2pgsql sufficient cache
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 100.
.TP
\fB\ \fR\-\-cache\-strategy strategy
There are a number of different modes in which osm2pgsql can organize its

View File

@ -0,0 +1,35 @@
$OpenBSD: patch-node-ram-cache_cpp,v 1.1.1.1 2015/10/30 17:18:53 landry Exp $
https://github.com/openstreetmap/osm2pgsql/commit/6813ddaf61b6e62f641fc064b528945a46fd41b9
--- node-ram-cache.cpp.orig Fri Oct 30 17:47:09 2015
+++ node-ram-cache.cpp Fri Oct 30 17:48:13 2015
@@ -362,15 +362,11 @@ node_ram_cache::node_ram_cache( int strategy, int cach
}
}
-#ifdef __MINGW_H
- fprintf( stderr, "Node-cache: cache=%ldMB, maxblocks=%d*%d, allocation method=%i\n", (cacheSize >> 20), maxBlocks, PER_BLOCK*sizeof(ramNode), allocStrategy );
-#else
- fprintf( stderr, "Node-cache: cache=%ldMB, maxblocks=%d*%zd, allocation method=%i\n", (cacheSize >> 20), maxBlocks, PER_BLOCK*sizeof(ramNode), allocStrategy );
-#endif
+ fprintf( stderr, "Node-cache: cache=%" PRId64 "MB, maxblocks=%d*%" PRId64 ", allocation method=%i\n", (cacheSize >> 20), maxBlocks, (int64_t) PER_BLOCK*sizeof(ramNode), allocStrategy );
}
node_ram_cache::~node_ram_cache() {
- fprintf( stderr, "node cache: stored: %" PRIdOSMID "(%.2f%%), storage efficiency: %.2f%% (dense blocks: %i, sparse nodes: %li), hit rate: %.2f%%\n",
+ fprintf( stderr, "node cache: stored: %" PRIdOSMID "(%.2f%%), storage efficiency: %.2f%% (dense blocks: %i, sparse nodes: %" PRId64 "), hit rate: %.2f%%\n",
storedNodes, 100.0f*storedNodes/totalNodes, 100.0f*storedNodes*sizeof(ramNode)/cacheUsed,
usedBlocks, sizeSparseTuples,
100.0f*nodesCacheHits/nodesCacheLookups );
@@ -395,8 +391,8 @@ node_ram_cache::~node_ram_cache() {
int node_ram_cache::set(osmid_t id, double lat, double lon, const taglist_t &) {
if ((id > 0 && id >> BLOCK_SHIFT >> 32) || (id < 0 && ~id >> BLOCK_SHIFT >> 32 )) {
- fprintf(stderr, "\nAbsolute node IDs must not be larger than %lld (got %lld)\n",
- 1ULL << 42, (long long) id);
+ fprintf(stderr, "\nAbsolute node IDs must not be larger than %" PRId64 " (got%" PRId64 " )\n",
+ (int64_t) 1 << 42, (int64_t) id);
util::exit_nicely();
}
totalNodes++;

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-options_cpp,v 1.1.1.1 2015/10/30 17:18:53 landry Exp $
Set the default cache size to 100M
--- options.cpp.orig Fri Oct 30 10:02:24 2015
+++ options.cpp Fri Oct 30 10:03:29 2015
@@ -98,7 +98,7 @@ namespace
printf("\
%s/default.style.\n", OSM2PGSQL_DATADIR);
printf("%s", "\
- -C|--cache Use up to this many MB for caching nodes (default: 800)\n\
+ -C|--cache Use up to this many MB for caching nodes (default: 100)\n\
\n\
Database options:\n\
-d|--database The name of the PostgreSQL database to connect\n\
@@ -261,7 +261,7 @@ std::string build_conninfo(const std::string &db,
options_t::options_t():
conninfo(""), prefix("planet_osm"), scale(DEFAULT_SCALE), projection(new reprojection(PROJ_SPHERE_MERC)), append(0), slim(0),
- cache(800), tblsmain_index(boost::none), tblsslim_index(boost::none), tblsmain_data(boost::none), tblsslim_data(boost::none), style(OSM2PGSQL_DATADIR "/default.style"),
+ cache(100), tblsmain_index(boost::none), tblsslim_index(boost::none), tblsmain_data(boost::none), tblsslim_data(boost::none), style(OSM2PGSQL_DATADIR "/default.style"),
expire_tiles_zoom(-1), expire_tiles_zoom_min(-1), expire_tiles_filename("dirty_tiles"), hstore_mode(HSTORE_NONE), enable_hstore_index(0),
enable_multi(false), hstore_columns(), keep_coastlines(0), parallel_indexing(1),
#ifdef __amd64__

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-sprompt_cpp,v 1.1.1.1 2015/10/30 17:18:53 landry Exp $
Include config.h which should define HAVE_TERMIOS_H.
https://github.com/openstreetmap/osm2pgsql/pull/488
--- sprompt.cpp.orig Fri Aug 14 22:28:11 2015
+++ sprompt.cpp Thu Sep 10 21:39:32 2015
@@ -62,6 +62,8 @@
#include <libpq-fe.h>
+#include "config.h"
+
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-tests_common-pg_cpp,v 1.1.1.1 2015/10/30 17:18:53 landry Exp $
Fix compiler error:
conversion from 'long int' to non-scalar type 'pg::result_ptr
{aka boost::shared_ptr<pg::result>}' requested
--- tests/common-pg.cpp.orig Fri Aug 14 22:28:11 2015
+++ tests/common-pg.cpp Fri Sep 18 23:10:29 2015
@@ -75,7 +75,7 @@ result::~result() {
tempdb::tempdb()
: m_conn(conn::connect("dbname=postgres")) {
- result_ptr res = NULL;
+ result_ptr res;
m_db_name = (boost::format("osm2pgsql-test-%1%-%2%") % getpid() % time(NULL)).str();
m_conn->exec(boost::format("DROP DATABASE IF EXISTS \"%1%\"") % m_db_name);
//tests can be run concurrently which means that this query can collide with other similar ones

3
geo/osm2pgsql/pkg/DESCR Normal file
View File

@ -0,0 +1,3 @@
osm2pgsql is a tool for loading OpenStreetMap data into a PostgreSQL/PostGIS
database suitable for applications like rendering into a map, geocoding with
Nominatim, or general analysis.

8
geo/osm2pgsql/pkg/PLIST Normal file
View File

@ -0,0 +1,8 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2015/10/30 17:18:53 landry Exp $
@bin bin/nodecachefilereader
@bin bin/osm2pgsql
@man man/man1/nodecachefilereader.1
@man man/man1/osm2pgsql.1
share/osm2pgsql/
share/osm2pgsql/900913.sql
share/osm2pgsql/default.style