Does GeoJSON support lists of FeatureCollection? - geojson

I have a JSON array of FeatureCollection which I want to visualize with tools like http://geojson.tools/ or https://geojson.io/.
[
{
"type": "FeatureCollection",
"features": [
...
]
},
{
"type": "FeatureCollection",
"features": [
...
]
},
{
"type": "FeatureCollection",
"features": [
...
]
}
]
But all the tools I tested do not support the visualization of arrays of FeatureCollection as this is no valid GeoJSON element. :-(
Does GeoJSON know any element which contains a list of FeatureCollection? (Or is there any way to visualize this data?)

According to the GeoJSON Format Specification, arrays of FeatureCollection are not supported.
A FeatureCollection can consist of any number of features of different geometries, so you should be able to combine your multiple FeatureCollections into a single FeatureCollection.

Related

Partitions not in metastore ERROR on Athena

I'm trying to partition data by a column. However, when I run the the query MSCK REPAIR TABLE mytable, it returns error
Partitions not in metastore: city:countrycode=AFG city:countrycode=AGO city:countrycode=AIA city:countrycode=ALB city:countrycode=AND city:countrycode=ANT city:countrycode=ARE
I created the table from Avro by this query:
CREATE external table city (
ID int,
Name string,
District string,
Population int
)
PARTITIONED by (CountryCode string)
ROW FORMAT
SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
WITH SERDEPROPERTIES ('avro.schema.literal'='
{
"fields": [
{
"name": "ID",
"type": "int"
},
{
"name": "Name",
"type": "string"
},
{
"name": "countrycode",
"type": "string"
},
{
"name": "District",
"type": "string"
},
{
"name": "Population",
"type": "int"
}
],
"name": "value",
"namespace": "world.city",
"type": "record"
}
')
STORED AS AVRO
LOCATION "s3://mybucket/city"
My partition look like s3://mybucket/city/countrycode=ABC
This is an old question, and Athena seems to have added a warning message on this, but in case anybody else misses the first several times they try something similar...
Here is the message Athena gives when you create the table:
Query successful. If your table has partitions, you need to load these partitions to be able to query data. You can either load all partitions or load them individually. If you use the load all partitions (MSCK REPAIR TABLE) command, partitions must be in a format understood by Hive. Learn more.
It seems that the codes you are using to partition don't work with Hive (I was doing something similar, partitioning by a grouping code). So, instead of MSCK REPAIR TABLE, you need to run an ALTER TABLE for each partition (see: https://docs.aws.amazon.com/athena/latest/ug/partitions.html)
ALTER TABLE city ADD PARTITION (CountryCode='ABC') location 's3://mybucket/city/ABC/' ;
...and you'll have to run that each time you add new county code bucket.
You definitely need a trailing slash in your location:
https://docs.aws.amazon.com/athena/latest/ug/create-table.html
Maybe also try lowercase for the partition column PARTITIONED by (countrycode string).
Did you try to add the partitions manually in Glue Catalog or via Crawler? Did this work?

How to use a multi-layer map with countries and lakes with Highmaps?

Is there any way to use a multi-layer map in Highcharts? In my case, I need three layers: One for the countries, one for the borders (which show the disputed ones differently than the normal ones) and one for the lakes, like this:
In the moment, I don't see how this could be achieved. Or can I export the three layers from shapefile to JSON and then stick the three together? But would a »join« in order to color the countries still work?
Thanks for any hints.
According to the comments - something, like is required on the image, can be done by base on this official demo: https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/maps/demo/mapline-mappoint
After some attempts, #luftikus143 face into the issue that geometry can't be set as null in his custom JSON file and my solution is to assign it as an object with the empty coordinates array. Demo: jsfiddle.net/BlackLabel/06xvrs8m/1
{
"type": "Feature",
"geometry": {
type: 'polygon',
"coordinates": [
[
]
]
},
"properties": {
"OBJECTID": 1,
"NAME": "Great Bear Lake",
"Shape_Leng": 35.7525061159,
"Shape_Area": 6.12829979344
}
},

Relationship shown in Neo4j although it shouldn't [duplicate]

This question already has answers here:
How to hide unwanted relationships between nodes in Neo4j
(2 answers)
Closed 5 years ago.
I have created a small database with three nodes, Abraham, Isaac and Jacob. Abraham is Isaac's FATHER, and Isaac is Jacob's FATHER.
Now I perform the following query:
MATCH (a:Person), (i:Person)
WHERE a.name='Abraham' and i.name='Isaac'
RETURN a, i
Running the query from the Neo4J web interface shows the two nodes with the FATHER relationship between them:
This is strange, as I have not requested any relationships. The JSON response doesn't contain the relationships, either:
[{
"keys": [
"a",
"i"
],
"length": 2,
"_fields": [
{
"identity": {
"low": 0,
"high": 0
},
"labels": [
"Person"
],
"properties": {
"name": "Abraham"
}
},
{
"identity": {
"low": 1,
"high": 0
},
"labels": [
"Person"
],
"properties": {
"name": "Isaac"
}
}
],
"_fieldLookup": {
"a": 0,
"i": 1
}
}]
Why is Neo4J showing this relationship? And how can I make it stop? I'm trying to create a query that returns various relationships between a set of nodes, and I really don't want Neo4J interfering and adding its own relationships.
It just the way the Neo4j browser visualizes, nothing more. Since you've got both nodes, Neo4j has everything it needs (the pointers) to know that there is a relationship (and shows it). If you process the result programmatically (in Java or such ... as you're bound to do since I assume the Neo4j browser will not be the "production" result) you will be able to process the results as you wish. If you're only interested in the names and not the actual nodes, just do
MATCH (a:Person), (i:Person)
WHERE a.name='Abraham' and i.name='Isaac'
RETURN a.name, i.name
Hope this helps.
Regards,
Tom

The graph section of Cypher response, remains blank

I noticed for some queries the response populates the "graph" section as follows
}
],
"graph": {
"nodes": [
{
"id": "68",
"labels": [
"ROOM"
],
"properties": {
"id": 15,
"name": "Sun and Snow",
but for other queries, this "graph" section is not returning with nodes/relationships and associated labels/properties even though the "data" section returns valid output
Does it convey anything about the quality of the cypher query ?
It depends on what you return from your query. If you return nodes and relationships, you'll get a graph. If you return scalars such as n.name or r.weight, you don't get a graph.
Are you talking about the HTTP requests from the web UI or requests that you are making yourself?
The graph key is controlled via the resultDataContents option when making a request. You can see the documentation for that here:
http://neo4j.com/docs/stable/rest-api-transactional.html#rest-api-return-results-in-graph-format
You can request multiple formats for the result ("row" and "REST" are other examples)

Rails: How to model objects with a mix of both fixed and dynamic data

I am building a site with a database of users. I am using arbor.js to build a graph for each user. The graph is a tree-like structure with edges and nodes that looks something like this (I had an image ready to go but apparently don't have enough reputation yet):
vehicle
/ \
/ \
car truck
/
/
sedan
and is represented by the following JSON:
{
"nodes":{
"vehicle":{
"color":"black",
"label":"vehicle"
},
"car":{
"color":"orange",
"label":"car"
},
"truck":{
"color":"red",
"label":"truck"
},
"sedan":{
"color":"red",
"label":"sedan"
}
},
"edges":{
"vehicle":{
"car":{
"weight":5,
"directed":true,
"color":"orange"
},
"truck":{
"weight":5,
"directed":true,
"color":"red"
}
},
"car":{
"sedan":{
"weight":2,
"directed":true,
"color":"orange"
}
}
}
}
Each graph will always have a nodes and edges object with dynamic nodes and edges. Their respective attributes (color, label, weight etc.) will be fixed.
I am trying to figure out how best to model this data for each user. I am using Rails with MongoDB (Mongoid), because I understand that MongoDB can save objects as documents in the database. I'm pretty sure each user will have a graph model which I can define, but beyond that I'm not sure how to handle the nodes and edges.
I'm guessing the solution will involve has_many, embeds_many, or possibly serialize, but I'm unclear on how to use these with a mix of fixed and dynamic data.
Also, it would be nice to retrieve the data exactly the way it looks above so I can easily create the graph when loading it from disk.
Any help would be appreciated!
In case all you need is to perform graph operations only per user. You can follow this model.
{
"nodes": [{"type": "vehicle", "color":"black", "label": "vehicle"},
{"type": "car", "color":"orange", "label": "car"},
{"type":"truck", "color":"red", "label":"truck"},
{"type": "sedan", "color":"red", "label":"sedan"}
],
"edges": {
"vehicle": [
{"type": "car", "weight": 5, "color": "orange"},
{"type": "truck", "weight": 5, "color": "red"}
],
"car": [
{"type": "sedan", "weight": 2, "color": "orange"}
],
"sedan": [],
"truck":: []
}
It is like you are storing a multimap for edges. Also it is self suggestive whether its a bi-directional or not. For individual user's graph to be processed independently, it is a pretty natural model you can go with.
Tell me if it meets your requirement. Also, until you specify what kind of queries you want to perform over your collection, its not possible to suggest a model.
Also if you are starting your project you can explore some graph databases as well like neo4j

Resources