# Adding list of geo gives "Input for predicate location\_olac of type scalar is uid"

**URL:** https://discuss.dgraph.io/t/adding-list-of-geo-gives-input-for-predicate-location-olac-of-type-scalar-is-uid/8210
**Category:** Dgraph Clients
**Tags:** untagged, pydgraph
**Created:** [July 10, 2018, 6:42pm UTC](https://discuss.dgraph.io/t/adding-list-of-geo-gives-input-for-predicate-location-olac-of-type-scalar-is-uid/8210 "2018-07-10T18:42:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)
#### Post date: [July 10, 2018, 6:42pm UTC](https://discuss.dgraph.io/t/adding-list-of-geo-gives-input-for-predicate-location-olac-of-type-scalar-is-uid/8210/1 "2018-07-10T18:42:14Z")

</div>

**Moved from GitHub [pydgraph/24](https://github.com/dgraph-io/pydgraph/issues/24)**

_Posted by_ [dwhitena](https://github.com/dwhitena):

The parallel of this issue with the Go client: [Adding array of geo gives "Input for predicate example.Loc of type scalar is uid" · Issue #11 · dgraph-io/dgo · GitHub](https://github.com/dgraph-io/dgo/issues/11), which I have reproduced in the Python client.

I created an index:

```auto
location_olac: [geo] @index(geo) .

```

and now I’m trying to add something like

```auto
'location_olac': [
  {
    'type': 'Point',
     'coordinates': [47.96056, -3.83472]
  },
  {
    'type': 'Point',
     'coordinates': [27.23453, -115.83472]
  },
]

```

I’m getting `Input for predicate location_olac of type scalar is uid`. If I take out one of the points (such that this is not a list), it works.

---

<div class="post-metadata">

### Author: ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)
#### Post date: [August 14, 2018, 6:48pm UTC](https://discuss.dgraph.io/t/adding-list-of-geo-gives-input-for-predicate-location-olac-of-type-scalar-is-uid/8210/2 "2018-08-14T18:48:58Z")

</div>

[danielmai](https://github.com/danielmai) _commented_ :

> The parallel of this issue with the Go client: dgraph-io/dgo#11

This pending PR dgraph-io/dgraph#2485 mentioned in dgraph-io/dgo#11 should address this issue.

---

<div class="post-metadata">

### Author: ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)
#### Post date: [August 14, 2018, 10:42pm UTC](https://discuss.dgraph.io/t/adding-list-of-geo-gives-input-for-predicate-location-olac-of-type-scalar-is-uid/8210/3 "2018-08-14T22:42:59Z")

</div>

[danielmai](https://github.com/danielmai) _commented_ :

The pull request dgraph-io/dgraph#2485 has been merged. This issue is fixed as of [Correctly handle a list of type geo in json (#2482) (#2485) · dgraph-io/dgraph@b1eb212 · GitHub](https://github.com/dgraph-io/dgraph/commit/b1eb212b6956e1d6c987298aa564ee5d9b81e53d).

```python
import json

import pydgraph

client_stub = pydgraph.DgraphClientStub('localhost:9080')
client = pydgraph.DgraphClient(client_stub)

# Drop all data
op = pydgraph.Operation(drop_all=True)
client.alter(op)

# Set schema with geo index
schema = "location_olac: [geo] @index(geo) ."
op = pydgraph.Operation(schema=schema)
client.alter(op)

# Write list of points
txn = client.txn()
p = {
    'location_olac': [
        {
            'type': 'Point',
            'coordinates': [47.96056, -3.83472]
        },
        {
            'type': 'Point',
            'coordinates': [27.23453, -115.83472]
        },
    ]
}
assigned = txn.mutate(set_obj=p)
txn.commit()

# Query results
res = client.query('''{
 points(func: has(location_olac)) {
  expand(_all_)
 }
}''')

print json.loads(res.json)['points']

```

Results:

```nohighlight
[{u'location_olac': [{u'type': u'Point', u'coordinates': [27.23453, -115.83472]}, {u'type': u'Point', u'coordinates': [47.96056, -3.83472]}]}]

```

---

<div class="post-metadata">

### Author: ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)
#### Post date: [July 11, 2020, 4:27am UTC](https://discuss.dgraph.io/t/adding-list-of-geo-gives-input-for-predicate-location-olac-of-type-scalar-is-uid/8210/4 "2020-07-11T04:27:06Z")

</div>


