For some addresses that I attempt to geocode, google returns inappropriately inconclusive results.
The following is an example, but it is not an isolated incident. The first returned result is the exact match, however google flags it as a "partial_match":
Street address: 16160 Frederick Rd
City: Gaithersburg
State: MD
Zip code: 20877
Link: http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=16160%20Frederick%20Rd,+Gaithersburg,+MD,+20877
My issue here is in determining which is the correct match. In this case, the "partial match" flag is not useful because it is set to "true" on all matching results. In this case, I could test for equality on the street address, city, state, and/or zip, however, if there is even a small difference in spelling between what I send google, and what I get as a response, that will not work either. (Example: "Road" vs "Rd").
Am I doing something wrong here? Is there a conclusive way to distinguish the exact match that I am unfamiliar with?
Thanks!
Google does a wonderful job at address approximation. What you're looking for is address verification. SmartyStreets provides an address verification API that is conclusive in it's results. Here's what the SmartyStreets API returns for that address:
Input:
https://api.qualifiedaddress.com/street-address/?street=16160%20Frederick%20Rd&street2=&city=gaithersburg&state=md&zipcode=20877&candidates=10&auth-token=YOUR_AUTHENTICATION_TOKEN_HERE
Output:
[
{
"input_index": 0,
"candidate_index": 0,
"delivery_line_1": "16160 Frederick Rd",
"last_line": "Gaithersburg MD 20877-4011",
"delivery_point_barcode": "208774011604",
"components": {
"primary_number": "16160",
"street_name": "Frederick",
"street_suffix": "Rd",
"city_name": "Gaithersburg",
"state_abbreviation": "MD",
"zipcode": "20877",
"plus4_code": "4011",
"delivery_point": "60",
"delivery_point_check_digit": "4"
},
"metadata": {
"record_type": "S",
"county_fips": "24031",
"county_name": "Montgomery",
"carrier_route": "C004",
"congressional_district": "08",
"latitude": 39.12162,
"longitude": -77.17619,
"precision": "Zip9"
},
"analysis": {
"dpv_match_code": "Y",
"dpv_footnotes": "AABB",
"dpv_cmra": "N",
"dpv_vacant": "N",
"ews_match": false
}
}
]
Notice that the "dpv_match_code" is "Y". That's USPS-speak for a verified delivery point--you know that it's a real address at that point. SmartyStreets uses official, current USPS data and is a CASS-Certified software provider.
The API is free for non-profits, educational institutions and low-usage users. Once you've received a result from SmartyStreets you could then geocode it with Google. Full disclosure: I'm a developer at SmartyStreets.
EDIT: Added Latitude/Longitude fields (newly released)
Related
Using the [searchContacts API method] (https://developers.google.com/people/api/rest/v1/people/searchContacts) used to support searching by telephone number - indeed this is called out in the documentation:
The query matches on a contact's names, nickNames, emailAddresses, phoneNumbers, and organizations fields that are from the CONTACT source.
It no longer returns results when using a phone number as the query. Is this deliberate, or a bug?
As per google people api search by phonenumbers I have tried a query of "canonical format without plus". I have also tried "canonical format with plus" and "exact number as stored".
Name query still works
https://people.googleapis.com/v1/people:searchContacts?readMask=names%2cphoneNumbers&query=Go Ogle&pageSize=30
returns
{
"results": [
{
"person": {
"resourceName": "people/c832768086350305259",
"etag": "%EgcBAgsuNz0/GgECIgwxZGVYd20reHpEUT0=",
"names": [
{
"metadata": {
"primary": true,
"source": {
"type": "CONTACT",
"id": "b8e96298f3117eb"
}
},
"displayName": "Go Ogle",
"familyName": "Ogle",
"givenName": "Go",
"displayNameLastFirst": "Ogle, Go",
"unstructuredName": "Go Ogle"
}
],
"phoneNumbers": [
{
"metadata": {
"primary": true,
"source": {
"type": "CONTACT",
"id": "b8e96298f3117eb"
}
},
"value": "020 7031 3000",
"canonicalForm": "+442070313000"
}
]
}
}
]
}
Phone number query fails
https://people.googleapis.com/v1/people:searchContacts?readMask=names%2cphoneNumbers&query=442070313000&pageSize=30
returns
{}
The query function does indeed seem to be broken at the moment. My tests gave the same results and the question you linked shows that it clearly worked in the past.
I found a bug report on Google's issue tracker. A Googler already replied to it saying that they were able to reproduce it and filed an internal report. It's a matter of time until they fix it so you may want to keep track of that thread or post on it yourself to apply some pressure.
The bug didn't went away although they say it was closed and verified
In order to get the same functionality I had to be creative, the documentation says:
The query matches on a contact's names, nickNames, emailAddresses,
phoneNumbers, and organizations fields that are from the CONTACT
source.
The names, emailAddresses, phoneNumbers and organizations are important fields where you don't want to have garbage, but on my case at least the nickNames had no usage, so I simply add the phone number as nick name and the search works like charm.
Keep in mind that if you have many previous contacts you will have to write a script that will copy their phone number to the one of the nicknames fields.
Enjoy :)
I am new to blockchain and i am trying to play with blockchain so I used metaplex and candy-machine to upload and mint dummy nft's which is working fine. The opensource repositories that I am playing with are below:
https://github.com/metaplex-foundation/metaplex
https://github.com/exiled-apes/candy-machine-mint
Then for learning purposes, I wanted to divide minting and secondary sales into more than one wallet so I changed JSON and added three test wallets into the creator's array.
{
"name": "#0",
"symbol": "%$%",
"description": "description goes here",
"seller_fee_basis_points": 500,
"image": "image.png",
"external_url": "",
"edition": 0,
"attributes": [
{
"trait_type": "Background",
"value": "Street"
}
],
"properties": {
"files": [
{
"uri": "image.png",
"type": "image/png"
}
],
"category": "image",
"creators": [
{
"address": "<public address 1>",
"share": 34
},
{
"address": "<public address 1>",
"share": 33
},
{
"address": "<public address 1>",
"share": 33
}
]
}
}
But the problem is splitting is happening on secondary sales and not on minting. On minting the wallet set as treasury resource is getting all amount. I want to split the transaction amount on minting too.
Interestingly, I found this quote in the metaplex documentation:
The SPL Metadata program supports storing up to five co-creators that
share potential future profits from sales for the items as defined by
seller_fee_basis_points . Each creator needs to be added as part of
the minting process and is required to approve metadata that was used
in his name using the sign_metadata endpoint. Unverified artwork
cannot be sold with Metaplex.
During the first sale, creators share in 100% of the proceeds, while
in follow up sales, they share in proceeds as a percentage determined
by seller_fee_basis_points. Whether or not a metadata is considered in
second sale or not is determined by the primary_sale_happened boolean
on the Metadata account.
My interpretation of this is that the expected behavior should be for the initial sale to get divided between creators using the ratios defined by each creator's share. Sounds like you're experiencing something different.
Keep in mind that this documentation is for the parent project. Candy-machine-mint seems to be a fork and they may have altered some of that behavior.
The source code of the code of the contract you are intersted in can be found here: https://github.com/metaplex-foundation/metaplex-program-library/blob/master/nft-candy-machine/program/src/lib.rs
At line 247 the transfer of sol is called to a single treasury address of the candy machine. To change it to multiple addresses this contract would have to be updated and redeployed.
Another alternative I have seen deployed in the solana community atm is a second contract which will split the funds evenly. Unfortunately, the creator of this contract has been charging for it and has not open-sourced it yet. They can be found on the metaplex discord if you are interested.
If I need to update the name or address of a contact, giving the field as "names, addresses" works.
How do I need to give the updateMask to update a specific field like "middleName" alone.
Providing updateMask as "names.middleName" does not work and throws the following error:
{
"error": {
"code": 400,
"message": "Invalid updatePersonFields mask path: \"names.middle_name\". Valid paths are documented at https://developers.google.com/people/api/rest/v1/people/updateContact.",
"status": "INVALID_ARGUMENT"
}
}
Anyone help?
Answer:
You need to use names as updatePersonFields, but all names need to be specified. This may be a bug, as linked below, but it is also not clear from the documentation.
More Information:
It is possible this is a bug, though until a response is obtained from the issue tracker report (which I assume was you -but if not - hit the star to help it gain more attention) about this it is not possible to know for sure.
While FieldMasks do accept sub-fields, these are not specified on the updatePersonFields documentation page, only the broader names.
You can see the list of definitely supported fields here under the Query Parameters.
Current Workaround:
While waiting for Google to respond to the bug report, the only way you can get around this is by using the names field mask, but also including the firstName and lastName parameters too when making the patch:
{
"names": [
{
"givenName": "Rafa",
"middleName": "Guillermo",
"familyName": "Rocks"
}
],
"etag": "%XxXXXx00XxxXXXXXXxXXXX00XXXXXXxXxxX0"
}
Remember: If you leave out any of these fields this is tantamount to replacing it with empty string - so be careful!
I'm trying to figure out:
if this even makes sense to go this deep in a URI and
how would I specify multi-level filtering on a resource such as below.
Example: Person
A person has had several drivers license lets say. And each drivers license has location information.
Person:
{
"id": 222,
"name": "Andy",
"licenses": [
{
"type": 4,
"location": {
"country": 12,
"city": 333,
"state": 58
}
},
{
"type": 4,
"location": {
"country": 53,
"city": 633,
"state": 23
}
}
]
}
Ok and lets say a consumer of our API wants to get all people whos drivers license was in country 53 (name for that country is lets say "USA").
I want to be able to call the API and somehow specify that I want this via querystring field filters.
I can't figure out how to represent filtering that goes x levels down, here being a couple levels.
I mean I started to think about it and got stuck /persons?licenses(type=drivers, location(country=53))
obviously this is just pseudo code and not even really something I'd use so how would you signify levels and filter on those levels like this? Or is there some way to still do a lot of that in the hierarchical part of the URI?
And I don't think you can specify filtering for this in that part of the URI...because the hierarchical part is for finding a specific resource first that you want to act upon. I don't think it's meant to be doing sublevel filtering in addition to finding a resource in the hierarchical part in this particular situation because the last resource you have in your {resource}/{id}/{resource}/{id} type of deal means the last resource is what you'll get back and that's not what I want, I don't want back the Country resource representation, I want back a list of persons in this case.
[Note: the first two answers, which includes the one I wrote, do not yet deal with the "optional" fql.multiquery issue.]
When I am using facebook's fql, I can get a list of schools I have attended, or that friends have attended. Specifically, I can get the school's name, and it's facebook id. However, I do not know how to query for deeper information about these schools.
Specifically, I would like to find out where the schools were located. But, I do not know what facebook graph entity (or whatever else) those school ids are part of.
How would I find out from facebook where these schools are located?
Optional: It would be even better if this can be done in the same multiquery that returned the lists of schools in the first place (this would be a query against the user table for my id and another query against the user table for some ids of my friends).
Here's an expanded version of the optional part mentioned in the above paragraph (note that I tried adding this as a separate question, but when I went in make the illustrative data more relevant, I saw that it had silently vanished. So I am assuming I tripped over some feature of stack overflow designed to weed out questions which are too similar to each other. So, instead, let's just say that this is a clarification of what I meant, in the above paragraph)
Using facebook's javascript sdk, this fails, silently:
FB.login(function(response){
disp('loginResponse', response);
var userQuery= FB.Data.query(
'select uid,name,education from user where uid= {0}'
, response.session.uid);
var friendlist = FB.Data.query(
'select uid2 from friend where uid1 = {0} order by rand() limit 10'
, response.session.uid);
var friends = FB.Data.query(
'select uid,name,education from user where uid in (select uid2 from {0})'
, friendlist);
var friendSchools= FB.Data.query(
'select page_id,name,location from page where page_id in (select education.school.id from {0})'
, friends);
self.queries= [userQuery, friendlist, friends, friendSchools];
FB.Data.waitOn(queries
, function() {alert(1)});
})
If I remove the friendSchools element from the queries array, it works just fine, and a friend might be represented by an object like this:
{
uid: '...',
name: '...',
education:
[
{
school:
{
id: '115920001751600',
name: 'Burlington High School'
},
year:
{
id: '138792749476094',
name: '1978'
},
type: 'High School'
},
{
school:
{
id: '20697868961',
name: 'Boston University'
},
degree:
{
id: '188387604516411',
name: 'BS'
},
year:
{
id: '103823546338323',
name: '1982'
},
type: 'College'
}
]
}
So, how do I restructure the where clause in the friendSchools query so that that query can be performed?
In other words, how can I use fql.multiquery to find information about schools (or other such entities) returned elsewhere in the multiquery?
I would suggest using batch requests (more information here: https://developers.facebook.com/docs/reference/api/batch/) to query the graph based on the schools ID you already have. The location of the school can be retrieved in it's default basic information returned (example below).
{
"id": "6192688417",
"name": "Stanford University",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/41571_6192688417_2310209_s.jpg",
"link": "https://www.facebook.com/stanford",
"likes": 203153,
"category": "Education",
"website": "http://www.stanford.edu",
"username": "stanford",
"founded": "1891",
"location": {
"street": "450 Serra Mall",
"city": "Stanford",
"state": "CA",
"country": "United States",
"zip": "94305",
"latitude": 37.42895,
"longitude": -122.1697
},
"public_transit": "http://transportation.stanford.edu",
"general_info": "Located between San Francisco and San Jose in the heart of Silicon Valley, Stanford University is recognized as one of the world's leading research and teaching institutions.\n\nLeland and Jane Stanford founded the University to \"promote the public welfare by exercising an influence on behalf of humanity and civilization.\" Stanford opened its doors in 1891, and more than a century later, it remains dedicated to finding solutions to the great challenges of the day and to preparing our students for leadership in today's complex world.",
"checkins": 9938
}
And, it looks like to get fql to work I want to be querying the page table. For example:
select name,location from page where page_id = 87873693141
(That said, I'm still trying to figure out how to extract the list my education's school ids into the where clause for a multi-query.)