public class OverpassDownloadReader extends BoundingBoxDownloader
BoundingBoxDownloader.MoreNotesException
Modifier and Type | Field and Description |
---|---|
(package private) String |
overpassQuery |
(package private) String |
overpassServer |
crosses180th, lat1, lat2, lon1, lon2
gpxParsedProperly
activeConnection, cancel, oauthParameters
Constructor and Description |
---|
OverpassDownloadReader(Bounds downloadArea,
String overpassServer,
String overpassQuery)
Constructs a new
OverpassDownloadReader . |
Modifier and Type | Method and Description |
---|---|
protected void |
adaptRequest(HttpClient request)
Allows subclasses to modify the request.
|
private static String |
completeOverpassQuery(String query) |
protected String |
getBaseUrl()
Return the base URL for relative URL requests
|
protected InputStream |
getInputStreamRaw(String urlStr,
ProgressMonitor progressMonitor,
String reason,
boolean uncompressAccordingToContentDisposition)
Open a connection to the given url and return a reader on the input stream
from that connection.
|
protected String |
getRequestForBbox(double lon1,
double lat1,
double lon2,
double lat2)
Builds the request part for the bounding box.
|
protected String |
getTaskName()
Returns the name of the download task to be displayed in the
ProgressMonitor . |
protected DataSet |
parseDataSet(InputStream source,
ProgressMonitor progressMonitor)
Parse the given input source and return the dataset.
|
DataSet |
parseOsm(ProgressMonitor progressMonitor)
Download OSM files from somewhere
|
parseNotes, parseRawGps
getInputStream, getInputStream, getInputStreamRaw, getInputStreamRaw, isDoAuthenticate, isGpxParsedProperly, parseOsmBzip2, parseOsmChange, parseOsmChangeBzip2, parseOsmChangeGzip, parseOsmGzip, parseOsmZip, parseRawGpsBzip2, parseRawNotes, parseRawNotesBzip2, setDoAuthenticate
addAuth, addBasicAuthorizationHeader, addOAuthAuthorizationHeader, cancel, isCanceled
final String overpassServer
final String overpassQuery
public OverpassDownloadReader(Bounds downloadArea, String overpassServer, String overpassQuery)
OverpassDownloadReader
.downloadArea
- The area to downloadoverpassServer
- The Overpass server to useoverpassQuery
- The Overpass queryprotected String getBaseUrl()
OsmServerReader
getBaseUrl
in class OsmServerReader
protected String getRequestForBbox(double lon1, double lat1, double lon2, double lat2)
BoundingBoxDownloader
getRequestForBbox
in class BoundingBoxDownloader
lon1
- leftlat1
- bottomlon2
- rightlat2
- topprivate static String completeOverpassQuery(String query)
protected InputStream getInputStreamRaw(String urlStr, ProgressMonitor progressMonitor, String reason, boolean uncompressAccordingToContentDisposition) throws OsmTransferException
OsmServerReader
null
.getInputStreamRaw
in class OsmServerReader
urlStr
- The exact url to connect to.progressMonitor
- progress monitoring and abort handlerreason
- The reason to show on console. Can be null
if no reason is givenuncompressAccordingToContentDisposition
- Whether to inspect the HTTP header Content-Disposition
for filename
and uncompress a gzip/bzip2 stream.null
.OsmTransferException
- if data transfer errors occurprotected void adaptRequest(HttpClient request)
OsmServerReader
adaptRequest
in class OsmServerReader
request
- the prepared requestprotected String getTaskName()
BoundingBoxDownloader
ProgressMonitor
.getTaskName
in class BoundingBoxDownloader
protected DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException
BoundingBoxDownloader
parseDataSet
in class BoundingBoxDownloader
source
- input streamprogressMonitor
- progress monitorIllegalDataException
- if an error was found while parsing the OSM dataOsmReader.parseDataSet(InputStream, ProgressMonitor)
public DataSet parseOsm(ProgressMonitor progressMonitor) throws OsmTransferException
OsmServerReader
parseOsm
in class BoundingBoxDownloader
progressMonitor
- The progress monitorOsmTransferException
- if any error occurs