Python 空間資料處理

2021-07-22 15:01:37 字數 3645 閱讀 6099

from geopy.geocoders import nominatim

geolocator = nominatim()

location = geolocator.geocode("中國人民大學")

print(location.address)

中國人民大學, 人民大學北路, 稻香園南社群, 海淀區, 北京市, 100872, 中國
print((location.latitude, location.longitude))
(39.96976785, 116.307086480528)
location1 = geolocator.reverse("29.60173, 103.48222")

print location1.address

名山中路, 峨眉山市, 峨眉山市 / emeishan, 樂山市 / leshan, 四川省, 中國
location1.point
point(29.6015657, 103.4791074, 0.0)
location1.raw
,

u'boundingbox': [u'29.5996549',

u'29.6015657',

u'103.4791074',

u'103.4885191'],

u'display_name': u'\u540d\u5c71\u4e2d\u8def, \u5ce8\u7709\u5c71\u5e02, \u5ce8\u7709\u5c71\u5e02 / emeishan, \u4e50\u5c71\u5e02 / leshan, \u56db\u5ddd\u7701, \u4e2d\u56fd',

u'lat': u'29.6015657',

u'lon': u'103.4791074',

u'osm_id': u'297311246',

u'osm_type': u'way',

u'place_id': u'125494104'}

from geopy.distance  import vincenty,great_circle

newport_ri = (29.60173, 103.48222) #峨眉山

cleveland_oh = (39.96976785, 116.307086480528) # 中國人民大學

print(vincenty(newport_ri, cleveland_oh).km)

1640.02356001
print(great_circle(newport_ri,cleveland_oh).km)

aa=great_circle(newport_ri,cleveland_oh)

1640.52238261
from geopy import location

aa=location(address="峨眉山")

print aa.address

峨眉山
import urllib2

from bs4 import beautifulsoup

defgetdetailurl

(search_add):

nominatim=""

search_url=nominatim+"search.php?q=%s&polygon=1" %search_add

# urllib2.urlopen(search_url)

req=urllib2.request(search_url)

cont=beautifulsoup(urllib2.urlopen(req))

detail_url_suffix=cont.find('a',class_="btn btn-default btn-xs details")

detail_url=nominatim+detail_url_suffix['href']

detail_cont=beautifulsoup(urllib2.urlopen(detail_url))

return detail_cont

search_add="中國人民大學"

detail_cont=getdetailurl(search_add)

print detail_cont.find("table",id="locationdetails").text
name 中國人民大學 (name)

chinesische volksuniversität (name:de)

renmin university of china (name:en)

université populaire de chine (name:fr)

中國人民大學 (name:zh)

typeamenity:university

last updated2015-12-25 09:18

admin level15

rankother: 30

coveragepolygon

centre point39.96976785,116.307086480528

osmway 30725330

extra tags (website)

print detail_cont.find("table",id="address").text
local name

type

osmadmin level

distance

中國人民大學

amenity:university

0details >

人民大學北路

highway:residential

way 165743483150

details >

稻香園南社群

place:village

node 2036482794150

details >

海淀路社群

place:village

node 2449570839150

details >

海淀區place:suburb

relation 550598460

details >

北京市place:state

relation 91294040

details >

100872

place:postcode

0details >

中國place:country

relation 270056

2~13 m

details >

cnplace:country_code

0details >

Sql Server 空間資料

1 地理座標系空間需要用geography 平面座標系空間用geometry,計算距離使用stdistance 字串裡經緯度的順序是 經度 空格 緯度 即 longitude latitude 如果要計算兩個lat lon點之間的實際距離就需要將geometry型別轉成geography型別,不然結...

空間資料轉換引擎

引擎採用windows com方式開發,二次開發者可以直接使用所提供的元件進行二次開發。支援第三方嵌入開發 第三方根據引擎提供介面,實現其特定格式檔案轉換,編譯成動態庫後可直接嵌入引擎內部,實現無縫連線。軟體實現的功能是支援以下格式空間資料格式相互轉換 arc view shape 檔案 arc i...

空間資料的採掘

近年來,資料採掘研究多針對於關聯式資料庫,但是空間資料庫系統的發展為我們提供了豐富的空間資料,為資料分析和知識發現展示了廣闊的前景。空間資料探勘技術幫助人們從龐大的空間資料中抽取有用資訊。由於空間資料的數量龐大及空間問題的特殊性,因此發現隱含在空間資料中的特徵和模式,已成為空間資料庫的乙個重要問題。...