graphql-platform
graphql-platform copied to clipboard
Spatial filtering with different EPSG/SRID distance calculation
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the bug
Is there any way to project spatial data to a desired EPSG/SRID for distance calculation and stuff?
companyCategories(where: {
company: {
city: {
location: {
distance: {
geometry: {
type: Point,
coordinates: [21.1655, 42.6629],
crs: 3035 # this throws The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 (\"@__p_0\"): The supplied value is not a valid instance of data type geography.
},
lt: 1
}
}
}
}
}) {
…
}
Is there any geometryFactory that I can override or something like that? This only works with EPSG WGS84 / 4326. Any help would be appreciated :raised_hands:
Steps to reproduce
Relevant log output
No response
Additional Context?
No response
Product
Hot Chocolate
Version
12.8.1
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm running into the same problem. Any solutions?
Nope, still nothing..
@robotrick @edihasaj
Did you try to configure the spaital types?
.AddSpatialTypes(x => x
.DefaultSrid(4326)
.AddCoordinateSystem(26918, WKT26918))
alternatively, we've also merged https://github.com/ChilliCream/hotchocolate/pull/5048 into main. This is already available in recent v13 previews
No, I didn't try this. I'll try and let you know. Thanks
Will give it a try and come back later, thank you @PascalSenn
Doesn't work for me, same exception
.AddSpatialTypes(x => x
.DefaultSrid(4326)
.AddCoordinateSystemFromString(4326, WKT4326)
.AddCoordinateSystemFromString(26918, WKT26918))
the overload for AddCoordinateSystem(number, string) is not avalible in 12.11.1 without .AddCoordinateSystemFromString(4326, WKT4326) throws an error
query:
xyz (
where:
{ station: {
location:
{ within:
{ geometry:
{
type: Point, coordinates: [16.376608026996855, 48.18535895537918], lt: 500}
}
}
}
}
)
error:
The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 (\"@__p_0\"): The supplied value is not a valid instance of data type geography. Check the source data for invalid values. An example of an invalid value is data of numeric type with scale greater than precision.
@PascalSenn: The fault was mine, sorry. Defining the DefaultSrid() and using "distance" instead of "within" solved my problem.
guess i found a typo in the documentation: https://chillicream.com/docs/hotchocolate/integrations/spatial-data
{
pubs(
where: {
location: {
within: { geometry: { type: Point, coordinates: [1, 1] }, **lt: 120** }
}
}
) {
id
name
location
}
}
lt: doesn't exist at this point.
Closing, as this appears to have been resolved.