-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation missing #10
Comments
I had same problem. Until I realized that you have to pass the geojson as object: {
type: "Point",
coordinates: [14.996638298034668, 41.04304487986917],
} |
Passing in {
type: "Point",
coordinates: [14.996638298034668, 41.04304487986917],
} directly in graphiql is o.k. My problem is: How do I pass it in as variable? This is my query: result = await client.query({
query: gql`
query tpopGemeindeQuery($point: GeoJSON) {
allChGemeindes(
filter: {
wkbGeometry: { containsProperly: $point }
}
) {
nodes {
name
}
}
}
`,
variables: {
point: pointCorrectlyFormatted?,
},
}) It seems that the variable has to be: {"point": {"type":"Point","coordinates":[8.529259225,47.549318163]}} because this works in graphiql. Even though gaphiql's linter complains: "expected value of type GeoJSON". But how do I convert a queried geojson output: "{"type":"Point","coordinates":[8.496577597,47.311831695]}" to {"point": {"type":"Point","coordinates":[8.529259225,47.549318163]}} ? I think it is not possible as {"point": {"type":"Point","coordinates":[8.529259225,47.549318163]}} only works in graphiql, not in JavaScript. Any way I try I only get this error: |
So I agree: probably a single working example would help us a lot. |
I found a very hacky solution: result = await client.query({
query: gql`
query tpopGemeindeQuery {
allChGemeindes(
filter: {
wkbGeometry: { containsProperly: {type: "${geojsonParsed.type}", coordinates: [${geojsonParsed.coordinates}]} }
}
) {
nodes {
name
}
}
}
`,
}) Not very happy with this. Is there a better way? |
@andilabs sorry, I am struggling with this too |
The documentation on how to use filters is unclear/missing. I think you should provide at least 1 example.
I tried to filter by a point on the following table containing polygons of several countries, guessing from several issues of the posgraphile ecosystem.
I always get:
No matter how I pass the point (wkt, json, full point feature...). Is it me passing the wrong argument? Is some weird parsing/escaping (I would suggest to also support WKT/EWKT).
The text was updated successfully, but these errors were encountered: