Shp2osm:shp转换为osm格式文件

2023-05-16

概述

背景;因为opendrive是自动驾驶使用的较多的数据格式,想把地图数据shp格式转换成opendrive格式的,但是网上没有现成的转换脚本,所以打算先从shp格式转到osm格式,再从osm格式转换到opendrive格式。(网上相关资料非常少)
其实shp转换为osm格式方式挺多的:本文选贼用Shp2osm脚本来转换。

![ ](https://img-blog.csdnimg.cn/dee39d6355e644109f40853e2bd3b56c.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAQUnmnb7lrZA2NjY=,size_20,color_FFFFFF,t_70,g_se,x_16)

There are multiple tools for converting shapefiles into .osm format suitable for importing. These include:
Merkaartor — simply import the shp, export the osm.xml.
shp2osm (and polyshp2osm) — require some programming skill, but very flexible
shp-to-osm.jar — less flexible, but requires only a simple configuration file
shape2osm — a Python script that will convert a POINT shapefile to OSM XML
PostGISconvert shp to osm using grass and gpsbabel
Load the shapefile into PostGIS first, using shp2pgsql (feature of PostGIS) May be helpful as first conversion step
ogr2osm (ogr2osm) — a new script to convert any OGR supported vector format into .osm format, with emphasis in converting polygon boundaries into relations
Using QGIS & GPX Editor to convert to GPX
1) Menu "Plugins/ Manage Plugins..." enable ,,GPS Tools".2) Menu "Plugins/GPS Tools/Create new GPS layer"3) Select feature(s) in the default layer. Copy, paste into a GPS tracks layer, save the changed layer.4) In GPX Editor open the gpx file. Menu "Edit/ OpenStreetMap Tools/ Anonymize time".MapCreator-Toolset: ShapeToOsmTool — This C#-OpenSource tool converts a set of shape files to an osm file, applying specific conversion rules defined in a dedicated XML conversion rule file.The tool is simple and flexible.
The tool can convert many layers (represented by many shape files) to one OSM output file.
The tool supports the following geometries: Polygon, LineString and Point. A Polygon will be mapped to a Closed OSM Way, a LineString to a OSM Way and a Point to a OSM Node.
With certain limits the tool can convert geometry types (Polygon to Point, LineString to Point), if so wanted.
The tool supports a flexible Tag generation. The Tag values can be constant or read out of the shape file fields.
SHPtoOSMBoundaries python script. If the SHP contains Administrative Boundaries and you want to transform them into OSM in order to autogenerate and join the multiple boundary relations before importing.

相关资料:
https://zhuanlan.zhihu.com/p/360377363
https://www.esri.com/content/dam/esrisites/sitecore-archive/Files/Pdfs/library/whitepapers/pdfs/shapefile.pdf
https://zhuanlan.zhihu.com/p/393715053
https://blog.csdn.net/Gary_888/article/details/91572141

方法:

按照博客中的方法来执行https://blog.csdn.net/Gary_888/article/details/91572141。
我会报错:
在这里插入图片描述
此时生成的.osm文件大小是0KB,很明显是错的*。按照博客中解决此方法,发现在终端中输入ppm根本打不开perl package manager的gui界面,使用ppm install Geo::ShapeFile安装时,也会报如下错误:
在这里插入图片描述
经过百番查找资料解决问题,发现输入命令:cpan Geo::ShapeFile可以安装。

然后再次输入转换命令就可以了

FOR /R .\ %G IN (*.shp) DO shp2osm.pl "%~dpnG" > "%~dpnG.osm"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Shp2osm:shp转换为osm格式文件 的相关文章

  • 算法网址

    九章算法 xff1a https www jiuzhang com Lintcode xff1a https www lintcode com Leetcode xff1a https leetcode com CodeTop xff1a
  • Datawhale跟李沐大神合作举办 (动手学深度学习) !

    三月的组队学习跟李沐大神合作举办 动手学深度学习 xff0c 欢迎感兴趣的小伙伴报名学习 xff0c 另外 xff0c 欢迎志同道合的小伙伴了解 加入Datawhale 跟李沐导师 xff1a 动手学深度学习 xff01 动手学深度学习 P
  • 期刊会议名缩写查询-1

    投往IEEE transactions的论文 xff0c 其中的参考文献格式都是采用会议期刊的缩写 本博客特此记录如何查询期刊和会议名的缩写问题 期刊名缩写 SCI论文的参考文献很多期刊名都是缩写 xff0c 如下图所示 在写论文时 xff
  • Linux从用户层到内核层系列 - GNU系列之你所不知道的printf

    题记 xff1a 本系列文章的目的是抛开书本从源代码和使用的角度分析Linux内核和相关源代码 xff0c byhankswang和你一起玩转linux开发 轻松搞定TCP IP协议栈 xff0c 原创文章欢迎交流 byhankswang
  • 第十一届蓝桥杯python组第二场省赛-排序

    1 问题描述 xff1a 小蓝最近学习了一些排序算法 xff0c 其中冒泡排序让他印象深刻 在冒泡排序中 xff0c 每次只能交换相邻的两个元素 小蓝发现 xff0c 如果对一个字符串中的字符排序 xff0c 只允许交换相邻的两个字符 xf

随机推荐

  • 4306 序列处理(贪心)

    1 问题描述 xff1a 给定一个长度为 n 的整数序列 a1 xff0c a2 xff0c xff0c an 我们可以对该序列进行修改操作 xff0c 每次操作选中其中一个元素 xff0c 并使其增加 1 现在 xff0c 请你计算要使得
  • python数据分析基础-datafrom基础属性

    linux 43 pycharm 43 anaconda span class token keyword import span pandas span class token keyword as span pd data1 span
  • python数据分析基础-series基本统计运算,数据运算和比较运算

    linux 43 pycharm 43 anaconda 96 span class token comment 两个series数据运算 43 span num span class token operator 61 span pd s
  • python数据分析-柱状图绘制及常用参数设置

    linux 43 pycharm 43 anaconda span class token comment 柱形图绘制与参数设置 span span class token comment plt bar x height width bo
  • 爬取西窗烛app

    本文旨在学习 xff0c 不可做商业用途 span class token keyword import span csv span class token keyword import span json span class token
  • 爬取百度地图店家信息

    本文旨在交流学习 xff0c 勿作他用 xff0c 否则后果自负 span class token keyword import span json span class token keyword import span csv span
  • 爬取蝉妈妈数据平台商品数据

    本文旨在交流学习 xff0c 勿作他用 xff0c 否则后果自负 环境 linux 43 pycharm 43 anaconda span class token keyword import span json span class to
  • selenium+webdriver+chrome实现百度以图搜图

    1 环境搭建 1 webdriver 43 chrome的版本需匹配 2 打开chrome 输入 chrome version 来查看chrome版本 访问此网站 谷歌浏览器驱动 然后选择合适版本webdriver 2 收集原始图片和构建图
  • 无聊之重学c/c++

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • Python配置Pip国内源

    临时指定下载源 以阿里云的镜像为例 pip install trusted host https mirrors aliyun com i https mirrors aliyun com pypi simple lt some packa
  • 爬虫效率提升方法

    协程 xff1a 在函数 特殊函数 定义的时候 使用async修饰 函数调用后 内部语句不会立即执行 而是会返回一个协程对象 任务对象 xff1a 任务对象 61 高级的协程对象 进一步封装 61 特殊的函数 xff0c 任务对象必须要注册
  • selenium JD爬虫

    python3 7 43 win10 span class token comment coding utf 8 span span class token comment 64 Time 2022 6 27 16 55 span span
  • 树莓派4b学习笔记三:三行命令极简安装vscode

    很多写代码的软件在树莓派上都不能用 xff0c 或者安装比较麻烦 恰巧 xff0c vscode作为一款轻量级代码编辑器 xff0c 可以在树莓上使用 xff0c 而且它通过简单的安装插件就可以支持很多种编程语言 我在网上搜了很多关于在树莓
  • you-get详细配置教程

    一 you get介绍 you get是一款能够直接从网页上下载视频 音乐 图片的命令行多媒体下载器 xff0c 它支持80多个网站 xff0c 包括某酷 某奇艺 某讯 Bzhan YouTube等 xff0c 具体说明及支持网站可点击下方
  • hyper-v虚拟机上的ubuntu 18.04 LTS通过xrdp传递声音遇到的一些坑

    背景 xff1a Windows10 pro上hyper v自带的ubuntu 18 04 LTS 在使用虚拟机时发现没有声音 xff0c 通过这篇博客Linux xrdp远程桌面连接声音重定向来到 pulseaudio module xr
  • 深入理解卡尔曼滤波算法

    最近做卡尔曼滤波跟踪的项目 xff0c 看原理花了一天 xff0c 再网上查找并看懂别人的kalman c 43 43 代码花了我近三天的时间 卡尔曼滤波就是纸老虎 xff0c 核心原理不难 xff0c 核心公式就5个 xff0c 2个状态
  • no module named ‘apex‘ 的解决方案

    背景 xff1a 部署fast reid工程环境的时候报出ModuleNotFoundError No module named 39 apex 的错误 纯粹记录一下 no module named apex 的解决方案 xff1a 1 官
  • C++ 中字符串查找、字符串截取、字符串替换

    1 字符串查找 s span class token punctuation span span class token function find span span class token punctuation span s1 spa
  • Jetson AGX Xavier 刷机指南

    目录 一 刷机准备 二 JetPack4 5刷机过程 三 安装Cudnn 四 开启高性能模式 五 打开风扇 六 上电自启 七 设置开机自启动 一 刷机准备 在刷机之前 xff0c 需要准备一台装有Ubuntu系统的宿主电脑 将 Xavier
  • Shp2osm:shp转换为osm格式文件

    概述 背景 因为opendrive是自动驾驶使用的较多的数据格式 xff0c 想把地图数据shp格式转换成opendrive格式的 xff0c 但是网上没有现成的转换脚本 xff0c 所以打算先从shp格式转到osm格式 xff0c 再从o