Geojson polygon data in CSV file, how to import into postgreSQL - csv

I have csv files with polygon data in geojson form where each line in the csv is similar to that shown below:
{"type": "Feature", "properties": {},"geometry": {"type": "Polygon","coordinates": [[[-80.86249607459162, 26.200956843221704], [-80.86270930028365, 26.200960980745556], [-80.86271370674712, 26.200778163395427], [-80.86250049530878, 26.200774026141644], [-80.86249607459162, 26.200956843221704]]]}}
I need to add these to a postgreSQL database (and ultimately a gdb) but I have no idea how. Please, any help? Sorry, new to postgreSQL.

Related

Is it possible to read a csv file in Vega with a custom delimiter, such as ;?

I have a csv file that has a custom delimiter, such as ;. I would like to load it into Vega a la:
"data": { "url": "https://url.csv",
"format":{"type":"csv",
"sep":";"
}
Here of course the last line does not exist in the current Vega schema.
This is akin to pandas pd.read_csv(sep=';')
Something like this should work:
"data": { "url": "https://url.csv",
"format":{"type":"dsv", "delimiter":";"}
}
See https://vega.github.io/vega-lite/docs/data.html#dsv for more information.

JMeter body data in CSV

I am running some tests in JMeter and the accepted data has to be in the format as shown in the example below.
{
"messageType": 1,
"customerId": 5922429,
"name": "Joe Bloggs",
"phone": "01234567890",
"postcode": "PO6 3EN",
"emailAddress": "joe.bloggs#example.com",
"jobDescription": "do some stuff",
"companyIds": [893999]
}
Now this works great but we want to randomise things up a little and read test data from a CSV file with about 20 samples.
Is this possible with the data having to be set out as above?
Currently the Body Data sits here
You have 2 options:
Modify your payload to rely on JMeter Variables like:
{
"messageType": ${messageType},
"customerId": ${customerId},
"name": "${name}",
"phone": "${phone}",
"postcode": "${postcode}",
"emailAddress": "${emailAddress}",
"jobDescription": "${jobDescription}",
"companyIds": [${companyIds}]
}
once done you can put the values into a CSV file, like:
messageType,customerId,name,phone,postcode,emailAddress,jobDescription,companyIds
1,5922429,Joe Bloggs,01234567890,PO6 3EN,joe.bloggs#example.com,do some stuff,893999
2,5922430,Jane Doe, 0987654321, P06 3EM,janedoe#example.com,do some other stuff,893998
and read the data using CSV Data Set Config so each virtual user will take the next line on each iteration and populate the body with the new values
If you have 20 different JSON files you can use Directory Listing Config plugin to load the file paths and __FileToString() function to read the data from the file in the file system

Issue with Cloud Datastore backup in BigQuery

I use an App Enginge Datastore backup file and create a BigQuery table. The issue I face is all the JSON values are treated as 'Flattened strings' by default.
I couldn't access the repeated string value for example as below. Value is for column: qoption
[{
"optionId": 0,
"optionTitle": "All inclusive",
"optionImageUrl": "http://sampleurl",
"masterCatInfo": 95680,
"brInfo": 56502428160,
"category": "",
"tags": ["Holiday"]
}, {
"optionId": 1,
"optionTitle": "Self catered",
"optionImageUrl": "http://sampleurl1",
"masterCatInfo": 520280,
"brId": 56598160,
"category": "",
"tags": ["Holiday"]
}]
Is it possibe to again recreate existing table as in JSON format , ideally through BQ CLI, so that I can access table qoption.optionId, qoption.optionTitle,etc
Take a look at Nested and Repeated Data. Basically you have to manually setup your bigquery schema with a nested data schema. Once that is done and your data is imported you should be able to use your nested properties.
Alternatively big query can parse your json ad-hoc.

How to parse json format having no array inside it on sencha platform

I am new to sencha so I have to set Data for which i am using this function component.setData( eval(WebServiceUtil.getAPIData('cartPage', 'getCartInfo')))
But when I am printing values inside cartPage.html file on console then I am not getting any json data there. So Can you give any suggestion for this format
I am fetching my json data from getCartInfo.txt file
[
{
"data":{
"unitPrice":56,
"shippingCity":"Mumbai",
"image":null,
"quantity":1,
"productId":"genpr-5",
"storePriceId":"12",
"customerIp":null,
"orderId":"2342",
"trackingCode":null,
"sessionId":"u48m6kn56k_66E4FE42F194803DB16D2692EA9DB608",
"storeId":"STORE-13",
"orderDetailId":null,
"productName":null,
"typeProduct":null,
"totalAmount":56,
"storeInventoryId":"5",
"toCurrency":null,
"inventorySensible":false,
"name":"Samsung Galaxy",
"customerId":"anonymous",
"fromCurrency":null,
"id":"EBEE13831114",
"currencyConversionRate":0,
"currencyCode":null
},
"response":"success"
}
]
I have solved my question by my own. The modification which i have done
is WebServiceUtil.getAPIData('cartPage', 'getCartInfo')[0].data which help ferch data from json.

How to import a JSON file that is exported from Neo4j into D3

Neo4j is a graph data base and it can export the data to a JSON file. However, the JSON file from Neo4j is somehow very complicated for me and I could not import it into D3. My question is how to import a JSON file from Neo4j and import it into D3 for graph visualization without changing the format of the JSON file. I asked the Neo4j community once and they said it's not possible or I believed they meant that.
Here is the exported JSON file from Neo4j:
{
"table":
{
"_response":
{
"columns":["n"],
"data":[
{"row":[{"num":"A08"}],"graph":{"nodes":[{"id":"0","labels":["Person"],"properties":{"num":"A08"}}],"relationships":[]}},
{"row":[{"num":"A04"}],"graph":{"nodes":[{"id":"1","labels":["Person"],"properties":{"num":"A04"}}],"relationships":[]}},
{"row":[{"num":"A05"}],"graph":{"nodes":[{"id":"2","labels":["Person"],"properties":{"num":"A05"}}],"relationships":[]}}
],
"stats":{
"contains_updates":false,"nodes_created":0,"nodes_deleted":0,"properties_set":0,"relationships_created":0,"relationship_deleted":0,
"labels_added":0,"labels_removed":0,"indexes_added":0,"indexes_removed":0,"constraints_added":0,"constraints_removed":0
}
},
"nodes":[
{"id":"0","labels":["Person"],"properties":{"num":"A08"}},
{"id":"1","labels":["Person"],"properties":{"num":"A04"}},
{"id":"2","labels":["Person"],"properties":{"num":"A05"}}
],
"other":[],
"relationships":[],
"size":3,
"stats":{
"contains_updates":false,"nodes_created":0,"nodes_deleted":0,"properties_set":0,"relationships_created":0,"relationship_deleted":0,
"labels_added":0,"labels_removed":0,"indexes_added":0,"indexes_removed":0,"constraints_added":0,"constraints_removed":0
}
},
"graph":
{
"nodeMap":{
"0":{"num":"A08"},
"1":{"num":"A04"},
"2":{"num":"A05"}
},
"relationshipMap":{
"623":{"date":"5/01/2011","time":"18:11:48","case":4},
"624":{"date":"5/02/2011","time":"21:21:06","case":4},
"625":{"date":"6/03/2011","time":"21:23:35","case":4},
"629":{"date":"6/04/2011","time":"22:14:47","case":5}
}
}
}
The D3 that I'm using as an example is http://bl.ocks.org/mbostock/1153292
Thank you.
You can customize the output returned by Cypher using literal maps. Using this it should be possible to return exactly the json structure to be handed over to D3.
Another alternative is using some application side json transformation, as an example see http://maxdemarzi.com/2012/10/11/hubway-data-visualization-challenge-with-neo4j/