Geocoding can automatically extract geolocations from text. This example also shows a new way of submitting information to a server: in the example below, data is posted to the server using the same mechanism that is used in HTML forms. This is typically done to avoid having to URL-encode large amounts of data because when POST is used, the data travels in the header of the request, not the URL. This also allows more data to be sent:

'Ma io stasera volevo cenare al lume di candela, non cucinarci! #Milano #blackout' |
  ForEach-Object -Begin {$url='https://geocode.xyz'
    $null = Invoke-RestMethod $url -S session
  } -Process {
    Invoke-RestMethod $url -W $session -Method Post -Body @{scantext=$_;geoit='json'}

  }

The result looks similar to this:

 
longt   matches match                                                                                      
-----   ------- -----                                                                                      
9.18067 1       {@{longt=9.18067; location=MILANO,IT; matchtype=locality; confidence=0.9; MentionIndices...
 

Twitter This Tip! ReTweet this Tip!

Anonymous