Skip to content

Commit

Permalink
Check response from Fieldpapers request to see if it has what we need
Browse files Browse the repository at this point in the history
  • Loading branch information
iandees committed Sep 9, 2024
1 parent 4187897 commit 1e5d9d9
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public void openUrl(String url) {
// fetch metadata
JsonObject metadata = getMetadata(url);

if (metadata == null || metadata.getJsonString("tilejson_url") == null) {
JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Could not read information for \"{0}\" from fieldpapers.org", url));
return;
}

String tileJsonUrl = metadata.getJsonString("tilejson_url").getString();
String id = metadata.getJsonString("id").getString();

Expand All @@ -86,7 +91,7 @@ public void openUrl(String url) {
double east = bounds.getJsonNumber(2).doubleValue();
double north = bounds.getJsonNumber(3).doubleValue();

// save this atlas as the
// save this atlas ID as the last used atlas
FieldPapersPlugin.LAST_USED_ID.put(id);

Bounds b = new Bounds(new LatLon(south, west), new LatLon(north, east));
Expand All @@ -96,7 +101,7 @@ public void openUrl(String url) {

} catch (IOException ex) {
Logging.error(ex);
JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Could not read information for the id \"{0}\" from fieldpapers.org", url));
JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Could not read information for \"{0}\" from fieldpapers.org", url));
}
}

Expand Down

0 comments on commit 1e5d9d9

Please sign in to comment.