Getting the geometry from a DataRecord

62
2
2 weeks ago
Labels (1)
MarkJTurnbull
New Contributor III

Hi All

I am building an ExB app with a custom widget.

In the widget I have a FeatureLayerDataSource with a single record in it (its actually a filtered dataview). I am trying to get the geometry of that feature but everything I tried returns null. I have traced the issue back to getting the dataRecord from the dataSource. I have tried the following commands and they all return a populated attribute object but a null geometry property for the feature object in the returned dataRecord:

dataSource.getRecord(0)

dataSource.getRecord(0) as FeatureDataRecord

dataSource.getRecords()[0]

dataSource.getRecordsWithSelection()[0]

Can someone assist me with getting the geometry from a record in a dataSource and/or can this be confirmed as a bug?

Thanks

Tags (2)
0 Kudos
2 Replies
DougLogsdon2
New Contributor II

Double-check the query parameters:

 

{
  returnGeometry: true
}

 

It defaults to false.

YueyangLi
New Contributor

Please make sure returnGeometry of your query params is true, and get geometry:

dataSource.getRecords()[0].getGeometry()

 

0 Kudos