Tatauhia, Uiuihia ranei te Tawhiti Porowhita Nui i waenga i nga Ira o te ahopae me te ahopou ma te whakamahi i te tauira Haversine (PHP, Python, MySQL, MSSQL Tauira)

Tātai Haversine - Tawhiti Porowhita Nui - PHP, Python, MySQL

I tenei marama kua roa taku hotaka i te PHP me te MySQL mo te GIS. I te tarai haere i te kupenga, i tino uaua ahau ki te rapu i etahi o Taatau matawhenua ki te rapu i te tawhiti i waenga i nga waahi e rua na reira i hiahia au ki te tohatoha i konei.

Mahere Rererangi a Europi me te Porowhita Maama

Ko te huarahi ngawari ki te tatau i te tawhiti i waenga i nga tohu e rua, ko te whakamahi i te ture Pythagorean ki te tatau i te hypotenuse o te tapatoru (A + + B² = C²). E mohiotia ana tenei ko te Te tawhiti o Euclidean.

He timatanga pai tena engari kaore e pa ki te Matawhenua mai i te tawhiti i waenga i nga raina ahopae me te ahopou e kore e rite te tawhiti wehe Ka tata atu koe ki te ekuitaita, ka wehe ke atu nga raina latitude. Mena ka whakamahia e koe etahi o nga wharite tapatoru ngawari, ka tika te whanganga i te tawhiti ki tetahi waahi ka tino he i tetahi atu, na te piko o te Ao.

Tawhiti Porowhita Nui

Ko nga huarahi e haerere ana i tawhiti, huri noa i te Ao, e mohiotia ana ko te Tawhiti Porowhita Nui. Arā… he rerekē te tawhiti poto rawa atu i waenga i ngā pūwāhi e rua o te āwheo i ngā tohu o te mapi papatahi. Whakakotahitia tena me te mea karekau te ahopae me nga raina ahopou i te riterite… a he uaua to tatauranga.

Anei tetahi whakamarama ataata pai mo te mahinga o nga Porowhita Nui.

Te Tātai Haversine

Ko te tawhiti e whakamahi ana i te piko o te Ao kei roto i te Tātai haversine, e whakamahi nei i te trigonometry kia pai ai te kopikopiko o te whenua. Ka kitea e koe te tawhiti i waenga i nga waahi e 2 i runga i te whenua (i te wa e rere ana te tii), he kopae te raina tika.

E pa ana tenei ki te rererangi rererangi - kua tiro koe ki te mapi o nga rererangi me te kite kua kopikopiko ratou? Na te mea he poto ake te rere i roto i te kopere i waenga i nga tohu e rua tena ki te waahi.

PHP: Tatau Taa tawhiti I waenga i te 2 Tohu Latitude me te Longitude

Anei te tātai PHP mō te tātai i te tawhiti i waenga i ngā pūwāhi e rua (me te Maero ki te Kiromita te hurihanga) kua whakaawhiwhia ki te rua ira.

function getDistanceBetweenPointsNew($latitude1, $longitude1, $latitude2, $longitude2, $unit = 'miles') {
  $theta = $longitude1 - $longitude2; 
  $distance = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) + (cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta))); 
  $distance = acos($distance); 
  $distance = rad2deg($distance); 
  $distance = $distance * 60 * 1.1515; 
  switch($unit) { 
    case 'miles': 
      break; 
    case 'kilometers' : 
      $distance = $distance * 1.609344; 
  } 
  return (round($distance,2)); 
}

Ko nga taurangi ko:

  • $Latitude1 – he taurangi mo te ahopae o to waahi tuatahi.
  • $Longitude1 – he taurangi mo te roa o to waahi tuatahi
  • $Latitude2 – he taurangi mo te ahopae tuarua o to waahi.
  • $Longitude2 – he taurangi mo te roa o to waahi tuarua.
  • $wae – te tangata taunoa kilomita. Ka taea te whakahou, te tuku ranei hei kiromita.

Python: Tatauhia te Tawhiti i waenganui i nga Pira 2 o te ahopae me te ahopou

Heoi ano, koinei te tauira Python mo te tatau i te tawhiti i waenga i nga ira e rua (me te Maero ki te Maero Kiromita) kua whakaawhiwhia ki nga waahi ira e rua. He mihi ki taku tama, a Bill Karr he Kaiputaiao Raraunga OpenINSIGHTS, mo te waehere.

from numpy import sin, cos, arccos, pi, round

def rad2deg(radians):
    degrees = radians * 180 / pi
    return degrees

def deg2rad(degrees):
    radians = degrees * pi / 180
    return radians

def getDistanceBetweenPointsNew(latitude1, longitude1, latitude2, longitude2, unit = 'miles'):
    
    theta = longitude1 - longitude2
    
    distance = 60 * 1.1515 * rad2deg(
        arccos(
            (sin(deg2rad(latitude1)) * sin(deg2rad(latitude2))) + 
            (cos(deg2rad(latitude1)) * cos(deg2rad(latitude2)) * cos(deg2rad(theta)))
        )
    )
    
    if unit == 'miles':
        return round(distance, 2)
    if unit == 'kilometers':
        return round(distance * 1.609344, 2)

Ko nga taurangi ko:

  • ahopae1 – he taurangi mo to waahi tuatahi Tuhinga.
  • ahopou1 – he taurangi mo to waahi tuatahi whakarihariha
  • ahopae2 – he taurangi mo to waahi tuarua Tuhinga.
  • ahopou2 – he taurangi mo to waahi tuarua whakarihariha.
  • kōwae – te tangata taunoa kilomita. Ka taea te whakahou, te tuku ranei hei kiromita.

MySQL: Te Tiki Rekooti Katoa I Roto I Te Awhe Ma te Tatau i te Tawhiti i Maero Ma te Whakamahi i te Latitu me te Longitude

Ka taea hoki te whakamahi i te SQL ki te mahi i te tatauranga ki te rapu i nga rekoata katoa i roto i tetahi tawhiti tawhiti. I roto i tenei tauira, ka paatai ​​au ki MyTable i roto i te MySQL ki te rapu i nga rekoata katoa he iti ake te rite ki te rereketanga $ tawhiti (i nga Maero) ki taku waahi i te $ latitude me te $ longitude:

Ko te patai mo te tango i nga rekoata katoa i roto i tetahi waahanga motuhake tawhiti ma te tatauranga i te tawhiti i nga maero i waenga i nga ira e rua o te ahopae me te ahopou:

$query = "SELECT *, (((acos(sin((".$latitude."*pi()/180)) * sin((`latitude`*pi()/180)) + cos((".$latitude."*pi()/180)) * cos((`latitude`*pi()/180)) * cos(((".$longitude."- `longitude`)*pi()/180)))) * 180/pi()) * 60 * 1.1515) as distance FROM `table` WHERE distance <= ".$distance."

Me whakarite e koe tenei:

  • $ ahopou - he taurangi PHP tenei ka tukuna atu e ahau te ahopou o te tohu.
  • $ ahopae - he taurangi PHP tenei ka tukuna atu e ahau te ahopou o te tohu.
  • $ tawhiti - Koinei te tawhiti e hiahia ana koe kia iti ake, kia rite ranei te katoa o nga rekoata.
  • ripanga - Koinei te teepu ... ka hiahia koe ki te whakakapi i tera ki to ingoa teepu.
  • Tuhinga - Koinei te mara o to latitude.
  • whakarihariha - Koinei te mara o to ahopou.

MySQL: Tiki Rekooti Katoa I Roto I Te Awhe Ma te Tatau i te Tawhiti i Kiromita Ma te Whakamahi i te Paepae me te Longitude

Anei te paatai ​​SQL e whakamahi ana i nga kiromita i roto i te MySQL:

$query = "SELECT *, (((acos(sin((".$latitude."*pi()/180)) * sin((`latitude`*pi()/180)) + cos((".$latitude."*pi()/180)) * cos((`latitude`*pi()/180)) * cos(((".$longitude."- `longitude`) * pi()/180)))) * 180/pi()) * 60 * 1.1515 * 1.609344) as distance FROM `table` WHERE distance <= ".$distance."

Me whakarite e koe tenei:

  • $ ahopou - he taurangi PHP tenei ka tukuna atu e ahau te ahopou o te tohu.
  • $ ahopae - he taurangi PHP tenei ka tukuna atu e ahau te ahopou o te tohu.
  • $ tawhiti - Koinei te tawhiti e hiahia ana koe kia iti ake, kia rite ranei te katoa o nga rekoata.
  • ripanga - Koinei te teepu ... ka hiahia koe ki te whakakapi i tera ki to ingoa teepu.
  • Tuhinga - Koinei te mara o to latitude.
  • whakarihariha - Koinei te mara o to ahopou.

I whakamahia e ahau tenei waehere ki roto i te papa whakamahere umanga i whakamahia e maatau mo te toa hokohoko me te nui atu o nga waahi 1,000 puta noa i Amerika ki te Raki a he ataahua te mahi.

Tawhiti Matawhenua Microsoft SQL Server: STDistance

Mena kei te whakamahi koe i te Microsoft SQL Server, ka tukuna e raatau a raatau ake mahi, STTawhiti mo te tatau i te tawhiti i waenga i nga tohu e rua ma te whakamahi i te momo raraunga Geography.

DECLARE @g geography;  
DECLARE @h geography;  
SET @g = geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326);  
SET @h = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326);  
SELECT @g.STDistance(@h);  

He pito potae ki a Manash Sahoo, VP me te Kaihanga o Highbridge.

77 Comments

  1. 1

    Nga mihi nui ki a koutou mo te tohatoha mai. He mahi kape me te whakapiri ngawari tenei, he pai te mahi. He maha nga wa i ora ai koe i ahau.
    FYI mo te hunga e kawe ana ki C:
    rua deg2rad (taarua deg) {whakahoki deg * (3.14159265358979323846 / 180.0); }

  2. 2

    He tino pai te whakairinga - he tino pai - me huri noa te ingoa o te teepu e mau ana ki te pae-roa. He tino tere te mahi ki .. He iti rawa taku lat-long (<400) engari ki taku whakaaro he pai te piki o tenei. Pae pai ano hoki - kua taapirihia e au ki taku nama del.icio.us a ka tirohia e au i nga wa katoa.

  3. 4
  4. 5

    I rapu ahau i te ra katoa mo nga tatauranga tawhiti ka kitea te algorithm harversine, he mihi ki a koe mo to tuku tauira mai me pehea te tuku ki roto i te korero sql. Nga mihi me te oha, Raniera

  5. 8

    Ki taku whakaaro me whai korero tau SQL.
    kaua ki te WHERE tawhiti <= $ tawhiti ka hiahia pea koe
    whakamahia te HEHEWE tawhiti <= $ tawhiti

    ki te kore he mihi mo te whakaora i ahau i te wa o te wa me te kaha.

  6. 10
  7. 11
  8. 12

    Nga mihi nui mo te tohatoha i tenei waehere. He nui te wa whanaketanga i ora ai ahau. Ano hoki, whakawhetai ki o kaipānui mo te whakaatu mai i tetahi korero KATOA e tika ana mo MySQL 5.x. Tino awhina.

  9. 14
  10. 15

    Hello,

    He patai ano. Kei kona tetahi tauira mo nga aho NMEA penei i raro nei?

    1342.7500, N, 10052.2287, E

    $GPRMC,032731.000,A,1342.7500,N,10052.2287,E,0.40,106.01,101106,,*0B

    mihi,
    Harry

  11. 16

    I kitea ano e KORE i mahi te MAHI ki ahau. Kua hurihia ki te MEA ana he tino pai nga mahi katoa. I te tuatahi kaore au i panui i nga korero ka tuhia ano ma te tohu kohanga. Ka pai nga mahi e rua.

  12. 17
  13. 18

    He nui te awhina, he mihi nui ki a koutou! I raru ahau mo te "HAVING" hou, kaua ki te "WHERE", engari i taku panui i nga korero i konei (i muri i te haurua haora o te huri o oku niho i te awangawanga = P), ka pai taku mahi. Mauruuru ^ _ ^

  14. 19
  15. 20

    Kia mahara ko nga korero kua tohua penei ka kaha ki te tatau, no reira he puhoi. Mena he maha o waa patai, ka tere te heke o nga mea.

    Ko te huarahi tino iti ake te kaha ko te whakahaere i tetahi waahanga tuatahi (miihini) ma te whakamahi i te takiwa KAUPAPA kua tautuhia e te tawhiti kua tohua ara "tohua * mai i te raarangi ingoa ko te latitude i waenga i te lat1 me te lat2 me te ahopou i waenga i te lon1 me te lon2". lat1 = targetlatitude - latdiff, lat2 = targetlatitude + latdiff, he rite ki te lon. latdiff ~ = tawhiti / 111 (mo te km), ko te tawhiti / 69 mo te maero mai i te 1 o te ahopae ko ~ 111 km (he rereketanga paku na te mea he porowhita te whenua, engari e ranea ana mo tenei kaupapa). londiff = tawhiti / (abs (cos (deg2rad (latitude)) * 111)) - 69 ranei mo te maero (ka taea e koe te tango i tetahi tapawha paku nui ake hei whakaatu i nga rereketanga). Na ka mau ki te hua o tera ka whangaia ki roto i te tiiwhana whiriwhiri. Kaua e wareware ki te whakaatu i nga taatai-i-rohe -e ko te whānuitanga o te ahopou manakohia ko -180 ki te +180 me te awhe o te ahopae manakohia ko -90 ki te +90 - mena ka rere to raanei me to riihi i waho o tenei awhe . Kia mahara, i roto i te nuinga o nga keehi kaore pea tenei e pa ki te mea ka pa ana ki nga tatauranga i runga i tetahi raina puta noa i te moana takawaenga mai i te pou ki tetahi pou, ahakoa kei waenga i te chukotka me tetahi waahanga o te alaska.

    Ko ta matou i tutuki ai ko tenei ko te whakaheke nui o te maha o nga tohu e whakaarohia ana e koe. Mena he miriona nga tohu o te ao kei roto i te papanga maatauranga kua tohatohahia a ka hiahia koe ki te rapu i roto i te 100 km, na ko to rapunga tuatahi (tere) ko te rohe 10000 km kiromita ka hua pea te 20 hua (i runga i te tohatoha te whanui e tata ana ki te 500M sq km), ko te tikanga ka whakahaerehia e koe te tatauranga tawhiti uaua kia 20 nga wa mo tenei patai kaua hei te miriona taima.

    • 21

      Hapa iti i roto i te tauira… tera pea kei roto 50 km (kaore i te 100) mai i te mea e titiro ana matou ki te "radius" o to… tapawha.

      • 22

        Tohutohu whakaharahara! I tino mahi ahau me tetahi kaiwhakawhanake nana i tuhi tetahi mahi i kumea te tapawha o roto ka mahi ai i te mahi haangai i te 'tapawha' huri noa i te paenga ki te whakauru me te aukati i nga toenga e toe ana. He hua tino tere te hua - ka taea e ia te arotake i nga miriona tohu i roto i te miihini-iti.

        Ko taku huarahi i runga ake nei he 'koretake' engari he ahei. Nga mihi ano!

        • 23

          Doug,

          Kei te ngana ahau ki te whakamahi i te mysql me te php ki te arotake mena kei roto i tetahi tohu he tohu roa. Kei te mohio koe mena i whakaputaina e to hoa kaiwhakawhanake etahi tauira mo te whakatutuki i tenei mahi. Kei te mohio ranei koe ki etahi tauira pai. Mihi i mua.

  16. 24

    Kia ora koutou katoa koinei taku whakamatautau SQL tauākī:

    SELECT DISTINCT area_id, (
    (
    (
    acos( sin( ( 13.65 * pi( ) /180 ) ) * sin( (
    `lat_dec` * pi( ) /180 ) ) + cos( ( 13.65 * pi( ) /180 ) ) * cos( (
    `lat_dec` * pi( ) /180 )
    ) * cos( (
    ( 51.02 - `lon_dec` ) * pi( ) /180 )
    )
    )
    ) *180 / pi( )
    ) *60 * 1.1515 * 1.609344
    ) AS distance
    FROM `post_codes` WHERE distance <= 50

    ana ko Mysql e kii mai ana ki ahau ko te tawhiti, kaore i te tiimatanga hei pou, ka taea e au te tono ma te, Ka taea e au te mahi mena kaore HEA, ka mahi, engari kaore i te taha…

  17. 26

    He rawe tenei, heoi he rite tonu ki nga manu e rere ana. He mea pai ki te whakamatau ki te whakauru i te maapepa google API ki tenei (peera ma te whakamahi i nga rori me etahi atu.) Hei tuku noa i tetahi whakaaro ma te whakamahi i nga momo waka rereke Kaore ano kia mahia e au te mahi tuhonoa whaarua i roto i te PHP kia taea ai te tuku otinga whaihua ki te raru o te kaihoko haere. Engari ki taku mahara ka taea pea e au te whakamahi ano i etahi o o tohu ki te mahi.

  18. 27
  19. 28

    Tuhinga pai! I kitea e au he maha o nga tuhinga e whakaatu ana me pehea te tatau i te tawhiti i waenga i nga waahanga e rua engari i tino rapu ahau mo te waahanga SQL.

  20. 29
  21. 30
  22. 31
  23. 32
  24. 36

    2 nga ra o te rangahau kia kitea te whaarangi nei ka ea taku raru. Te ahua nei he pai ake taku whakaputa i taku WolframAlpha ka para i aku pangarau. Ko te panoni mai i WHERE ki TE WHAKAMAHI kei te tuhia e taku tuhinga. NGA MAHI KATOA

  25. 37
  26. 39

    Ko taku hiahia koinei te whaarangi tuatahi i kitea e au i runga i tenei. Whai muri i te whakamatau i nga whakahau maha, koinei anake te mea e mahi tika ana, me te iti o nga whakarereketanga e tika ana kia uru mai ki taku ake paataka.
    Mihi te rota!

  27. 40

    Ko taku hiahia koinei te whaarangi tuatahi i kitea e au i runga i tenei. Whai muri i te whakamatau i nga whakahau maha, koinei anake te mea e mahi tika ana, me te iti o nga whakarereketanga e tika ana kia uru mai ki taku ake paataka.
    Mihi te rota!

  28. 41
  29. 42
  30. 43
  31. 45
  32. 46
  33. 47

    Kei te mohio ahau he pai tenei mahi, engari kaore e taea e au te kite kei hea te whiti o te ao e whakaarohia ana. Ka taea e tetahi te whakamarama i ahau, koa?

  34. 49
  35. 50
  36. 52
  37. 53
  38. 55
  39. 56
  40. 58

    whakawhetai mo te tuku i tenei tuhinga awhina,  
    engari mo etahi take ka hiahia au ki te patai
    me pehea te tawhiti i waenga i nga rangatira i roto i te mysql db me nga coords ka whakauruhia ki te php e te kaiwhakamahi?
    kia marama te whakamaarama:
    1. Kaiwhakamahi me whakauru [id] mo te kowhiri i nga raraunga kua tau mai i te db me nga taura a te kaiwhakamahi ake
    2.ko te konae php te tiki i nga raraunga whaainga (coords) ma te [id] ka tatau i te tawhiti i waenga i te kaiwhakamahi me te tohu whaainga

    ka taea noa ranei te neke atu i te waehere i raro nei?

    $ qry = “SELECT *, (((acos (sin ((“. $ latitude. ”* pi () / 180)) * sin ((` Latitude` * pi () / 180)) + cos ((“. $ latitude. ”* pi () / 180)) * cos ((` Latitude` * pi () / 180)) * cos (((". $ longitude." - `Longitude`) * pi () / 180) ))) * 180 / pi ()) * 60 * 1.1515 * 1.609344) hei tawhiti MAI `MyTable` WHERE tawhiti> =“. $ Tawhiti. ” >>>> Ka taea e au te "tango" i tawhiti mai i konei?
    whakawhetai ano,
    Timmy S

    • 59

      kaua e whakaaro, kua mohio ahau me pehea te mahi o te “mahi” ki te php
      $ dis = getDistanceBetantaraPointsNew ($ userLati, $ userLongi, $ lati, $ longi, $ unit = 'Km')
      kia ora !! 

  41. 60

    pai, ko nga mea katoa i whakamatauria e au kaore i te mahi. Ko te tikanga o aku mahi, engari ko nga tawhiti ka mamao.

    Ka taea pea e etahi te kite he aha te he o tenei waehere?

    mena ka tukuna ($ _ POST ['tukuna'])) {$ z = $ _POST ['zipcode']; $ r = $ _POST ['pūtoro']; oro "Nga hua mo". $ z; $ sql = mysql_query (“SELECT DISTINCT m.zipcode, m.MktName, m.LocAddSt, m.LocAddCity, m.LocAddState, m.x1, m.y1, m. kua whakamanahia, z1.lat, z2.lon, z1. taone, z1.state MAI mrk m, zip z1, zip z2 WHERE m.zipcode = z1.zipcode AND z2.zipcode = $ z AND (3963 * acos (truncate (sin (z2.lat / 57.2958) * sin (m. y1 / 57.2958) + cos (z2.lat / 57.2958) * cos (m.y1 / 57.2958) * cos (m.x1 / 57.2958 - z2.lon / 57.2958), 8))) <= $ r ") ka mate ranei (mysql_error ()); i te wa ($ row = mysql_fetch_array ($ sql)) {$ store1 = $ row ['MktName']. ""; $ store = $ row ['LocAddSt']. ””; $ store. = $ row ['LocAddCity']. ",". $ row ['LocAddState']. " ". $ Row ['zipcode']; $ latitude1 = $ rarangi ['lat']; $ longitude1 = $ rarangi ['lon']; $ latitude2 = $ rarangi ['y1']; $ longitude2 = $ rarangi ['x1']; $ city = $ row ['taone']; $ state = $ row ['state']; $ dis = getnew ($ latitude1, $ longitude1, $ latitude2, $ longitude2, $ unit = 'Mi'); // $ dis = tawhiti ($ lat1, $ lon1, $ lat2, $ lon2); $ verified = $ row ['manatoko']; mena ($ manatoko == '1') {echo “”; oro "". $ toa. ""; oro $ dis. ”Maero (s) kei tawhiti atu”; oro “”; } atu {echo "". $ toa. ""; oro $ dis. ”Maero (s) kei tawhiti atu”; oro “”; }}}

    taku waehere mahi.php
    mahi getnew ($ latitude1, $ longitude1, $ latitude2, $ longitude2, $ unit = 'Mi') {$ theta = $ longitude1 - $ longitude2; $ tawhiti = (hara (deg2rad ($ latitude1)) * sin (deg2rad ($ latitude2))) + (cos (deg2rad ($ latitude1)) * cos (deg2rad ($ latitude2)) * cos (deg2rad ($ theta)) ); $ tawhiti = acos ($ tawhiti); $ tawhiti = rad2deg ($ tawhiti); $ tawhiti = $ tawhiti * 60 * 1.1515; pana ($ wae) {take 'Mi': pakaru; take 'Km': $ tawhiti = $ tawhiti * 1.609344; } hokinga (huri noa ($ tawhiti, 2)); }

    Mauruuru koe i mua

  42. 61
  43. 62

    Hey Douglas, tuhinga pai. I kite ahau i te whakamarama o nga kaupapa matawhenua me te waehere he tino pai. Ko taku whakaaro noa ko te mokowhiti me te whakauru i te waehere hei whakaatu (penei i a Stackoverflow, hei tauira). Kei te maarama ahau kei te pirangi koe ki te penapena i te waahi, engari ma te mokowhiti tikanga / mokowhiti e maama ai te maama ki a au, hei kaiwhakahau rorohiko, ki te panui me te tohatoha. Ahakoa ra, he mea iti noa tera. Kia kaha tonu.

  44. 64
  45. 65

    i konei i te wa e whakamahi ana maatau ka whiwhi maatau i tetahi momo tawhiti .. i tenei wa me te paatai ​​i tetahi atu momo tawhiti

  46. 66
  47. 67
  48. 68
  49. 69
  50. 70

    te ahua tere (mysql 5.9) ki te whakamahi kia rua nga tikanga i te waahanga ka tohua ki hea:
    $ tātai = “(((acos (sin ((“. $ latitude. ”* pi () / 180)) * sin ((` Latitude` * pi () / 180)) + cos ((“. $ latitude. ”* Pi () / 180)) * cos ((` Latitude` * pi () / 180)) * cos (((". $ Longitude." - `Longitude`) * pi () / 180))) * 180 / pi ()) * 60 * 1.1515 * 1.609344) ”;
    $ sql = 'SELECT *,'. $ tātai. ' hei tawhiti MAI te teepu WHERE '.. $ tātai.' <= '. $ tawhiti;

  51. 71
  52. 72

    Nga mihi nui mo te kutikuti o tenei tuhinga. He pai te awhina.
    I te tuatahi i hangaia a PHP hei papaaho tuhi ngawari i huaina ko "Wharangi Kaainga Whaiaro". I enei wa ko te PHP (te kupu poto mo te Kaiwhakahauitua Hypertext) he rereke ki te hangarau a te Wharangi Tūmau Hohe (ASP) a Microsoft.

    Ko te PHP he reo tuwhera puna-taha a te taha ka whakamahia hei hanga i nga wharangi paetukutuku hihiri. Ka taea te whakauru ki te HTML. Ka whakamahia te PHP i te taha o te paataka MySQL i runga i nga kaituku paetukutuku Linux / UNIX. Koinei pea te reo tuhi rongonui.

  53. 73

    I kitea e ahau i runga ake nei te otinga kaore e mahi tika.
    Me huri au ki:

    $ qqq = “SELECT *, (((acos (sin ((“. $ latitude. ”* pi () / 180)) * sin ((` latt` * pi () / 180)) + cos ((”. $ latitude. “* pi () / 180)) * cos ((` latt` * pi () / 180)) * cos (((". $ longitude." - `long`` * * pi () / 180) ))) * 180 / pi ()) * 60 * 1.1515) te tawhiti mai i te `rehita`“;

  54. 75
  55. 76

    Kia ora, tena koa me awhina mai koe mo tenei.

    I tonoa e au he tono tiki ki taku kaituku paetukutuku http://localhost:8000/users/findusers/53.47792/-2.23389/20/
    53.47792 = $ latitude
    -2.23389 = $ ahopou
    me te 20 = te tawhiti e hiahia ana ahau ki te tiki

    Heoi ma te whakamahi i te tauira, ka tangohia e ia nga rarangi katoa o taku db

    $ hua = DB :: kowhiria (DB :: raw (“SELECT *, (((acos (sin ((“. $ latitude. ”* pi () / 180)) * sin ((lat * pi () / 180 )) + cos ((". $ latitude." * pi () / 180)) * cos ((lat * pi () / 180)) * cos (((". $ longitude." - lng) * pi ( ) / 180)))) * 180 / pi ()) * 60 * 1.1515 * 1.609344) hei tawhiti MAI nga tohu HAVING tawhiti> = “. $ Tawhiti));

    [{“Id”: 1, ”ingoa”: ”Frankie Johnnie & Luigo too”, ”wāhitau”: ”939 W El Camino Real, Mountain View, CA”, ”lat”: 37.386337280273, ”lng”: - 122.08582305908, ”Tawhiti”: 16079.294719663}, {“id”: 2, ”ingoa”: ”Amici's East Coast Pizzeria”, ”address”: ”790 Castro St, Mountain View, CA”, ”lat”: 37.387138366699, ”lng”: -122.08323669434, ”tawhiti”: 16079.175940152}, {“id”: 3, ”ingoa”: ”Kapp's Pizza Bar & Grill”, ”wāhitau”: ”191 Castro St, Mountain View, CA”, ”lat”: 37.393886566162, ”Lng”: - 122.07891845703, ”tawhiti”: 16078.381373826}, {“id”: 4, ”ingoa”: ”Round Table Pizza: Mountain View”, ”address”: ”570 N Shoreline Blvd, Mountain View, CA”, ”Lat”: 37.402652740479, ”lng”: - 122.07935333252, ”tawhiti”: 16077.420540582}, {“id”: 5, ”ingoa”: ”Tony & Alba's Pizza & Pasta”, ”wāhitau”: ”619 Escuela Ave, Mountain Tirohia, CA ”,” lat ”: 37.394012451172,” lng ”: - 122.09552764893,” tawhiti ”: 16078.563225154}, {“ id ”: 6,” ingoa ”:” Oregano's Wood-Fired Pizza ”,” wahitau ”:” 4546 El Camino Real, Los Altos, CA ”,” lat ”: 37.401725769043,” lng ”: - 122.11464691162,” tawhiti ”: 16077.937560795}, {“ id ”: 7,” ingoa ”:” The bar and grills ”,” address ”:” 24 Whiteley Street, Manchester ”,” lat ”: 53.485118865967,” lng ”: - 2.1828699111938,” tawhiti ”: 8038.7620112314}]

    Kei te hiahia au ki te tiki noa i nga haupae me te 20 maero engari e kawea katoa mai ana nga rarangi. Tena koa he aha taku mahi he

  56. 77

    Kei te rapu ahau mo tetahi patai rite engari he paku taapiri - poto ki te whakaropu i nga taunga katoa i roto i te 2 maero mai i ia ruruku ka tatau e hia nga taunga o ia roopu ka whakaputa i tetahi roopu e nui ana nga taunga - ahakoa he maha ake o roopu i waenga i nga roopu e maha ana nga taunga - whakaputa noa i te roopu tupurangi mai i nga roopu e rite ana te rahi o te nama -

He aha koutou whakaaro?

Whakamahia ai e tenei pae i te Akismet hei whakaiti i te mokowhiti. Akohia te tukatuka o to raraunga korero.