Skip to content
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

contributor filter with additional other filter does not work correctly. #409

Closed
rtroilo opened this issue Jul 30, 2021 · 4 comments · Fixed by #411
Closed

contributor filter with additional other filter does not work correctly. #409

rtroilo opened this issue Jul 30, 2021 · 4 comments · Fixed by #411
Assignees
Labels
bug Something isn't working as expected

Comments

@rtroilo
Copy link
Member

rtroilo commented Jul 30, 2021

Bug Description

When filtering for contributors with additional other filters does not work correctly.

var filter = "contributor:1822133 " 
    + "and type:node"; // with this additional filter

var result = OSMContributionView.on(oshdb).keytables(keytables)
    .areaOfInterest(bboxWgs84Coordinates(-180, -90, 180, 90))
    .filter(filter)
    .aggregateBy(OSMContribution::getContributorUserId)
    .count();

assertEquals(1, result.size());

reported by @SlowMo24

@rtroilo rtroilo added the bug Something isn't working as expected label Jul 30, 2021
@SlowMo24
Copy link
Contributor

This may be unrelated and I will file a different bug in that case but something tells me that the following behaviour goes in the same direction:

Requesting one building tag grouped by building key works fine:

curl -X POST "https://api.ohsome.org/v1/elements/area/groupBy/tag" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "bboxes=7.614272368193529%2C48.65702077458387%2C9.13521359578018%2C49.65272281436074&filter=building%3Dresidential&format=json&groupByKey=building&time=2021-06-13T10%3A25%3A59"

{
  "attribution": {
    "url": "https://ohsome.org/copyrights",
    "text": "© OpenStreetMap contributors"
  },
  "apiVersion": "1.5.0",
  "groupByResult": [
    {
      "groupByObject": "building=residential",
      "result": [
        {
          "timestamp": "2021-06-13T10:25:59Z",
          "value": 11989738.62
        }
      ]
    }
  ]
}

requesting residential buildings grouped by natural key also works fine:

curl -X POST "https://api.ohsome.org/v1/elements/area/groupBy/tag" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "bboxes=7.614272368193529%2C48.65702077458387%2C9.13521359578018%2C49.65272281436074&filter=building%3Dresidential&format=json&groupByKey=natural&time=2021-06-13T10%3A25%3A59"

{
  "attribution": {
    "url": "https://ohsome.org/copyrights",
    "text": "© OpenStreetMap contributors"
  },
  "apiVersion": "1.5.0",
  "groupByResult": [
    {
      "groupByObject": "remainder",
      "result": [
        {
          "timestamp": "2021-06-13T10:25:59Z",
          "value": 11989738.62
        }
      ]
    }
  ]
}

but requesting residential and other buildings grouped by natural key returns a strange result

curl -X POST "https://api.ohsome.org/v1/elements/area/groupBy/tag" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "bboxes=7.614272368193529%2C48.65702077458387%2C9.13521359578018%2C49.65272281436074&filter=building%3Dresidential%20or%20building%3Dyes&format=json&groupByKey=natural&time=2021-06-13T10%3A25%3A59"

{
  "attribution": {
    "url": "https://ohsome.org/copyrights",
    "text": "© OpenStreetMap contributors"
  },
  "apiVersion": "1.5.0",
  "groupByResult": [
    {
      "groupByObject": "remainder",
      "result": [
        {
          "timestamp": "2021-06-13T10:25:59Z",
          "value": 237458958.23
        }
      ]
    },
    {
      "groupByObject": "natural=water",
      "result": [
        {
          "timestamp": "2021-06-13T10:25:59Z",
          "value": 6162.25
        }
      ]
    },
    {
      "groupByObject": "natural=bare_rock",
      "result": [
        {
          "timestamp": "2021-06-13T10:25:59Z",
          "value": 1177.67
        }
      ]
    },
    {
      "groupByObject": "natural=spring",
      "result": [
        {
          "timestamp": "2021-06-13T10:25:59Z",
          "value": 30.24
        }
      ]
    }
  ]
}

@tyrasd
Copy link
Member

tyrasd commented Jul 30, 2021

returns a strange result

you mean strange in the sense of that you did not expect entries like natural=spring in the result? There are some OSM objects like this one which do have both tags, which explains the results. Or did you mean something else?

@SlowMo24
Copy link
Contributor

yes, unexpected is what I meant and thank you for the example. I first thought of these 'double' objects but dropped that thought when I saw the natural=bare_rock. Seems like I was wrong and should dig deeper into the data. Yet the result is still unexpected but maybe reasonable and probably hard to prevent.

@tyrasd
Copy link
Member

tyrasd commented Jul 30, 2021

here's the object with bare_rock: https://www.openstreetmap.org/way/93066394 🏰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants