you should also enable flatnode storage of node locations. With this
setting enabled, node coordinates are stored in a simple file instead
of the database. This will save you import time and disk storage.
-Add to your settings/local.php:
+Add to your `settings/local.php`:
@define('CONST_Osm2pgsql_Flatnode_File', '/path/to/flatnode.file');
./utils/setup.php --osm-file <your data file> --all [--osm2pgsql-cache 28000] 2>&1 | tee setup.log
-The --osm2pgsql-cache parameter is optional but strongly recommended for
+The `--osm2pgsql-cache` parameter is optional but strongly recommended for
planet imports. It sets the node cache size for the osm2pgsql import part
-(see -C parameter in osm2pgsql help). 28GB are recommended for a full planet
+(see `-C` parameter in osm2pgsql help). 28GB are recommended for a full planet
import, for excerpts you can use less. Adapt to your available RAM to
avoid swapping, never give more than 2/3 of RAM to osm2pgsql.
// look for an interpolation that is closer
$aPlaceLine = $this->lookupInterpolation($sPointSQL, $fDistancePlacex);
- if ($aPlaceLine) {
+ if ($aPlaceLine && (float) $aPlaceLine['distance'] < (float) $fDistancePlacex) {
// interpolation is closer to point than placex house
$bPlaceIsLine = true;
$aPlace = $aPlaceLine;
# just use the pgxs makefile
ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/dummy
- COMMAND PGXS=${PGXS} PG_CONFIG=${PG_CONFIG} MODSRCDIR=${CMAKE_CURRENT_SOURCE_DIR} make -f ${CMAKE_CURRENT_SOURCE_DIR}/Makefile
+ COMMAND PGXS=${PGXS} PG_CONFIG=${PG_CONFIG} MODSRCDIR=${CMAKE_CURRENT_SOURCE_DIR} $(MAKE) -f ${CMAKE_CURRENT_SOURCE_DIR}/Makefile
COMMENT "Running external makefile ${PGXS}"
)
add_executable(nominatim export.c geometry.cpp import.c index.c input.c nominatim.c postgresql.c sprompt.c)
-
+include(CheckIncludeFile)
+CHECK_INCLUDE_FILE(byteswap.h HAVE_BYTESWAP_H)
+CHECK_INCLUDE_FILE(sys/endian.h HAVE_SYS_ENDIAN_H)
+if(HAVE_BYTESWAP_H)
+ target_compile_definitions(nominatim PRIVATE HAVE_BYTESWAP_H)
+endif(HAVE_BYTESWAP_H)
+if(HAVE_SYS_ENDIAN_H)
+ target_compile_definitions(nominatim PRIVATE HAVE_SYS_ENDIAN_H)
+endif(HAVE_SYS_ENDIAN_H)
target_link_libraries(nominatim ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${PostgreSQL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
}
paramValues[7] = (const char *)featureExtraTagString;
- if (strlen(feature.parentPlaceID) == 0)
+ if (xmlStrlen(feature.parentPlaceID) == 0)
paramValues[8] = "0";
else
paramValues[8] = (const char *)feature.parentPlaceID;
if (featureNameLines)
{
- if (strlen(feature.parentPlaceID) > 0 && featureAddressLines == 0)
+ if (xmlStrlen(feature.parentPlaceID) > 0 && featureAddressLines == 0)
{
paramValues[0] = (const char *)place_id;
- paramValues[1] = feature.parentPlaceID;
+ paramValues[1] = (const char *)feature.parentPlaceID;
if (verbose) fprintf(stderr, "search_name_from_parent_insert: INSERT %s %s\n", paramValues[0], paramValues[1]);
res = PQexecPrepared(conn, "search_name_from_parent_insert", 2, paramValues, NULL, NULL, 0);
if (PQresultStatus(res) != PGRES_COMMAND_OK)
#define PG_OID_INT8 20
#define PG_OID_INT4 23
+#if defined(HAVE_BYTESWAP_H)
#include <byteswap.h>
+#elif defined(HAVE_SYS_ENDIAN_H)
+#include <sys/endian.h>
+#endif
#if __BYTE_ORDER == __BIG_ENDIAN
#define PGint16(x) (x)
-- Patch in additional country names
IF NEW.admin_level = 2 AND NEW.type = 'administrative' AND NEW.country_code is not null THEN
- select coalesce(country_name.name || NEW.name,NEW.name) from country_name where country_name.country_code = lower(NEW.country_code) INTO NEW.name;
+ SELECT name FROM country_name WHERE country_code = lower(NEW.country_code) INTO existing;
+ IF existing.name IS NOT NULL THEN
+ NEW.name = existing.name || NEW.name;
+ END IF;
END IF;
-- Have we already done this place?
"""
Then place has no entry for R1
- @wip
Scenario: Type tag is renamed to something unknown
When loading osm data
"""
"""
Then place has no entry for R1
+ Scenario: Country boundary names are left untouched when country_code unknown
+ When loading osm data
+ """
+ n200 Tamenity=prison x0 y0
+ n201 x0 y0.0001
+ n202 x0.0001 y0.0001
+ n203 x0.0001 y0
+ """
+ And updating osm data
+ """
+ w1 Nn200,n201,n202,n203,n200
+ r1 Ttype=boundary,boundary=administrative,name=Foo,country_code=XX,admin_level=2 Mw1@
+ """
+ Then place contains
+ | object | country_code | name |
+ | R1 | XX | 'name' : 'Foo' |
+
+ Scenario: Country boundary names are extended when country_code known
+ When loading osm data
+ """
+ n200 Tamenity=prison x0 y0
+ n201 x0 y0.0001
+ n202 x0.0001 y0.0001
+ n203 x0.0001 y0
+ """
+ And updating osm data
+ """
+ w1 Nn200,n201,n202,n203,n200
+ r1 Ttype=boundary,boundary=administrative,name=Foo,country_code=ch,admin_level=2 Mw1@
+ """
+ Then place contains
+ | object | country_code | name+name:de | name+name |
+ | R1 | ch | Schweiz | Foo |
+