交通安全に係るビッグデータを活用するためのデータプラットフォーム構築の試み
94/110

88 if start>end: #QMessageBox.warning(self, "設定エラー", u"事故期間の開始時間は終了時間より遅いのは間違えている") message=QMessageBox() message.setIcon(QMessageBox.Critical) message.setWindowTitle(u"設定エラー") message.setText(u"開始時間は終了時間より遅いのは間違えている") message.setStandardButtons(QMessageBox.Ok) if self.dlg.crash_map.currentIndex()==0: self.dlg.mesh_comboBox_start.setCurrentIndex(0) else: self.dlg.plot_comboBox_start.setCurrentIndex(0) message.exec_() def load_drm(self): #load the drm into the project drm_location=currentPath+"¥¥drm¥¥2016toyota.shp" drm_layer=QgsVectorLayer(drm_location,u"デジタル道路地図","ogr") props0 = drm_layer.rendererV2().symbol().symbolLayer(0) props0.setColor(QColor(202,205,203)) props0.setWidth(0.10) QgsMapLayerRegistry.instance().addMapLayer(drm_layer) #load the drm into the project def load_plot(self,size,start,end,flag): map_canvas=self.iface.mapCanvas() map_canvas.freeze(True) self.load_drm() if size==1: zone_location=currentPath+"¥¥map¥¥school¥¥map.shp" zone_name=u"小学校区" else: if size==2: zone_location=currentPath+"¥¥map¥¥choaza¥¥map.shp" zone_name=u"町字区分" else: zone_location=currentPath+"¥¥map¥¥shozone¥¥map.shp" zone_name=u"小ゾーン" zone_layer = QgsVectorLayer(zone_location,zone_name,"ogr") #change properties of zone_layer props0 = zone_layer.rendererV2().symbol().symbolLayer(0).properties() props0[u'outline_width'] = u'0.10' props0[u'color'] = u'0,0,0,0' Symbol0 = QgsFillSymbolV2.createSimple(props0) zone_layer.rendererV2().setSymbol(Symbol0) QgsMapLayerRegistry.instance().addMapLayer(zone_layer) #load the selected crash data from shape crashPath=currentPath+"¥¥crash¥¥crash.shp" crash_layer=QgsVectorLayer(crashPath,"crash","ogr") if flag==1: sql_sentence='"rwd"<=2 AND"year">=%s AND "year"<=%s'%(start,end) else: sql_sentence='"rwd">=0 AND"year">=%s AND "year"<=%s'%(start,end) crash_layer.setSubsetString(sql_sentence)

元のページ  ../index.html#94

このブックを見る