Skip to content

Instantly share code, notes, and snippets.

View iliasmachairas's full-sized avatar

iliasmachairas

View GitHub Profile
layout_name = f"Layout_{filename_without_extension}"
layout_manager = project.layoutManager()
layout = QgsPrintLayout(project)
layout.setName(layout_name)
layout.initializeDefaults()
layout_manager.addLayout(layout)
project.write(path_project)
exporter = QgsLayoutExporter(layout)
settings = QgsLayoutExporter.ImageExportSettings()
settings.dpi = 300
result = exporter.exportToImage(path_image, settings)
exporter.exportToPdf(path_pdf, QgsLayoutExporter.PdfExportSettings())
project.clear()
path_shp = "F:\\Tutorials\\Layout_plot_qgis\\periphereies (1)\\periphereies\\periphereies.shp"
prefectures = QgsVectorLayer(path_shp, 'prefectures', 'ogr')
prefectures.loadNamedStyle(style_prefecture_path)
if not prefectures.isValid():
print("Layer failed to load!")
else:
QgsProject.instance().addMapLayer(prefectures)
individual_prefecture = QgsVectorLayer(filepath, filename_without_extension, 'ogr')
for filename in os.listdir(input_directory):
if filename.endswith(".shp"):
filepath = os.path.join(input_directory, filename)
filename_without_extension = os.path.splitext(os.path.basename(filename))[0]
project_name = f"QGIS_Project_{filename_without_extension}.qgz"
path_project = os.path.join(qgis_project_directory, project_name)
path_image = os.path.join(export_images_directory, f"image_{filename_without_extension}.png")
path_pdf = os.path.join(export_pdf_directory, f"{filename_without_extension}.pdf")
<!DOCTYPE html>
<html>
<head>
<title>Form Result</title>
</head>
<body>
<h2>Form Submission Result</h2>
<p>Name: {{ name }}</p>
<p>Date: {{ date }}</p>
<p>Location: {{ location }}</p>
<label for="location">Location:</label><br>
<select id="location" name="location">
<option value="New York">New York</option>
<option value="London">London</option>
<option value="Paris">Paris</option>
<option value="Tokyo">Tokyo</option>
</select><br><br>
<label for="name">Name:</label><br>
<input type="text" id="name" name="name"><br><br>
from flask import Flask, render_template, request, redirect, url_for
from twilio.rest import Client
# Your Twilio Account SID and Auth Token
account_sid = 'your_account_sid'
auth_token = 'your_auth_toekn'
# Initialize Twilio client
client = Client(account_sid, auth_token)
import os
from eodag import EODataAccessGateway, setup_logging
from datetime import datetime
setup_logging(0)
config_file = "config.yaml"
dag = EODataAccessGateway(config_file)
search_results, total_count = dag.search(
<!DOCTYPE html>
<html>
<head>
<title>Appointment Form</title>
</head>
<body>
<h2>Enter Your Information</h2>
<form action="/submit" method="post">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name"><br><br>