Linux【工具 02】OpenStreetMap数据处理工具OSMCTools下载安装使用举例(osmconvert命令说明)

news2024/9/17 7:47:14

OSMCTools安装使用实例

    • 1.Tools
    • 2.官网安装步骤
    • 3.实际安装步骤
      • 3.1 环境
      • 3.2 步骤
    • 4.工具使用实例

OpenStreetMap的下载地址:Geofabrik Download Server。

OSMCTools的GitHub地址:https://github.com/ramunasd/osmctools

Windows操作系统,可以从 http://m.m.i24.cc/osmconvert_latest.zip 下载osmconvert最新版本的zip文件;也可以从官方网站 http://wiki.openstreetmap.org/wiki/osmconvert 下载一个适用于Windows的安装程序进行安装。这两个地址都无法访问,原因不明。本次安装的是 Linux 系统的。

1.Tools

  • osmassignpoly
  • osmchange - updates an .osm file using one or more .osc files
  • osmconvert - reads and converts OSM data to the selected output file format
  • osmfilter - filters OSM data
  • osmgeobase
  • osmposition
  • osmrelpoly
  • osmupdate - cares about updating an .osm, .o5m or .pbf file
  • pbftoosm - converts .pbf file into .osm XML format

2.官网安装步骤

  git clone https://github.com/ramunasd/osmctools.git
  cd osmctools
  autoreconf --install
  ./configure
  make install

3.实际安装步骤

3.1 环境

[root@tcloud ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

3.2 步骤

# 1.安装autoconf
yum install -y autoconf
# 否则会报错
-bash: autoreconf: command not found

# 2.安装 automake libtool
yum install -y automake libtool
# 否则报错
Can't exec "aclocal": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory
  1. 从GIT上下载源码
# 1.从GIT上下载源码
git clone https://github.com/ramunasd/osmctools.git

在这里插入图片描述
2. 生成 configure 脚本等文件

# 2.生成 configure 脚本等文件
[root@tcloud osmctools-master]# autoreconf --install                                  
configure.ac:3: installing './install-sh'
configure.ac:3: installing './missing'
src/Makefile.am: installing './depcomp'

在这里插入图片描述

  1. 构建环境并生成 Makefile 以及设置编译选项的脚本
# 3.构建环境并生成 Makefile 以及设置编译选项的脚本
[root@tcloud osmctools-master]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for gzopen in -lz... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating include/config.h
config.status: executing depfiles commands
# 4.安装
make install
[root@tcloud osmctools-master]# make install
Making install in src
make[1]: Entering directory `/opt/osmctools-master/src'
gcc -DHAVE_CONFIG_H -I. -I../include     -march=native -O3 -MT osmconvert.o -MD -MP -M                                                                                                      F .deps/osmconvert.Tpo -c -o osmconvert.o osmconvert.c
mv -f .deps/osmconvert.Tpo .deps/osmconvert.Po
gcc  -march=native -O3   -o osmconvert osmconvert.o -lz
gcc -DHAVE_CONFIG_H -I. -I../include     -march=native -O3 -MT osmfilter.o -MD -MP -MF                                                                                                       .deps/osmfilter.Tpo -c -o osmfilter.o osmfilter.c
mv -f .deps/osmfilter.Tpo .deps/osmfilter.Po
gcc  -march=native -O3   -o osmfilter osmfilter.o
gcc -DHAVE_CONFIG_H -I. -I../include     -march=native -O3 -MT osmupdate.o -MD -MP -MF .deps/osmupdate.Tpo -c -o osmupdate.o osmupdate.c
mv -f .deps/osmupdate.Tpo .deps/osmupdate.Po
gcc  -march=native -O3   -o osmupdate osmupdate.o
gcc -DHAVE_CONFIG_H -I. -I../include     -march=native -O3 -MT osmchange.o -MD -MP -MF .deps/osmchange.Tpo -c -o osmchange.o osmchange.c
mv -f .deps/osmchange.Tpo .deps/osmchange.Po
gcc  -march=native -O3   -o osmchange osmchange.o
gcc -DHAVE_CONFIG_H -I. -I../include     -march=native -O3 -MT pbftoosm.o -MD -MP -MF .deps/pbftoosm.Tpo -c -o pbftoosm.o pbftoosm.c
mv -f .deps/pbftoosm.Tpo .deps/pbftoosm.Po
gcc  -march=native -O3   -o pbftoosm pbftoosm.o -lz
gcc -DHAVE_CONFIG_H -I. -I../include     -march=native -O3 -MT osmrelpoly.o -MD -MP -MF .deps/osmrelpoly.Tpo -c -o osmrelpoly.o osmrelpoly.c
mv -f .deps/osmrelpoly.Tpo .deps/osmrelpoly.Po
gcc  -march=native -O3   -o osmrelpoly osmrelpoly.o
gcc -DHAVE_CONFIG_H -I. -I../include     -march=native -O3 -MT osmassignpoly.o -MD -MP -MF .deps/osmassignpoly.Tpo -c -o osmassignpoly.o osmassignpoly.c
mv -f .deps/osmassignpoly.Tpo .deps/osmassignpoly.Po
gcc  -march=native -O3   -o osmassignpoly osmassignpoly.o
gcc -DHAVE_CONFIG_H -I. -I../include     -march=native -O3 -MT osmgeobase.o -MD -MP -MF .deps/osmgeobase.Tpo -c -o osmgeobase.o osmgeobase.c
mv -f .deps/osmgeobase.Tpo .deps/osmgeobase.Po
gcc  -march=native -O3   -o osmgeobase osmgeobase.o
gcc -DHAVE_CONFIG_H -I. -I../include     -march=native -O3 -MT osmposition.o -MD -MP -MF .deps/osmposition.Tpo -c -o osmposition.o osmposition.c
mv -f .deps/osmposition.Tpo .deps/osmposition.Po
gcc  -march=native -O3   -o osmposition osmposition.o
make[2]: Entering directory `/opt/osmctools-master/src'
 /usr/bin/mkdir -p '/usr/local/bin'
  /usr/bin/install -c osmconvert osmfilter osmupdate osmchange pbftoosm osmrelpoly osmassignpoly osmgeobase osmposition '/usr/local/bin'
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/opt/osmctools-master/src'
make[1]: Leaving directory `/opt/osmctools-master/src'
make[1]: Entering directory `/opt/osmctools-master'
make[2]: Entering directory `/opt/osmctools-master'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/opt/osmctools-master'
make[1]: Leaving directory `/opt/osmctools-master'

安装成功后增加的bin文件跟介绍里的一样:

在这里插入图片描述

4.工具使用实例

这里举例一个用到的命令osmconvert。

它是一个用于处理OSM(OpenStreetMap)地图数据的命令行工具。可以将OSM地图文件从一种格式转换成另一种格式,比如OSM XML文件转换成PBF(Protocolbuffer Binary Format)、CSV(Comma Separated Values)等格式,并且可以对地图数据进行筛选、剪切、合并等操作。

# 可以直接输入 osmconvert 根据指引进行文件处理
[root@tcloud ~]# osmconvert

osmconvert 0.8.11

Converts .osm, .o5m, .pbf, .osc, .osh files, applies changes
of .osc, .o5c, .osh files and sets limiting borders.
Use command line option -h to get a parameter overview,
or --help to get detailed help.

If you are familiar with the command line, press <Return>.

If you do not know how to operate the command line, please
enter "a" (press key E and hit <Return>).

不同版本的 osmconvert 用法可能不同,常见的用法:

  1. 将OSM XML文件转换成PBF格式:
osmconvert input.osm -o=output.pbf
  1. 将PBF格式的地图文件转换成OSM XML格式:
# pbf格式的文件无法直接查看转换后可直接看数据
osmconvert input.pbf -o=output.osm
  1. 将PBF格式的地图文件转换成CSV格式:
# 转换成csv文件可以直接导入数据库
osmconvert input.pbf --csv="@id @lon @lat name place" -o=output.csv
  1. 筛选地图数据中的节点、路线或关系:
osmconvert input.pbf --all-to-nodes -o=output_nodes.osm
osmconvert input.pbf --all-to-ways -o=output_ways.osm
osmconvert input.pbf --all-to-relations -o=output_relations.osm
  1. 对地图数据进行剪切或合并:
osmconvert input1.osm input2.osm -o=output_combined.osm
osmconvert input.pbf -b=-122.6,45.4,-122.3,45.6 --complete-ways -o=output_bbox.osm

更多命令和参数可通过 help 查询:

# 使用 help 查看可执行的命令
[root@tcloud ~]# osmconvert --help

Examples

./osmconvert europe.pbf --drop-author >europe.osm
./osmconvert europe.pbf |gzip >europe.osm.gz
bzcat europe.osm.bz2 |./osmconvert --out-pbf >europe.pbf
./osmconvert europe.pbf -B=ch.poly >switzerland.osm
./osmconvert switzerland.osm --out-o5m >switzerland.o5m
./osmconvert june_july.osc --out-o5c >june_july.o5c
./osmconvert june.o5m june_july.o5c.gz --out-o5m >july.o5m
./osmconvert sep.osm sep_oct.osc oct_nov.osc >nov.osm
./osmconvert northamerica.osm southamerica.osm >americas.osm

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/544364.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

MyBatis之注解开发

除了XML映射方式&#xff0c;MyBatis还支持注解方式实现POJO对象和数据表之间的关联映射&#xff0c;使用注解的方式一般将SQL语句直接写到接口上。与XML的映射方式相比&#xff0c;基于注解的映射方式相对简单。Mybatis提供的注解有&#xff1a; 1.环境准备 1.1 数据库准备…

C语言函数大全-- _w 开头的函数(3)

C语言函数大全 本篇介绍C语言函数大全-- _w 开头的函数 1. _wmkdir 1.1 函数说明 函数声明函数功能int _wmkdir(const wchar_t* dirname);用于创建指定路径名的新目录 参数&#xff1a; dirname &#xff1a; 指向以 null 结尾的宽字符数组&#xff0c;该数组包含要创建的目…

客户管理系统软件怎么用?

阅读本文您将了解&#xff1a;1.客户管理系统的作用&#xff1b;2.客户管理系统软件怎么用&#xff1b;3.客户管理的注意事项。 一、客户管理系统的作用 客户是企业的重要财富&#xff0c;因此客户管理是企业发展过程中至关重要的一部分&#xff0c;那么客户管理怎么做&#…

《编码——隐匿在计算机软硬件背后的语言》精炼——第17章收尾

古之立大事者,不惟有超世之才,亦必有坚忍不拔之志。——苏轼 文章目录 数字计算机硬件软件 数字计算机 数字计算机分为硬件和软件两部分&#xff0c;硬件是组成计算机的设备&#xff0c;软件是输入计算机的指令和数值。之所以将它们区分&#xff0c;是因为相对于硬件而言&…

照片从安卓手机中消失了?让他们恢复回来的几个方法请收好

“我安卓上的所有照片都消失了&#xff0c;我的照片去哪儿了” “我安卓上的所有照片都不见了” “下载的图片从安卓上消失了” …… 您是否遇到类似的问题&#xff1f;导致Android手机照片丢失的原因有很多&#xff0c;例如软件更新、误删、误操作、系统崩溃、应用程序崩溃、…

【算法】——动态规划题目讲解

本期继续为大家带来的是关于动态规划类题目的讲解&#xff0c;对于这类题目大家一定要多加练习&#xff0c;争取掌握。 &#xff08;一&#xff09;不同路径 链接如下&#xff1a;62. 不同路径 题目如下&#xff1a; 算法思路&#xff1a; 1. 状态表⽰&#xff1a; 对于这种「…

【FMC200】基于FMC标准的1路CameraLink Full 输出子卡模块

产品概述 FMC200是一款CameraLink发送FMC子卡模块&#xff0c;该模块支持2路CameraLink Base模式或者1路CameraLink Full模式的图像信号输出。板卡具有2个CameraLink端口&#xff08;SDR26&#xff09;&#xff0c;可以作为模拟相机的输出。 技术指标 图像接口性能&#xff1a…

202305-第二周资讯

山川软件愿为您提供最优质的服务。 您的每一个疑问都会被认真对待&#xff0c;您的每一个建议都将都会仔细思考。 我们希望人人都能分析大数据&#xff0c;人人都能搭建应用。 因此我们将不断完善DEMO、文档、以及视频&#xff0c;期望能在最大程度上快速帮助用户快速解决问…

高效易懂,打造维护性好的Web自动化测试框架PO模式精讲

目录 前言&#xff1a; 一、 PO概述 二、PO何实现于Web框架素自动化测试重中之重。 1.为了保证易维护性和易读性&#xff0c;我们可以在项目中定义一个统一的库&#xff0c;用来存放所有的定位器类。 2.定义一个基础的类&#xff0c;该类用于针对PO的元素定位进行封装。 3…

Visual Studio 2022 17.7 发布首个预览版

Visual Studio 2022 17.7 已发布首个预览版&#xff0c;这个版本有大量社区贡献的新改进&#xff0c;主要改动如下&#xff1a; 生产效率 文件对比功能&#xff0c;可以在 Solution Explorer 中对比不同的文件差异。在资源管理器中右键单击一个文件&#xff0c;然后使用上下文…

Java 中 Token 是什么,有哪些用途

简介 Token 是一种身份验证机制&#xff0c;通常由服务器生成并返回给客户端&#xff0c;客户端在后续的请求中携带 Token&#xff0c;以证明自己的身份。在 Java 中&#xff0c;Token 的应用场景非常广泛&#xff0c;例如用户登录、API 认证、OAuth 授权等等。 在用户登录的…

Hash索引和B+树

Hash索引和B树所有有什么区别或者说优劣呢? 首先要知道Hash索引和B树索引的底层实现原理&#xff1a; hash索引底层就是hash表&#xff0c;进行查找时&#xff0c;调用一次hash函数就可以获取到相应的键值&#xff0c;之后进行回表查询获得实际数据。B树底层实现是多路平衡查…

晨控CK-GW208-EC与欧姆龙PLC工业EtherCAT协议通讯指南

晨控CK-GW208-EC与欧姆龙PLC工业EtherCAT协议通讯指南 EtherCAT 是一种实时以太网络通讯协议&#xff0c;旨在解决传统现场总线系统在数据传输速率和复杂性方面的限制。相比传统现场总线&#xff0c;EtherCAT 的数据传输速率有了极大的提升&#xff0c;同时&#xff0c;EtherC…

借《2023年Q1TikTok电商带货达人趋势分析报告》教你分析TikTok数据报告

现今TikTok的电商业务正进入爆发期。在众多跨境电商的商业营销中&#xff0c;许多商家把TikTok作为重点选择的平台&#xff0c;期望能搭上这波海外流量红利的巨轮。TikTok营销正越来越受商家青睐和使用。那么作为TikTok电商商家&#xff0c;该如何挑选高匹配、高ROI的带货达人&…

公司招了一个00后,以为是个小年轻,没想到人家是个卷王...

公司前段缺人&#xff0c;也面了不少测试&#xff0c;结果竟然没有一个合适的。一开始瞄准的就是中级的水准&#xff0c;也没指望来大牛&#xff0c;提供的薪资也不低&#xff0c;面试的人很多&#xff0c;但平均水平很让人失望。 令我印象最深的是一个00后测试员&#xff0c;…

基于αβ剪枝算法的五子棋

访问【WRITE-BUG数字空间】_[内附完整源码和文档] 五子棋是世界智力运动会竞技项目之一&#xff0c;是一种两人对弈的纯策略型棋类游戏&#xff0c;是世界智力运动会竞技项目之一&#xff0c;通常双方分别使用黑白两色的棋子&#xff0c;下在棋盘直线与横线的交叉点上&#xf…

Husky + lint-staged + ESlint + Prettier(可选) 实现git增量代码lint校验

工具介绍 Husky lint-staged ESlint Prettier(可选) 实现git增量代码lint校验 Husky&#xff1a;一个为 git 客户端增加 hook 的工具&#xff0c;它有一些钩子函数&#xff0c;比如pre-commit、 pre-push等lint-staged: 一个过滤出 git 代码暂存区文件的工具&#xff0c;在…

防火墙NAT策略中各项之间以及策略与策略之间的关系

实验结论 将实验结论写在前面方便大家直接查看 1、NAT策略中rule与rule之间的关系为“或”的关系&#xff0c;即多个rule存在时&#xff0c;流量只需要匹配其中一个rule即可&#xff0c;流量会按照匹配的rule规则进行流量转发。&#xff08;华为华三的防火墙rule是没有ID的&a…

都说今年软件测试炸了,到底炸到什么程度呢?

软件测试薪资“乱”了 随着互联网行业的发展&#xff0c;每年都有有数以万计的求职者推开软件测试的大门&#xff0c;软件测试从业人员数逐年递增&#xff0c;市场对于软件测试人员的要求也越来越高&#xff0c;所以很多的初级测试人员找不到工作&#xff0c;导致了都在说软件…

十年软件测试工程师感悟,写给想要转行的软件测试新人

作为一个30岁并且奋战在测试一线的测试员&#xff0c;被人无数次问到这个问题&#xff0c;也回答过无数次。 刚看到知乎上的一个问题&#xff1a;程序员真的干到35岁就干不动了吗&#xff1f;想到在测试行业真的干到35就干不动了吗&#xff1f;软件测试能做到多少岁?也有很多…