POST
|
I'm trying to extend the Use a feature layer (function) sample to use more than one Feature Layer, but I can't seem to make the FieldSelector component cooperate. It seems like it working part of the way, but I have these issues: Whenever I select a field in a data source that is not the first in the list it will pop back to the initial selection. Logging props.useDataSources show that the select was made despite this. When I try to switch to a data source other than the initial after having made a selection it triggers the onChange parameter, which will wipe out my selected fields because it registers as nothing being selected. In addition to #2 usually when I try to switch the data source it won't actually change despite the above behavor. I'm not sure if these issues are something I'm missing or if there is an issue in the API itself but the documentation doesn't give any example of using FieldSelector with more than one data source. I haven't made many changes to the code, but here is my setting.tsx file: import { React, Immutable, IMFieldSchema, UseDataSource, AllDataSourceTypes, DataSource, ImmutableObject } from 'jimu-core'
import { AllWidgetSettingProps } from 'jimu-for-builder'
import { DataSourceSelector, FieldSelector } from 'jimu-ui/advanced/data-source-selector'
export default function Setting (props: AllWidgetSettingProps<{}>) {
const onFieldChange = (allSelectedFields: IMFieldSchema[], ds: DataSource, isSelectedFromRepeatedDataSourceContext: boolean) => {
props.onSettingChange({
id: props.id,
useDataSources: [...props.useDataSources].map(item => item.dataSourceId === ds.id ? { ...item, ...{ fields: allSelectedFields.map(f => f.jimuName) } } : item)
})
}
const onToggleUseDataEnabled = (useDataSourcesEnabled: boolean) => {
props.onSettingChange({
id: props.id,
useDataSourcesEnabled
})
}
const selectedFields = () => {
let newFields = Immutable({}) as ImmutableObject<{ [dataSourceId: string]: string[] }>
props.useDataSources.forEach(ds => {
newFields = newFields.set(ds.dataSourceId, ds.fields ? ds.fields : [])
})
return newFields
}
const onDataSourceChange = (useDataSources: UseDataSource[]) => {
props.onSettingChange({
id: props.id,
useDataSources: useDataSources
})
}
return <div className="use-feature-layer-setting p-2">
<DataSourceSelector
types={Immutable([AllDataSourceTypes.FeatureLayer])}
useDataSources={props.useDataSources}
useDataSourcesEnabled={props.useDataSourcesEnabled}
onToggleUseDataEnabled={onToggleUseDataEnabled}
onChange={onDataSourceChange}
widgetId={props.id}
isMultiple={true}
/>
{
props.useDataSources && props.useDataSources.length > 0 &&
<FieldSelector
useDataSources={props.useDataSources}
onChange={onFieldChange}
selectedFields={selectedFields() || Immutable([])}
/>
}
</div>
}
... View more
05-08-2023
11:31 AM
|
0
|
2
|
713
|
POST
|
Is it possible to do a client side query on items in a Feature Table similar to how you can with a Layer View for the in map geometry? Swapping my geometry query from the Feature Layer to the Layer View has sped things up significantly for my application, but I can't find a similar solution for updating what is displayed in the the Feature Table.
... View more
08-02-2021
11:11 AM
|
0
|
0
|
257
|
POST
|
The issue was a silly one. I was trying to use the X/Y when creating the point, but when I used lat/lon from the map click it started working.
... View more
04-19-2021
10:34 AM
|
0
|
0
|
2285
|
POST
|
You're right. It was a silly mistake, the i assumed i could use for the WGS84 part of the conversion but it needed to be lat/lon.
... View more
04-19-2021
10:32 AM
|
0
|
0
|
850
|
POST
|
I'm trying to to get coordinates by clicking in my map, and then project them into NAD 83 Zone 12 so I can feed them to our Roads and Highways REST API, but I'm having trouble trying to make the conversion using the geometry projection method. You can see the entire app on github at: https://github.com/utahdot/Stationing/blob/main/main.js and there is a live preview at: https://utahdot.github.io/Stationing/ Basically I'm getting the x/y values from the view on a click, trying to make a point geometry from those, and then trying to reproject that point, but it always come up null. I've tested projecting to other coordinate systems(web mercator for example) and that gives me back a result. I think this is the relevant bit of code view.on("click", function(event){
const WGS84 = new SpatialReference({ wkid: 3857 });
const NAD83 = new SpatialReference({ wkid: 26912 });
console.log(event.mapPoint.x);
console.log(event.mapPoint.y)
let point = new Point({
type: "point",
x: event.mapPoint.x,
y: event.mapPoint.y
})
projection.load().then(function(){
// const transformations = projection.getTransformations(WGS84, NAD83);
// console.log(transformations);
point = projection.project(point, NAD83);
console.log(point);
});
}); It's commented out but I tried to use the getTransformations() function to see if anything other than the default would work. Thus far it didn't make a difference. Sometimes I read the documentation incorrectly so hopefully there is something I'm doing wrong here and it's not an issue with the projection method.
... View more
04-15-2021
08:40 AM
|
0
|
3
|
2321
|
POST
|
I've spent quite a few hours this week trying to figure out how to convert a point from WGS 84 to NAD 83 Zone 12 so I can use the coordinates in our Roads and High ways API. Here's an example of a rest call I'm trying to make. I'm not sure if my syntax is incorrect or if there is something wrong with what I'm trying to convert but I'm stumped as to why I can make this work.
... View more
04-15-2021
07:39 AM
|
0
|
2
|
899
|
POST
|
On ArcGIS online there is an Item Information section that ranks the completeness of item metadata. Is it possible to access this information using the Python API?
... View more
06-12-2019
07:44 AM
|
0
|
1
|
1020
|
POST
|
Our open data portal has been working for a long time now, but looks like at least as recently as yesterday everything gives a 404 error when we try to access it. I have no idea what we might have changed on our end to cause this. I saw that Daniel Fenton had addressed this issue (I think it's the same issue?)with someone in the fall, but there wasn't an obvious solution given that I saw, beyond I guess a bug fix on ESRI's end?
... View more
05-21-2019
08:06 AM
|
2
|
9
|
3552
|
POST
|
Been searching around and I haven't found a solid answer for this yet: Is there a way to check if a user is a member of a group within my ArcGIS Online org when they log in using OAuthInfo with JS API 4.x? I'm hoping to limit which portion of my data some users can see when they log in to the app, and this seems it could be a way to accomplish this, if possible. Basically I'd like to see which group(s) a user is in, and query the data they can see in the map accordingly.
... View more
05-20-2019
02:51 PM
|
0
|
0
|
331
|
POST
|
This could work! Thanks! Do you know if it's possible to default the layer group to be open so it displays all the child layers when the map loads?
... View more
05-16-2019
11:47 AM
|
0
|
1
|
1028
|
POST
|
Is it possible to set the LayerList widget to only show one layer at a time in 4.x?
... View more
05-16-2019
09:24 AM
|
0
|
5
|
1264
|
Title | Kudos | Posted |
---|---|---|
3 | 01-30-2019 11:34 AM | |
1 | 05-21-2019 11:57 AM | |
2 | 05-21-2019 08:06 AM |
Online Status |
Offline
|
Date Last Visited |
2 weeks ago
|