- public static GeoParsedResult parse(Result result) {
- String rawText = result.getText();
- if (rawText == null || !rawText.startsWith("geo:")) {
- return null;
- }
- // Drop geo, query portion
- int queryStart = rawText.indexOf('?', 4);
- String geoURIWithoutQuery;
- if (queryStart < 0) {
- geoURIWithoutQuery = rawText.substring(4);
- } else {
- geoURIWithoutQuery = rawText.substring(4, queryStart);
- }
- int latitudeEnd = geoURIWithoutQuery.indexOf(',');
- if (latitudeEnd < 0) {
- return null;
+ public String getGeoURI() {
+ StringBuffer result = new StringBuffer();
+ result.append("geo:");
+ result.append(latitude);
+ result.append(',');
+ result.append(longitude);
+ if (altitude > 0) {
+ result.append(',');
+ result.append(altitude);