zsoltk / overpasser Goto Github PK
View Code? Open in Web Editor NEWFluid Java interface to OpenStreetMap data through querying the Overpass API
License: Apache License 2.0
Fluid Java interface to OpenStreetMap data through querying the Overpass API
License: Apache License 2.0
$ scripts/run-tests-travis.sh
ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-7-oracle
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
This one should be very easy and is intended to get you comfortable in the project.
Have a look at the desired output that should be generated:
Overpass_QL#Filters.
The filter node is already implemented. The task now is to implement area.
Check out Language_Guide. Under every example you can see "Display result: OpenLayers map, JSON, XML.". Use those urls to fiddle around and try to write your own query by hand, including the new filter to be written. When satisfied, move on to coding.
Open OverpassFilterQuery.java, and look at how node is implemented. Now do the same for area, next to it.
Tailor the Javadoc for the new method.
Open OverpassFilterQueryTest.java, and create a test for the new method.
Please leave issues of the same kind with way and rel filters for others, and move on to something more complex. You could even browse the Overpass_QL documentation to look for features to be implemented.
Documentation: Overpass_QL#Global_bounding_box.
Goal: add method to OverpassQuery with the following signature:
public OverpassQuery boundingBox(double southernLat, double westernLon, double northernLat, double easternLon)
The adapter currently supports 2.0 beta only.
Documentation: Overpass_QL#Relative to other elements (around)
Implement filters:
(around:radius)
(around:radius,latitude,longitude)
Note: the optional [.input_set]
modifier is intentionally left out. Input sets here and in other parts of the library will be supported in a later stage.
Goal: add methods to OverpassFilterQuery
with the following signatures:
public OverpassFilterQuery around(double radius)
and
public OverpassFilterQuery around(double radius, double lat, double lon)
I forked the repo to try things out, and I'm not sure if I discovered a bug.
Here's a simple class that prints your example query. Here's the output:
["out":"xml"]["timeout":"30"]; (node["amenity"="parking"]["access"!="private"]
(47.48047027491862,19.039797484874725,47.51331674014172,19.07404761761427);
way["amenity"="parking"]["access"!="private"]
(47.48047027491862,19.039797484874725,47.51331674014172,19.07404761761427);
rel["amenity"="parking"]["access"!="private"]
(47.48047027491862,19.039797484874725,47.51331674014172,19.07404761761427);<;); out body
center qt 100;
When I paste this into Overpass Turbo, it gives me an error about the quotation marks around 'out' and 'timeout'. When I remove them, the query works.
I'm not sure who's wrong here, overpasser or Overpass Turbo?
I tried working around this like this:
sebkur@308bd3d
However that removes quotation marks around all clauses, which is not what is desired:
[out:"xml"][timeout:"30"]; (node[amenity="parking"][access!="private"]
(47.48047027491862,19.039797484874725,47.51331674014172,19.07404761761427);
way[amenity="parking"][access!="private"]
(47.48047027491862,19.039797484874725,47.51331674014172,19.07404761761427);
rel[amenity="parking"][access!="private"]
(47.48047027491862,19.039797484874725,47.51331674014172,19.07404761761427);<;); out body
center qt 100;
Maybe I just dont see the code but I want to know how I can get the coordinates from the result. I just see that the builder can build the query but does it connect automatically with overpass api? And how do I get the coordinates to show on the map or how can I handle the result?
As I said, I just dont see the code. Maybe someone can post the link to the code where this is handled.
This one should be very easy and is intended to get you comfortable in the project.
Have a look at the desired output that should be generated:
Overpass_QL#Filters.
The filter node is already implemented. The task now is to implement rel.
Check out Language_Guide. Under every example you can see "Display result: OpenLayers map, JSON, XML.". Use those urls to fiddle around and try to write your own query by hand, including the new filter to be written. When satisfied, move on to coding.
Open OverpassFilterQuery.java, and look at how node is implemented. Now do the same for rel, just under it.
Tailor the Javadoc for the new method.
Open OverpassFilterQueryTest.java, and create a test for the new method.
Please leave issues of the same kind with way and area filters for others, and move on to something more complex. You could even browse the Overpass_QL documentation to look for features to be implemented.
I'm trying to call overpass-api in my java project, with following code:
OverpassQuery query = new OverpassQuery()
.format(JSON)
.timeout(30)
.filterQuery()
.node()
.amenity("drinking_water")
.boundingBox(41.88659196260802, 12.488558292388916, 41.89248629819397, 12.51119613647461)
.end()
.output(100);
OverpassQueryResult result = interpret(query.build());
And getting following error message as response:
Response{protocol=http/1.1, code=400, message=Bad Request, url=http://overpass-api.de/api/interpreter?data=[%22out%22:%22json%22][%22timeout%22:%2230%22];%20(node[%22amenity%22%3D%22drinking_water%22](41.88659196260802,12.488558292388916,41.89248629819397,12.51119613647461);%3C;);%20out%20body%20center%20qt%20100;}
Can you please guide, how can I overhaul this issue.
I need to use the around filter and that is not available in the latest version on the maven repository. Can you please put the latest release on maven repository?
I would like to know if I can use you library to generate a query that will return state, county, city, zipcode or any admi level by country
Using overpass-api.de it was not possible to load results for this query:
["out":"json"]["timeout":"30"];
(
node
["amenity"="parking"]
["access"!="private"]
(47.48047027491862,19.039797484874725,47.51331674014172,19.07404761761427);
<;
);
out body center qt 100;
But this works fine:
(
node
["amenity"="parking"]
["access"!="private"]
(47.48047027491862,19.039797484874725,47.51331674014172,19.07404761761427);
<;
);
out body center qt 100;
If I ignore format and timeout in the query builder, I still get an ";" in the beginning of the query string.
In order to get a working query string I had to use:
query.substring(31)
Now I get a response but also the parsing error:
com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
Even when XML Outputformat is used, the same error message appears.
Documentation: Overpass_QL#By_polygon
Implementation guidelines:
class OverpassPolygonFilter extends AbstractOverpassSubQuery
public OverpassPolygonFilter polygon()
to OverpassFilterQuery
(by the same logic as OverpassFilterQuery
is embedded in OverpassQuery.filterQuery()
public OverpassPolygonFilter addPoint(double lat, double lon)
to OverpassPolygonFilter (should return the query object itself by the logic applied everywhere else in the Query classes)When done, it should be possible to use the polygon filter like:
new OverpassQuery()
.filterQuery()
.node()
.polygon()
.addPoint(lat1, lon1)
.addPoint(lat2, lon2)
.addPoint(lat3, lon3)
// ...
.end()
.end()
.output(100)
.build()
;
This one should be very easy and is intended to get you comfortable in the project.
Have a look at the desired output that should be generated:
Overpass_QL#Filters.
The filter node is already implemented. The task now is to implement way.
Check out Language_Guide. Under every example you can see "Display result: OpenLayers map, JSON, XML.". Use those urls to fiddle around and try to write your own query by hand, including the new filter to be written. When satisfied, move on to coding.
Open OverpassFilterQuery.java, and look at how node is implemented. Now do the same for way, just under it.
Tailor the Javadoc for the new method.
Open OverpassFilterQueryTest.java, and create a test for the new method.
Please leave issues of the same kind with rel and area filters for others, and move on to something more complex. You could even browse the Overpass_QL documentation to look for features to be implemented.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.