Closed kradem closed 6 years ago
Hi @kradem,
The /v1/reverse
endpoint is definitely the one you want. However its ability to do coarse (admin area only, as opposed to addresses and venues too) reverse geocoding has been pretty poor for a long time.
Fortunately, we are currently rolling out a new point in polygon service that does an excellent job at coarse reverse. You could try setting that up on its own, or use it with the pelias api (support was recently merged to the master branch).
This new service should be able to always return, for any given lat/lon, what whosonfirst admin areas that point is within. Using the population from the corresponding full record like you suggested would be a great way to determine if a place is populated.
Please let us know how it goes and don't hesitate to ask if you have any more questions!
Regards!
The /v1/reverse endpoint is definitely the one you want. However its ability to do coarse (admin area only, as opposed to addresses and venues too) reverse geocoding has been pretty poor for a long time.
This explains a lot of things happened last few months in my project's tests... :-)
Fortunately, we are currently rolling out a new point in polygon service that does an excellent job at coarse reverse. You could try setting that up on its own, or use it with the pelias api (support was recently merged to the master branch).
This new service should be able to always return, for any given lat/lon, what whosonfirst admin areas that point is within. Using the population from the corresponding full record like you suggested would be a great way to determine if a place is populated.
Something went wrong with the last libpostal upgrade I had on my development machine, but I would try remove it as textAnalyzer and look for this brand new feature.
Please let us know how it goes and don't hesitate to ask if you have any more questions!
As soon I have anything to report I'll write here.
Thank you very much!
Hey @orangejulius!
I'm stuck with this. I successfully installed api@master and if I understand correctly api's code (btw, prior to installing and using Pelias I have never been dealing with node.js...) pip service has to be enabled (I can't find any configuration entry for this) and reverse layers
attribute has to be coarse
, then pip-service would automatically run.
For example, if I send this request to running Pelias API service:
curl 'http://127.0.0.1:3100/v1/reverse?point.lat=30.187&point.lon=71.499&layers=coarse&sources=wof'
that should be equal to request on running standalone pip-service:
curl 'http://127.0.0.1:3102/71.499/30.187'
I'm afraid I can't say that happens on my development machine and I cannot manage to run standalone service:
@kradem I think the pip service needs the path to WOF data as a parameter. so something like npm start -- /path/to/wof/data
. @trescube can we change that to be read from pelias.json
? (if there was a good reason for it I'm forgetting let me know)
The syntax is npm start <path to WOF data>
. The project doesn't currently use pelias-config since it's a heavy to come along for the ride for a single value. Support for a command line parameter and config could probably exist, though.
Sorry for delay!
Yep, of course, I haven't provided wof source. So, I have got running pip-service ready to give me some point information:
This is a request for a point at sea:
curl 'http://127.0.0.1:3102/14.94937115/43.892623'
{
"region": [{
"id": 85684785,
"name": "Inland waters of Croatia",
"centroid": {
"lat": 43.618249,
"lon": 15.646464
},
"bounding_box": "13.224042,42.1758995,18.5415705,45.5030665"
}],
"country": [{
"id": 85633229,
"name": "Croatia",
"abbr": "HRV",
"centroid": {
"lat": 45.067726,
"lon": 16.398549
},
"bounding_box": "13.501475,42.416327,19.407838,46.546979"
}]
}
and this is for some mountain point:
curl 'http://127.0.0.1:3102/15.072006/44.577639'
{
"region": [{
"id": 85684737,
"name": "Licko-senjska",
"centroid": {
"lat": 44.687678,
"lon": 15.410409
},
"bounding_box": "14.733,44.271229,16.13929,45.1228905"
}],
"country": [{
"id": 85633229,
"name": "Croatia",
"abbr": "HRV",
"centroid": {
"lat": 45.067726,
"lon": 16.398549
},
"bounding_box": "13.501475,42.416327,19.407838,46.546979"
}]
}
both with the lack of locality attribute.
The next examples have locality attributes:
curl 'http://127.0.0.1:3102/14.901770/44.988023'
{
"locality": [{
"id": 101795793,
"name": "Senj",
"centroid": {
"lat": 44.990145,
"lon": 14.904972
},
"bounding_box": "14.8950382746,44.9802379292,14.9215760792,45.0072016039"
}],
"region": [{
"id": 85684737,
"name": "Licko-senjska",
"centroid": {
"lat": 44.687678,
"lon": 15.410409
},
"bounding_box": "14.733,44.271229,16.13929,45.1228905"
}],
"country": [{
"id": 85633229,
"name": "Croatia",
"abbr": "HRV",
"centroid": {
"lat": 45.067726,
"lon": 16.398549
},
"bounding_box": "13.501475,42.416327,19.407838,46.546979"
}]
}
curl 'http://127.0.0.1:3102/26.713394/58.372835'
{
"locality": [{
"id": 101748151,
"name": "Tartu",
"centroid": {
"lat": 58.373635,
"lon": 26.731958
},
"bounding_box": "26.6709107752,58.3292883301,26.8197040973,58.4080162143"
}],
"region": [{
"id": 85682995,
"name": "Tartumaa",
"centroid": {
"lat": 58.367777,
"lon": 26.738988
},
"bounding_box": "26.0771095,58.113041,27.480841,58.682676"
}],
"country": [{
"id": 85633135,
"name": "Estonia",
"abbr": "EST",
"centroid": {
"lat": 58.671014,
"lon": 25.535793
},
"bounding_box": "21.832367,57.515819,28.186475,59.670885"
}]
}
so I suppose I'll just look for the existence of that locality
attribute and set the is_populated
property according to that.
Also, as I need the point's label too, I'll go with name
attribute of locality for populated point, respectively region
(if attr exists) or country
for the non-populated area.
Hello!
Sorry we never got back to you on this, but it looks like you figured everything out. In the past year, the quality of PIP service results should only have improved, and if you seem to be on the right track with checking for a locality
record (you might want to consider localadmin
as well).
If you have a chance, let us know if it worked out.
Hi everybody!
I was using Pelias in development for some time, but I haven't figured out what to search if I want some kind of easy reverse geocoding response: is this point (lon-lat) inside populated area or not?
What would be the best practice for that and by which source? Am I confident if I, for example, condition my query to wof source, try to get locality attribute and check for the existence of wk:population entry?
Btw, this response I need is just for informational purposes and correct answers aren't crucial, I'd rather be implementing some fast queries with less accuracy than slow sophisticated algorithms.
Thank you very much for your work!