本片文章简单记录了PostGIS涉及的常用数据导入导出的使用方法。这里要注意几个参数,是选用-c还是-a要看你的应用方式,-S这个是在
本片文章简单记录了PostGIS涉及的常用数据导入导出的使用方法。
1.将osm数据导入PostGIS
osm2pgsql -c -d osm -l -E 4326 -S /usr/share/osm2pgsql/default.style xxxxx.osm
这里要注意几个参数,是选用-c还是-a要看你的应用方式,-S这个是在Ubuntu下路径不同时使用,espg可以不用再使用900913了。自然要使得数据库采用UTF8编码最好。
osm2pgsql SVN version 0.70.5
Usage:
osm2pgsql [options] planet.osm
osm2pgsql [options] planet.osm.{gz,bz2}
osm2pgsql [options] file1.osm file2.osm file3.osm
This will import the data from the OSM file(s) into a PostgreSQL database
suitable for use by the Mapnik renderer
Options:
-a|--append Add the OSM file into the database without removing
existing data.
-b|--bbox Apply a bounding box filter on the imported data
Must be specified as: minlon,minlat,maxlon,maxlat
e.g. --bbox -0.5,51.25,0.5,51.75
-c|--create Remove existing data from the database. This is the
default if --append is not specified.
-d|--database The name of the PostgreSQL database to connect
to (default: gis).
-i|--tablespace-index The name of the PostgreSQL tablespace where indexes will be create
to (default: pg_default).
-l|--latlong Store data in degrees of latitude & longitude.
-m|--merc Store data in proper spherical mercator (default)
-M|--oldmerc Store data in the legacy OSM mercator format
-E|--proj num Use projection EPSG:num
-u|--utf8-sanitize Repair bad UTF8 input data (present in planet
dumps prior to August 2007). Adds about 10% overhead.
-p|--prefix Prefix for table names (default planet_osm)
-s|--slim Store temporary data in the database. This greatly
reduces the RAM usage but is much slower.
-S|--style Location of the style file. Defaults to /usr/share/default.style
-C|--cache Only for slim mode: Use upto this many MB for caching nodes
Default is 800
-U|--username Postgresql user name.
-W|--password Force password prompt.
-H|--host Database server hostname or socket location.
-P|--port Database server port.
-e|--expire-tiles [min_zoom-]max_zoom Create a tile expiry list.
-o|--expire-output filename Output filename for expired tiles list.
-r|--input-reader Input frontend.
libxml2 - Parse XML using libxml2. (default)
primitive - Primitive XML parsing.
-O|--output Output backend.
pgsql - Output to a PostGIS database. (default)
gazetteer - Output to a PostGIS database suitable for gazetteer
null - No output. Useful for testing.
-x|--extra-attributes
Include attributes for each object in the database.
This includes the username, userid, timestamp and version.
Note: this option also requires additional entries in your style file.
-k|--hstore Generate an additional hstore (key/value) column to postgresql tables
-z|--hstore-column Generate an additional hstore (key/value) column to containing all tags
that start with the specified string, eg --hstore-column "name:" will
produce an extra hstore column that contains all name:xx tags
-G|--multi-geometry Generate multi-geometry features in postgresql tables.
-K|--keep-coastlines Keep coastline data rather than filtering it out.
By default natural=coastline tagged data will be discarded based on the
assumption that post-processed Coastline Checker shapefiles will be used.
-h|--help Help information.
-v|--verbose Verbose output.
Add -v to display supported projections.
Use -E to access any espg projections (usually in /usr/share/proj/epsg)

要优化MySQL慢查询,需使用slowquerylog和performance_schema:1.启用slowquerylog并设置阈值,记录慢查询;2.利用performance_schema分析查询执行细节,找出性能瓶颈并优化。

MySQL和SQL是开发者必备技能。1.MySQL是开源的关系型数据库管理系统,SQL是用于管理和操作数据库的标准语言。2.MySQL通过高效的数据存储和检索功能支持多种存储引擎,SQL通过简单语句完成复杂数据操作。3.使用示例包括基本查询和高级查询,如按条件过滤和排序。4.常见错误包括语法错误和性能问题,可通过检查SQL语句和使用EXPLAIN命令优化。5.性能优化技巧包括使用索引、避免全表扫描、优化JOIN操作和提升代码可读性。

MySQL异步主从复制通过binlog实现数据同步,提升读性能和高可用性。1)主服务器记录变更到binlog;2)从服务器通过I/O线程读取binlog;3)从服务器的SQL线程应用binlog同步数据。

MySQL是一个开源的关系型数据库管理系统。1)创建数据库和表:使用CREATEDATABASE和CREATETABLE命令。2)基本操作:INSERT、UPDATE、DELETE和SELECT。3)高级操作:JOIN、子查询和事务处理。4)调试技巧:检查语法、数据类型和权限。5)优化建议:使用索引、避免SELECT*和使用事务。

MySQL的安装和基本操作包括:1.下载并安装MySQL,设置根用户密码;2.使用SQL命令创建数据库和表,如CREATEDATABASE和CREATETABLE;3.执行CRUD操作,使用INSERT,SELECT,UPDATE,DELETE命令;4.创建索引和存储过程以优化性能和实现复杂逻辑。通过这些步骤,你可以从零开始构建和管理MySQL数据库。

InnoDBBufferPool通过将数据和索引页加载到内存中来提升MySQL数据库的性能。1)数据页加载到BufferPool中,减少磁盘I/O。2)脏页被标记并定期刷新到磁盘。3)LRU算法管理数据页淘汰。4)预读机制提前加载可能需要的数据页。

MySQL适合初学者使用,因为它安装简单、功能强大且易于管理数据。1.安装和配置简单,适用于多种操作系统。2.支持基本操作如创建数据库和表、插入、查询、更新和删除数据。3.提供高级功能如JOIN操作和子查询。4.可以通过索引、查询优化和分表分区来提升性能。5.支持备份、恢复和安全措施,确保数据的安全和一致性。

全表扫描在MySQL中可能比使用索引更快,具体情况包括:1)数据量较小时;2)查询返回大量数据时;3)索引列不具备高选择性时;4)复杂查询时。通过分析查询计划、优化索引、避免过度索引和定期维护表,可以在实际应用中做出最优选择。


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

mPDF
mPDF是一个PHP库,可以从UTF-8编码的HTML生成PDF文件。原作者Ian Back编写mPDF以从他的网站上“即时”输出PDF文件,并处理不同的语言。与原始脚本如HTML2FPDF相比,它的速度较慢,并且在使用Unicode字体时生成的文件较大,但支持CSS样式等,并进行了大量增强。支持几乎所有语言,包括RTL(阿拉伯语和希伯来语)和CJK(中日韩)。支持嵌套的块级元素(如P、DIV),

SublimeText3 Linux新版
SublimeText3 Linux最新版

螳螂BT
Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

SublimeText3汉化版
中文版,非常好用

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。