cst989 Posted July 23, 2019 Posted July 23, 2019 Hello I'm having an issue with filtering on a negative longitude value. My search filter looks like this (decimal places have been shortened for the example) $pages->find("template=skyscraper,longitude>=-0.1011,longitude<=0.0708,limit=10,sort=created"); Now lets say I have two pages, one has a longitude of 0.05, this one is found. Another has a longitude of -0.05, this one is not found, even though -0.05 is still greater than -0.1011...
cst989 Posted July 23, 2019 Author Posted July 23, 2019 As always I work this out after 30 mins of trying, but always 2 mins after posting on a forum ? It was because the field type must be float decimal, (see below!). Funnily enough it works fine if it's Text, until you hit a negative number. I will leave this up for anyone who makes the same mistake as me. 2
Robin S Posted July 23, 2019 Posted July 23, 2019 7 hours ago, cst989 said: It was because the field type must be float. From past experience working with lat/lng coordinates, I suggest using a decimal field for these. Float fields only have a precision of 6 figures which is often not sufficient for a lat/lng value. 2 1
Erik Richter Posted November 22, 2020 Posted November 22, 2020 @cst989 Hey! I changed the fieldtyp to float in database, but still: as soon as I have negative longitude, I get no results.. any tips? Thank you!!!
cst989 Posted November 25, 2020 Author Posted November 25, 2020 On 11/22/2020 at 9:08 PM, Erik Richter said: @cst989 Hey! I changed the fieldtyp to float in database, but still: as soon as I have negative longitude, I get no results.. any tips? Thank you!!! Hi Erik, I would try the decimal fieldtype linked to in Robin's post - and also you don't want to be changing it directly in the db, just changing the field type
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now