I don't understand why the "attribution" does not appear with the layer.
Have you an idea ?
var raster = new ol.layer.Tile({
title: 'OSM',
type: 'base',
minResolution : 2,
attributions: [new ol.Attribution({
html: "© OpenStreetMap -Mitwirkende, SRTM | Affichage de la carte: © OpenTopoMap (CC-BY-SA)"
})],
source: new ol.source.XYZ({
url: '//{a-c}.tile.opentopomap.org/{z}/{x}/{y}.png',
})
});
attributions is a property of the source property of a layer.
So that means your layer definition should look like this:
var raster = new ol.layer.Tile({
title: 'OSM',
type: 'base',
minResolution : 2,
source: new ol.source.XYZ({
url: '//{a-c}.tile.opentopomap.org/{z}/{x}/{y}.png',
attributions: [new ol.Attribution({
html: "© OpenStreetMap -Mitwirkende, SRTM | Affichage de la carte: © OpenTopoMap (CC-BY-SA)"
})],
})
});
Related
this is the odata response i am getting:
my desired result would be a search help that displays the "TypRolle", "RolleNr" and "RolleOri" columns of the odata response. But right now i am stuck at trying to just display one of them, the "TypRolle" one.
this is what my search help looks like right now:
As you can see, no values are being displayed.
Here is my valueHelpRequest method:
var roletypeUrl = "my odata url";
var attModel = new sap.ui.model.json.JSONModel();
var link = this.getView().byId("roletype"); // roletype input field
var oDataModel = new sap.ui.model.odata.v2.ODataModel(roletypeUrl, {
json: true,
loadMetadataAsync: true
});
oDataModel.read("/ZshNsiAgr01xxlEinzelTypSet", {
success: function(oData, response) {
attModel.setData(oData);
var oValueHelpDialog = new sap.m.Popover({
title: "Rollentyp auswählen",
footer: [new sap.m.Button({
text: "Ok"
})]
});
oValueHelpDialog.openBy(link);
var oItemTemplate = new sap.m.StandardListItem({
title: "test",
description: "{TypRolle}"
});
var oHelpTable = new sap.m.Table({
width: "300pt",
columns: [
new sap.m.Column({
header: [
new sap.m.Label({
text: "Rollentyp"
})
]
})
],
items: {
path: "/results",
template: oItemTemplate
},
items: [
new sap.m.ColumnListItem({
cells: [
new sap.m.Text({
text: "{TypRolle}"
})
]
})
]
})
oHelpTable.setModel(attModel);
oValueHelpDialog.addContent(oHelpTable);
I am very thankful for any kind of suggestion and look forward to your answers :)
If you have to do it with JSON model ... here it is
]
})
]
})
oHelpTable.bindAggregation("items", "/results", new sap.m.ColumnListItem({
cells: [
new sap.m.Text({
text: "{TypRolle}"
})
]
}));
oHelpTable.setModel(attModel);
oValueHelpDialog.addContent(oHelpTable);
Or else you can directly bind to your default OData model as well and it can fetch the data automatically without you writing the read
this is my grid.js file which is included in the grid.html. I don't know what is wrong with my code. I have seen examples and tried to perform same with my geoserver layer but no output. My code after variable store is not working. I want to load my file on the web and display its data in feature grid using geoext 3.0.0. Kindly help.
Ext.require([
'Ext.container.Container',
'Ext.panel.Panel',
'Ext.grid.GridPanel',
'GeoExt.component.Map',
'GeoExt.data.store.Features'
]);
Ext.onReady(function () {
var wmsLayer = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://localhost:8080/geoserver/opengeo/wms',
params: {'LAYERS': 'opengeo:abc'},
serverType: 'geoserver'
})
});
var baseLayer = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'http://ows.terrestris.de/osm-gray/service',
params: {'LAYERS': 'OSM-WMS', 'TILED': true}
})
});
var view = new ol.View({
center: ol.proj.fromLonLat([75, 36]),
zoom: 8
});
var map = new ol.Map({
layers: [ baseLayer, wmsLayer ],
target: 'map',
view: view
});
var store = Ext.create("GeoExt.data.store", {
url: 'http://localhost:8080/geoserver/wms',
params: {'LAYERS': 'opengeo:abc'},
autoLoad: true
});
grid1 = Ext.create('Ext.grid.Panel', {
title: 'Main Cities',
border: true,
region: 'east',
store: store,
columns: [
{text: 'CityName', dataIndex: 'Name'}
],
width: 300
});
var mapComponent = Ext.create('GeoExt.component.Map', {
map: olMap
});
var mapPanel = Ext.create('Ext.panel.Panel', {
region: 'center',
height: 400,
layout: 'fit',
items: [mapComponent]
});
var description = Ext.create('Ext.panel.Panel', {
contentEl: 'description',
region: 'south',
title: 'Description',
height: 180,
border: false,
bodyPadding: 5,
autoScroll: true
});
Ext.create('Ext.Viewport', {
layout: 'border',
items: [mapPanel, grid1, description]
});
});
In the first lines you require GeoExt.data.store.Features but try to instantiate the package GeoExt.data.store later. Try this:
var store = Ext.create("GeoExt.data.store.Features", {
url: 'http://localhost:8080/geoserver/wms',
params: {'LAYERS': 'opengeo:abc'},
autoLoad: true
});
Also, you try to hand over a variable olMap to the GeoExt map component. You named it map some lines above. Try:
var mapComponent = Ext.create('GeoExt.component.Map', {
map: map
});
I have a remote JSON file with a list of houses in inventory. I wan't to plot these on an OL map. The JSON is coming from an API and isn't in standard GeoJSON. I need to get the coordinates from a collection called inventory which is nested one level down from the root object. How can I do this OL 3. In OL2 I did this using the protocol.Script() and on read parsing out the nested items that I needed. So far I have:
var myLayer = new ol.layer.Vector({
title: "Inventory",
source: new ol.source.Vector({
format: new ol.format.GeoJSON({
projection : "EPSG:4326",
url: "http://some.closed.api/inventory/",
strategy: ol.loadingstrategy.bbox
})
})
});
Any pointers to the most efficient way to do this would be appreciated.
I ended up with this solution:
var olSource = new ol.source.Vector(),
layer = new ol.layer.Vector({
source: olSource
});
function successHandler( data ) {
var transform = ol.proj.getTransform(
"EPSG:4326",
map.getView().getProjection()
);
var rootObj = "inventory",
items = data[ rootObj ] ? data[ rootObj ] : data;
items.forEach( function( item ) {
var feature = new ol.Feature( item );
var coordinate = transform(
[ parseFloat( item.longitude ), parseFloat( item.latitude) ]
);
var geometry = new ol.geom.Point( coordinate );
feature.setGeometry( geometry );
olSource.addFeature( feature );
});
}
$.ajax({
url: "http://some.closed.api/inventory",
dataType: 'jsonp',
params: { q: "seattle" },
jsonpCallback: "callback",
success: successHandler
});
Openlayer3 does provide MapGuide untiled example:
var mdf = 'Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition';
var agentUrl =
'http://data.mapguide.com/mapguide/mapagent/mapagent.fcgi?USERNAME=Anonymous';
var bounds = [
-87.865114442365922,
43.665065564837931,
-87.595394059497067,
43.823852564430069
];
var map = new ol.Map({
layers: [
new ol.layer.Image({
extent: bounds,
source: new ol.source.ImageMapGuide({
projection: 'EPSG:4326',
url: agentUrl,
useOverlay: false,
metersPerUnit: 111319.4908, //value returned from mapguide
params: {
MAPDEFINITION: mdf,
FORMAT: 'PNG'
},
ratio: 2
})
})
],
target: 'map',
view: new ol.View({
center: [-87.7302542509315, 43.744459064634],
projection: 'EPSG:4326',
zoom: 12
})
});
, but not MapGuide tiled example. Please help me accessing tiled mapguide map using ol3
not sure if you have found your way, but i used the following example to display a Mapguide tiled map: http://jsfiddle.net/ynaatpaq/
var projection = ol.proj.get('EPSG:4326');
var urlTemplate = 'http://data.mapguide.com/mapguide/mapagent/mapagent.fcgi?USERNAME=Anonymous&mapdefinition=Library%3A%2F%2FSamples%2FSheboygan%2FMapsTiled%2FSheboygan.MapDefinition&basemaplayergroupname=Base%20Layer%20Group&operation=GETTILEIMAGE&version=1.2.0&tilecol={x}&tilerow={y}&scaleindex={z}';
var metersPerUnit = 111319.4908;
var dpi = 96;
var tileSize = [300, 300];
var extent = [-87.764987, 43.691398, -87.695522, 43.797520];
var scales = [100000, 51794.74679, 26826.95795, 13894.95494, 7196.85673, 3727.59372, 1930.69773, 1000];
var inPerUnit = 39.37 * metersPerUnit;
var len = scales.length;
var resolutions = new Array(len);
for (var i = 0; i < len; ++i) {
resolutions[i] = scales[i] / inPerUnit / dpi;
}
var tileGrid = new ol.tilegrid.TileGrid({
origin: ol.extent.getTopLeft(extent),
resolutions: resolutions,
tileSize: tileSize
});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
new ol.layer.Tile({
source: new ol.source.TileImage({
tileGrid: tileGrid,
projection: projection,
tileUrlFunction: function (tileCoord) {
return urlTemplate.replace('{z}', (7 - tileCoord[0]).toString())
.replace('{x}', tileCoord[1].toString())
.replace('{y}', (-tileCoord[2] - 1).toString());
},
wrapX: false
})
})],
view: new ol.View({
projection: projection,
center: [-87.764987, 43.691398],
resolutions: resolutions,
zoom: 1
})
});
I have a problem to load a kml map using OpenLayers.
I used this in this example:
http://www.openlayers.org/dev/examples/sundials.html
I put the following script to load the kml
var wms = new OpenLayers.Layer.WMS('OpenLayers WMS','http://vmap0.tiles.osgeo.org/wms/vmap0', { layers: 'basic' }, {});
var gphy = new OpenLayers.Layer.Google("Google", { type: G_PHYSICAL_MAP });
var geomor = new OpenLayers.Layer.Vector("KML", {
projection: map.displayProjection,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "/Shapes/Geomorfologia/est_temp2.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
})
});
map.addLayers([wms, gphy, geomor]);
Only this KML is not loading from the folder where the KML is within the Visual Studio folder.
Can anyone tell me what's wrong.