HOW TO

Get Global Envelope and Bounding Envelope from the Recordset when using Java Connector

Last Published: April 25, 2020

Summary

When you set a filter to a FeatureLayer by calling yourFeatureLayer.setFilterObject(yourFilter) method, this will return a new Recordset which contains the selected features as per filter definition. This article explains about how to get the Bounding Envelope of the individual features as well as Global Envelope of all features from the Recordset.

Procedure



  1. Call the following methods in the filter object:

    Code:
    yourFilter.setBoundingEnvelope(true);
    yourFilter.setGlobalEnvelope(true);


    Note:
    You may only set Global Envelope to true and leave Bounding Envelope to a default false if you choose not to have Bounding Envelope returned in the Recordset.

  2. Call map.refresh() method to send the request to the server and get the response.
  3. Call this method to get Global Envelope from the Recorset:

    Code:
    int count = yourFeatureLayer.getRecordset().getCount();
    Envelope globalEnvelope = yourFeatureLayer.getRecordset().getEnvelope(count);


    Note:
    If you did not set Bounding Envelope to true in the filter, use this code instead:


    Code:
    yourFeatureLayer.getRecordset().getEnvelope(0);

  4. Get Bounding Envelope for the individual features as follows:

    Code:
    for (int i=0;i<fLayer.getRecordset().getCount();i++)
    env [i] =fLayer.getRecordset().getEnvelope(i);


    Note:
    If you did not set the Bounding Envelope to true in the filter, you won't be able to get the bounding envelope as above.



Article ID:000005482

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic