Coder Social home page Coder Social logo

overpasser's People

Contributors

sebkur avatar zsoltk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

overpasser's Issues

Implement "way" filter

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.

Implement "area" filter

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.

Implement around filters

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)

Implement polygon filter

Documentation: Overpass_QL#By_polygon

Implementation guidelines:

  • create class OverpassPolygonFilter extends AbstractOverpassSubQuery
  • add method public OverpassPolygonFilter polygon() to OverpassFilterQuery (by the same logic as OverpassFilterQuery is embedded in OverpassQuery.filterQuery()
  • add method 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()
;

Getting Bad Request error message as response

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.

Implement "rel" filter

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.

Quotation marks around paramters

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;

Travis error

$ 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.

How to get coordinates?

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.

Example query works only after format and timeout have been removed....

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.

Refactor tests

  • Refactor tests so that OverpassQueryBuilder can be mocked out and injected into query classes
  • Test only interactions with the mock instead of making assumptions on its implementation details
  • Extract usage example tests into their own test class

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.