Исходную базу данных локации в приложении будет использоваться OpenStreetMap(OSM). Следовательно, необходимо написать инстурмент, который будет сихронизировать локации из OSM в нашу базу данных Neo4j.
Инструкция по подготовке инструментов:
Необходимо установить osmosis для импорта локаций в postgres
Установить postgres вместе с postgis Для локальная работы можно использоваться docker:
osmosis --read-pbf-fast "E:\\Work\\projects\\TransportLogistics\\osm\\moldova-latest.osm.pbf" --log-progress --write-pgsql host="localhost:5436" database="osm_snapshot_3" user="postgres" password="postgres"
Установить расширения:
CREATE EXTENSION postgis;
CREATE EXTENSION hstore;
Выполнить скрипты из osmosis:
Скачать pbf файл из OSM
Запуск
osmosis --read-pbf-fast "E:\\Work\\projects\\TransportLogistics\\osm\\moldova-latest.osm.pbf" --log-progress --tf accept-relations boundary=administrative --un --uw --write-pgsql host="localhost:5436" database="osm_snapshot_4" user="postgres" password="postgres" nodeLocationStoreType="InMemory"
osmosis --read-pbf-fast "E:\\Downloads\\monaco-latest.osm.pbf" --log-progress --tf accept-relations boundary=administrative --un --uw --write-pgsql host="localhost:5436" database="osm_snapshot_7" user="postgres" password="postgres" nodeLocationStoreType="InMemory"
osmosis --read-pbf-fast "E:\\Downloads\\planet-230814.osm.pbf" --log-progress --tf accept-relations type=boundary boundary=administrative admin_level=2 --tf reject-nodes --tf reject-ways --write-pgsql host="localhost:5432" database="osm1" user="postgres" password="postgres
osmosis --read-pbf-fast "E:\\Downloads\\planet-230814.osm.pbf" --log-progress --tf accept-relations type=boundary boundary=administrative railway=station industrial=port --tf reject-relations public_transport=station --write-pgsql host="localhost:5432" database="osm2" user="postgres" password="postgres
Примечание:
--write-pgsql, то необходимо удалить строку из таблицыФильтр для стран:
relation["type"="boundary"]["boundary"="administrative"]["admin_level"="2"];
Фильтр для городов: