Select to view content in your preferred language

WCF Service End Point to a Feature Layer

1546
0
01-20-2016 08:47 AM
AndrewWigglesworth
New Contributor

Hi There,

I want to find a simple way to serve up csv files through a WCF Service that i can then add as Feature layers to AGOL.

I've created the WCF service, and exposed the service end points. I am now trying to add them as a feature layer by pointing to them as CSV files. Has anyone done this before, if so can you provide some best practices for this? Number of records returned etc.

I'm trying to get around having to synchronize all our spatial data into their own feature sets.

Here is the code for the WCF service method, it returns fine through a browser window.

  [WebGet]

        public List<string> GetServiceOrderCsv()

        {

            var query = from a in this.CurrentDataSource.ServiceOrders

                        select a.ServiceOrderNumber + "," + SqlFunctions.StringConvert(a.Latitude) + "," + SqlFunctions.StringConvert(a.Longitude) + "," + a.Address1; //, a.Longitude, a.Address1 ;

            List<string> myList = query.ToList();

            myList.Insert(0, "ServiceOrder,Latitude,Longitude,Address1");

            //byte[] resultBytes = myList.SelectMany(s => System.Text.Encoding.ASCII.GetBytes(s)).ToArray();

            WebOperationContext.Current.OutgoingResponse.ContentType = "text/plain";

            return myList;

        }

        #endregion

0 Kudos
0 Replies