-
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
What if a model has more geodjango fields? #3
Comments
Hi @zmasek, We could include the class PlaceType(graphql_geojson.GeoJSONType):
class Meta:
model = models.Place
geojson_field = ('field_a', 'field_b')
what do you think? |
Hi, @mongkok, I tried to loop through the fields, but had some issues and got impatient. I ended up annotating fields with AsGeoJSON function and displaying them separately. I'd have a list of fields, though. Not a collection because it might be easier to mutate... maybe... thoughts? |
Hi @zmasek, You should not have any problem with mutations using more than one geometry field. mutation CreatePlace($fieldA: Geometry!, $fieldB: Geometry!) {
createPlace(fieldA: $fieldA, fieldB: $fieldB) {
place {
geometries {
type
coordinates
}
properties {
...
}
}
}
} For now, you could use mutation CreatePlace($fieldA: Geometry!, $fieldB: Geometry!) {
createPlace(fieldA: $fieldA, fieldB: $fieldB) {
place {
geometry {
type
coordinates
}
properties {
fieldB {
type
coordinates
}
}
}
}
} |
What if you don't want to bundle, to save bandwidth?
…On Fri, Jun 22, 2018, 18:10 Dani ***@***.***> wrote:
Hi @zmasek <https://github.com/zmasek>,
You should not have any problem with mutations using more than one
geometry field.
For resolvers, I think the GeometryCollection type could be the most
appropriate.
mutation CreatePlace($fieldA: Geometry!, $fieldB: Geometry!) {
createPlace(fieldA: $fieldA, fieldB: $fieldB) {
place {
geometries {
type
coordinates
}
properties {
...
}
}
}
}
For now you can use properties for the second geometry field:
mutation CreatePlace($fieldA: Geometry!, $fieldB: Geometry!) {
createPlace(fieldA: $fieldA, fieldB: $fieldB) {
place {
geometry {
type
coordinates
}
properties {
fieldB {
type
coordinates
}
}
}
}
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAs-Kym6kkPo7gBgaG1bgaz82ak5a5Loks5t_SUKgaJpZM4UtJH0>
.
|
Then you could select a single geometry field within |
And filtering would work in that case, I presume. How can I help? |
I would like to create the GeometryCollection field soon, PRs are also welcome :) |
You can simply import the Model
Type
Query
Even better because the API response body will not change: Request
Response
|
Currently I see only support for one field per model. Is it possible to have more?
Thanks
The text was updated successfully, but these errors were encountered: