您好,接口没问题,请检查你的代码
<script type="text/javascript">
var map, layer, pointVector,
url = "http://localhost:8090/iserver/services/map-world/rest/maps/World";
function init() {
map = new SuperMap.Map("map");
layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, null, { maxResolution: "auto" });
layer.events.on({ "layerInitialized": addLayer });
vector = new SuperMap.Layer.Vector("vector");
addData();
}
function addLayer() {
map.addLayers([layer, vector]);
map.setCenter(new SuperMap.LonLat(0, 0), 0);
}
function addData() {
var geoText = new SuperMap.Geometry.GeoText(100, 35, "中华人民共和国");
var geotextFeature = new SuperMap.Feature.Vector(geoText);
var strategy = new SuperMap.Strategy.GeoText();
strategy.style = {
fontColor: "#FF7F00",
fontWeight: "bolder",
fontSize: "14px",
fill: true,
fillColor: "#FFFFFF",
fillOpacity: 1,
stroke: true,
strokeColor: "#8B7B8B"
};
var vectorLayer = new SuperMap.Layer.Vector("Label", { strategies: [strategy] });
map.addLayers([vectorLayer]);
vectorLayer.addFeatures([geotextFeature]);
}
</script>