计算机中丢失spatialite,SpatiaLite 快速入门

创建一个新的数据库并从 north_carolina 数据集读取两个 shp 文件。

user@osgeo-6:~$ spatialite test.sqlite

SpatiaLite version ..: 3.1.0-RC2 Supported Extensions:

- 'VirtualShape' [direct Shapefile access]

- 'VirtualDbf' [direct DBF access]

- 'VirtualXL' [direct XLS access]

- 'VirtualText' [direct CSV/TXT access]

- 'VirtualNetwork' [Dijkstra shortest path]

- 'RTree' [Spatial Index - R*Tree]

- 'MbrCache' [Spatial Index - MBR cache]

- 'VirtualSpatialIndex' [R*Tree metahandler]

- 'VirtualFDO' [FDO-OGR interoperability]

- 'SpatiaLite' [Spatial SQL - OGC]

PROJ.4 version ......: Rel. 4.8.0, 6 March 2012

GEOS version ........: 3.3.3-CAPI-1.7.4

SQLite version ......: 3.7.9

Enter ".help" for instructions

spatialite>

spatialite> .loadshp data/north_carolina/shape/schools_wake schools utf-8 3358

spatialite> .loadshp data/north_carolina/shape/roadsmajor roads utf-8 3358

在 .loadshp 命令中第一项为目标文件名(无 .shp 扩展名),第二项为目标表单,然后是字符编码和投影系统的 EPSG 代码。

查询 42 高速公路周围的学校:

spatialite> SELECT s.NAMESHORT, s.ADDRNUMBER, s.ADDRROOT

...> FROM schools AS s, roads AS r

...> WHERE r.ROAD_NAME = "NC-42" AND

...> ST_Distance(s.Geometry, r.Geometry) < 1000;

FUQUAY-VARINA|6600|Johnson Pond Rd

WILLOW SPRINGS|6800|Dwight Rowland Rd

FUQUAY-VARINA|109|N Ennis St

LINCOLN HEIGHTS|307|Bridge St

输出:

最后,我们可以对逗号分隔的 “schools_rt42.txt” 文本文件作查询:

spatialite> .mode csv

spatialite> .output "schools_rt42.txt"

spatialite> SELECT s.NAMESHORT, s.ADDRNUMBER, s.ADDRROOT

...> FROM schools AS s, roads AS r

...> WHERE r.ROAD_NAME = "NC-42" AND

...> ST_Distance(s.Geometry, r.Geometry) < 1000;

spatialite>.q

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值