You are not logged in.

Announcement

*** NOTICE: forum.openstreetmap.org is being retired. Please request a category for your community in the new ones as soon as possible using this process, which will allow you to propose your community moderators.
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***

#1 2021-08-03 11:11:24

nagadoudi
New Member
Registered: 2021-06-14
Posts: 2

Optimize a Overpass QL request

Hi everybody!

Here's a Overpass QL request to get nodes, ways and relations having values "yes", "customary", "permissive" and "obligatory".

[out:json][timeout:25];
// gather results
(
  // query part for: “beach”
  node["nudism"="yes"]({{bbox}});
  way["nudism"="yes"]({{bbox}});
  relation["nudism"="yes"]({{bbox}});
  node["nudism"="customary"]({{bbox}});
  way["nudism"="customary"]({{bbox}});
  relation["nudism"="customary"]({{bbox}});
  node["nudism"="permissive"]({{bbox}});
  way["nudism"="permissive"]({{bbox}});
  relation["nudism"="permissive"]({{bbox}});
  node["nudism"="obligatory"]({{bbox}});
  way["nudism"="obligatory"]({{bbox}});
  relation["nudism"="obligatory"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

Is it possible to optimize it to make it lighter and faster?

Offline

#2 2021-08-03 15:03:21

mmd
Member
Registered: 2010-11-06
Posts: 2,150

Re: Optimize a Overpass QL request

Instead of "node", "way", "relation"; you can use "nwr" for short. Also, you can merge multiple values using regular expressions:

nwr[nudism~"^(yes|customary|permissive|obligatory)$"]({{bbox}});

Offline

Board footer

Powered by FluxBB