To run this example, you will need to create a resource key.
The resource key is used as shorthand to store the particular set of
properties you are interested in as well as any associated license keys
that entitle you to increased request limits and/or paid-for properties.
You can create a resource key using the 51Degrees Configurator.
Expected output:
1 What country
is at coordinates:-0.9822207999999999, 51.458048?
35 from fiftyone_location.location_pipelinebuilder
import LocationPipelineBuilder
42 resourceKey =
"!!YOUR_RESOURCE_KEY!!" 44 if resourceKey ==
"!!YOUR_RESOURCE_KEY!!":
46 You need to create a resource key at 47 https://configure.51degrees.com and paste it into the code, 48 'replacing !!YOUR_RESOURCE_KEY!! 49 To get a resourcekey with the properties used in this example go to https://configure.51degrees.com/GCrtGh1L 53 pipeline = LocationPipelineBuilder({
"resourceKey": resourceKey}).build()
58 flowData = pipeline.create_flowdata()
62 latitude =
"51.458048" 63 longitude =
"-0.9822207999999999" 65 flowData.evidence.add(
"query.51D_Pos_latitude", latitude)
66 flowData.evidence.add(
"query.51D_Pos_longitude", longitude)
72 print(
"What country is at coordinates:" + longitude +
", " + latitude +
"?")
73 if flowData.location.country.has_value():
74 print(flowData.location.country.value())
76 print(flowData.location.no_value_message())