本文整理匯總了Python中ocgis.util.shp_cabinet.ShpCabinet.get_geom_dict方法的典型用法代碼示例。如果您正苦於以下問題:Python ShpCabinet.get_geom_dict方法的具體用法?Python ShpCabinet.get_geom_dict怎麽用?Python ShpCabinet.get_geom_dict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ocgis.util.shp_cabinet.ShpCabinet
的用法示例。
在下文中一共展示了ShpCabinet.get_geom_dict方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_shp
# 需要導入模塊: from ocgis.util.shp_cabinet import ShpCabinet [as 別名]
# 或者: from ocgis.util.shp_cabinet.ShpCabinet import get_geom_dict [as 別名]
def get_shp(request,key=None):
query = helpers.parse_qs(request.META['QUERY_STRING'])
select_ugid = SelectUgid()
select_ugid.parse_query(query)
prefix = Prefix()
prefix.parse_query(query)
unwrap = Unwrap()
unwrap.parse_query(query)
pm = PrimeMeridian()
pm.parse_query(query)
sc = ShpCabinet()
geom_dict = sc.get_geom_dict(key,attr_filter=select_ugid.value)
## unwrap coordinates if requested
if unwrap.value:
unwrap_geoms(geom_dict,pm.value)
dir_path = get_temp_path(nest=True,only_dir=True,wd=env.DIR_OUTPUT)
if prefix.value is None:
out_name = key
else:
out_name = prefix.value
filename = '{0}.shp'.format(out_name)
path = os.path.join(dir_path,filename)
path = sc.write(geom_dict,path)
path = os.path.split(path)[0]
resp = helpers._zip_response_(path,filename=filename.replace('shp','zip'))
return(resp)
示例2: _format_all_elements_
# 需要導入模塊: from ocgis.util.shp_cabinet import ShpCabinet [as 別名]
# 或者: from ocgis.util.shp_cabinet.ShpCabinet import get_geom_dict [as 別名]
def _format_all_elements_(self,value):
try:
minx,miny,maxx,maxy = value
geom = Polygon(((minx,miny),
(minx,maxy),
(maxx,maxy),
(maxx,miny)))
assert(geom.is_valid)
ret = [{'id':1,'geom':geom}]
except ValueError:
sc = ShpCabinet()
ret = sc.get_geom_dict(value[0])
return(ret)
示例3: _format_string_element_
# 需要導入模塊: from ocgis.util.shp_cabinet import ShpCabinet [as 別名]
# 或者: from ocgis.util.shp_cabinet.ShpCabinet import get_geom_dict [as 別名]
def _format_string_element_(self,value):
elements = value.split('|')
try:
elements = [float(e) for e in elements]
minx,miny,maxx,maxy = elements
geom = Polygon(((minx,miny),
(minx,maxy),
(maxx,maxy),
(maxx,miny)))
self._assert_(geom.is_valid)
ret = [{'ugid':1,'geom':geom}]
self._bounds = elements
except ValueError:
from ocgis.util.shp_cabinet import ShpCabinet
sc = ShpCabinet()
ret = sc.get_geom_dict(value)
return(ret)
示例4: nebraska
# 需要導入模塊: from ocgis.util.shp_cabinet import ShpCabinet [as 別名]
# 或者: from ocgis.util.shp_cabinet.ShpCabinet import get_geom_dict [as 別名]
def nebraska(self):
sc = ShpCabinet()
geom_dict = sc.get_geom_dict('state_boundaries',{'ugid':[16]})
return(geom_dict)
示例5: world_countries
# 需要導入模塊: from ocgis.util.shp_cabinet import ShpCabinet [as 別名]
# 或者: from ocgis.util.shp_cabinet.ShpCabinet import get_geom_dict [as 別名]
def world_countries(self):
sc = ShpCabinet()
ret = sc.get_geom_dict('world_countries')
return(ret)
示例6: state_boundaries
# 需要導入模塊: from ocgis.util.shp_cabinet import ShpCabinet [as 別名]
# 或者: from ocgis.util.shp_cabinet.ShpCabinet import get_geom_dict [as 別名]
def state_boundaries(self):
sc = ShpCabinet()
ret = sc.get_geom_dict('state_boundaries')
return(ret)
示例7: alaska
# 需要導入模塊: from ocgis.util.shp_cabinet import ShpCabinet [as 別名]
# 或者: from ocgis.util.shp_cabinet.ShpCabinet import get_geom_dict [as 別名]
def alaska(self):
sc = ShpCabinet()
ret = sc.get_geom_dict('state_boundaries',{'ugid':[51]})
return(ret)
示例8: california
# 需要導入模塊: from ocgis.util.shp_cabinet import ShpCabinet [as 別名]
# 或者: from ocgis.util.shp_cabinet.ShpCabinet import get_geom_dict [as 別名]
def california(self):
sc = ShpCabinet()
ret = sc.get_geom_dict('state_boundaries',{'ugid':[25]})
return(ret)