-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added parsing of county #51
Conversation
src/test/resources/converter.yml
Outdated
@@ -1 +1,5 @@ | |||
nominatimURL: https://nominatim.openstreetmap.org/search/ | |||
|
|||
openCageDataURL: https://api.opencagedata.com/geocode/v1/json | |||
openCageDataKey: XXXXXXXX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could in theory commit my personal ocd key here, it's a free key and is pretty limited anyway, but that way we could actually test ocd in travis. Like this the test will always fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT @karussell?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's try. Or we can also try to hide it and then it will work on travis only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sure, one downside of this is that we cannot run tests for any PRs if the env variable is encrypted, because travis does not share encrypted variables with forked repos. So maybe every contributor needs to set up their own keys or it's not possible at all (not sure yet).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be a problem for now.
@@ -35,6 +35,9 @@ | |||
@JsonProperty("adm1_name") | |||
private String adm1Name; | |||
|
|||
@JsonProperty("adm3_name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -16,7 +16,7 @@ public static GHEntry convertFromGisgraphyAddress(GisgraphyAddressEntry gisgraph | |||
GHEntry rsp = new GHEntry(null, null, gisgraphyEntry.getLat(), | |||
gisgraphyEntry.getLng(), gisgraphyEntry.getDisplayName(), null, | |||
gisgraphyEntry.getCountry(), gisgraphyEntry.getCity(), | |||
gisgraphyEntry.getState(), gisgraphyEntry.getStreetName(), | |||
gisgraphyEntry.getState(), gisgraphyEntry.getAdm3Name(), gisgraphyEntry.getStreetName(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When thinking about this a bit more, I am not sure if we should do this. We convert Adm3Name to county, but maybe this is not true for other regions of the world? Gisgraphy does not return county, maybe we just return null then instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, admin3 is not always county. Do you plan to add county @gisgraphy ?
County is very country specific and can not be general field. As you can see on this page https://wiki.openstreetmap.org/wiki/Tag:boundary=administrative We prefer administrative division with level. We import several datasets (tiger next month) and it seems to be a good choice |
If you know in which country there is a county you may map the adm field to county. |
Thanks for the information @gisgraphy. @karussell, so I would remove the county parsing from Gisgraphy for now? |
Ok |
Ok, I removed the Gisgraphy Adm3 part again. |
BTW: I set the gisgraphy tests to ignore for now, so that the tests can run successfully for the other providers. |
@@ -41,17 +41,19 @@ public Response handle(@QueryParam("q") @DefaultValue("") String query, | |||
@QueryParam("nominatim") @DefaultValue("false") boolean nominatim, | |||
@QueryParam("find_osm_id") @DefaultValue("true") boolean find_osm_id, | |||
@QueryParam("reverse") @DefaultValue("false") boolean reverse, | |||
@QueryParam("point") @DefaultValue("false") String point | |||
@QueryParam("point") @DefaultValue("false") String point, | |||
@QueryParam("ocd_key") @DefaultValue("") String ocdKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allowing to provide an ocd_key per request seemed the cleanest solution to inject the key from an environment variable. Another solution could have been to check if there is an environment variable in ConverterApplication
. Let me know if I should move the code there. For now I decided against it, because it's too much "magic" for my taste. When debugging an issue you would easily miss this and wonder why it works locally but not on the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point! This works great. BTW: We could also use the same approach for Gisgraphy and specify private environment variables for this as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can I remove the user-agent that allow requests (for tests) on #48 ?
If I understand Travis and other will use an env variable as the API key, right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand Travis and other will use an env variable as the API key, right ?
Yes, that is correct. I think you can remove the user agent :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done :)
Fixes #50.
This PR adds the ability to parse the county field of Nominatim, OCD, and in theory for Gisgraphy. The Gisgraphy part is untested.