<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Handling PBF Output Format in .NET Server Object Interceptor in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/handling-pbf-output-format-in-net-server-object/m-p/1671823#M7657</link>
    <description>&lt;P&gt;After much Googling and gnashing of teeth, I found &lt;A href="https://github.com/rowanwins/arcgis-pbf-parser" target="_blank" rel="noopener"&gt;Rowan Winsemius'&amp;nbsp; arcgis-pfb-parser GitHub repo&lt;/A&gt;&amp;nbsp;that implements a javascript PBF featurecollection parser/decoder.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;I used Claude AI to convert this to C#, and with a bit of spit-polishing I got it to work.&amp;nbsp; The C# files are in the attached zip file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Usage Example:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;byte[] originalResponse = restRequestHandler.HandleRESTRequest(Capabilities, resourceName, operationName, operationInput, outputFormat, requestProperties, out responseProperties);

if (outputFormat == "pbf")
{
    var decodedPBF = new  FeatureCollectionDecoder().Decode(originalResponse); 
    decodedPBF.FeatureCollection.Features.ToList().ForEach(feature =&amp;gt;
    {
        if (feature.Properties != null &amp;amp;&amp;amp; feature.Properties.TryGetValue("GlobalID", out var globalIdValue) &amp;amp;&amp;amp; globalIdValue != null)
        {
             _serverLog.LogMessage(ServerLogger.msgType.infoSimple, "HandleRESTRequest()", 200, "PBF: Feature GlobalId: " + globalIdValue.ToString());
        }
    });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps someone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Dec 2025 22:40:54 GMT</pubDate>
    <dc:creator>JonSwoveland</dc:creator>
    <dc:date>2025-12-09T22:40:54Z</dc:date>
    <item>
      <title>Handling PBF Output Format in .NET Server Object Interceptor</title>
      <link>https://community.esri.com/t5/developers-questions/handling-pbf-output-format-in-net-server-object/m-p/1671732#M7656</link>
      <description>&lt;P&gt;I am trying to build a .NET SOI that logs the username associated with each query, as well as the GlobalIds of all features contained in the response. The SOI works fine when the outputFormat is "json", however, the format used with many web clients is "pbf".&lt;/P&gt;&lt;P&gt;I managed to find the&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pbf/tree/main/proto/FeatureCollection" target="_blank" rel="noopener"&gt;Esri/arcgis-pbf/tree/main/proto/FeatureCollection github repo&lt;/A&gt;&amp;nbsp;and generate the FeatureCollection class to convert the byte[] output of&amp;nbsp;IRESTRequestHandler.HandleRESTRequest to a JSON string using the following code:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;byte[] originalResponse = restRequestHandler.HandleRESTRequest(Capabilities, resourceName, operationName, operationInput, outputFormat, requestProperties, out responseProperties);

string resultJSONStr = null;

if(outputFormat == "pbf") { 
    var featureCollection = FeatureCollectionPBuffer.Parser.ParseFrom(originalResponse);
    resultJSONStr = JsonFormatter.Default.Format(featureCollection);
}
ESRI.Server.SOESupport.JsonObject resultJSON = new ESRI.Server.SOESupport.JsonObject(resultJSONStr);
                    &lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;However, the structure of this JsonObject is completely different than that of the one generated when the output format is json.&amp;nbsp; &amp;nbsp;It does not resemble an Esri feature collection at all.&lt;/P&gt;&lt;P&gt;Is anybody aware of a library to convert the PBF JsonObject into an array of features?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2025 18:59:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/handling-pbf-output-format-in-net-server-object/m-p/1671732#M7656</guid>
      <dc:creator>JonSwoveland</dc:creator>
      <dc:date>2025-12-09T18:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: Handling PBF Output Format in .NET Server Object Interceptor</title>
      <link>https://community.esri.com/t5/developers-questions/handling-pbf-output-format-in-net-server-object/m-p/1671823#M7657</link>
      <description>&lt;P&gt;After much Googling and gnashing of teeth, I found &lt;A href="https://github.com/rowanwins/arcgis-pbf-parser" target="_blank" rel="noopener"&gt;Rowan Winsemius'&amp;nbsp; arcgis-pfb-parser GitHub repo&lt;/A&gt;&amp;nbsp;that implements a javascript PBF featurecollection parser/decoder.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;I used Claude AI to convert this to C#, and with a bit of spit-polishing I got it to work.&amp;nbsp; The C# files are in the attached zip file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Usage Example:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;byte[] originalResponse = restRequestHandler.HandleRESTRequest(Capabilities, resourceName, operationName, operationInput, outputFormat, requestProperties, out responseProperties);

if (outputFormat == "pbf")
{
    var decodedPBF = new  FeatureCollectionDecoder().Decode(originalResponse); 
    decodedPBF.FeatureCollection.Features.ToList().ForEach(feature =&amp;gt;
    {
        if (feature.Properties != null &amp;amp;&amp;amp; feature.Properties.TryGetValue("GlobalID", out var globalIdValue) &amp;amp;&amp;amp; globalIdValue != null)
        {
             _serverLog.LogMessage(ServerLogger.msgType.infoSimple, "HandleRESTRequest()", 200, "PBF: Feature GlobalId: " + globalIdValue.ToString());
        }
    });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps someone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2025 22:40:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/handling-pbf-output-format-in-net-server-object/m-p/1671823#M7657</guid>
      <dc:creator>JonSwoveland</dc:creator>
      <dc:date>2025-12-09T22:40:54Z</dc:date>
    </item>
  </channel>
</rss>

