楼主: igs816
3364 25

[其他] Python Geospatial Analysis Cookbook [推广有奖]

11
Elena3(真实交易用户) 发表于 2015-12-15 10:36:14

12
welcometoc(真实交易用户) 发表于 2015-12-16 16:44:14
谢谢分享

13
leejwen(真实交易用户) 发表于 2015-12-17 03:23:58
kankan

14
enjoylife(真实交易用户) 发表于 2015-12-17 15:54:04
谢谢!

15
tangor(真实交易用户) 在职认证  发表于 2015-12-18 14:59:07
要看内容就要回复,既然是这样的话,那我就回复一下...

16
Nicolle(真实交易用户) 学生认证  发表于 2016-3-26 08:33:36
提示: 作者被禁止或删除 内容自动屏蔽

17
lonestone(未真实交易用户) 在职认证  发表于 2016-12-23 09:06:25
好书啊!谢谢!

18
Lisrelchen(未真实交易用户) 发表于 2016-12-29 07:52:25

Converting a Shapefile to a PostGIS table using ogr2ogr

  1. How to do it...
  2. 1. Now, let's get into the actual importing of our Shapefile into a PostGIS database that
  3. will automatically create a new table from our Shapefile:
  4. #!/usr/bin/env python
  5. # -*- coding: utf-8 -*-
  6. import subprocess
  7. # database options
  8. db_schema = "SCHEMA=geodata"
  9. overwrite_option = "OVERWRITE=YES"
  10. geom_type = "MULTILINESTRING"
  11. output_format = "PostgreSQL"
  12. # database connection string
  13. db_connection = """PG:host=localhost port=5432
  14. user=pluto dbname=py_test password=stars"""
  15. # input shapefile
  16. input_shp = "../geodata/bikeways.shp"
  17. # call ogr2ogr from python
  18. subprocess.call(["ogr2ogr","-lco", db_schema, "-lco",
  19. overwrite_option,
  20. "-nlt", geom_type, "-f", output_format, db_connection,
  21. input_shp])
  22. 2. Next, we'll call our script from the command line:
  23. $ python ch03-01_shp2pg.py
复制代码

19
Nicolle(真实交易用户) 学生认证  发表于 2017-1-21 11:56:46
提示: 作者被禁止或删除 内容自动屏蔽

20
Nicolle(真实交易用户) 学生认证  发表于 2017-1-21 11:57:59
提示: 作者被禁止或删除 内容自动屏蔽

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jr
拉您进交流群
GMT+8, 2026-1-17 19:27