-
Notifications
You must be signed in to change notification settings - Fork 1
OSM
AndreasWBartels edited this page Dec 6, 2021
·
13 revisions
<dependency>
<groupId>net.anwiba.spatial</groupId>
<artifactId>anwiba-spatial-data-osm</artifactId>
<version>1.1.158</version>
</dependency>
see JSSD
String urlString = "http://overpass.osm.rambler.ru/cgi/interpreter?data=[out:json];rel(50.746,7.154,50.748,7.157);out;"
OverpassJsonObjectsUnmarshaller<OverpassObject> unmarshaller = new OverpassJsonObjectsUnmarshaller()
.create(OverpassObject.class);
IHttpRequestExecutor httpRequestExecutor = new HttpRequestExcecutorFactory(
new HttpClientConnectionManagerProvider()).create();
ConvertingHttpRequestExecutor requestExecutor = new ConvertingHttpRequestExecutor(httpRequestExecutor);
List<OverpassObject> objects = requestExecutor.execute(
canceler,
() -> RequestBuilder.get(urlString).build(),
(IResultProducer<List<Place>>) (
inputStream,
statusCode,
statusMessage,
contentType,
contentEncoding) -> unmarshaller.unmarshal(inputStream));
see description
see JSSD
String urlString = "http://nominatim.openstreetmap.org/search/where am i?format=jsonv2&addressdetails=1&limit=20&polygon_geojson=1";
NominatimJsonObjectsUnmarshaller<Place> unmarshaller = new NominatimJsonObjectsUnmarshallerFactory()
.create(Place.class);
IHttpRequestExecutor httpRequestExecutor = new HttpRequestExcecutorFactory(
new HttpClientConnectionManagerProvider()).create();
ConvertingHttpRequestExecutor requestExecutor = new ConvertingHttpRequestExecutor(httpRequestExecutor);
List<Place> places = requestExecutor.execute(
canceler,
() -> RequestBuilder.get(urlString).build(),
(IResultProducer<List<Place>>) (
inputStream,
statusCode,
statusMessage,
contentType,
contentEncoding) -> unmarshaller.unmarshal(inputStream));
Dependencies for samples
<dependency>
<groupId>net.anwiba.commons</groupId>
<artifactId>anwiba-commons-http</artifactId>
<version>1.0.58</version>
</dependency>