geomfromtext insert in spatialite from retrived textSolutions for INSERT OR UPDATE on SQL ServerHow to randomly select an item from a list?Inserting multiple rows in a single SQL query?“INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”How to insert an item into an array at a specific index (JavaScript)?How do you read from stdin?Why can't Python parse this JSON data?How to insert an element after another element in JavaScript without using a library?Why is reading lines from stdin much slower in C++ than Python?How to remove a key from a Python dictionary?
Rudin 2.10 (b) Example
Zonal Statistics is returning null values in ArcGIS
What is this word supposed to be?
Multiple fireplaces in an apartment building?
How long after the last departure shall the airport stay open for an emergency return?
How can I get rid of an unhelpful parallel branch when unpivoting a single row?
Combinatorics problem, right solution?
Mistake in years of experience in resume?
How exactly does Hawking radiation decrease the mass of black holes?
std::unique_ptr of base class holding reference of derived class does not show warning in gcc compiler while naked pointer shows it. Why?
How do I produce this Greek letter koppa: Ϟ in pdfLaTeX?
What was Apollo 13's "Little Jolt" after MECO?
What is the term for a person whose job is to place products on shelves in stores?
Can a stored procedure reference the database in which it is stored?
Why did C use the -> operator instead of reusing the . operator?
Why do distances seem to matter in the Foundation world?
How did Captain America manage to do this?
Could moose/elk survive in the Amazon forest?
Israeli soda type drink
"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"
How much of a wave function must reside inside event horizon for it to be consumed by the black hole?
A Paper Record is What I Hamper
Older movie/show about humans on derelict alien warship which refuels by passing through a star
Multiple options vs single option UI
geomfromtext insert in spatialite from retrived text
Solutions for INSERT OR UPDATE on SQL ServerHow to randomly select an item from a list?Inserting multiple rows in a single SQL query?“INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”How to insert an item into an array at a specific index (JavaScript)?How do you read from stdin?Why can't Python parse this JSON data?How to insert an element after another element in JavaScript without using a library?Why is reading lines from stdin much slower in C++ than Python?How to remove a key from a Python dictionary?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Attempting to build a data entry form, I would like to create geometry points from the longitude.get() and latitude.get() values. However, the pasted code below doesn't work, probably due to some syntax error from my side (I suspect that python reads som parts of the geofromtext as a string) but I don't know how to proceed otherwise.
Does anyone see my error?
I have tried to change the code as per the specification of the spatialite documentation but without success so far. I suspect some syntax error frpm my side.
Is there any obvious mistake?
Here is the relevant code:
date = datetime.date(int(year.get()),int(month.get()), int(day.get()))
narratif=T.get("1.0","end-1c")
c.execute("""INSERT INTO Incidents
(Geometry, Datestamp, Description, Place, Latitude, Longitude, Precision, Intimidation, Destruction, Burglary,
Carjacking, Theft, Assault, Sexualassault, Abduction, Homicide, Shooting, Explosive, Narrative)
VALUES(GeomFromText('POINT(? ?)', 4326),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", (longitude.get(), latitude.get(), date, description.get(),place.get(),latitude.get(), longitude.get(), precision.get(), intimidation1.get(),destruction2.get(), burglary3.get(), carjacking4.get(), theft5.get(), assault6.get(), sexualassault7.get(), abduction8.get(), homicide9.get(), shooting10.get(), explosive11.get(), narratif))
con.commit()
python sqlite3 insert spatialite
add a comment |
Attempting to build a data entry form, I would like to create geometry points from the longitude.get() and latitude.get() values. However, the pasted code below doesn't work, probably due to some syntax error from my side (I suspect that python reads som parts of the geofromtext as a string) but I don't know how to proceed otherwise.
Does anyone see my error?
I have tried to change the code as per the specification of the spatialite documentation but without success so far. I suspect some syntax error frpm my side.
Is there any obvious mistake?
Here is the relevant code:
date = datetime.date(int(year.get()),int(month.get()), int(day.get()))
narratif=T.get("1.0","end-1c")
c.execute("""INSERT INTO Incidents
(Geometry, Datestamp, Description, Place, Latitude, Longitude, Precision, Intimidation, Destruction, Burglary,
Carjacking, Theft, Assault, Sexualassault, Abduction, Homicide, Shooting, Explosive, Narrative)
VALUES(GeomFromText('POINT(? ?)', 4326),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", (longitude.get(), latitude.get(), date, description.get(),place.get(),latitude.get(), longitude.get(), precision.get(), intimidation1.get(),destruction2.get(), burglary3.get(), carjacking4.get(), theft5.get(), assault6.get(), sexualassault7.get(), abduction8.get(), homicide9.get(), shooting10.get(), explosive11.get(), narratif))
con.commit()
python sqlite3 insert spatialite
add a comment |
Attempting to build a data entry form, I would like to create geometry points from the longitude.get() and latitude.get() values. However, the pasted code below doesn't work, probably due to some syntax error from my side (I suspect that python reads som parts of the geofromtext as a string) but I don't know how to proceed otherwise.
Does anyone see my error?
I have tried to change the code as per the specification of the spatialite documentation but without success so far. I suspect some syntax error frpm my side.
Is there any obvious mistake?
Here is the relevant code:
date = datetime.date(int(year.get()),int(month.get()), int(day.get()))
narratif=T.get("1.0","end-1c")
c.execute("""INSERT INTO Incidents
(Geometry, Datestamp, Description, Place, Latitude, Longitude, Precision, Intimidation, Destruction, Burglary,
Carjacking, Theft, Assault, Sexualassault, Abduction, Homicide, Shooting, Explosive, Narrative)
VALUES(GeomFromText('POINT(? ?)', 4326),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", (longitude.get(), latitude.get(), date, description.get(),place.get(),latitude.get(), longitude.get(), precision.get(), intimidation1.get(),destruction2.get(), burglary3.get(), carjacking4.get(), theft5.get(), assault6.get(), sexualassault7.get(), abduction8.get(), homicide9.get(), shooting10.get(), explosive11.get(), narratif))
con.commit()
python sqlite3 insert spatialite
Attempting to build a data entry form, I would like to create geometry points from the longitude.get() and latitude.get() values. However, the pasted code below doesn't work, probably due to some syntax error from my side (I suspect that python reads som parts of the geofromtext as a string) but I don't know how to proceed otherwise.
Does anyone see my error?
I have tried to change the code as per the specification of the spatialite documentation but without success so far. I suspect some syntax error frpm my side.
Is there any obvious mistake?
Here is the relevant code:
date = datetime.date(int(year.get()),int(month.get()), int(day.get()))
narratif=T.get("1.0","end-1c")
c.execute("""INSERT INTO Incidents
(Geometry, Datestamp, Description, Place, Latitude, Longitude, Precision, Intimidation, Destruction, Burglary,
Carjacking, Theft, Assault, Sexualassault, Abduction, Homicide, Shooting, Explosive, Narrative)
VALUES(GeomFromText('POINT(? ?)', 4326),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", (longitude.get(), latitude.get(), date, description.get(),place.get(),latitude.get(), longitude.get(), precision.get(), intimidation1.get(),destruction2.get(), burglary3.get(), carjacking4.get(), theft5.get(), assault6.get(), sexualassault7.get(), abduction8.get(), homicide9.get(), shooting10.get(), explosive11.get(), narratif))
con.commit()
python sqlite3 insert spatialite
python sqlite3 insert spatialite
edited Mar 9 at 8:44
stovfl
8,55251134
8,55251134
asked Mar 9 at 8:00
PanPan
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
For ionformation, I was able to make it work with the following code:
def get():
try:
date = datetime.date(int(year.get()),int(month.get()), int(day.get()))
narratif=T.get("1.0","end-1c")
c.execute("""INSERT INTO Incidents
(Datestamp, Description, Place, Latitude, Longitude, Precision, Interpretation, Wounded, Killed, Intimidation, Destruction, Burglary,
Carjacking, Theft, Assault, Sexualassault, Abduction, Homicide, Shooting, Explosive, Indirectfire, Intercommunity, Narrative)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", (date, description.get(),place.get(),latitude.get(), longitude.get(), precision.get(), interpretation.get(), wounded.get(), killed.get(), intimidation1.get(),destruction2.get(), burglary3.get(), carjacking4.get(), theft5.get(), assault6.get(), sexualassault7.get(), abduction8.get(), homicide9.get(), shooting10.get(), explosive11.get(), indirectfire12.get(), intercommunity13.get(), narratif ))
c.execute('UPDATE Incidents SET Geometry=MakePoint(Longitude, Latitude, 4326) WHERE Incident_ID = (SELECT MAX(Incident_ID) FROM Incidents);')
print("You just added an incident!")
print(c.lastrowid)
messagebox.showinfo("Incident added", "incident successfully added!")
except:
messagebox.showerror("No incident added", "Check for duplicates, empty fields or other sources of error")
con.commit()
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55075242%2fgeomfromtext-insert-in-spatialite-from-retrived-text%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
For ionformation, I was able to make it work with the following code:
def get():
try:
date = datetime.date(int(year.get()),int(month.get()), int(day.get()))
narratif=T.get("1.0","end-1c")
c.execute("""INSERT INTO Incidents
(Datestamp, Description, Place, Latitude, Longitude, Precision, Interpretation, Wounded, Killed, Intimidation, Destruction, Burglary,
Carjacking, Theft, Assault, Sexualassault, Abduction, Homicide, Shooting, Explosive, Indirectfire, Intercommunity, Narrative)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", (date, description.get(),place.get(),latitude.get(), longitude.get(), precision.get(), interpretation.get(), wounded.get(), killed.get(), intimidation1.get(),destruction2.get(), burglary3.get(), carjacking4.get(), theft5.get(), assault6.get(), sexualassault7.get(), abduction8.get(), homicide9.get(), shooting10.get(), explosive11.get(), indirectfire12.get(), intercommunity13.get(), narratif ))
c.execute('UPDATE Incidents SET Geometry=MakePoint(Longitude, Latitude, 4326) WHERE Incident_ID = (SELECT MAX(Incident_ID) FROM Incidents);')
print("You just added an incident!")
print(c.lastrowid)
messagebox.showinfo("Incident added", "incident successfully added!")
except:
messagebox.showerror("No incident added", "Check for duplicates, empty fields or other sources of error")
con.commit()
add a comment |
For ionformation, I was able to make it work with the following code:
def get():
try:
date = datetime.date(int(year.get()),int(month.get()), int(day.get()))
narratif=T.get("1.0","end-1c")
c.execute("""INSERT INTO Incidents
(Datestamp, Description, Place, Latitude, Longitude, Precision, Interpretation, Wounded, Killed, Intimidation, Destruction, Burglary,
Carjacking, Theft, Assault, Sexualassault, Abduction, Homicide, Shooting, Explosive, Indirectfire, Intercommunity, Narrative)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", (date, description.get(),place.get(),latitude.get(), longitude.get(), precision.get(), interpretation.get(), wounded.get(), killed.get(), intimidation1.get(),destruction2.get(), burglary3.get(), carjacking4.get(), theft5.get(), assault6.get(), sexualassault7.get(), abduction8.get(), homicide9.get(), shooting10.get(), explosive11.get(), indirectfire12.get(), intercommunity13.get(), narratif ))
c.execute('UPDATE Incidents SET Geometry=MakePoint(Longitude, Latitude, 4326) WHERE Incident_ID = (SELECT MAX(Incident_ID) FROM Incidents);')
print("You just added an incident!")
print(c.lastrowid)
messagebox.showinfo("Incident added", "incident successfully added!")
except:
messagebox.showerror("No incident added", "Check for duplicates, empty fields or other sources of error")
con.commit()
add a comment |
For ionformation, I was able to make it work with the following code:
def get():
try:
date = datetime.date(int(year.get()),int(month.get()), int(day.get()))
narratif=T.get("1.0","end-1c")
c.execute("""INSERT INTO Incidents
(Datestamp, Description, Place, Latitude, Longitude, Precision, Interpretation, Wounded, Killed, Intimidation, Destruction, Burglary,
Carjacking, Theft, Assault, Sexualassault, Abduction, Homicide, Shooting, Explosive, Indirectfire, Intercommunity, Narrative)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", (date, description.get(),place.get(),latitude.get(), longitude.get(), precision.get(), interpretation.get(), wounded.get(), killed.get(), intimidation1.get(),destruction2.get(), burglary3.get(), carjacking4.get(), theft5.get(), assault6.get(), sexualassault7.get(), abduction8.get(), homicide9.get(), shooting10.get(), explosive11.get(), indirectfire12.get(), intercommunity13.get(), narratif ))
c.execute('UPDATE Incidents SET Geometry=MakePoint(Longitude, Latitude, 4326) WHERE Incident_ID = (SELECT MAX(Incident_ID) FROM Incidents);')
print("You just added an incident!")
print(c.lastrowid)
messagebox.showinfo("Incident added", "incident successfully added!")
except:
messagebox.showerror("No incident added", "Check for duplicates, empty fields or other sources of error")
con.commit()
For ionformation, I was able to make it work with the following code:
def get():
try:
date = datetime.date(int(year.get()),int(month.get()), int(day.get()))
narratif=T.get("1.0","end-1c")
c.execute("""INSERT INTO Incidents
(Datestamp, Description, Place, Latitude, Longitude, Precision, Interpretation, Wounded, Killed, Intimidation, Destruction, Burglary,
Carjacking, Theft, Assault, Sexualassault, Abduction, Homicide, Shooting, Explosive, Indirectfire, Intercommunity, Narrative)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", (date, description.get(),place.get(),latitude.get(), longitude.get(), precision.get(), interpretation.get(), wounded.get(), killed.get(), intimidation1.get(),destruction2.get(), burglary3.get(), carjacking4.get(), theft5.get(), assault6.get(), sexualassault7.get(), abduction8.get(), homicide9.get(), shooting10.get(), explosive11.get(), indirectfire12.get(), intercommunity13.get(), narratif ))
c.execute('UPDATE Incidents SET Geometry=MakePoint(Longitude, Latitude, 4326) WHERE Incident_ID = (SELECT MAX(Incident_ID) FROM Incidents);')
print("You just added an incident!")
print(c.lastrowid)
messagebox.showinfo("Incident added", "incident successfully added!")
except:
messagebox.showerror("No incident added", "Check for duplicates, empty fields or other sources of error")
con.commit()
answered Mar 10 at 7:17
PanPan
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55075242%2fgeomfromtext-insert-in-spatialite-from-retrived-text%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown