OpenStreetMap地图.osm.pbf合并

OSM2Unity实战:将OpenStreetMap数据导入Unity构建三维地理场景 地理信息系统(GIS)与三维引擎的融合是数字孪生、智慧城市等领域的核心技术。其原理在于将真实世界的矢量地理数据通过坐标转换与几何生成算法,转换为三维引擎可识别的网格模型,从而实现真实地理环境的快速三维重建。这一技术的核心价值在于大幅降低了基于真实地理信息进行三维场景构建的成本与门槛,为城市规划、仿真训练、游戏开发等应用提供了高效的数据 pipeline。在实际工程中,开发者常利用开源地图数据(如 OpenStreetMap)配合 Unity3D 引擎,通过解析 OSM 文件格式、处理 Node/Way/Re 阅读详情

合并china.osm.pbf 和taiwai.osm.pbf

Osmconvert 工具

由于osm.pbf文件无法直接合并,使用Osmconvert 转化为o5m中间格式,在转换为osm.pbf.
osm.pbf -->o5m --> osm.pbf

Osmconvert 工具下载

λ osmconvert64-0.8.8p.exe --help

osmconvert 0.8.8

This program reads different file formats of the OpenStreetMap
project and converts the data to the selected output file format.
These formats can be read:
  .osm  .osc  .osc.gz  .osh  .o5m  .o5c  .pbf
These formats can be written:
  .osm (default)  .osc  .osh  .o5m  .o5c  .pbf

Names of input files must be specified as command line parameters.
Use - to read from standard input. You do not need to specify the
input formats, osmconvert will recognize them by itself.
The output format is .osm by default. If you want a different format,
please specify it using the appropriate command line parameter.

-b=<x1>,<y1>,<x2>,<y2>
        If you want to limit the geographical region, you can define
        a bounding box. To do this, enter the southwestern and the
        northeastern corners of that area. For example:
        -b=-0.5,51,0.5,52

-B=<border_polygon>
        Alternatively to a bounding box you can use a border polygon
        to limit the geographical region.
        The format of a border polygon file can be found in the OSM
        Wiki: http://wiki.openstreetmap.org/wiki/Osmosis/
              Polygon_Filter_File_Format
        You do not need to strictly follow the format description,
        you must ensure that every line of coordinates starts with
        blanks.

--complete-ways
        If applying a border box or a border polygon, all nodes
        the borders are excluded; even then if they belong to a way
        which is not entirely excluded because it has some nodes
        inside the borders.
        This option will ensure that every way stays complete, even
        it it intersects the borders. This will result in slower
        processing, and the program will loose its ability to read
        from standard input. It is recommended to use .o5m format as
        input format to compensate most of the speed disadvantage.

--complete-multipolygons, --complete-boundaries
        Same as before, but multipolygons resp. boundaries will not
        be cut at the borders too.

--all-to-nodes
        Some applications do not have the ability to process ways or
        relations, they just accept nodes as input. However, more and
        more complex object are mapped as ways or even relations in
        order to get all their details into the database.
        Apply this option if you want to convert ways and relations
        to nodes and thereby make them available to applications
        which can only deal with nodes.
        For each way a node is created. The way's id is increased by
        10^15 and taken as id for the new node. The node's longitude
        and latitude are set to the way's geographical center. Same
        applies to relations, however they get 2*10^15 as id offset.

--add-bbox-tags
        This option adds a tag with a bounding box to each object.
        The tag will contain the border coordinates in this order:
        min Longitude, min Latitude, max Longitude, max Latitude.
        e.g.:  <tag k="bBox" v="-0.5000,51.0000,0.5000,52.0000"/>

--add-bboxarea-tags
        A tag for an estimated area value for the bbox is added to
        each way and each relation. The unit is square meters.
        For example:  <tag k="bBoxArea" v="33828002"/>

--add-bboxweight-tags
        This option will add the binary logarithm of the bbox area
        of each way and each relation.
        For example:  <tag k="bBoxWeight" v="20"/>

--add-bboxwidth-tags
        A tag for an estimated width value for the bbox is added to
        each way and each relation. The unit is meters.
        For example:  <tag k="bBoxWidth" v="825"/>

--add-bboxwidthweight-tags
        This option will add the binary logarithm of the bbox width
        of each way and each relation.
        For example:  <tag k="bBoxWidthWeight" v="10"/>

--object-type-offset=<id offset>
        If applying the --all-to-nodes option as explained above, you
        may adjust the id offset. For example:
          --object-type-offset=4000000000
        By appending "+1" to the offset, the program will create
        ids in a sequence with step 1. This might be useful if the
        there is a subsequently running application which cannot
        process large id numbers. Example:
          --object-type-offset=1900000000+1

--drop-broken-refs
        Use this option if you need to delete references to nodes
        which have been excluded because lying outside the borders
        (mandatory for some applications, e.g. Map Composer, JOSM).

--drop-author
        For most applications the author tags are not needed. If you
        specify this option, no author information will be written:
        no changeset, user or timestamp.

--drop-version
        If you want to exclude not only the author information but
        also the version number, specify this option.

--drop-nodes
--drop-ways
--drop-relations
        According to the combination of these parameters, no members
        of the referred section will be written.

--modify-tags=<tag_modification_list>
        The tag modification list determines which tags will be
        modified. The example
          --modify-tags="highway=primary to =secondary"
        will change every "primary" highway into "secondary".
        You can also use comparisons or add additional tags:
          --modify-way-tags="maxspeed>200 add highspeed=yes"

--modify-node-tags=TAG_MODIFICATION_LIST
--modify-way-tags=TAG_MODIFICATION_LIST
--modify-relation-tags=TAG_MODIFICATION_LIST
--modify-node-way-tags=TAG_MODIFICATION_LIST
--modify-node-relation-tags=TAG_MODIFICATION_LIST
--modify-way-relation-tags=TAG_MODIFICATION_LIST
        Same as above, but just for the specified object types.

--diff
        Calculate difference between two files and create a new .osc
        or .o5c file.
        There must be TWO input files and borders cannot be applied.
        Both files must be sorted by object type and id. Created
        objects will appear in the output file as "modified", unless
        having version number 1.

--diff-contents
        Similar to --diff, this option calculates differences between
        two OSM files. Here, to determine the differences complete
        OSM objects are consulted, not only the version numbers.
        Unfortunately, this option strictly requires both input files
        to have .o5m format.

--subtract
        The output file will not contain any object which exists in
        one of the input files following this directive. For example:
        osmconvert input.o5m --subtract minus.o5m -o=output.o5m

--pbf-granularity=<val>
        Rarely .pbf files come with non-standard granularity.
        osmconvert will recognize this and suggest to specify the
        abnormal lon/lat granularity using this command line option.
        Allowed values are: 100 (default), 1000, 10000, ..., 10000000.

--emulate-osmosis
--emulate-pbf2osm
        In case of .osm output format, the program will try to use
        the same data syntax as Osmosis, resp. pbf2osm.

--fake-author
        If you have dropped author information (--drop-author) that
        data will be lost, of course. Some programs however require
        author information on input although they do not need that
        data. For this purpose, you can fake the author information.
        osmconvert will write changeset 1, timestamp 1970.

--fake-version
        Same as --fake-author, but - if .osm xml is used as output
        format - only the version number will be written (version 1).
        This is useful if you want to inspect the data with JOSM.

--fake-lonlat
        Some programs depend on getting longitude/latitude values,
        even when the object in question shall be deleted. With this
        option you can have osmconvert to fake these values:
           ... lat="0" lon="0" ...
        Note that this is for XML files only (.osc and .osh).

-h
        Display a short parameter overview.

--help
        Display this help.

--merge-versions
        Some .osc files contain different versions of one object.
        Use this option to accept such duplicates on input.

--out-osm
        Data will be written in .osm format. This is the default
        output format.

--out-osc
        The OSM Change format will be used for output. Please note
        that OSM objects which are to be deleted will be represented
        by their ids only.

--out-osh
        For every OSM object, the appropriate 'visible' tag will be
        added to meet 'full planet history' specification.

--out-o5m
        The .o5m format will be used. This format has the same
        structure as the conventional .osm format, but the data are
        stored as binary numbers and are therefore much more compact
        than in .osm format. No packing is used, so you can pack .o5m
        files using every file packer you want, e.g. lzo, bz2, etc.

--out-o5c
        This is the change file format of .o5m data format. All
        <delete> tags will not be performed as delete actions but
        converted into .o5c data format.

--out-pbf
        For output, PBF format will be used.

--out-csv
        A character separated list will be written to output.
        The default separator is Tab, the default columns are:
        type, id, name. You can change both by using the options
        --csv-separator= and --csv=

--csv-headline
        Choose this option to print a headline to csv output.

--csv-separator=<sep>
        You may change the default separator (Tab) to a different
        character or character sequence. For example:
        --csv-separator="; "

--csv=<columns>
        If you want to have certain columns in your csv list, please
        specify their names as shown in this example:
        --csv="@id name ref description"
        There are a few special column names for header data:
        @otype (object type 0..2), @oname (object type name), @id
        @lon, @lat, @version, @timestamp, @changeset, @uid, @user

--out-none
        This will be no standard output. This option is for testing
        purposes only.

--timestamp=<date_and_time>
--timestamp=NOW<seconds_relative_to_now>
        If you want to set the OSM timestamp of your output file,
        supply it with this option. Date and time must be formatted
        according OSM date/time specifications. For example:
        --timestamp=2011-01-31T23:59:30Z
        You also can supply a relative time in seconds, e.g. 24h ago:
        --timestamp=NOW-86400

--out-timestamp
        With this option set, osmconvert prints just the time stamp
        of the input file, nothing else.

--statistics
        This option activates a statistics counter. The program will
        print statistical data to stderr.

--out-statistics
        Same as --statistics, but the statistical data will be
        written to standard output.

-o=<outfile>
        Standard output will be rerouted to the specified file.
        If no output format has been specified, the program will
        rely on the file name's extension.

-t=<tempfile>
        If borders are to be applied or broken references to be
        eliminated, osmconvert creates and uses two temporary files.
        This parameter defines their name prefix. The default value
        is "osmconvert_tempfile".

--parameter-file=FILE
        If you want to supply one ore more command line arguments
        by a parameter file, please use this option and specify the
        file name. Within the parameter file, parameters must be
        separated by empty lines. Line feeds inside a parameter will
        be converted to spaces.
        Lines starting with "// " will be treated as comments.

-v
--verbose
        With activated 'verbose' mode, some statistical data and
        diagnosis data will be displayed.
        If -v resp. --verbose is the first parameter in the line,
        osmconvert will display all input parameters.

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

Tuning

To speed-up the process, the program uses some main memory for a
hash table. By default, it uses 900 MB for storing a flag for every
possible node, 90 for the way flags, and 10 relation flags.
Every byte holds the flags for 8 ID numbers, i.e., in 900 MB the
program can store 7200 million flags. As there are less than 3200
million IDs for nodes at present (Oct 2014), 400 MB would suffice.
So, for example, you can decrease the hash sizes to e.g. 400, 50 and
2 MB using this option:

  --hash-memory=400-50-2

But keep in mind that the OSM database is continuously expanding. For
this reason the program-own default value is higher than shown in the
example, and it may be appropriate to increase it in the future.
If you do not want to bother with the details, you can enter the
amount of memory as a sum, and the program will divide it by itself.
For example:

  --hash-memory=1500

These 1500 MB will be split in three parts: 1350 for nodes, 135 for
ways, and 15 for relations.

Because we are taking hashes, it is not necessary to provide all the
suggested memory; the program will operate with less hash memory too.
But, in this case, the border filter will be less effective, i.e.,
some ways and some relations will be left in the output file although
they should have been excluded.
The maximum value the program accepts for the hash size is 4000 MiB;
If you exceed the maximum amount of memory available on your system,
the program will try to reduce this amount and display a warning
message.

There is another temporary memory space which is used only for the
conversion of ways and relations to nodes (option --all-to-nodes).
This space is sufficient for up to 25 Mio. OSM objects, 400 MB of
main memory are needed for this purpose, 800 MB if extended option
--add-bbox-tags has been invoked. If this is not sufficient or
if you want to save memory, you can configure the maximum number of
OSM objects by yourself. For example:

  --max-objects=35000000

The number of references per object is limited to 100,000. This will
be sufficient for all OSM files. If you are going to create your own
OSM files by converting shapefiles or other files to OSM format, this
might result in way objects with more than 100,000 nodes. For this
reason you will need to increase the maximum accordingly. Example:

  --max-refs=400000

Limitations

When extracting a geographical region (using -b or -B), the input
file must contain the objects ordered by their type: first, all
nodes, next, all ways, followed by all relations. Within each of
these sections, the objects section must be sorted by their id in
ascending order.

Usual .osm, .osc, .o5m, o5c and .pbf files adhere to this condition.
This means that you do not have to worry about this limitation.
osmconvert will display an error message if this sequence is broken.

If a polygon file for borders is supplied, the maximum number of
polygon points is about 40,000.

This program is for experimental use. Expect malfunctions and data
loss. Do not use the program in productive or commercial systems.

There is NO WARRANTY, to the extent permitted by law.
Please send any bug reports to markus.weber@gmx.com

Download


Linux
binary for Linux 32 bit
binary for Linux 64 bit
osmctools Debian package, to install run: apt install osmctools
Windows
binary for Windows 32 bit (runs with Win 64 too)
binary for Windows 64 bit (see Limitations)
binary for Windows 64 bit (with large file support)
在这里插入图片描述

转换步骤

# 转换o5m格式
λ osmconvert64-0.8.8p.exe taiwan-260313.osm.pbf -o=taiwan-260313.o5m
λ osmconvert64-0.8.8p.exe china-260313.osm.pbf -o=china-260313.o5m
# 合并o5m格式
λ osmconvert64-0.8.8p.exe china-260313.o5m taiwan-260313.o5m -o=chinaall.o5m
# 转换.osm.pbf
λ osmconvert64-0.8.8p.exe chinaall.o5m -o=chinaall.osm.pbf
从OSM到浏览器:一站式构建矢量瓦片地图应用实战 本文详细介绍了从OSM数据获取到前端可视化的一站式矢量瓦片地图应用开发流程。通过实战案例解析了PBF转GeoJSON、Tippecanoe切片、MapLibre GL JS集成等关键技术,帮助开发者高效构建高性能地图应用,特别适合处理大规模地理数据可视化需求。 阅读详情

相关推荐

全国分省市OSM数据裁剪全流程解析:从PBF到GeoPackage的实践指南

地理信息系统(GIS)与空间数据分析中,矢量数据的组织与处理是工程实践的核心环节。OpenStreetMap(OSM)作为全球开放空间数据源,提供丰富的路网、建筑、水系等要素,但其全国级PBF文件体积庞大,直接用于业务系统时存在性能瓶颈。通过行政区划边界进行空间裁剪,将全量数据按省市拆分为独立矢量包,是提升地图加载效率、满足分区域管理需求的关键技术手段。本文从数据格式选型、坐标系处理、裁剪算法原理出发,介绍基于Osmium与GDAL的本地化裁剪流程,探讨如何利用GeoJSON边界统一行政口径,以及导出Geo

weixin_29531177的博客 218

.pbf转为.osm的命令行语句

下载转换工具osmconvert后,将其放在待转数据目录下,在当前目录运行cmd,输入下面语句: osmconvert china.osm.pbf --out-osm -o=china.osm_01.osm 即可将.pbf格式文件转为.osm格式。 注:osmconvert可换成osmconvert64或osmconvert64-0.8.8p,文件名根据自己的修改。还可直接运行osmconvert...

antelope_ff的博客 3129

告别数据孤岛:用ArcGIS Editor for OSM插件,5分钟把OpenStreetMap数据导入ArcMap做分析

本文介绍如何利用ArcGIS Editor for OSM插件,快速将OpenStreetMap数据导入ArcMap进行分析,解决数据孤岛问题。通过详细的安装指南和实战操作步骤,帮助城市规划师和研究人员在5分钟内获取全球免费地理数据,提升空间分析效率。

weixin_30565327的博客 470

Osmconvert工具下载

Osmconvert工具下载 https://wiki.openstreetmap.org/wiki/Osmconvert

antelope_ff的博客 5968

shp转.osm.pbf

开源离线地图GraphHopper需要.osm.pbf格式的数据,也就是osm的压缩格式 1、下载工具 工具一:用于转换shp–>osm josm-setup.exe 链接:https://pan.baidu.com/s/1HAPUDRi4ob4imQCMTmbIug 提取码:b57z 安装之后还需要安装"opendata"插件,以便支持shp格式的数据 借鉴这位兄弟的链接 https://www.jianshu.com/p/a47ed4a0b7bd?from=singlemessage 工具二:用

yilvyangguang520的博客 3989

OSM道路数据处理实战:从PBF到SHP的完整流程与GIS应用

地理信息系统(GIS)中的矢量数据是进行空间分析的基础,其核心原理在于通过点、线、面等几何要素及其属性来描述地理实体。在智慧城市、交通规划等领域,高质量的道路网络数据是实现路径规划、流量仿真等应用的技术基石。OpenStreetMap(OSM)作为全球性的众包地理数据库,提供了覆盖广泛、更新及时的道路数据源,具有极高的开源价值。然而,其原始的PBF格式数据如同未经加工的‘矿石’,包含了海量且结构复杂的要素,无法被主流GIS软件直接利用。通过数据ETL流程,利用Osmosis进行基于空间范围和属性(如high

weixin_29038537的博客 304

Python实现OSM地图数据解析——OSM2GMNS

基于python语言,实现OSM开源地图数据解析,获取交通网路数据。

Better.C的博客 1万+

osmconvert64.exe

osm 转换工具 。windows版本,根据提示,可转换。如想转换为shp文件,可用它来转换.可转为osm,再通过ArcGIS_Editor_OSM转为shp文件。

用OpenStreetMap为老款Garmin免费制作最新地图

地图数据是GPS设备的核心资产,但厂商预装地图往往滞后且更新成本高昂。OpenStreetMap作为全球开放的矢量地理数据库,以标准化格式持续更新,为设备地图更新提供了免费优质的数据源。通过mkgmap等开源工具,可将OSM数据转换为Garmin设备识别的IMG文件,实现旧款手持机、车载导航的地图升级。这一技术路径不仅适用于户外探险,也为物流、测绘等依赖GPS设备的行业提供了低成本的数据更新方案。本文以旧款Garmin为例,详解从数据下载、工具配置到安装测试的全流程,帮助你亲手激活设备的第二春。

weixin_34252090的博客 292

osmconvert64-0.8.8p(304kb)

OpenStreetMap中osm.pbf转为.osm的工具

osmconvert64-0.8.8p.exe

.osm.osc.osc.gz.osh.o5m.o5c.pbf(之间互导) osmconvert可用于转换和处理OpenStreetMap文件

Makepad 地图瓦片工具链:从 OSM PBF 构建磁盘流式 MBTiles 地图存档

`makepad-map-tiles` 是 Makepad 开源仓库中负责"地图数据生产"的命令行工具链:它把 OSM(OpenStreetMap)的两类上游数据——VersaTiles 的 Shortbread 基础金字塔与 Geofabrik 的全量 `.osm.pbf`——加工成两种互补的、可磁盘流式读取的 gzip-MVT MBTiles 存档,供 Makepad 地图渲染直接随机寻址瓦片

gitblog_00368的博客 141

osm2node:来自 XAPI 或 Overpass API 请求的包装器,仅向节点提供转换后的输出(使用 osmconvert),输出可以是 osm 或 gpx

osm2node 来自 XAPI 或 Overpass API 请求的包装器,仅向节点提供转换后的输出(使用 osmconvert),输出可以是 osm 或 gpx 当您希望将 osm 数据库中绘制为多边形的餐厅或酒店转换为质心中的虚拟节点时,我会很有用。 (当客户端工具不提供这种简化时更容易处理) 阅读代码了解更多;-) 注意:您需要 osmconvert 才能使其工作: ://wiki.openstreetmap.org/wiki/Osmconvert wget -O - http://mmi24.cc/osmconvert.c | cc -xc - -lz -O3 -o osmconvert 应该下载并编译它 fixme 和 osmand 的调整 如果您想从 osm 导出对象,并将 fixme 标记设置为 gpx 的名称: ://api.openstreetmap.f

OSM道路数据格式解析:从XML/PBF到SLANetPlus训练的语义映射

OpenStreetMap(OSM)并非简单地理数据源,而是一套具备严格语义、拓扑与空间约束的道路描述语言。其核心在于将现实道路解构为节点(Node)、路径(Way)、关系(Relation)三层结构,并通过highway=*、lanes=*、maxspeed=*等标签承载通行权、车道能力与动态限速规则。这种结构化表达支撑了交通仿真、自动驾驶训练(如SLANetPlus)及城市规划等高阶应用。理解OSM原始格式(XML/PBF)与业务Schema间的语义映射逻辑——而非仅做GeoJSON转换——是构建可靠路

weixin_34364071的博客 297

osmconvert可用于转换和处理OpenStreetMap文件.zip

osmconvert可用于转换和处理OpenStreetMap文件.zip

[uboot] (第四章)uboot流程——uboot编译流程

uboot编译流程简单介绍

ooonebook的博客 1万+
上一篇: 强化学习课程第2讲:探索与利用
下一篇: 19.卷积层
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

热衷技术的尼古拉斯

您的鼓励是我创作的最大动力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值