def shaperead(fn, encoding=None): ''' Returns a layer readed from a shape file. :param fn: (*string*) The shape file name (.shp). :param encoding: (*string*) Encoding :returns: (*MILayer*) The created layer. ''' if not fn.endswith('.shp'): fn = fn + '.shp' if not os.path.exists(fn): fn = os.path.join(migl.get_map_folder(), fn) if os.path.exists(fn): try: if encoding is None: encoding = IOUtil.encodingDetectShp(fn) if encoding == 'ISO8859_1': encoding = 'UTF-8' layer = MILayer(MapDataManage.readMapFile_ShapeFile(fn, encoding)) if not layer.legend() is None: lb = layer.legend().getLegendBreaks()[0] if lb.getBreakType() == BreakTypes.PolygonBreak: lb.setDrawFill(False) return layer except: raise else: print 'File not exists: ' + fn raise
def shaperead(fn): ''' Returns a layer readed from a shape file. :param fn: (*string*) The shape file name (.shp). :returns: (*MILayer*) The created layer. ''' if not fn.endswith('.shp'): fn = fn + '.shp' if not os.path.exists(fn): fn = os.path.join(migl.mapfolder, fn) if os.path.exists(fn): try: layer = MILayer(MapDataManage.loadLayer(fn)) if not layer.legend() is None: lb = layer.legend().getLegendBreaks()[0] if lb.getBreakType() == BreakTypes.PolygonBreak: lb.setDrawFill(False) return layer except: raise else: print 'File not exists: ' + fn raise
def georead(fn): ''' Returns a layer readed from a supported geo-data file. :param fn: (*string*) The supported geo-data file name (shape file, wmp, geotiff, image, bil...). :returns: (*MILayer*) The created layer. ''' if not os.path.exists(fn): mapfolder = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../map') fn = os.path.join(mapfolder, fn) if os.path.exists(fn): try: layer = MILayer(MapDataManage.loadLayer(fn)) if not layer.legend() is None: lb = layer.legend().getLegendBreaks()[0] if lb.getBreakType() == BreakTypes.PolygonBreak: lb.setDrawFill(False) return layer except: raise else: print 'File not exists: ' + fn raise IOError
def maplayer(shapetype='polygon'): ''' Create a new map layer. :param shapetype: (*string*) Shape type of the layer. ['point' | 'line' | 'polygon']. :returns: (*MILayer*) MILayer object. ''' return MILayer(shapetype=shapetype)
def trajsplayer(self): if self.dataset.isTrajData(): return MILayer( self.dataset.getDataInfo().createTrajStartPointLayer()) else: return None
def trajlayer(self): if self.dataset.isTrajData(): return MILayer(self.dataset.getDataInfo().createTrajLineLayer()) else: return None