Main menu

 The new version of the platform allows you to upload static and dinamic information. You can use a powerful GUI or command line to upload or download data. The platform follows the GeoJSON standard and the metadata can be download in RDF format. This document explains all the steps to register an account and create / upload /download datasets.

 


 

The first step in the platform is create an user account because you will need an API-KEY (user identification) to see or create data. Go to homepage:


http://opencities.upf.edu

 


 

Here we can see the main page of the platform. To login or register an account we go to Data Catalog in the menu. In this section you will find all the available datasets in the platform. To register we can go to the Register Bottom in the top right of the page, as you can see with the arrow. 


 

You must complete all the required fields.


 

 

 

Once the user account has been created, you will be redirected to the user panel where you will find all the information of datasets created and very important information for the use of the platform and the API-KEY, which is the code that identifies the user on the platform and lets you download the information.

This code is used to download or upload information on the platform, as it is a unique identifier for the user, as discussed in the following sections of this tutorial.

 

 

 


 

We must login or register in the Data Catalog to follow this steps. We headed to Data Catalog again. We press the botton add dataset. You must have permission to create datasets, since you belong to an organization, otherway you only can see the data. 

 

 

 

This screen is the first stage of the dataset creation. You have to introduce the basic metadata, like title, tags and license.

 

Organization:

 This field is so important, because if you leave in blank the dataset is public and any person can modify it. The organizations are a group of members that can create datasets and all the users of the organization can edit this dataset. This is useful in the case of company departments, that can manage own datasets. *You only can create dataset for your organizations.

 

After filling all the information we can go to the next stage of the creation of the dataset by clicking the Next button: Add Data. 

 

 

 The second stage consists in add a Resource to the dataset, there are 2 posibilities:

 

Resource:

Use Open Data sensor Network

If you want to use the integrated platform, you have to put in Resource the word OSN. In the next point we will be explain the way to upload data in the GeoJSON standard. In format, you should put "json".

External Link

If you only want to use a external URL, you have to use directly this field with the URL. You should put "html" in format field.

 

*For security reasons this URL can be modified with another one from the platform.

 

You can add all the Resources that you want perssing "Save & Add Another". Once you finish, click on "Next: Additional Info" and to go the third stage.

 

 

 The third stage of the dataset creation is to complement the metadata information.

Add Group:

This field is so important, because is the dataset category. For example: Economics, Urban Transport, Demographics...

 

 

Finally we have the new Dataset and all the resources.

 

 

 

  • If you decide to use an external URL, you've finished creating the Dataset, because automatically entered in the platform as an external link and you can access it using your user API-KEY. For security reasons the link has been encrypted.

 The resource link will be:  http://opencities.upf.edu/platform2/api/datasets/data/{APIKEY}/d3d3LmVpeG9zLmNhdA==

 

In "/{APIKEY}/" you have to introduce your ID to download the data. The API-KEY is located in user panel.


 

  • If you decide to use the platform integrated to upload the data, you have to follow the next step (Upload data to platform).

 

 

 

 


 

At this point we will explain how to upload data to the platform using the graphical interface and command-line. Let's click on the "UPLOAD DATA" top menu by a new window or tab, as we'll need some data from the Dataset.


 

 

You have to follow this steps:

 

  1. Enter API-KEY.

 

  1. Enter DATA in GeoJSON standard.

 


 

 

 

The platform follows the GeoJSON standard and the data must be uploaded in this format, so in Playground is where data will be introduced. As we can see, you can press the button and get a sample Example of how to be a file of this type is. There are a number of fields that are required to upload (See the API section).

 

 

 

Once we have the formatted data, we can test them using ValidateGeoJSON and we can see the result on the map.


 

  1. Upload Data

 

3.1  With  GUI

Once all the details are correct only need to locate the Dataset ID field and press Upload. The ID can be found in the description of the dataset in section Additional info.

1.


          

 

                        2.


 

 

 200 OK

-         Pop-Up “File Uploaded” will be displayed.

 

       ERROR

-          “Request Failed:error” will be displayed. The commons errors are:

o   You don't introduce your API-KEY correctly.

o   The GeoJSON data is not well formatted, test with the GUI if you can visualize the data in the map and you don't forgot any required field. (Use example as guide).

o   The ID Dataset is not right. 

 

 

            3.2 With CURL (command-line)

CURL can also be used for uploading data to the platform. All the information is available in the API section of the website.

http://opencities.upf.edu/index.php/api

 

       4.  Download Data

 

If you want to download a dataset resource, you can do it in two different ways:

 

  • With GUI of CKAN:

 

1. You should go to Data Catalog in the menu.

2. Login with your username.

3. Take your API Key from your account.

4. You should go to Data Catalog another time to see the Datasets and choose one.

5. Once you are in, you have to go to the resource and click in the link. 

6. You probably see the message "Unauthorized"

7. Put your API-KEY in the URL and enjoy!

 

 

 

  • With Curl:

 

1. You should go to Data Catalog in the menu.

2. Login with your username.

3. Take your API Key from your account.

4. You should go to Data Catalog another time to see the Datasets and choose one.

5. Once you are in, you have to go to the resource and click in the link. 

6. Copy the link and use Curl with your API-KEY:

curl -O http://opendata.nets.upf.edu/osn2/api/datasets/data/{API-KEY}/aHR0cDovL29wZW5kYXRhLm5ldHMudXBmLmVkdS93ZWIvZGF0YXNldHMvdHJhbnNwb3J0L01ldHJvX1RyYW5zcG9ydF9QYXJpcy54bWw= --header "Content-Type:application/xml"