如何提供利比亚的意大利语或英语瓷砖地图
How to serve italian or english tiles map of Libia
我有 Libian 地图,但我不想用原始阿拉伯字母显示它,而是用意大利语或英语字符显示,我该怎么做?如果我可以只用一种语言显示所有地图就更好了...
这是我的代码
<body onload="init()">
<div id="map" id="map"></div>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
var map;
function init() {
// The overlay layer for our marker, with a simple diamond as symbol
var overlay = new OpenLayers.Layer.Vector('Overlay', {
styleMap: new OpenLayers.StyleMap({
externalGraphic: 'ico_soggiorno.png',
graphicWidth: 20, graphicHeight: 20, graphicYOffset: -20,
title: 'test'
})
});
// The location of our marker and popup. We usually think in geographic
// coordinates ('EPSG:4326'), but the map is projected ('EPSG:3857').
var myLocation = new OpenLayers.Geometry.Point( 13.1833326, 32.6833306 )
.transform('EPSG:4326', 'EPSG:3857');
// We add the marker with a tooltip text to the overlay
overlay.addFeatures([
new OpenLayers.Feature.Vector(myLocation, {tooltip: 'OpenLayers'})
]);
// Finally we create the map
map = new OpenLayers.Map({
div: "map", projection: "EPSG:3857",
layers: [new OpenLayers.Layer.OSM(), overlay],
center: myLocation.getBounds().getCenterLonLat(), zoom: 7
});
}
使用 osmappa.it 个图块,它看起来像这样:
<body onload="init()">
<div id="map" id="map"></div>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
var map;
function init() {
var osmappa = new TileLayer({
source: new OSM({
attributions: [
'Tiles © <a href="https://www.osmappa.it/">osMap</a>',
ATTRIBUTION
],
url: 'https://osmap.{a-d}.tile.maphost.it/it/map/v1/{z}/{x}/{y}.png'
//ask them first if you can use those tiles!
})
});
// The overlay layer for our marker, with a simple diamond as symbol
var overlay = new OpenLayers.Layer.Vector('Overlay', {
styleMap: new OpenLayers.StyleMap({
externalGraphic: 'ico_soggiorno.png',
graphicWidth: 20, graphicHeight: 20, graphicYOffset: -20,
title: 'test'
})
});
// The location of our marker and popup. We usually think in geographic
// coordinates ('EPSG:4326'), but the map is projected ('EPSG:3857').
var myLocation = new OpenLayers.Geometry.Point( 13.1833326, 32.6833306 )
.transform('EPSG:4326', 'EPSG:3857');
// We add the marker with a tooltip text to the overlay
overlay.addFeatures([
new OpenLayers.Feature.Vector(myLocation, {tooltip: 'OpenLayers'})
]);
// Finally we create the map
map = new OpenLayers.Map({
div: "map", projection: "EPSG:3857",
layers: [osmappa, overlay],
center: myLocation.getBounds().getCenterLonLat(), zoom: 7
});
这将是您使用意大利瓷砖的代码变体。但请先询问他们,也许您需要一个 apikey 或类似的东西,因为现在看起来这些图块似乎只为 osmappa.it 而不是为其他项目加载。
我有 Libian 地图,但我不想用原始阿拉伯字母显示它,而是用意大利语或英语字符显示,我该怎么做?如果我可以只用一种语言显示所有地图就更好了...
这是我的代码
<body onload="init()">
<div id="map" id="map"></div>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
var map;
function init() {
// The overlay layer for our marker, with a simple diamond as symbol
var overlay = new OpenLayers.Layer.Vector('Overlay', {
styleMap: new OpenLayers.StyleMap({
externalGraphic: 'ico_soggiorno.png',
graphicWidth: 20, graphicHeight: 20, graphicYOffset: -20,
title: 'test'
})
});
// The location of our marker and popup. We usually think in geographic
// coordinates ('EPSG:4326'), but the map is projected ('EPSG:3857').
var myLocation = new OpenLayers.Geometry.Point( 13.1833326, 32.6833306 )
.transform('EPSG:4326', 'EPSG:3857');
// We add the marker with a tooltip text to the overlay
overlay.addFeatures([
new OpenLayers.Feature.Vector(myLocation, {tooltip: 'OpenLayers'})
]);
// Finally we create the map
map = new OpenLayers.Map({
div: "map", projection: "EPSG:3857",
layers: [new OpenLayers.Layer.OSM(), overlay],
center: myLocation.getBounds().getCenterLonLat(), zoom: 7
});
}
使用 osmappa.it 个图块,它看起来像这样:
<body onload="init()">
<div id="map" id="map"></div>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
var map;
function init() {
var osmappa = new TileLayer({
source: new OSM({
attributions: [
'Tiles © <a href="https://www.osmappa.it/">osMap</a>',
ATTRIBUTION
],
url: 'https://osmap.{a-d}.tile.maphost.it/it/map/v1/{z}/{x}/{y}.png'
//ask them first if you can use those tiles!
})
});
// The overlay layer for our marker, with a simple diamond as symbol
var overlay = new OpenLayers.Layer.Vector('Overlay', {
styleMap: new OpenLayers.StyleMap({
externalGraphic: 'ico_soggiorno.png',
graphicWidth: 20, graphicHeight: 20, graphicYOffset: -20,
title: 'test'
})
});
// The location of our marker and popup. We usually think in geographic
// coordinates ('EPSG:4326'), but the map is projected ('EPSG:3857').
var myLocation = new OpenLayers.Geometry.Point( 13.1833326, 32.6833306 )
.transform('EPSG:4326', 'EPSG:3857');
// We add the marker with a tooltip text to the overlay
overlay.addFeatures([
new OpenLayers.Feature.Vector(myLocation, {tooltip: 'OpenLayers'})
]);
// Finally we create the map
map = new OpenLayers.Map({
div: "map", projection: "EPSG:3857",
layers: [osmappa, overlay],
center: myLocation.getBounds().getCenterLonLat(), zoom: 7
});
这将是您使用意大利瓷砖的代码变体。但请先询问他们,也许您需要一个 apikey 或类似的东西,因为现在看起来这些图块似乎只为 osmappa.it 而不是为其他项目加载。