php - Using Column names as a parameter of POINT geometry in mysql -


i working on query fetches rows in lat , longs inside given polygon. using geometry functions so. able use contain method polygon , point, in case using polygon coordinates explicitly in query , want use "latitude" , "longitude" column name parameters of point. tried use concat method getting "false" return contain method.

query:

  select      *    table          contains(        geomfromtext(          'polygon(             (32.717399 -117.144126,32.714655  -117.136487,32.710827 -117.145843,32.714005 -117.146444, 32.717399 -117.144126))          '),        geomfromtext(          'point(             concate(latitude," ",longitude))          ')) 

my table structure is:

property_id                 int(11) latitude                    decimal(10,6)     longitude                   decimal(10,6) address_f1365               char(100) addressontheinternet_f27    char(255) 

try this, before using in actual query:

select aswkt(geomfromtext(concat('point(', 15, ' ', 26, ')'))); 

shows:

'point(15 26)' 

i suggest test anything, part of spatial data query function aswkt() / astext(). check manual supported formats , conversion functions.

you have wrongly used concat(). try:

select      *      `table`      contains(        geomfromtext('polygon((32.717399 -117.144126,32.714655  -117.136487,32.710827 -117.145843,32.714005 -117.146444, 32.717399 -117.144126))')     ,        geomfromtext(concat('point(', latitude, ' ', longitude, ')'))     ) 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -