Closed stvdo closed 12 months ago
Hi @sdorresteijn88
Have you had a look at the app.IValueFactory that has helper functions for creating a data.IGeoPoint object from either a pair of latitude and longitude values or from a data.IGeoPointData object.
Cheers
Hi @Anthony-Johnson-i2 ,
I have seen this in the connectors indeed. But I didn't get it to work in the plugin.
import {
chart,
data,
records,
schema,
toolview,
} from '@i2analyze/notebook-sdk';
.....
targetProperties[propertyType.id] = data.createGeoPoint(sourceProperty.value.coordinates[1], sourceProperty.value.coordinates[0]);
This gives an error and I don't know what to import.
@sdorresteijn88 Using the value factory is the correct approach - however, note that data
is just a typing namespace, there's no code (or at least very little) shipped with the @i2analyze/notebook-sdk, it's mostly just Typescript types. Instead, the value factory can be found on the mutations object that is passed to you in the runXMutations
call, e.g.
api.runTrackedMutation((application, mutations) => {
const geoPoint = mutations.valueFactory.createGeoPoint(lat, long);
...
});
Hi @sdorresteijn88 (Steven)
With Tim's last reply to you, did you manage to get this figured out?
If so, are you happy for this issue to be closed?
Cheers
Morning @Tim-Mawson-i2 and @Anthony-Johnson-i2,
Thank you very much for your reply. That's the solution indeed, thanks a lot!
Good morning,
I have now added most properties to an entity and put them on the chart. However, I cannot figure out how to do this for the geospatial entities. Please can you help with this.
The Source is already a Geospatial object, so I expect that this can be easily added as a target property.
My function in ToolView.tsx
The error