0

I am querying a Virtuoso store with SPARQL, and I want to retrieve some layer that are near a wkt geometry with a tolerance of 10 kilometers.

How I have to set the tolerance parameter? In which unit of measure?

I have done some try but I have not understood.

PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX gis: <http://www.opengis.net/ont/geosparql#>
SELECT * WHERE{

?layer <http://www.disit.org/km4city/schema#hasGeometry> ?geo.
?geo gis:asWKT ?wkt.

FILTER ( bif:st_within(bif:st_point(11.3049,43.781),?wkt, _tolerance_)=1).
FILTER ( bif:st_within(bif:st_point(11.3068,43.7811),?wkt,_tolerance_)=1).

}

Can you help me?

============

In particular, this is the ?wkt value that contains a POLYGON:

POLYGON ((11.22497476017258 43.820997211527605,11.227855048015385 43.819280760203,11.230807109337618 43.818392426222189,11.235875123265659 43.816090958559798,11.23924762920907 43.814182638800816,11.242662138451175 43.813026587465771,11.245326900138103 43.812495868235494,11.247648496494525 43.812185582495815,11.249506578105764 43.811884377017648,11.249217580931605 43.809902954361533,11.248789172799501 43.808124393011184,11.24926338931256 43.806770387513787,11.248546824793486 43.805411560104204,11.2488139834041 43.80440815688447,11.248599092442005 43.802625780820769,11.249400998846109 43.801645227927274,11.249461649208071 43.800953780070003,11.248666412115918 43.800358737011152,11.24709574723218 43.799320918907561,11.245766783204953 43.797606560197842,11.244762499872069 43.796305152804628,11.24458852059764 43.795036282743773,11.24544351072803 43.794978768929553,11.245191752256298 43.793884459429698,11.246008354866474 43.793552881440256,11.248290771890389 43.793091366204585,11.250448902462045 43.792814087970527,11.253178870525684 43.791426923082973,11.255730665170912 43.789788752996849,11.257401407070263 43.788636139680122,11.26135811091982 43.788120225534065,11.264043300459814 43.788313769250514,11.265785850883876 43.788694091306198,11.267229800343951 43.789723990070613,11.268168579878052 43.792127131483049,11.271434846578536 43.796314364572197,11.271498346308713 43.796312722128384,11.274340898929694 43.799722185915968,11.276702132274876 43.802736872056691,11.277569305273367 43.80373741627141,11.278848570876129 43.803956063871944,11.27884908715021 43.803838717178373,11.278968011067537 43.803781963608813,11.279379201503758 43.803679583702049,11.279420309692876 43.803534706713158,11.279401061577039 43.803453518536649,11.279334317483606 43.803234803264878,11.279479326527568 43.802961803605506,11.279786707717246 43.802842424062085,11.279277140443176 43.799866142940921,11.278421519553591 43.799168693764877,11.277048262182273 43.797791467939703,11.275993274720097 43.795542730049526,11.277403711218422 43.794080663092053,11.276123895444055 43.792111467141709,11.275659640384678 43.789715173836875,11.275634228533717 43.788675457089724,11.275859142791838 43.787938138836665,11.275103051148433 43.787307958993786,11.274227490281277 43.786036750989879,11.273674117123331 43.785152073485321,11.274317345429463 43.784701603378124,11.27553544327696 43.784405041268585,11.277322562984841 43.784519600594273,11.279906826083145 43.785608030435775,11.28424394163196 43.787189500789815,11.285259994758389 43.787212443292667,11.287243927591582 43.78620797407654,11.290116264373557 43.78522139790546,11.291473113903418 43.78496950047208,11.293184205764964 43.785260874301912,11.294153999395506 43.785198776546139,11.294329102999722 43.785441454439407,11.294793540708772 43.7854626616095,11.295101244473557 43.78505952671334,11.295332523938987 43.78449507349832,11.29592528591898 43.783831751268941,11.296634622930563 43.783278043977106,11.297193037072793 43.782818971736624,11.297354088550685 43.782622345490346,11.29820767228304 43.782167510817629,11.299301666189274 43.781689837224377,11.299563628219605 43.781576522130365,11.300202571002128 43.781435239273385,11.301201964352508 43.781486361994524,11.302273871097041 43.78123066543607,11.303620188231712 43.781105132017821,11.306175875523456 43.780874911636182,11.308063427886015 43.779943490308632,11.309326591613273 43.778167087999698,11.311043627623471 43.776585326773663,11.3125728215244 43.775385779112916,11.315318161531234 43.773943767071707,11.318235199165137 43.772571868140737,11.322195412834228 43.771094000141638,11.323288048066944 43.769934827239602,11.326655781950061 43.769489695902642,11.329604589037249 43.769470319265857,11.330342354675265 43.769092212733277,11.329279840671077 43.768676265711264,11.328033281882176 43.76818337251013,11.326315267270322 43.767092917318301,11.324368923074694 43.765696457402491,11.323314672040915 43.764961598287101,11.322180308655309 43.764277877345116,11.321590335211182 43.763979242790107,11.319343479751002 43.763091562729215,11.319436871471272 43.762921062484558,11.319837283806782 43.762466060560016,11.320922416627111 43.761728429058294,11.321443887341252 43.761651581413588,11.321503287690726 43.761553861938971,11.320471037815844 43.760874200035829,11.320354922687349 43.760767031235041,11.320212748207732 43.760635810178044,11.319964279170797 43.760406481867697,11.31988557452307 43.760252375274142,11.319725605874117 43.759816009909031,11.319606376262426 43.75967910085042,11.319103859080034 43.759231847638127,11.318439436550985 43.758827761867352,11.317852851155175 43.758631860821104,11.317634841100631 43.758625875667335,11.317535180884439 43.758707952410589,11.3172131277672 43.759308616627536,11.316981570949171 43.759482301045331,11.316049598850725 43.759345656007341,11.315932144293356 43.759395095399832,11.315337987836555 43.759435125931766,11.314692441928136 43.759310793072231,11.314313840926223 43.758857262045716,11.314065189440218 43.758889067614426,11.313838127783052 43.758934509438973,11.313651397921364 43.758826329228192,11.313526123556631 43.758126560525383,11.313404068300065 43.757874573470616,11.31323333422799 43.757816960370995,11.312784783264663 43.758202639859419,11.312488227808977 43.758524171192697,11.312334267445479 43.758537465635669,11.312123003540423 43.758521384520691,11.312020469939233 43.758411497706078,11.311495665839994 43.75754677913104,11.310833302085369 43.756756088743984,11.310547188722266 43.756619378425746,11.309331189956096 43.757132523921896,11.308359138353143 43.757416804424835,11.30780021251404 43.757489165711625,11.307623331892319 43.757390165502457,11.30761074056543 43.757383691349119,11.30758195634305 43.756938594141197,11.307455974176014 43.75668903745013,11.307322186602731 43.756624212196407,11.307116307428421 43.756700398428436,11.306926806928882 43.756798762613066,11.306815704730726 43.756512890334051,11.306699533602558 43.75613708418161,11.30644073285819 43.755624601210251,11.306446726579486 43.755492847447201,11.306192707601546 43.754959198880179,11.306031689549446 43.754337238050582,11.30591327887033 43.753944909514672,11.305793697608765 43.752603443571203,11.305718435476726 43.751956702170894,11.305935821125921 43.75076383791788,11.305972365387202 43.750696653695293,11.30610478160796 43.75053533745708,11.306172547420712 43.750165361638807,11.306247311273946 43.749683503356188,11.30596075200839 43.749411607816796,11.305442662507065 43.749269605187372,11.303733486764443 43.749637022938948,11.300373675509571 43.749257432686484,11.299582992353397 43.748930318948581,11.298107226130817 43.748493109372227,11.296473822652796 43.748745110391987,11.295139614881968 43.748571818584885,11.29343948348677 43.74855775545975,11.28975895249549 43.749346782494172,11.287514168608563 43.750355961881553,11.286175603219398 43.750171301340103,11.284774174938143 43.750304149516772,11.284053385677851 43.751052265378028,11.283019146993775 43.751854283509559,11.281123907010928 43.752968714208457,11.280283283803202 43.753678701909543,11.279507705229975 43.756621371249942,11.279349439665669 43.75749068033435,11.27958332977812 43.757937670577768,11.279882013199877 43.758273311857621,11.28026128749543 43.758394379320805,11.280719382734709 43.758513872128695,11.281326894971215 43.758673258524098,11.282706705330362 43.758917264761948,11.281792708887513 43.7595143856107,11.281263736136653 43.759865120280558,11.280833392836946 43.760216742182976,11.280126622459736 43.760512519581589,11.279708563429496 43.76097527709954,11.279248151712508 43.761851090297142,11.278859936743862 43.76218757135068,11.278545542933937 43.762217663262433,11.278211095926391 43.762048529716367,11.277823399972986 43.761706083158892,11.27774678501032 43.76131407879182,11.277578061357278 43.760873766182847,11.276605685853429 43.761125405819897,11.275143209699493 43.761714343819094,11.273990846960226 43.761987411309583,11.272524492474219 43.762127864000341,11.272021304052066 43.762228481759749,11.27186681995147 43.762532300609784,11.27147422509619 43.762860700930105,11.270123173264048 43.763575800822856,11.268839147595299 43.764062848400144,11.267718146730818 43.76440669439814,11.267356173214919 43.764613383671467,11.266365599797679 43.764668769583054,11.26542865527861 43.764550148324211,11.265286451032834 43.764380490845177,11.264344466101042 43.764351520466455,11.26424649895362 43.764433859679301,11.263137707117718 43.764339698031449,11.262200569392324 43.76422128316932,11.261368245485233 43.764202027665,11.261463334742611 43.763940202550579,11.261775686874017 43.763827232105889,11.261374490742172 43.76371356248697,11.261194939099534 43.763964264610884,11.261358533637837 43.764053335265359,11.261287366337649 43.764236383052811,11.260200640462132 43.764618782445147,11.259173179848005 43.764567638712386,11.258474411398826 43.764609496920201,11.257461397688616 43.764846595540916,11.255689363574893 43.766042076845729,11.254046234679462 43.767010609779838,11.252193521846909 43.767130521197544,11.249573972240087 43.765759529000263,11.248509008767099 43.765297368215819,11.246946460483672 43.764060348628725,11.246714633065725 43.763135867017908,11.244094037471116 43.76205584451553,11.242863591566625 43.761120449472777,11.242699419947073 43.760364997282693,11.242127115398544 43.760146309342282,11.241614933922097 43.760072983641962,11.241226593480761 43.76023544213664,11.240485433065089 43.761071822303904,11.240290641243261 43.76245729254282,11.239987976532424 43.76359475075305,11.239507914100191 43.764069066870199,11.238439736128361 43.764825700104787,11.238444179671403 43.765385419530674,11.238508327903599 43.766512850929558,11.235991764742458 43.768313011926296,11.23470266559651 43.769104488511047,11.233696180626369 43.769273657497564,11.233463191446095 43.769726057192877,11.233053687103126 43.770382007351976,11.232443919890114 43.770603552880175,11.232260641291971 43.770978749824828,11.231780068682241 43.771845713309901,11.230822229041967 43.772255092328813,11.22956644665426 43.772432062442945,11.228065349567196 43.772023028818104,11.226371226280664 43.771505232601164,11.225850306231129 43.770312394262859,11.226566366791603 43.76956588629978,11.226828295739814 43.769378098988405,11.226773469953899 43.767900800357005,11.226137792563962 43.767114070051932,11.224646114651183 43.765544888520452,11.220934155200649 43.765057720237948,11.21763643136002 43.76352197789263,11.216003142611203 43.761304910187889,11.213409876279568 43.760859687909019,11.211466974816586 43.761111627869454,11.209177766582023 43.760179303707325,11.207403574114727 43.758553110887988,11.204754301383497 43.756434232601293,11.203603763753348 43.755177643760817,11.201236237490249 43.754246593272441,11.200917759878475 43.754224060453765,11.200798251807742 43.754536985298365,11.20050315584905 43.755134387856955,11.20008163728424 43.755898810383023,11.199466897387802 43.756302303444713,11.199404188646113 43.756329981205802,11.198720947966162 43.756884789356604,11.198666570813192 43.756983975343807,11.199911434824914 43.757437207575265,11.200538410767534 43.757767272877011,11.200674792157184 43.757973710717053,11.200830798067239 43.758247837880091,11.201772733549905 43.758738396684222,11.202092567620475 43.75879165724055,11.202461909078469 43.758819652826617,11.20324669101281 43.759139998565971,11.203099907273398 43.759280044157428,11.202092545847123 43.759647903191158,11.200962857351572 43.759976332838292,11.200640751140938 43.760074734069342,11.200444197828991 43.760114533933425,11.200283504200403 43.760261686530264,11.200242666554574 43.760310012083856,11.20039674876557 43.760619651089499,11.200598804965637 43.760899374251913,11.200524466974791 43.76105386764241,11.199752590434102 43.761536918981648,11.199278566424638 43.761717292813543,11.198890040840961 43.762003702786892,11.198441220550999 43.762088869920852,11.197604529490919 43.762478615620978,11.197323752392558 43.762763127959317,11.19684989050765 43.762839766767229,11.196417965231079 43.763023641047916,11.195946560563502 43.763595428491968,11.195428100463527 43.763961034624138,11.194739701064227 43.764415437152948,11.194112064013146 43.764598559912322,11.193772113864012 43.764770573929511,11.193164911654625 43.765111943067325,11.192849013600499 43.765221547713253,11.192597231461891 43.764960772433916,11.192408291304142 43.764464696481213,11.1922128724805 43.764216344279887,11.192095204930617 43.763947052287442,11.19148310682314 43.764518459136639,11.191201360084007 43.764753635104611,11.19089225764114 43.764943956609748,11.190560167650132 43.765355486943477,11.190429950695092 43.76572263022021,11.190179103486342 43.766083081997991,11.189901363645106 43.766813197314676,11.18952131305573 43.767293170913504,11.189380836094662 43.767358888053003,11.189032226683988 43.767338556332227,11.188730427121582 43.767303821462136,11.188649494676772 43.76727169815355,11.187607426049139 43.766870644166573,11.186539692624807 43.766422892731349,11.186269636200574 43.766277159417037,11.185075878128776 43.765820640952491,11.184475943734435 43.765742075745614,11.183620032506646 43.765330763379147,11.183511557150343 43.765292680147567,11.182883476744029 43.76502070620073,11.182351816108467 43.764981341817958,11.181077936368727 43.764650021484947,11.180032526652758 43.764486117451341,11.179626159504995 43.764679490339397,11.179501904013541 43.764738617726017,11.179101108347639 43.765097403568554,11.179093083934825 43.765163823328209,11.17882447777601 43.765327769592353,11.178373288305487 43.765732531934589,11.177952971622396 43.765961133227734,11.17742459586821 43.766358359375104,11.177255855766759 43.766354191813186,11.176582897760033 43.766680519240779,11.17591063828878 43.767111991789939,11.175697959860624 43.767201576092134,11.175432510901379 43.767076077582132,11.174802150878351 43.76657955205642,11.17454525988121 43.766611272043477,11.174342893993281 43.766831210212487,11.174216057273345 43.766824620110079,11.17395047340127 43.766654102550632,11.173492159532374 43.766712341358655,11.173355650401994 43.766788587615693,11.172991685192331 43.76689292913057,11.172378863553348 43.767124090240181,11.172036903967465 43.767266725949902,11.171513565632164 43.767330694663926,11.17141708079364 43.767562120834462,11.170945817128597 43.767863693529428,11.1706181915706 43.768104012137997,11.170132006742818 43.768371110902706,11.169930772416592 43.76852673382465,11.16966763056708 43.768873868640988,11.169418706635895 43.76905416576642,11.169186276453281 43.769261160115143,11.168892865868472 43.769307246190834,11.168367047913797 43.769340995368019,11.166834479756274 43.76961190591819,11.16565968520638 43.769812990114239,11.165321492952524 43.769861176267717,11.164955690356654 43.769967147634951,11.163470584125283 43.770431952290771,11.162487376067853 43.770644142141691,11.161825278069454 43.771016815824417,11.160727904170498 43.771502519786125,11.160517646298288 43.771667300360079,11.160459814746273 43.771940248401137,11.160407513874702 43.772187091273175,11.16025005188966 43.772320620921263,11.159455930549692 43.772547216920621,11.158644534021722 43.772936199032493,11.158005767832272 43.773164351713838,11.157583913592365 43.773454259967821,11.15734565579505 43.773617994487495,11.156876337556239 43.773779916089367,11.156466231658145 43.774147801661286,11.156228467689681 43.774273837610608,11.155441739225498 43.774423735360578,11.154260275125051 43.774761142991636,11.153980560203047 43.774950990543523,11.153555453287145 43.775310144794013,11.152774662126784 43.775910093471708,11.152159954564013 43.776200785512103,11.15194935118353 43.776332783571299,11.151838116977892 43.776494962838036,11.152025168740215 43.776707527032265,11.152031361899537 43.776900988279955,11.151844660680325 43.77715210406754,11.152193112336406 43.77779380215172,11.152377187600255 43.778186494199701,11.152641596923189 43.77841110553554,11.152795710143057 43.778477709989417,11.153909617989324 43.778796874517404,11.154566583008261 43.779225665871429,11.154645270466862 43.77929567082866,11.154690298889829 43.779511448784433,11.154529675439374 43.779627022828002,11.154037456402291 43.779782521766471,11.153624692929634 43.780008730049346,11.153374930152376 43.78027904402996,11.153153641019545 43.780733395060075,11.153025895129961 43.780920376366382,11.152577010458561 43.781158425943843,11.151706258526533 43.781327888066613,11.151674627974666 43.781378003595641,11.152017432378807 43.781754201443277,11.152387385899942 43.782454016969353,11.152619611441731 43.782768190139222,11.153404539609717 43.783946198693052,11.153678380078555 43.784446500315454,11.154058572333657 43.784848997925657,11.15441117384178 43.785234007242138,11.154531511924018 43.785515351931501,11.15451255488801 43.78574530144337,11.154464666321168 43.785865232139066,11.153321028737313 43.786109899726171,11.15249720276144 43.786269479914623,11.150526769072702 43.786189535544402,11.150483530235533 43.7861620779981,11.150874478195789 43.786916784977549,11.151249331582141 43.787711049266264,11.151441380703876 43.788193628142103,11.15156401332713 43.788400562850107,11.151836386740102 43.788658879228997,11.151978531768956 43.788723729237205,11.152224443584286 43.789169277830069,11.152735395270284 43.790205151041818,11.153893459937626 43.792522822766571,11.153988314998344 43.792904047816684,11.154269161089328 43.793303915099642,11.154392199419666 43.793594212255655,11.154596141943472 43.793693908114506,11.154844181068214 43.79368905053483,11.155099901754841 43.794136568404163,11.155521219301946 43.794820097352222,11.156575330400038 43.797061909903206,11.156916698923942 43.797778274791973,11.15709591784614 43.79805400285904,11.156925700994183 43.798201273714554,11.155773351922335 43.798628182891221,11.155153063617824 43.798900988540595,11.154292738155331 43.799173815015138,11.153961642436704 43.799234078676342,11.153785463898288 43.799367951839351,11.153854881957209 43.799483689985067,11.154575294468653 43.799879770960487,11.154639929243848 43.79992807188394,11.154561798447236 43.800348212154361,11.154779796171793 43.800596201740056,11.154937501009263 43.800660754454391,11.155394249978684 43.800724167958911,11.155700446160616 43.800880456060447,11.155981340029701 43.801235299721711,11.156707750773123 43.802270508594319,11.1568410791951 43.80252459408802,11.156703180750917 43.802965851804615,11.163672550940802 43.802136850674501,11.167447819825382 43.801702272939472,11.173136132110489 43.801095787373171,11.180611098448242 43.800218680110255,11.181571991698254 43.799894215601725,11.181729222862099 43.799808380447253,11.183135544422703 43.801205885178923,11.183485796581152 43.801757414365291,11.183605732576622 43.802128770892928,11.184347226236749 43.802987944817069,11.184642544427142 43.803225395230953,11.184989659327959 43.803673078288512,11.185143525599084 43.803733520921682,11.18555443483959 43.803707654478842,11.185735612483036 43.803668174390232,11.185970305060062 43.803821247094248,11.186242009349822 43.804239216637697,11.186475579153205 43.804657915267519,11.187245767922912 43.805494011843031,11.187465003949074 43.805662683376369,11.187754664706858 43.805853415324229,11.187991023591543 43.806542164518099,11.188183841321422 43.806777066617734,11.188925747505737 43.807317295572382,11.189573001625361 43.807668817994795,11.189833297920112 43.808011547369986,11.190104869226051 43.808189834883571,11.190511788585461 43.808924828688205,11.192169083445451 43.810900838647747,11.193518073487938 43.812491088129683,11.194057487743633 43.813205877944938,11.198511849720299 43.811080586172011,11.199060963221138 43.811011495582122,11.199663337124399 43.810909864509384,11.201301180674873 43.81024807117344,11.202093794468301 43.809720944839881,11.204866664810476 43.808477275649587,11.207319129294161 43.810493267325853,11.213406658117764 43.816676110849968,11.21379043676512 43.817182598126671,11.214291862116971 43.817672578454172,11.214897813085361 43.8182955835127,11.215818355944089 43.818934993397143,11.216914060503992 43.819458452777404,11.217019681384613 43.819449740679651,11.217626880207737 43.819728951342164,11.218167526055776 43.820064372507538,11.218899086411954 43.820491341015256,11.219122598183302 43.820630516501652,11.219592102009122 43.82089798530977,11.220073921513478 43.821041324075786,11.220077348878821 43.821042223587249,11.220140547201311 43.821076858184554,11.221253503285705 43.821479233629141,11.222226068831082 43.82204333221727,11.22497476017258 43.820997211527605))

2 Answers 2

1

ST_Within tells you if a geometry is inside or touching another. So if you want to know if a point is within 10 km of another point then the point could be buffered to 10 km (or if you have a polygon, etc, you could find its center and then buffer that) in order to use ST_Within for your purpose.

ST_DWithin is probably what you are after though because it not only includes a distance parameter but also takes advantage of indices, making it much faster.

1

_tolerance_ is tacitly expressed in the unit of the requested data. So you need to be aware of the different units in which your data are expressed and be sure that you do not compare different unit systems or CRS projected data.

By default, _tolerance_ is 0.

This response concerns Virtuoso built-ins specifically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.