mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
b5ac29c9a5
given css class and extends a given vocabulary with a term consisting with the text content of the html class tag. Additionally, the term is included into the semantic facet of the document. This allows the creation of faceted search to documents without the pre-creation of vocabularies; instead, the vocabulary is created on-the-fly, possibly for use in other crawls. If any of the term scraping for a specific vocabulary is successful on a document, this vocabulary is excluded for auto-annotation on the page. To use this feature, do the following: - create a vocabulary on /Vocabulary_p.html (if not existent) - in /CrawlStartExpert.html you will now see the vocabularies as column in a table. The second column provides text fields where you can name the class of html entities where the literal of the corresponding vocabulary shall be scraped out - when doing a search, you will see the content of the scraped fields in a navigation facet for the given vocabulary
64 lines
2.7 KiB
Java
64 lines
2.7 KiB
Java
/**
|
|
* osm
|
|
* Copyright 2008 by Michael Peter Christen
|
|
* First released 13.02.2011 at http://yacy.net
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program in the file lgpl21.txt
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import net.yacy.cora.protocol.RequestHeader;
|
|
import net.yacy.peers.graphics.EncodedImage;
|
|
import net.yacy.peers.graphics.OSMTile;
|
|
import net.yacy.server.serverObjects;
|
|
import net.yacy.server.serverSwitch;
|
|
import net.yacy.visualization.PrintTool;
|
|
import net.yacy.visualization.RasterPlotter;
|
|
import net.yacy.visualization.RasterPlotter.DrawMode;
|
|
|
|
public class osm {
|
|
|
|
public static EncodedImage respond(final RequestHeader header, final serverObjects post, @SuppressWarnings("unused") final serverSwitch env) {
|
|
|
|
int zoom = 10;
|
|
double lat = 50.11670d;
|
|
double lon = 8.68333d;
|
|
int width = 3;
|
|
int height = 3;
|
|
|
|
if (post != null) {
|
|
zoom = post.getInt("zoom", zoom);
|
|
lat = post.getDouble("lat", lat);
|
|
lon = post.getDouble("lon", lon);
|
|
width = post.getInt("width", width);
|
|
height = post.getInt("height", height);
|
|
}
|
|
|
|
final OSMTile.tileCoordinates coord = new OSMTile.tileCoordinates(lat, lon, zoom);
|
|
RasterPlotter map = OSMTile.getCombinedTiles(coord, width, height);
|
|
map.setDrawMode(DrawMode.MODE_SUB);
|
|
map.setColor(0xffffff);
|
|
/*
|
|
* copyright notice on OSM Tiles
|
|
* According to http://www.openstreetmap.org/copyright/ the (C) of the map tiles is (CC BY-SA)
|
|
* while the OpenStreetMap raw data is licensed with (ODbL) http://opendatacommons.org/licenses/odbl/
|
|
* Map tiles shall be underlined with the statement "(C) OpenStreetMap contributors". In our 5-dot character
|
|
* set the lowercase letters do not look good, so we use uppercase only.
|
|
* The (C) symbol is not available in our font, so we use the letters (C) instead.
|
|
*/
|
|
PrintTool.print(map, map.getWidth() - 6, map.getHeight() - 6, 0, "(C) OPENSTREETMAP CONTRIBUTORS", 1);
|
|
return new EncodedImage(map, header.get("EXT", null), true);
|
|
}
|
|
|
|
} |