When loading a Feature Service from my localhost, I came to this strange thing: All my feature layers are loaded without any error, but they can not be seen on the map.
In ArcGIS, it should be like this:
In Browser, it shows nothing. However, click on feature do does a query and returns the right data.
Changing Layer's Display Order does not fix it.
Do I have to write a client js Render myself, or am I missing something. Can anyone give some help.
Solved! Go to Solution.
All right, after several days of struggle, I finally make symbols show by switching my Spatial Reference System from Beijing_1954_GK_Zone_20N(WKID: 21480) to WGS_1984_Web_Mercator_Auxiliary_Sphere(WKID: 3857).
My map is a subway 3D-laser scanning image using an assumed coordinate system, it does not matter whatever the actual SR is.
But, curiously, I'm wondering what if I'm really have to use that projection system, how to solve that question I raised above.
Is your maps basemap and your layer in the same spatial reference? Are you applying the correct symbol for your geometry type? Your geometry is a polygon so are you providing a SimpleFillSymbol? It would help to share your code.
That sounds like what FC Basson was saying then, that the polygon is under the image.
Are you using the black and white image shown in the image above as a basemap or just another layer added to the map. Seeing your code I could determine most of the questions I will have to ask.
/** tile map server url */
var tileUrl = "http://localhost:6080/arcgis/rest/services/奥体东到元通上行/MapServer";
var tileLayer = new TileLayer({
url: tileUrl
});
/** feature server url */
var featureBaseUrl = "http://localhost:6080/arcgis/rest/services/元通到奥体东上行要素/FeatureServer";
/** predefined layer id array list*/
var featureArray = ['0', '1', '2'];
/** store feature layer in this list */
var featureLayerList = [];
/** create a basemap */
var baseMap = new Basemap({
baseLayers: [tileLayer],
title: "Metro Scan Basemap",
id: "scanBaseMap"
});
/** initial a map, set the TileLayer as its basemap*/
var map = new Map({
basemap: baseMap //comment or uncomment this line not solve my issue
});
/** create map view */
var view = new MapView({
container: "viewDiv",
map: map,
extent: {
xmin: -9177811,
ymin: 4247000,
xmax: -9176791,
ymax: 4247784,
spatialReference: 102100
}
});
var popupTemplate = {
title: "<h5 style='font-family:Microsoft Yahei Light;'>{Type}</h5>",
content: "<table style='font-family:Microsoft Yahei Light;'><tbody>" +
// "<tr><td>类型:</td><td> " + layerName + "</td></tr>" +
"<tr><td>环号:</td><td> {Ring}</td></tr>" +
"<tr><td>里程:</td><td> {Mile}</td></tr>" +
"</tbody></table>"
};
view.then(function () {
/** add feature layer to map */
featureArray.forEach(function (layerName) {
var url = featureBaseUrl + '/' + layerName;
var layer = new FeatureLayer({
url: url,
outFields: ["*"],
popupTemplate: popupTemplate
});
map.add(layer);
featureLayerList.push(layer);
});
});
Now it's better
So I see that you are using JS api 4.1. This would have been helpful info from the begining. You are setting the views extent to WKID 102100 is your services in web mercator as well or some local Chinese projection?
Here is a link about formatting code on GeoNet
Sorry I didn't mention the js version, I thought the 4.1 tag may explain itself.
WKID 102100 is a Chinese Local Projection, does it matters?
Projection: Gauss_Kruger
False_Easting: 20500000.0
False_Northing: 0.0
Central_Meridian: 117.0
Scale_Factor: 1.0
Latitude_Of_Origin: 0.0
Linear Unit: Meter (1.0)--------------------------------------
Geographic Coordinate System: GCS_Beijing_1954
Angular Unit: Degree (0.0174532925199433)
Prime Meridian: Greenwich (0.0)
Datum: D_Beijing_1954
Spheroid: Krasovsky_1940
Semimajor Axis: 6378245.0
Semiminor Axis: 6356863.018773047
Inverse Flattening: 298.3
Oh, maybe I know what is wrong, I just provide a wrong WKID, it should be 21420.How stupid.
Wen Yan Tang,
So you have it fixed now?
No, the problem remains.