GeoJSON: Difference between revisions

From Tygron Preview Support Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(45 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{learned|What GeoJSON is|How to create a GeoJSON file|And how to upload GeoJSON data into the Engine}}
GeoJSON is a file format for geographical data. It is a simple text-based format which can be read by humans, but also by computers. Any Geo Dataset in another format can be converted to the GeoJSON file format.


==What is GeoJSON==
==How to create a GeoJSON file==
GeoJson is a file format for geographical data. It is a simple text-based format which can be read by humans, but also by computers. Any Geo Data file can be converted to a GeoJSON file, so that it can be loaded in the Tygron Engine.
To convert a Geo Dataset to a GeoJSON a GIS (Geographical Information System) can be used. ArcGIS Desktop is one example. An open-source alternative is QGIS.  


==How to create a GeoJSON file==
*Go to the documentation for [[How_to_create_a_GeoJSON_file_in_ArcMap|ArcGIS]]
To convert a Geo Data set so that it meets these requirements, for example a GIS (Geographical Information System) can be used. ArcGIS Desktop is one example. An open-source alternative is QGIS.  
*Go to the documentation for [[How_to_create_a_GeoJSON_in_QGIS|QGIS]]
 
Also take a look at the [[Data_preparation|data preparation]] page for considerations and tips regarding importing geo data.  


Any GeoJSON file must conform to a number of prerequisites before it can be loaded properly. Files which do not conform to these prerequisites may not be loaded properly by the Tygron Engine.
====Notes====
The GeoJSON file must conform to a number of prerequisites before it can be loaded properly. Files which do not conform to these prerequisites may not be loaded properly by the {{software}}. The requirements are:
* The file must be saved in GeoJSON format
* The file must be saved in GeoJSON format
* The file must have a CRS (Coordinate Reference System) defined
* The file must use character encoding UTF-8.
* The file must use character encoding UTF-8.
* All desired attributes must be numerical, so that they can be loaded as valid [[attribute]] values. Non-numeric attributes are ignored when attempting to load them as attributes.  
* All desired attributes must be numerical, so that they can be loaded as valid [[attribute]] values. Attributes with text values are ignored when attempting to load them as attributes. See for steps, [[Data_preparation#Text_attributes|this page]].  
 
 
{{editor steps|title=Convert a Geo Data file|Open the Geo Data file in a GIS|Optional: make sure all desired attributes are numeric|Save the file in GeoJSON format with encoding UTF-8}}
 
These steps for creating a GeoJSON file in QGIS are described in more detail below.
 
====Open a Geo Dataset====
First open a Geo Data file in QGIS. It's possible to load a file either by dragging it directly into the QGIS window, or by selecting it in the "Browser" panel in the QGIS window. The file will appear in the "Layers" panel, and its contents will be displayed as shapes or polygons in the main view.
<gallery mode="nolines">
File:QGISOverview.jpg|An overview of the QGIS interface
File:QGISBrowser.jpg|The "Browser" panel in the QGIS interface
File:QGISLayers.jpg|The "Layers" panel in the QGIS interface
</gallery><br clear=all>
 
====Optional: Modifying attributes====
If the Geo Data file contains attributes that need to be imported as well, those attributes need to be numbers, conforming to the requirements of [[attribute]]s in the Tygron Engine. If there are attributes that need to be imported which are not numeric, those attributes can be used for creating new attributes. A new attribute can be calculated, with its data type set to either "integer" or "real" (with some precision), and a value based on the value of the original attribute. This process must be repeated for each attribute that needs to be imported. When this is done, the result will be a set of attributes which can be imported into the engine.
<gallery mode="nolines">
File:QGISAttributeMenu.jpg|The "Open Attribute Table" option in the menu
File:QGISAttributeTable.jpg|The Attribute Table shows the attributes of all shapes
File:QGISFieldCalculatorMenu.jpg|The "Field Calculator" option in the menu
File:QGISFieldCalculator.jpg|The "Field Calculator" window
File:QGISAttributeTableDone.jpg|The Attribute Table now contains a new numeric attribute
</gallery><br clear=all>
{{editor steps|title=create fields for attributes which are not yet numeric|Select Layer &rarr; Open Attribute Table|Select the "Field Calculator" option|Set an "Output field name" for the new field|Set the "Output field type" to "integer" or "real"|Set the "Output field width" and "precision", so that the desired numeric values will fit in the field|Create an expression which indicates how the field should be calculated|Select "OK"|Repeat steps 2 through 7 for all desired attributes}}
 
====Saving====
The last step is to save the file as a GeoJSON file. This can be done by clicking on the specific layer with the right mouse button and selecting the "Save as" option. Choose the GeoJSON format, a location and file name and a character set (which should be UTF-8). Saving will create a new ".geojson" file with all the desired data, ready to import into the Tygron Engine.
<gallery mode="nolines">
File:QGISSaveAsMenu.jpg|The "Save As" option in the menu
File:QGISSaveAs.jpg|The "Save vector layer as..." window
</gallery><br clear=all>


{{editor steps|title=save as GeoJSON|Right-click the layer|Select Save As...|Set the Format to "GeoJSON"|Use "Browse" to select a name and location for the resulting file|Set the encoding to "UTF-8"|Select "OK" to save the file}}


==How to load a GeoJSON file into the Engine==
==How to import GeoJSON file==
<!--[[File:GeoJSON_received.jpg|framed|right|After either dragging and dropping the GeoJSON file, or selecting a file with the file-selection window, this window will appear.]]-->
<!--[[File:GeoJSON_received.jpg|framed|right|After either dragging and dropping the GeoJSON file, or selecting a file with the file-selection window, this window will appear.]]-->
The Tygron Engine can be provided with a GeoJSON file by opening the [[Geo Data Wizard]] and selecting the first option "Import a GeoJSONf-file", or by dragging-and-dropping the relevant file into the Tygron Engine. With this last option, a window will appear for choosing the kind of component to create based on the data in the file).
Use the [[Geo Data Wizard]] for importing the created file. Select in step 1 the first option: ''Import a GeoJSON file'' and follow the steps in the wizard.
<br>
{{Template:GeoDataOverview}}
[[Category:Files]]

Latest revision as of 09:43, 30 January 2023

GeoJSON is a file format for geographical data. It is a simple text-based format which can be read by humans, but also by computers. Any Geo Dataset in another format can be converted to the GeoJSON file format.

How to create a GeoJSON file

To convert a Geo Dataset to a GeoJSON a GIS (Geographical Information System) can be used. ArcGIS Desktop is one example. An open-source alternative is QGIS.

  • Go to the documentation for ArcGIS
  • Go to the documentation for QGIS

Also take a look at the data preparation page for considerations and tips regarding importing geo data.

Notes

The GeoJSON file must conform to a number of prerequisites before it can be loaded properly. Files which do not conform to these prerequisites may not be loaded properly by the Tygron Platform. The requirements are:

  • The file must be saved in GeoJSON format
  • The file must have a CRS (Coordinate Reference System) defined
  • The file must use character encoding UTF-8.
  • All desired attributes must be numerical, so that they can be loaded as valid attribute values. Attributes with text values are ignored when attempting to load them as attributes. See for steps, this page.


How to import GeoJSON file

Use the Geo Data Wizard for importing the created file. Select in step 1 the first option: Import a GeoJSON file and follow the steps in the wizard.