Select to view content in your preferred language

Data not drawing on the map

409
4
3 weeks ago
Daniel4
Emerging Contributor

I got an Add-In that retrive data from an Oracle database and create a feature Layer in ArcGIS Pro, but after updating to ArcGIS Pro 3.5.2, that features are not drawing on the map. 

But its only features that have a z-value from Oracle. 

The code, where the feature layer are created look like this: 

   if (featureClass != null && featureClass.GetCount() > 0)
   {
       var def = featureClass.GetDefinition();
       SpatialReference sr = def.GetSpatialReference();
       GeometryType geomType = def.GetShapeType();
       string oidField = def.GetObjectIDField();

       var featureCreateParams = new FeatureLayerCreationParams(featureClass)
       {
           Name = this.tableName,
           IsVisible = true,                          

       };

       FeatureLayer flyr = LayerFactory.Instance.CreateLayer<FeatureLayer>(featureCreateParams, map);
   }

 

If I force the data to be 2D (In my SQL), the features are drawn on the map. 

I can't figure this out. I need the z-value. 

 

 

 

 

0 Kudos
4 Replies
UmaHarano
Esri Regular Contributor

For the new layer, if you access the layer properties, what setting do you see under Elevation? Perhaps change this setting to see if your points are visible.

 

UmaHarano_0-1758228392865.png

 

0 Kudos
Daniel4
Emerging Contributor

Hi Uma, the settings are set to 'absoulute height'. 

Daniel4_0-1758262740464.png

 

I have tried to change the settings, but the feature layer are not drawn. 

The add-in is doing the following: 

1. User select a theme (like road, buidling ect.) and an extent (map extent, municipality level, country level)

2. The add-in makes a SQL and retrive data from Oracle

3. Show the feature layer in the TOC and the map. 

 

The taget version are 3.1 and works fine (also in 3.2, 3.3)

Its only data with a z-value, that are not drawn. 

If I manual creats a query layer, and past in a SQL (whit a z-value), ArcGIS Pro have no issues drawing the data on the map. 

The SQL can ba a simpel 'Select * from {table} or more complex depening on the users input. 

This is the code that open the table:

Map map = MapView.Active.Map;

CIMSqlQueryDataConnection sqldc = new CIMSqlQueryDataConnection()
{
    WorkspaceConnectionString = oracleDatabase.GetConnectionString(),
    GeometryType = this.geomType,
    OIDFields = "OBJECTID",
    Srid = "25832",
    SqlQuery = this.GetQuery,
    Dataset = this.tableName
};

QueryDescription queryDescription = oracleDatabase.GetQueryDescription(this.GetQuery, this.tableName);


FeatureClass featureClass = oracleDatabase.OpenTable(queryDescription) as FeatureClass;
0 Kudos
UmaHarano
Esri Regular Contributor

I am not able to repro this one.  My code looks like this:

 Map map = MapView.Active.Map;
 Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri(@"C:\Users\uma\Path\Oracle-gdb.sde")));
 CIMSqlQueryDataConnection sqldc = new CIMSqlQueryDataConnection()
 {
   WorkspaceConnectionString = geodatabase.GetConnectionString(),
   GeometryType = esriGeometryType.esriGeometryPoint,
   OIDFields = "OBJECTID,NAME,NUMBER_",
   Srid = "25832",
   SqlQuery = "select * from MAP.TestPoints",
   Dataset = "MAP.%pointsLayer"
 };

FeatureLayerCreationParams featureLayerParams = new FeatureLayerCreationParams(sqldc)
 {
   IsVisible = true,
   Name = "pointsLayerSDK"
 };
 FeatureLayer featureLayer = LayerFactory.Instance.CreateLayer<FeatureLayer>(featureLayerParams, map) as FeatureLayer;
0 Kudos
Daniel4
Emerging Contributor

Hi Uma, I used you code, but I did not have any luck drawing to data to the map, when I used an Oracle database. I tried with a postgresql database, and it worked. 

 

 

var map = MapView.Active?.Map;                
/*
var geodatabase = new Geodatabase(
    new DatabaseConnectionFile(
        new Uri(@"C:\Users\nan\Documents\ArcGIS\Projects\gv_tp\PostgreSQL.sde")));
*/

var geodatabase = new Geodatabase(
    new DatabaseConnectionFile(
        new Uri(@"F:\Users\nan\con\oracle.sde")));

var sqlQueryDataConnection = new CIMSqlQueryDataConnection
{
    WorkspaceConnectionString = geodatabase.GetConnectionString(),
    GeometryType = esriGeometryType.esriGeometryPolygon,
    OIDFields = "objectid",
    Srid = "25832",
    //SqlQuery = "SELECT * FROM i.buildings", // from postgresql
    SqlQuery = "select * from i.building", // from oracle
    Dataset = "test"
};

var featureLayerCreationParams = new FeatureLayerCreationParams(sqlQueryDataConnection)
{
    IsVisible = true,
    Name = "PolygonLayerSDK",
};

var featureLayer = LayerFactory.Instance.CreateLayer<FeatureLayer>(
    featureLayerCreationParams, map);

 

 

I did not have this problem, when I used the Add-in in ArcGIS Pro 3.2 - 3.4. I am using Oracle 19c.

0 Kudos