Geo Location, multiple types

I’ve put together some json data that includes information on both a point geo position as well as polygon for a city; as an example

"f5bdcbc74f41eec55554dfe1575de5e7": {
		"city": "Skykomish",
		"state": "Washington",
		"state_2": "WA",
		"county": "King",
		"postal_codes": [98288],
		"location": {
			"point": {
				"long": -121.369352,
				"lat": 47.722245
			"polygon": [
					[-121.34732325093523, 47.71169679480062],
					[-121.3471560205903, 47.71175889036292],

To be able to make use of dgraphs geo functions near, within, contains, etc , is it possible to have a location with two types (polygon and point) or I have to only choose one?

I don’t think so. It doesn’t feel to me that GEOJSON works like that. You should have two types of edges in the entity you have to make it work as you wish.

BTW, avoid using wrong tags. You have used GraphQL tag, I can’t see any relation with graphql and your question. This can confuse anyone who reads.

Another point, why do you have an edge like this? “f5bdcbc74f41eec55554dfe1575de5e7” - If that object is an entity it does not need an edge above it. And it doesn’t seem like a good practice to name edges with something similar to hashes. If it comes from an external dataset you should sanitize it. Because your schema can get very messy.


Apologies for the confusion, the JSON posted was my raw data set (not dgraph schema) that I’m trying to figure out how to best put into dgraph to make use of the geo location functionality.

I appreciate the guidance.

Sure, But what I meant was that Dgraph will take your dataset into account and create that edge automatically. FYI.

Your welcome. If you need more clarification don’t hesitate to ask