Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

more fixes for double precision of coordinates

Michael Peter Christen0284a4d88f6b
diff --git a/source/de/anomic/data/wiki/WikiCode.java b/source/de/anomic/data/wiki/WikiCode.java
index 5ae9b0202..114bef703 100644
--- a/source/de/anomic/data/wiki/WikiCode.java
+++ b/source/de/anomic/data/wiki/WikiCode.java
@@ -1049,7 +1049,7 @@ public class WikiCode extends AbstractWikiParser implements WikiParser {
if (d[d.length-1].toUpperCase().equals("w")) {lon = -lon; lonm = -lonm;}
}
}
- if (lon != 0.0f && lat != 0.0f) {
+ if (lon != 0.0d && lat != 0.0d) {
// replace this with a format that the html parser can understand
line = line.substring(0, p) + (name.length() > 0 ? (" " + name) : "") + " <nobr> " + lato + " " + lat + "\u00B0 " + latm + "'</nobr><nobr>" + lono + " " + lon + "\u00B0 " + lonm + "'</nobr> " + line.substring(q + WIKI_CLOSE_METADATA.length());
s = p;
diff --git a/source/net/yacy/document/geolocalization/Coordinates.java b/source/net/yacy/document/geolocalization/Coordinates.java
index 75edf46bd..06fddbd49 100644
--- a/source/net/yacy/document/geolocalization/Coordinates.java
+++ b/source/net/yacy/document/geolocalization/Coordinates.java
@@ -24,20 +24,20 @@ package net.yacy.document.geolocalization;
public class Coordinates {
- private static final float tenmeter = 90.0f / 1.0e6f;
+ private static final double tenmeter = 90.0d / 1.0e6d;
- private final float lon, lat;
+ private final double lon, lat;
- public Coordinates(float lon, float lat) {
+ public Coordinates(double lon, double lat) {
this.lon = lon;
this.lat = lat;
}
- public float lon() {
+ public double lon() {
return this.lon;
}
- public float lat() {
+ public double lat() {
return this.lat;
}
diff --git a/source/net/yacy/document/parser/html/ContentScraper.java b/source/net/yacy/document/parser/html/ContentScraper.java
index 269980a13..fe2f8c559 100644
--- a/source/net/yacy/document/parser/html/ContentScraper.java
+++ b/source/net/yacy/document/parser/html/ContentScraper.java
@@ -174,8 +174,8 @@ public class ContentScraper extends AbstractScraper implements Scraper {
this.li = new ArrayList<String>();
this.content = new CharBuffer(MAX_DOCSIZE, 1024);
this.htmlFilterEventListeners = new EventListenerList();
- this.lon = 0.0f;
- this.lat = 0.0f;
+ this.lon = 0.0d;
+ this.lat = 0.0d;
this.evaluationScores.match(Element.url, root.toNormalform(false, false));
this.canonical = null;
}
@@ -227,29 +227,29 @@ public class ContentScraper extends AbstractScraper implements Scraper {
r--;
if (newtext[r] == 'N') {
this.lat = Float.parseFloat(new String(newtext, r + 2, p - r - 2)) +
- Float.parseFloat(new String(newtext, p + pl + 1, q - p - pl - 1)) / 60.0f;
- if (this.lon != 0.0f) break location;
+ Float.parseFloat(new String(newtext, p + pl + 1, q - p - pl - 1)) / 60.0d;
+ if (this.lon != 0.0d) break location;
s = q + 6;
continue location;
}
if (newtext[r] == 'S') {
this.lat = -Float.parseFloat(new String(newtext, r + 2, p - r - 2)) -
- Float.parseFloat(new String(newtext, p + pl + 1, q - p - pl - 1)) / 60.0f;
- if (this.lon != 0.0f) break location;
+ Float.parseFloat(new String(newtext, p + pl + 1, q - p - pl - 1)) / 60.0d;
+ if (this.lon != 0.0d) break location;
s = q + 6;
continue location;
}
if (newtext[r] == 'E') {
this.lon = Float.parseFloat(new String(newtext, r + 2, p - r - 2)) +
- Float.parseFloat(new String(newtext, p + pl + 1, q - p - pl - 1)) / 60.0f;
- if (this.lat != 0.0f) break location;
+ Float.parseFloat(new String(newtext, p + pl + 1, q - p - pl - 1)) / 60.0d;
+ if (this.lat != 0.0d) break location;
s = q + 6;
continue location;
}
if (newtext[r] == 'W') {
this.lon = -Float.parseFloat(new String(newtext, r + 2, p - r - 2)) -
- Float.parseFloat(new String(newtext, p + 2, q - p - pl - 1)) / 60.0f;
- if (this.lat != 0.0f) break location;
+ Float.parseFloat(new String(newtext, p + 2, q - p - pl - 1)) / 60.0d;
+ if (this.lat != 0.0d) break location;
s = q + 6;
continue location;
}
@@ -804,7 +804,7 @@ public class ContentScraper extends AbstractScraper implements Scraper {
// <meta NAME="geo.position" CONTENT="38.90551492;1.454004505" />
public double getLon() {
- if (this.lon != 0.0f) return this.lon;
+ if (this.lon != 0.0d) return this.lon;
String s = this.metas.get("ICBM"); // InterContinental Ballistic Missile (abbrev. supposed to be a joke: http://www.jargon.net/jargonfile/i/ICBMaddress.html), see http://geourl.org/add.html#icbm
if (s != null) {
int p = s.indexOf(';');
@@ -815,7 +815,7 @@ public class ContentScraper extends AbstractScraper implements Scraper {
this.lon = Double.parseDouble(s.substring(p + 1).trim());
}
}
- if (this.lon != 0.0f) return this.lon;
+ if (this.lon != 0.0d) return this.lon;
s = this.metas.get("geo.position"); // http://geotags.com/geobot/add-tags.html
if (s != null) {
int p = s.indexOf(';');