當前位置: 首頁>>代碼示例>>Python>>正文


Python ShpCabinet.get_geom_dict方法代碼示例

本文整理匯總了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)
開發者ID:aashish24,項目名稱:ocgis,代碼行數:36,代碼來源:views.py

示例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)
開發者ID:aashish24,項目名稱:ocgis,代碼行數:15,代碼來源:parms.py

示例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)
開發者ID:aashish24,項目名稱:ocgis,代碼行數:19,代碼來源:OLD_definition.py

示例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)
開發者ID:doutriaux1,項目名稱:ocgis,代碼行數:6,代碼來源:test_360.py

示例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)
開發者ID:aashish24,項目名稱:ocgis,代碼行數:6,代碼來源:OLD_work.py

示例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)
開發者ID:aashish24,項目名稱:ocgis,代碼行數:6,代碼來源:OLD_work.py

示例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)
開發者ID:aashish24,項目名稱:ocgis,代碼行數:6,代碼來源:OLD_work.py

示例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)
開發者ID:aashish24,項目名稱:ocgis,代碼行數:6,代碼來源:OLD_work.py


注:本文中的ocgis.util.shp_cabinet.ShpCabinet.get_geom_dict方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。