Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Texas A&M Geolocation Service in F#
#r "../packages/FSharp.Data.2.2.2/lib/net40/FSharp.Data.dll"
open System.IO
open System.Text
open FSharp.Data
let sample = "..\Data\TAMUHttpGet.json"
type Context = JsonProvider<sample>
let streetAddress = "1600 Pennslyvania Ave"
let city = "Washington"
let state = "DC"
let zip = "20500"
let apiKey = "XXXXXXX"
let stringBuilder = new StringBuilder()
stringBuilder.Append("") |> ignore
stringBuilder.Append("?streetAddress=") |> ignore
stringBuilder.Append(streetAddress) |> ignore
stringBuilder.Append("&city=") |> ignore
stringBuilder.Append(city) |> ignore
stringBuilder.Append("&state=") |> ignore
stringBuilder.Append(state) |> ignore
stringBuilder.Append("&zip=") |> ignore
stringBuilder.Append(zip) |> ignore
stringBuilder.Append("&apiKey=") |> ignore
stringBuilder.Append(apiKey) |> ignore
stringBuilder.Append("&version=4.01") |> ignore
stringBuilder.Append("&format=json") |> ignore
let searchUri = stringBuilder.ToString()
let searchResult = Context.Load(searchUri)
let firstResult = searchResult.OutputGeocodes |> Seq.head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.