I get type errors if I put in anything other than '1=1' in the where clause when using geometry input on a query. Is it supported to do both a SQL filter and spatial filter on a Feature Layer query?
Can you post your code?
public query(value: string, point?: { latitude: number; longitude: number }): Observable<PeopleInCountry[]> {
value = value.toLowerCase();
const query = {
outFields: ['PEID', 'NmDisp', 'GENC0'],
orderByFields: ['NmDisp'],
where: `status=1`,
geometry: {
type: 'point',
latitude: point!.latitude,
longitude: point!.longitude,
} as any,
} as any;
if (value) {
query.where = `LOWER(NmDisp) LIKE '%${value}%' OR LOWER(PEID) LIKE '%${value}%' AND status = 1`;
}
return new Observable((observer) => {
this.featureLayer
.queryFeatures(query)
.then((result) => {
observer.next(result);
observer.complete();
})
.catch((e) => {
observer.error(e);
observer.complete();
});
});
}
When you're working with TypeScript, you can't use autocasting.
Due to limitations in TypeScript, autocasting works best in non-TypeScript applications. Autocasting casts JavaScript objects as ArcGIS API for JavaScript class types without the need for these classes to be explicitly imported. No changes are required if you are already using the API without any TypeScript build errors.
You won't be able to use
geometry: {
type: 'point',
latitude: point!.latitude,
longitude: point!.longitude,
} as any,
but have to create a new Point and use that in the geometry property
geometry: new Point({
latitude: point!.latitude,
longitude: point!.longitude
});