def __signal_pbCopyKml_clicked(self, cheked):
   # Extent Openlayers
   action = "map.getExtent().toGeometry().toString();" 
   wkt = self.webViewMap.page().mainFrame().evaluateJavaScript(action)
   rect = core.QgsGeometry.fromWkt(wkt).boundingBox()
   srsGE = core.QgsCoordinateReferenceSystem(4326, core.QgsCoordinateReferenceSystem.EpsgCrsId) 
   coodTrans = core.QgsCoordinateTransform(self.__srsOL, srsGE)
   rect = coodTrans.transform(rect, core.QgsCoordinateTransform.ForwardTransform)
   line = core.QgsGeometry.fromRect(rect).asPolygon()[0]
   wkt = str(core.QgsGeometry.fromPolyline(line).exportToWkt() )
   # Kml
   proj4 = str( srsGE.toProj4() )
   kmlLine = bindogr.exportKml(wkt, proj4)
   kml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"\
         "<kml xmlns=\"http://www.opengis.net/kml/2.2\" " \
         "xmlns:gx=\"http://www.google.com/kml/ext/2.2\" " \
         "xmlns:kml=\"http://www.opengis.net/kml/2.2\" " \
         "xmlns:atom=\"http://www.w3.org/2005/Atom\">" \
         "<Placemark>" \
         "<name>KML from Plugin Openlayers Overview for QGIS</name>" \
         "<description>Extent of openlayers map from Plugin Openlayers Overview for QGIS</description>"\
         "%s" \
         "</Placemark></kml>" % kmlLine
   clipBoard = QApplication.clipboard()
   clipBoard.setText(kml)
예제 #2
0
 def __signal_pbCopyKml_clicked(self, cheked):
   # Extent Openlayers
   action = "map.getExtent().toGeometry().toString();" 
   wkt = self.webViewMap.page().mainFrame().evaluateJavaScript(action).toString()
   rect = core.QgsGeometry.fromWkt(wkt).boundingBox()
   srsGE = core.QgsCoordinateReferenceSystem(4326, core.QgsCoordinateReferenceSystem.EpsgCrsId) 
   coodTrans = core.QgsCoordinateTransform(self.__srsOL, srsGE)
   rect = coodTrans.transform(rect, core.QgsCoordinateTransform.ForwardTransform)
   line = core.QgsGeometry.fromRect(rect).asPolygon()[0]
   wkt = str(core.QgsGeometry.fromPolyline(line).exportToWkt() )
   # Kml
   proj4 = str( srsGE.toProj4() )
   kmlLine = bindogr.exportKml(wkt, proj4)
   kml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"\
         "<kml xmlns=\"http://www.opengis.net/kml/2.2\" " \
         "xmlns:gx=\"http://www.google.com/kml/ext/2.2\" " \
         "xmlns:kml=\"http://www.opengis.net/kml/2.2\" " \
         "xmlns:atom=\"http://www.w3.org/2005/Atom\">" \
         "<Placemark>" \
         "<name>KML from Plugin Openlayers Overview for QGIS</name>" \
         "<description>Extent of openlayers map from Plugin Openlayers Overview for QGIS</description>"\
         "%s" \
         "</Placemark></kml>" % kmlLine
   clipBoard = QtGui.QApplication.clipboard()
   clipBoard.setText(kml)