def createHtmlTileSettings(self, zoom): print("geospatial::mapTile::createHtmlTileSettings(self)") try: # Define the map object and its center. lat_center = self._tile_center[0] lon_center = self._tile_center[1] txt_map = "\t\t\tvar map = L.map('map');\n" # Set the tile layer with specific attributes. src = self._tile_src attr = self._tile_attribution minz = self._tile_minZoom maxz = self._tile_maxZoom sub = self._tile_subdomains txt_lay = '\t\t\tL.tileLayer("%s", {attribution: "%s",minZoom: %s, maxZoom: %s, subdomains: %s}).addTo(map);\n' % ( src, attr, minz, maxz, sub) txt_set = '\t\t\tmap.setView([%s, %s], %s);\n' % (lat_center, lon_center, zoom) # Return the value. return (txt_map + txt_lay + txt_set) except Exception as e: print( "Error occured in geospatial::mapTile::createHtmlTileSettings(self)" ) print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=self._language) return (None)
def changeConfig(parent): print("general::changeConfig(self)") try: # Get the root node of the configuration file. xml_config = ET.parse(parent.config_file).getroot() # Replace current settings by new values. for xml_child in xml_config: # Configurations for User Interface. if xml_child.tag == "theme": xml_child.find("language").text = parent.language # Language settings. xml_child.find("skin").text = parent.skin # Skin settings. if xml_child.tag == "project": xml_child.find("root").text = parent.root_directory # Current project. if xml_child.tag == "tools": xml_child.find("awb").text = parent.awb_algo # Auto white balance algorithm. xml_child.find("psp").text = parent.psp_algo # Pansharpen algorithm if xml_child.tag == "geoinfo": xml_child.find("maptile").text = parent.map_tile # Source for the map tile if xml_child.tag == "network": xml_child.find("proxy").text = parent.proxy # Proxy setting # Create a new tree object by new entries. tree = ET.ElementTree(xml_config) # Save the new configuration. tree.write(parent.config_file) except Exception as e: print("Error occured in general::changeConfig(self)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=parent.language) return(None)
def createPathIfNotExists(path): print("general::createPathIfNotExists(path)") try: if not os.path.exists(path): os.mkdir(path) return(True) except Exception as e: print("Error occured in general::createPathIfNotExists(parent)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return(False)
def createMarker(self): print("geospatial::mapMarker::createMarker(self)") try: txt_marker = "\t\t\tL.marker(%s).addTo(map);" % self._geometry return (txt_marker) except Exception as e: print("Error occured in geospatial::mapMarker::createMarker(self)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=self._language) return (None)
def loadConfig(parent, file_config): print("general::loadConfig(parent)") if os.path.exists(file_config): try: xml_config = ET.parse(file_config).getroot() for xml_child in xml_config: if xml_child.tag == "theme": parent.language = xml_child.find("language").text parent.skin = xml_child.find("skin").text elif xml_child.tag == "tools": parent.awb_algo = xml_child.find("awb").text parent.psp_algo = xml_child.find("psp").text elif xml_child.tag == "geoinfo": parent.map_tile = xml_child.find("maptile").text elif xml_child.tag == "network": parent.proxy = xml_child.find("proxy").text elif xml_child.tag == "project": if not xml_child.find("root").text == "": xml_root = xml_child.find("root").text if xml_root: if os.path.exists(xml_root): parent.root_directory = xml_child.find("root").text # Some essential directories are created under the root directory if they are not existed. parent.table_directory = os.path.join(parent.root_directory, "Table") parent.consolidation_directory = os.path.join(parent.root_directory, "Consolidation") # Define the DB file. parent.database = os.path.join(parent.table_directory, "project.db") # Check directories and files. if parent.root_directory == None: return(None) if parent.table_directory == None: return(None) if parent.consolidation_directory == None: return(None) if parent.database == None: return(None) if not os.path.exists(parent.root_directory): return(None) if not os.path.exists(parent.table_directory): return(None) if not os.path.exists(parent.consolidation_directory): return(None) if not os.path.exists(parent.database): return(None) # Return True return(True) except Exception as e: print("Error occured in general::loadConfig(self)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return(None)
def initAll(parent): print("general::initAll(parent)") try: # Define paths parent.root_directory = None parent.table_directory = None parent.consolidation_directory = None parent.database = None # Define the default extensions. parent.qt_image = [".BMP", ".GIF", ".JPG", ".JPEG", ".PNG", ".PBM", ".PGM", ".PPM", ".XBM", ".XPM"] parent.image_extensions = [".JPG", ".TIF", ".JPEG", ".TIFF", ".PNG", ".JP2", ".J2K", ".JPF", ".JPX", ".JPM"] parent.raw_image_extensions = [".RAW", ".ARW"] parent.sound_extensions = [".WAV"] # Difine the current objects parent.current_consolidation = None parent.current_material = None parent.current_file = None parent.current_camera = None # Initialize the flickr API keys. parent.flickr_apikey = None parent.flickr_secret = None # Initialize the map tile source. # Set the default settings. parent.language = "en" parent.skin = "grey" parent.map_tile = "OpenStreetMap" parent.proxy = "No Proxy" # Set default algorithms. parent.awb_algo = "retinex_adjusted" parent.psp_algo = "ihsConvert" # Initialyze the temporal directory. if not os.path.exists(parent.temporal_directory): # Create the temporal directory if not exists. os.mkdir(parent.temporal_directory) else: # Delete the existing temporal directory before create. shutil.rmtree(parent.temporal_directory) os.mkdir(parent.temporal_directory) except Exception as e: print("Error occured in general::initAll(parent)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return(None)
def proxySettingsTrue(self): print("configuration::toggleProxySettingsTrue(self)") try: self.rbtn_proxy.setChecked(True) self.txt_proxy.setEnabled(True) self.txt_proxy.setText(self._proxy) except Exception as e: print("Error occured in configuration::setSkin(self, icon_path)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=self._language) return (None)
def moveMapTo(parent, geoname, output, proxies=None): try: if not proxies == None: g = geocoder.arcgis(geoname, proxies=proxies) else: g = geocoder.arcgis(geoname) writeHtml(parent, output, map_zoom=15, map_center=g.latlng) except Exception as e: print("Error occured in geospatial::geoCoding(geoname, proxies=None)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=parent.language) return (None)
def createJsMapEvent(self): print("geospatial::mapEvent::createJsMapEvent(self)") try: txt_event = "\t\t\tmap.on('%s', %s);" % (self._script_event, self._script_function) return (txt_event) except Exception as e: print( "Error occured in geospatial::mapEvent::createJsMapEvent(self)" ) print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=self._language) return (None)
def geoCoding(geoname, proxies=None): print("geospatial::geoCoding(geoname, proxies=None)") try: if not proxies == None: g = geocoder.arcgis(geoname, proxies=proxies) else: g = geocoder.arcgis(geoname) return (g.latlng) except Exception as e: print("Error occured in geospatial::geoCoding(geoname, proxies=None)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=parent.language) return (None)
def setSkin(self, icon_path): print("configuration::setSkin(self, icon_path)") try: # Apply the new skin. setupConfigSkin.applyConfigWindowSkin(self, icon_path, skin=self._skin) setupConfigSkin.setConfigWindowButtonText(self) # Set the tool tips with the specific language. #setupConfigSkin.setMainWindowToolTips(self) except Exception as e: print("Error occured in configuration::setSkin(self, icon_path)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=self._language) return (None)
def refreshCameraParameters(self): print("configuration::refreshCameraParameters(self)") try: # Clear comboboxes for camera parameters. self.cbx_cam_size.clear() self.cbx_cam_iso.clear() self.cbx_cam_wht.clear() self.cbx_cam_exp.clear() self.cbx_cam_fval.clear() self.cbx_cam_qoi.clear() self.cbx_cam_fmod.clear() self.cbx_cam_epg.clear() self.cbx_cam_cpt.clear() self.cbx_cam_met.clear() except Exception as e: print("Error occured in main::refreshCameraParameters(self)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=self._language) return (None)
def initConfig(parent): print("general::initConfig(parent)") try: # Create the root node. root = ET.Element("config") # Create the theme node. theme = ET.SubElement(root, "theme") ET.SubElement(theme, "language").text = parent.language ET.SubElement(theme, "skin").text = parent.skin # Create the project node. project = ET.SubElement(root, "project") ET.SubElement(project, "root").text = "" # Create the tool node tools = ET.SubElement(root, "tools") ET.SubElement(tools, "awb").text = parent.awb_algo ET.SubElement(tools, "psp").text = parent.psp_algo # Create the tool node geoInfo = ET.SubElement(root, "geoinfo") ET.SubElement(geoInfo, "maptile").text = parent.map_tile # Create the network node. network = ET.SubElement(root, "network") ET.SubElement(network, "proxy").text = parent.proxy # Write the tree = ET.ElementTree(root) tree.write(parent.config_file) except Exception as e: print("Error occured in general::initConfig(self)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return(None)
def publishMap(self, output, zoom=15): print("geospatial::mapTile::publishMap(self, output, zoom=15)") try: saveAs = open(output, 'w') saveAs.write("<!DOCTYPE html>\n") saveAs.write("<html>\n") saveAs.write("\t<head>\n") saveAs.write("\t\t<title>%s</title>\n" % self._map_title) saveAs.write("\t\t<meta charset='utf-8' />\n") saveAs.write( "\t\t<meta name='viewport' content='width=device-width, initial-scale=1.0'>\n" ) saveAs.write("\t\t<link rel='stylesheet' href='%s' />\n" % self._map_style) saveAs.write("\t\t<script src='%s'></script>\n" % self._map_source) events = self._map_events if events != None and len(events) > 0: for event in events: saveAs.write("\t\t<script src='%s'></script>\n" % event.script_source) saveAs.write( "\t\t<style>body {padding: 0; margin: 0} html, body, #map {height: 100%; width: 100%;}</style>\n" ) saveAs.write("\t</head>\n") saveAs.write("\t<body>\n") saveAs.write("\t\t<div id='map'></div>\n") tileSettings = self._map_tile.createHtmlTileSettings(zoom) saveAs.write("\t\t<script>\n") saveAs.write(tileSettings) saveAs.write("\t\t</script>\n") markers = self._map_markers if markers != None and len(markers) > 0: for marker in markers: saveAs.write("\t\t<script>\n") saveAs.write("%s\n" % marker.createMarker()) saveAs.write("\t\t</script>\n") lines = self._map_lines if lines != None and len(lines) > 0: saveAs.write("\t\t<script>\n") saveAs.write("\t\t</script>\n") polys = self._map_polygons if polys != None and len(polys) > 0: saveAs.write("\t\t<script>\n") saveAs.write("\t\t</script>\n") if events != None and len(events) > 0: for event in events: saveAs.write("\t\t<script>\n") saveAs.write("%s\n" % event.createJsMapEvent()) saveAs.write("\t\t</script>\n") saveAs.write("\t</body>\n") saveAs.write("</html>\n") saveAs.close() except Exception as e: print("Error occured in publishMap(self, output, zoom=15)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=self._language) return (None)
def mediaImporter(sop_object, item_path, in_dir, mat_uuid, con_uuid, dbfile): print( "media::mediaImporter(sop_object, item_path, in_dir, mat_uuid, con_uuid, dbfile)" ) try: # Add a list for new objects if there are no objects. if sop_object.images == None: sop_object.images = list() if sop_object.sounds == None: sop_object.sounds = list() if sop_object.movies == None: sop_object.movies = list() if sop_object.texts == None: sop_object.texts = list() if sop_object.geometries == None: sop_object.geometries = list() # Define the path for saving files. img_path = os.path.join(item_path, "Images") general.createPathIfNotExists(img_path) img_path_main = os.path.join(img_path, "Main") general.createPathIfNotExists(img_path_main) img_path_raw = os.path.join(img_path, "Raw") general.createPathIfNotExists(img_path_raw) snd_path = os.path.join(item_path, "Sounds") general.createPathIfNotExists(snd_path) mov_path = os.path.join(item_path, "Movies") general.createPathIfNotExists(mov_path) txt_path = os.path.join(item_path, "Texts") general.createPathIfNotExists(txt_path) geo_path = os.path.join(item_path, "Geometries") general.createPathIfNotExists(geo_path) # Create empty lists for storeing file names. img_files = list() raw_files = list() snd_files = list() txt_files = list() mov_files = list() geo_files = list() err_files = list() for in_fl in in_dir: name, ext = os.path.splitext(in_fl) # Check the extension of the file and append the file name to the list. if checkMediaType(in_fl) == "image": img_files.append(in_fl) # Image file elif checkMediaType(in_fl) == "raw": raw_files.append(in_fl) # RAW file elif checkMediaType(in_fl) == "audio": snd_files.append(in_fl) # Audio file elif checkMediaType(in_fl) == "movie": mov_files.append(in_fl) # Movie file elif checkMediaType(in_fl) == "text": txt_files.append(in_fl) # Plane text elif checkMediaType(in_fl) == "geometry": geo_files.append(in_fl) # WKT files except Exception as e: print("Error occured in importing file settings.") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return (None) # Importing JPEG files. try: # Move main images from the temporal directory to the object's directory. if not (len(img_files) == 0 or img_files == None): for img_file in img_files: # Generate the GUID for the consolidation img_uuid = str(uuid.uuid4()) # Get current time. now = datetime.datetime.utcnow().isoformat() # Get the extension of the file main_name, main_ext = os.path.splitext(img_file) # Define the destination file path. main_dest = os.path.join(img_path_main, img_uuid + main_ext) # Copy the original file. shutil.copy(img_file, main_dest) # Instantiate the File class. sop_img_file = features.File(is_new=True, uuid=img_uuid, dbfile=None) sop_img_file.material = mat_uuid sop_img_file.consolidation = con_uuid sop_img_file.filename = general.getRelativePath( main_dest, "Consolidation") sop_img_file.created_date = now sop_img_file.modified_date = now sop_img_file.file_type = "image" sop_img_file.alias = "Imported" sop_img_file.status = "Original" sop_img_file.lock = False sop_img_file.public = False sop_img_file.source = "Nothing" sop_img_file.operation = "Importing" sop_img_file.operating_application = "Survey Data Collector" sop_img_file.caption = "Imported image" sop_img_file.description = "" # Execute the SQL script. sop_img_file.dbInsert(dbfile) # Add the image to the boject. sop_object.images.insert(0, sop_img_file) except Exception as e: print("Error occured in image file import.") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return (None) # Importing Raw files. try: if not (len(raw_files) == 0 or raw_files == None): for raw_file in raw_files: # Generate the GUID for the consolidation raw_uuid = str(uuid.uuid4()) # Get current time. now = datetime.datetime.utcnow().isoformat() # Get the extension of the file raw_name, raw_ext = os.path.splitext(raw_files) # Define the destination file path. raw_dest = os.path.join(img_path_raw, raw_uuid + raw_ext) # Copy the original file. shutil.copy(raw_file, raw_dest) # Instantiate the File class. sop_raw_file = features.File(is_new=True, uuid=raw_uuid, dbfile=None) sop_raw_file.material = mat_uuid sop_raw_file.consolidation = con_uuid sop_raw_file.filename = general.getRelativePath( main_dest, "Consolidation") sop_raw_file.created_date = now sop_raw_file.modified_date = now sop_raw_file.file_type = "image" sop_raw_file.alias = "Imported" sop_raw_file.status = "Original(RAW)" sop_raw_file.lock = False sop_raw_file.public = False sop_raw_file.source = "Nothing" sop_raw_file.operation = "Importing" sop_raw_file.operating_application = "Survey Data Collector" sop_raw_file.caption = "Imported image" sop_raw_file.description = "" # Execute the SQL script. sop_raw_file.dbInsert(dbfile) # Add the image to the boject. sop_object.images.insert(0, sop_raw_file) except Exception as e: print("Error occured in raw file import.") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return (None) # Importing Sound files. try: if not (len(snd_files) == 0 or snd_files == None): for snd_file in snd_files: # Generate the GUID for the consolidation snd_uuid = str(uuid.uuid4()) # Get current time. now = datetime.datetime.utcnow().isoformat() # Get the extension of the file snd_name, snd_ext = os.path.splitext(snd_file) # Define the destination file path. snd_dest = os.path.join(snd_path, snd_uuid + snd_ext) # Copy the original file. shutil.copy(snd_file, snd_dest) # Instantiate the File class. sop_snd_file = features.File(is_new=True, uuid=None, dbfile=None) sop_snd_file.material = mat_uuid sop_snd_file.consolidation = con_uuid sop_snd_file.filename = general.getRelativePath( snd_dest, "Consolidation") sop_snd_file.created_date = now sop_snd_file.modified_date = now sop_snd_file.file_type = "audio" sop_snd_file.alias = "Imported" sop_snd_file.status = "Original" sop_snd_file.lock = False sop_snd_file.public = False sop_snd_file.source = "Nothing" sop_snd_file.operation = "Importing" sop_snd_file.operating_application = "Survey Data Collector" sop_snd_file.caption = "Original audio" sop_snd_file.description = "" # Insert the new entry into the database. sop_snd_file.dbInsert(dbfile) # Add the image to the boject. sop_object.sounds.insert(0, sop_snd_file) except Exception as e: print("Error occured in sound file import.") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return (None) # Importing Texts files. try: if not (len(txt_files) > 0 or txt_files == None): for txt_file in txt_files: # Generate the GUID for the consolidation txt_uuid = str(uuid.uuid4()) # Get current time. now = datetime.datetime.utcnow().isoformat() # Get the extension of the file txt_name, txt_ext = os.path.splitext(mov_path) # Define the destination file path. txt_dest = os.path.join(txt_path, txt_uuid + txt_ext) # Copy the original file. shutil.copy(txt_file, txt_dest) # Instantiate the File class. sop_txt_file = features.File(is_new=True, uuid=txt_uuid, dbfile=None) sop_txt_file.material = mat_uuid sop_txt_file.consolidation = con_uuid sop_txt_file.filename = general.getRelativePath( txt_dest, "Consolidation") sop_txt_file.created_date = now sop_txt_file.modified_date = now sop_txt_file.file_type = "text" sop_txt_file.alias = "Imported" sop_txt_file.status = "Original" sop_txt_file.lock = False sop_txt_file.public = False sop_txt_file.source = "Nothing" sop_txt_file.operation = "Importing" sop_txt_file.operating_application = "Survey Data Collector" sop_txt_file.caption = "Original text" sop_txt_file.description = "" # Insert the new entry into the database. sop_txt_file.dbInsert(dbfile) # Add the image to the boject. sop_object.texts.insert(0, sop_txt_file) except Exception as e: print("Error occured in text file import.") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return (None) # Importing movies files. try: if not (len(mov_files) == 0 or mov_files == None): for mov_file in mov_files: # Generate the GUID for the consolidation mov_uuid = str(uuid.uuid4()) # Get current time. now = datetime.datetime.utcnow().isoformat() # Get the extension of the file mov_name, mov_ext = os.path.splitext(mov_file) # Define the destination file path. mov_dest = os.path.join(mov_path, mov_uuid + mov_ext) # Copy the original file. shutil.copy(mov_file, mov_dest) # Instantiate the File class. sop_mov_file = features.File(is_new=True, uuid=mov_uuid, dbfile=None) sop_mov_file.material = mat_uuid sop_mov_file.consolidation = con_uuid sop_mov_file.filename = general.getRelativePath( mov_dest, "Consolidation") sop_mov_file.created_date = now sop_mov_file.modified_date = now sop_mov_file.file_type = "movie" sop_mov_file.alias = "Imported" sop_mov_file.status = "Original" sop_mov_file.lock = False sop_mov_file.public = False sop_mov_file.source = "Nothing" sop_mov_file.operation = "Importing" sop_mov_file.operating_application = "Survey Data Collector" sop_mov_file.caption = "Original text" sop_mov_file.description = "" # Insert the new entry into the database. sop_mov_file.dbInsert(dbfile) # Add the image to the boject. sop_object.movies.insert(0, sop_mov_file) except Exception as e: print("Error occured in movie file import.") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return (None) # Importing geoies files. try: if not (len(geo_files) == 0 or geo_files == None): for geo_file in geo_files: # Generate the GUID for the consolidation geo_uuid = str(uuid.uuid4()) # Get current time. now = datetime.datetime.utcnow().isoformat() # Define the destination file path. geo_dest = os.path.join(geo_path, geo_uuid + ".wkt") # Copy the original file. shutil.copy(geo_file, geo_dest) # Instantiate the File class. sop_geo_file = features.File(is_new=True, uuid=geo_uuid, dbfile=None) sop_geo_file.material = mat_uuid sop_geo_file.consolidation = con_uuid sop_geo_file.filename = general.getRelativePath( geo_dest, "Consolidation") sop_geo_file.created_date = now sop_geo_file.modified_date = now sop_geo_file.file_type = "geometry" sop_geo_file.alias = "Imported" sop_geo_file.status = "Original" sop_geo_file.lock = False sop_geo_file.public = False sop_geo_file.source = "Nothing" sop_geo_file.operation = "Importing" sop_geo_file.operating_application = "Survey Data Collector" sop_geo_file.caption = "Original geometry" sop_geo_file.description = "" # Insert the new entry into the database. sop_geo_file.dbInsert(dbfile) # Add the image to the boject. sop_object.geoies.insert(0, sop_geo_file) except Exception as e: print("Error occured in geoie file import.") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language="en") return (None)
def showImage(self): print("imageInformationDialog::showImage(self)") try: # Get the full path of the image. if not os.path.exists( os.path.join(self._root_directory, self._sop_file.filename)): img_file_path = os.path.join( os.path.join(self._source_directory, "images"), "noimage.jpg") else: img_file_path = os.path.join(self._root_directory, self._sop_file.filename) # Get container size. panel_w = self.lbl_img_thumb.width() panel_h = self.lbl_img_thumb.height() # Check whether the image is Raw image or not. if not self.imageIsValid(img_file_path) == True: # Extract the thumbnail image from the RAW image by using "dcraw". imageProcessing.getThumbnail(img_file_path) # Get the extracted thumbnail image. img_file_path = os.path.splitext( img_file_path)[0] + ".thumb.jpg" if os.path.exists(img_file_path): # Create the container for displaying the image org_pixmap = QPixmap(img_file_path) scl_pixmap = org_pixmap.scaled(panel_w, panel_h, Qt.KeepAspectRatio) # Set the image file to the image view container. self.lbl_img_thumb.setPixmap(scl_pixmap) # Show the selected image. self.lbl_img_thumb.show() else: # Create error messages. error_title = "エラーが発生しました" error_msg = "このファイルはプレビューに対応していません。" error_info = "諦めてください。RAW + JPEG で撮影することをお勧めします。" error_icon = QMessageBox.Critical error_detailed = str(e) # Handle error. general.alert(title=error_title, message=error_msg, icon=error_icon, info=error_info, detailed=error_detailed) # Returns nothing. return (None) except Exception as e: print("Error occurs in imageInformationDialog::showImage(self)") # Show the error message. error.ErrorMessageUnknown(details=str(e)) # Return nothing. return (None)
def writeHtml(parent, output, map_zoom=2, map_center=[32.6759094, 129.4209844], markers=None): print( "geospatial::writeHtml(parent, output, map_zoom = 2, map_center = [32.6759094,129.4209844], markers = None)" ) try: if parent.map_tile == "OpenStreetMap": # OpenStreetMap src = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" attr = "Map data © <a href='https://www.openstreetmap.org/'>OpenStreetMap</a>contributors, <a href='https://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>, Imagery © <a href='https://www.mapbox.com/'>Mapbox</a>" minz = 0 maxz = 19 sub = "'abc'" elif parent.map_tile == "Google Streets": # Google Streets src = "http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}" attr = "Google Streets" minz = 0 maxz = 20 sub = "['mt0','mt1','mt2','mt3']" elif parent.map_tile == "Google Hybrid": # Google Hybrid src = "http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}" attr = "Google Hybrid" minz = 0 maxz = 20 sub = "['mt0','mt1','mt2','mt3']" elif parent.map_tile == "Google Satellite": # Google Satellite src = "http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}" attr = "Google Satellite" minz = 0 maxz = 20 sub = "['mt0','mt1','mt2','mt3']" elif parent.map_tile == "Google Terrain": # Google Terrain src = "http://{s}.google.com/vt/lyrs=p&x={x}&y={y}&z={z}" attr = "Google Terrain" minz = 0 maxz = 20 sub = "['mt0','mt1','mt2','mt3']" elif parent.map_tile == u"地理院タイル": src = "https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png" attr = u"地理院タイル" minz = 0 maxz = 18 else: src = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" attr = "Map data © <a href='https://www.openstreetmap.org/'>OpenStreetMap</a>contributors, <a href='https://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>, Imagery © <a href='https://www.mapbox.com/'>Mapbox</a>" minz = 0 maxz = 19 sub = "'abc'" # Generate the click event to get geographic coordinates from the map. newEvent = mapEvent(src='lib/copyToClipboard.js', event='click', func='copyCoord') # Generate the background map tile from the given map server. newTile = mapTile(name='', src=src, cntr=map_center, attr=attr, minz=minz, maxz=maxz, sub=sub) # Generate the map objects. newMap = mapObject(title='Get Coordinates from the Map', tile=newTile, markers=markers, events=[newEvent]) # Publish map for leaflet. newMap.publishMap(output, zoom=map_zoom) except Exception as e: print("Error occured in main::createMapByLocationName(self)") print(str(e)) error.ErrorMessageUnknown(details=str(e), show=True, language=parent.language) return (None)