Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7000259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:38:52+00:00 2026-05-27T20:38:52+00:00

I have been trying the following but always fails, roomTypeSQL = SELECT spftype FROM

  • 0

I have been trying the following but always fails,

roomTypeSQL = "SELECT spftype FROM cameron_toll_spatialfeatures WHERE ST_Contains(ST_GeomFromText(%s), ST_geomFromWKB(geometry)) = 'True';"
roomTypeData = (pointTested) # "POINT(-3.164005 55.926378)"
.execute(roomTypeSQL, roomTypeData)

I want to get the polygon from my table which contains the specific point. I have also tried ST_Within which also fails. I think my problem is related to the formatting of the point and polygon but I have tried almost all combinations and nothing does the job. I tried defining my polygon and it worked but I must do it with a polygon from the database. My postgresql log file is not particularly helpful either..
Can anybody see anything going wrong?
Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:38:53+00:00Added an answer on May 27, 2026 at 8:38 pm

    This had to do with python operators. I entered all the sql arguments using the python % operator properly and it worked. Like this,

    roomTypeSQL = "SELECT spftype FROM cameron_toll_spatialfeatures WHERE ST_Contains(ST_GeomFromText(%s),ST_geomFromWKB(geometry))=%s;"
    
    roomTypeData = (pointTested,'t') # "POINT(-3.164005 55.926378)"
    
    .execute(roomTypeSQL, roomTypeData)
    

    The python operator can be quite frustrating sometimes. It doesn’t always work as expected. I have some examples of SQL commands in which I had to place the arguments directly inside SQL commands. This method worked although its not advisable in Python documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to extract e-mail addresses from the following code for quite
I have been trying the following interface IUIntegral : IEquatable<Byte>, IEquatable<UInt16>, IEquatable<UInt32>, IEquatable<UInt64> {
I have been trying to find out why the following lines of code do
I have been trying to write a regex that will remove whitespace following a
Hi I am hitting std::out_of_range: basic_string::substr in the following code. Have been trying hard
The following image have been uploaded to show what I am trying to do
Here's a fun one I've been trying to figure out. I have the following
I'm trying to create a friendship association. I found and have been following the
I have been trying to output XML with PHP but encountered a strange(!) error
I have been trying to set a custom resourceProviderFactory at the web.config file but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.