我正在尝试将我的数据库postgresql / postgis连接到mapguide maestro,但它向我发送了一条错误消息。
你对此有所了解,或者你能帮助我如何将它与我的数据库postgis连接起来吗?我正在使用postgresql 9.4,mapguide开源2.6.1和mapguide maestro 6.0
答案 0 :(得分:1)
您可能在未安装PostGIS的情况下连接到PostgreSQL数据库。
将PostGIS安装到该数据库(例如from tkinter import *
from tkinter import ttk
import sys
import csv
from csv import DictReader
class GUI:
def __init__(self, rootWindow):
#variable
sonumber = StringVar()
result = int()
#item1
self.label = ttk.Label(rootWindow, text="Shop Order:")
self.label.grid(row=1, column=1, sticky=(E), padx=3, pady=3)
self.SOentry = ttk.Entry(rootWindow, width=5, background="white", textvariable = sonumber)
self.SOentry.grid(row=1, column=2, sticky=(W, E), padx=3, pady=3)
#item2
self.label2 = ttk.Label(rootWindow, text="Quantity:")
self.label2.grid(row=1, column=3, sticky=(E), padx=3, pady=3)
self.outputQty = Text(rootWindow, width=5, height=1, background="white")
self.outputQty.grid(row=1, column=4, sticky=(W, E), padx=3, pady=3)
#item3
self.label3 = ttk.Label(rootWindow, text="Description:")
self.label3.grid(row=2, column=1, sticky=(E), padx=3, pady=3)
self.outputDesc = Text(rootWindow, width=5, height=1, background="white")
self.outputDesc.grid(row=2, column=2, columnspan=5, sticky=(W, E), padx=3, pady=3)
#output
self.label4 = ttk.Label(rootWindow, text="Drawings:")
self.label4.grid(row=3, column=1, sticky=(N,E), padx=3, pady=3)
self.dwgoutputbox = Text(rootWindow, width=50, height=15, background="white")
self.dwgoutputbox.grid(row=3, column=2, columnspan=5, padx=3, pady=3)
sys.stdout = TextRedirector(self.dwgoutputbox, "printdwgoutputbox") #redirects from shell to screen
#buttons
def DoASearch():
try:
print(int(sonumber.get()))
except ValueError:
messagebox.showwarning("Fail !!", "Please enter a valid Shop Order number.")
with open("lesspreadsheettest.csv") as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
result=(row['Shop Order'])
if sonumber == result:
print(row['Shop Order'], row['Part Number'], row['Description'])
self.searchbutton = ttk.Button(rootWindow, text="Search", command=DoASearch)
self.searchbutton.grid(row=1, column=7, sticky=W, padx=3, pady=3)
def clear_text():
self.SOentry.delete(0, 'end')
self.clrsearchbutton = ttk.Button(rootWindow, text="Reset", command=clear_text)
self.clrsearchbutton.grid(row=2, column=7, sticky=W, padx=3, pady=3)
#
self.exitbutton = ttk.Button(rootWindow, text="Exit", command=rootWindow.destroy)
self.exitbutton.grid(row=3, column=7, sticky=(N,W), padx=3, pady=3)
class TextRedirector(object):
def __init__(self, widget, tag="printdwgoutputbox"):
self.widget = widget
self.tag = tag
def write(self, str):
self.widget.configure(state="normal")
self.widget.insert("end", str, (self.tag,))
self.widget.configure(state="disabled")
def main():
global label
rootWindow = Tk()
rootWindow.title("Production Drawings")
rootWindow.geometry("575x325+600+300")
gui = GUI(rootWindow)
rootWindow.mainloop()
main()
My test csv code is
Shop Order Part Number Description Quantity
12345 5-1841111-1 Ferrari California 1
12346 5-1841222-2 Porsche 911 2
12347 5-1841333-3 Lamborghini Aventador 3
12348 5-1841444-4 Jaguar F-Type 4
12349 5-1841555-5 Bugatti Veyron 5
),或使用现有的PostGIS安装将连接设置修改为正确的主机/端口/ dbname。