Can I publish map services in geoserver like this?
You can't publish services exactly like that in GeoServer - the ArcGIS Server Feature Layer is Esri's proprietary implementation for sending vectors to the client.
If you're using GeoServer then as @user30184 noted you should look at a Web Feature Service to emulate the Esri Feature Layer.
The advantage of using ArcGIS Server's feature layer is that is has been built specifically by Esri, for seamless use within Esri's own APIs and other infrastructure. For example, you can create a FeatureLayer in the ArcGIS Server JS API, or edit the Feature Layer in an ArcMap session. The disadvantage is that you're locked into the Esri platform.
The advantage of the open standards like WMS and WFS is that you aren't locked into any particular vendor or platform. The disadvantage is that you may not get the full functionality of the ArcGIS Server Feature Layer.
I use node/request;
to add a workspace
curl -u admin:geoserver -v -XPOST -H Content-Type:application/xml -d @test.xml http://192.168.1.254:8083/geoserver/rest/workspaces
curl -u admin:geoserver -v -XPOST -H Content-Type:application/json -d @test.json http://192.168.1.254:8083/geoserver/rest/workspaces
curl -u admin:geoserver -v -XPOST -H Content-type:text/xml -d "myworkspace1" http://192.168.1.254:8083/geoserver/rest/workspaces
curl -u admin:geoserver -v -XPOST -H Content-type:text/json -d "{workspace:{name:'string'}}" http://192.168.1.254:8083/geoserver/rest/workspaces
use ndoejs do this:
//create a workspace
request.post('http://192.168.1.254:8083/geoserver/rest/workspaces',{
headers:{
'Content-Type':"application/json"
},
body:JSON.stringify({
"workspace":{
"name":"test"
}
})
},function(error,response,body){
if(error){
console.log(error)
};
console.log(response.statusCode);//201 created ok or 401 has alreay one;
console.log(body);
}).auth('admin','geoserver');
to add a datastore:
request.post('http://192.168.1.254:8083/geoserver/rest/workspaces/test/datastores',{
headers:{
'Content-Type':"application/json"
},
body:JSON.stringify({
"dataStore":{
"name":"buildings",
"connectionParameters": {
"entry": [
{"@key":"host","$":"192.168.1.254"},
{"@key":"port","$":"5432"},
{"@key":"database","$":"$$$"},
{"@key":"user","$":"$$$$"},
{"@key":"passwd","$":"gss7"},
{"@key":"dbtype","$":"postgis"}
]
}
}
})
},function(error,response,body){
if(error){
console.log(error)
};
console.log(response.statusCode);//201 created ok or 404 has alreay
deleted;
console.log(body);
}).auth('admin','geoserver');
add a layer is somehow confused ,it said
To create a new layer, instead POST to one of /workspaces/{workspaceName}/coveragestores/{coveragestoreName}/coverages, /workspaces/{workspaceName}/datastores/{datastoreName}/featuretypes, /workspaces/{workspaceName}/wmsstores/{wmsstoreName}/wmslayers, or /workspaces/{workspaceName}/wmtsstores/{wmststoreName}/wmtslayers
I'll complete this after I success.
Best Answer
The ArcGIS Web API's all support WMS (but not WFS). So the QueryTask will not work with your geoserver).
To use it within the ArcGIS API for JavaScript, use
See the JSAPI resource center for more samples: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm