Blog

WPS Split polygon on Geoserver Openlayers

WPS (Web Process Service) is an OGC service that allows you to publish geospatial processes. This is available as an extension on geoserver. To add this extension you must check the version for geoserver you are using.
Before downloading the extension you can check whether WPS is available in you local geoserver or not. For that go to demos section check for WPS request builder.

WPS Split polygon on Geoserver

WPS Split polygon on Geoserver

If not available please follow. To add this extension just download the extension and extract the file in WEB-INF/lib folder of your geoserver.
After extracting this, you can check WPS (Web Process service) with version in service capability section on right side of login page of geoserver.

WPS Split polygon on Geoserver

There are many processes available in WPS request builder. In this article will see the splitting of existing or newly created polygon using geo:splitPolygon process.

There are two options available to split a polygon in GeoServer.

1. Using WPS request builder option on geoserver, by providing the geometry for polygon and line string.
2. Creating a map with options to draw and split polygon interactively.

Execute Process on Geoserver with split polygon

For the first option you need to navigate to WPS Request builder option and choose the geo:spliPolygon process.

WPS Split polygon on Geoserver

Then provide the geometry of polygon to be split and geometry of line string, which will split the polygon.

WPS Split polygon on Geoserver

Then write values,

WPS Split polygon on Geoserver

The output can be collected as geometry WKT(well know text), Json (Javascript object notation) format or GML(Geography Markup Language). You can also check the generated XML with provided inputs.

WPS Split polygon on Geoserver

The execute button is available for executing the process. this will prompt you to download the geometry of spited polygon. In the result you can see the geometry collection will contain number of polygons.

WPS Split polygon on Geoserver

Execute Process by creating Map – WPS Split polygon on Geoserver

For visualization of splitting of polygon you can create a map with option to draw the polygon and spilt option. This article is created using OpenLayer JavaScript library with three radio buttons for draw polygon, splitting line and drag.

Use WPS on Geoserver To create map using OpenLayer library you need to add the openlayer script and to use splitPolygon process you need to split-poly javascript file in your document. In the given lines echo base_url() fucntion gives the project name on localhost. Instead of this you can give the folder path, where these files are kept

The requires a library of file which can be downloaded from https://github.com/openlayers/openlayers/tree/052be822882ef527dedb82d7d3cc19adc76d6371 link. The lib folder is required. As this contains various javascript file which are required while running this example. Now to add all these files in your document in tag, you can follow the given code.

Here we have taken all the file name in jsFiles variable.

if(!singleFile) {
  if (!jsFiles) {
  jsFiles = [
  "OpenLayers/BaseTypes/Class.js",
  "OpenLayers/Util.js",
  "OpenLayers/Animation.js",
  "OpenLayers/Lang/en.js",
  "OpenLayers/Spherical.js"
  ]; // etc. write all file name
  }

After table created a script tag and using for loop inserted file names in src of script tag

 var scriptTags = new Array(jsFiles.length);
  var host = OpenLayers._getScriptLocation() + "lib/";
  for (var i=0, len=jsFiles.length; i";
  }
  if (scriptTags.length > 0) {
  document.write(scriptTags.join(""));
  }
  }
  })();

The host name is the base path which is collected from _getScriptLocation function.

function() {
  var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
  // Relative path of this script.
  var scriptName = (!singleFile) ? "/var/www/html/PHP_pgrouting/lib/OpenLayers.js" : "OpenLayers.js";
  var jsFiles = window.OpenLayers;
  window.OpenLayers = {
  _getScriptLocation: (function() {
  var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)"),
  s = document.getElementsByTagName('script'),
  src, m, l = "";
  for(var i=0, len=s.length; i<len; i++) {
  src = s[i].getAttribute('src');
  if(src) {
  m = src.match(r);
  if(m) {
  l = m[1];
  break;
  }
  }
  }
  return (function() { return 'http://localhost/PHP_pgrouting/'; });
  })(),
  ImgPath : ''
  };

After adding all required Js files in document you can create a view or HTML page to visualize your map.
Just create a div for map and three radio buttons for draw, split and drag options.

Use WPS on Geoserver

Now Split-poly.js file contains the function all draw, split and drag option. one of them is given below

var dragPoly = new OpenLayers.Control.DragFeature(map.layers[1]);

var dragToggle = document.getElementById("drag");
  var toggleDrag = dragToggle.onclick = function() {
  if (dragToggle.checked) {
  drawPoly.deactivate();
  drawLine.deactivate();
  dragPoly.activate();
  } else {
  dragPoly.deactivate();
  }
  };

Similarly for all we can write functions. The split Function works as Take the drawn polygon and polyline features in variables. then check for intersection of polygon and polyline. If both intersects set hit variable a true. Check the intersections and execute split process.

function handleSplitDraw(event) {
  var splitter = event.feature;
  var features = map.layers[1].features;
  var candidates = OpenLayers.Array.filter(map.layers[1].features, function(feature) {
  var hit = false;
  if (feature.geometry.intersects(splitter.geometry)) {
  hit = true;
  }
  return hit;
  });
  var candidate;
  for (var i=0, ii=candidates.length; i<ii; ++i) {
  candidate = candidates[i];
  if (candidate.geometry.intersects(splitter.geometry)) {
  map.layers[1].removeFeatures([candidate]);
  executeSplit(candidate, splitter);
  }
  }
  return false;

The execute process will take the data in variable. This data will contain the input/output identifier and mimetype.

 function executeSplit(poly, line) {

 var doc = this.wpsFormat.write({
  identifier: "geo:splitPolygon",
  dataInputs: [{
  identifier: "polygon",
  data: {
  complexData: {
  mimeType: "application/wkt",
  value: wktFormat.write(poly)
  }
  }
  }, {
  identifier: "line",
  data: {
  complexData: {
  mimeType: "application/wkt",
  value: wktFormat.write(line)
  }
  }
  }],
  responseForm: {
  rawDataOutput: {
  mimeType: "application/wkt",
  identifier: "result"
  }
  }
  });

After this using post method of Openlayer we can send this data to geo:splitPolygon process and can collect the response. after collecting geometry as well known text we can render again this geometry on map.

OpenLayers.Request.POST({
  url: "http://localhost:8080/geoserver/ows?service=WPS&version=1.0.0&request=Execute&Identifier=geo:splitPolygon",
  data: doc,
  success: function(response) {
  handleSuccess(response, poly);
  console.log(response);
  }
  });

After writing code open the project on browser and draw a polygon using draw option.

WPS Split polygon on Geoserver

Now draw the splitting line using split option.

WPS Split polygon on Geoserver

As you finish the drawing part the executeSplit() function runs which splits the polygon which can be seen on map as

WPS Split polygon on Geoserver

Now to see, actually these polygons are splited or not. you can use drag option.

WPS Split polygon on Geoserver

In this way you can go for other processes available on geoserver. If you find any problem in implementing WPS Split polygon on Geoserver do comment below.

Install GeoServer for Ubuntu

Install GeoServer for Linux System. For producing any detail map, we need to have large detailed dataset. If it is about country level or world level analysis it may create huge problem with huge dataset. It can hang your system or slow down it. Even for browser it is dangerous because browser takes time or get in not responding mode. More than this you want to change or query data with rendering it on map, this will take much of your precise time.

To solve this problem we use some servers which can handle the dataset and provide us when required. For the map data we have one the great solution that is geoserver. What is geoserver and how it is helping us… geoserver is an open-source server written in Java that allows users to share, process and edit geospatial data. It helps us to display the information to the world. It has a great feature that using WMS (Web Map Services) standards it provides variety for output format.

Download and Install Geoserver in linux

To download and install Geoserver in Linux based system, please follow the content. First of all download the Geoserver zip folder. To download that navigate to http://geoserver.org/release/stable/ link and click the Platform Independent Binary link.

Now make sure that you have already installed Java Runtime Environment (JRE) in
your system. if not, please visit http://www.oracle.com/technetwork/java/javase/downloads/index.html website to download and install the JRE in your system. Currently Java 9 is not supported by geoserver so download JRE 8 from oracle.

Steps for installing GeoServer on Linux based operating system-

Step 1 for installing geoserver-

Extract the downloaded geoserver zip file. if you are not sure where to unzip it, navigate to usr/share folder and make a new folder name it as geoserver and unzip file in this folder.

STEP 2-

Open the terminal in your system and add an environment variable to save the location of GeoServer by running given command
–> echo “export GEOSERVER_HOME=/usr/share/geoserver”

Step 3 for installing geoserver in ubuntu-

To make sure you are the owner of the geoserver folder, run the give command
–> sudo chown -R USER_NAME /usr/share/geoserver/
Here replace USER_NAME with your user name. The user name can be your system’s user name, then it will ask for the password so give your system password.

Step 4-

After this navigate yourself to the bin folder inside the unzip geoserver folder and run the startup.sh file.To run this file on terminal, look given command
–> sh startup.sh

Step 5 for installing geoserver-

Now your geoserver is installed successfully to check open the browser and run the given command

–> http://localhost:8080/geoserver

Give admin as username and geoserver as password. Create your workspace and datastores for various datasets and upload them on geoserver with various styles and icons.

To know how to publish and style vector and raster dataset on geoserver you can visit our previous tutorials as Publish style vector data on geoserver, Publish style raster data on geoserver or install geoserver in windows operating system.

If you have other query related to geoserver or publishing and styling dataset on geoserver, let us know via comments. We would definitely help you out.

Convert Geojson to GML- Geography Markup Language

This article is about Convert GeoJSON to GML. Here we are using GDAL utility (ogr2ogr) for conversion. This conversion become useful when you just wants to study or analysis the data in text format. In GML format stores data as text in tags. It makes easy for user to understand the details of attributes. Before conversion, lets look for GeoJSON and GML (Geography Markup Language) in detail.

Convert Geojson to GML

Lets look for specification of GML and GeoJSON file before moving for conversion, as you should be aware of how the files are structured, so that if conversion has any minor error then it can be corrected. If you know specification of both the files, then you may skip and navigate to convert.

Online Tool to Convert GeoJSON To GML

Specification of GML – Convert Geojson to GML

GML stores geographic information as text developed by the OpenGIS Consortium (OGC). GML is based on XML and it is not programming language. it is just data describing language. It provides bounding box in the starting of file in ‘Boundedby’ tag. Feature member is defined with geometry property, SRS (Spatial reference system) used, coordinates and attributes.

Convert- Geojson to GML- Geography Markup Language

Specification of GeoJSON

Geojson data is open standard format, contains simple geographical feature with non-spatial data. In type, it has feature collection. That contains name, CRS (coordinate reference system) and features. These features can be line, point, polygon, Multi-Line string and multi-polygon. Properties contains all attribute information.

Convert- Geojson to GML- Geography Markup Language

Convert Geojson to GML using GDAL utility-

For converting GeoJSON to GML we need to have GDAL library in system. you can follow the commands to download the library.

Convert- Geojson to GML- Geography Markup Language

The presence of this utility  can be tested by typing ogr2ogr in command prompt. Convert- Geojson to GML- Geography Markup Language

Now, to check the drivers available you can follow the given command,

–> ogr2ogr –formats

Convert- Geojson to GML- Geography Markup Language

Convert GeoJSON to GML is an easy process, we also can assign the SRS (Spatial reference system) to the generated output file. ogr2ogr have various options, which can be used while converting file in other format.

–> ogr2ogr -f ‘GML’ -a_srs EPSG:4326 Output_fileName.gml Input_fileName.geojson

Here -f is an option for output file format. The ‘GML’ is driver available for converting file in GML.

Output of Convert Geojson to GML-

The Generated file can be open in any test editor.

Convert- Geojson to GML- Geography Markup Language

We can also help you out in conversion like Shapefile to geopackage, KML to GML , shapefile to TopoJSON and many more.

Feel free to comment in given box for any help or suggestions.

Convert Geojson to MIF MapInfo file

In this article we will be discussing about convert GeoJSON to MIF Mapinfo using GDAL utility (Ogr2ogr). This conversion is useful with MapInfo mapping and geographic analysis softwares.

Convert Geojson to MIF MapInfo file

We must understand GeoJSON and MIF format in detail before conversion.

Convert Online GeoJSON to MIF Mapinfo

Specification of GeoJSON data- Convert Geojson to MIF

Geojson data is open standard format, contains simple geographical feature with non-spatial data. In type, it has feature collection. That contains name, CRS (coordinate reference system) and features. These features can be line, point, polygon, Multi-Line string and multi-polygon. Properties contains all attribute information.

Convert Geojson to MapInfo file

Specification of MIF data- Convert Geojson to MIF

Convert Geojson to MapInfo file

MIF (Map Info File) File format used by MapInfo mapping and geographic analysis software. This stores a map visualization in a format that can be recognized by third party applications. Also used as an exchange format between GIS applications. This sometimes accompanied by a .MID (MapInfo data) file that contains additional spatial data. MID files are GIS data files created by MapInfo, a spatial data analysis and visualization software, saves spatial data for a corresponding .mif (MapInfo Interchange Format) file. Also used for storing larger data sets not expressed in the MIF file.

MIF file show some general property when open with QGIS software, as like :

i.) Storage type of this layer
–> MapInfo File
ii.) Description of this provider
–> OGR data provider (compiled against GDAL/OGR library version 2.2.2, running against GDAL/OGR library version 2.2.2)
iii.) Source for this layer
–> /var/www/html/PHP_pgrouting/public/shpfolder222/newwhello.mif
iv.) Geometry type of the features in this layer
–> Line
v.) The number of features in this layer
–> 19148
vi.) Capabilities of this layer
–> Fast Access to Features at ID, Presimplify Geometries, Presimplify Geometries with Validity Check
vii.) In layer spatial reference system units
–> xMin,yMin 68.4982,7.92528 : xMax,yMax 97.3348,35.5013
viii.) Layer Spatial Reference System
–> +proj=longlat +datum=WGS84 +no_defs

Convert Geojson to MIF MapInfo file

  • Go to MapOG Tool
  • Tap on Switch To and click on Converter.
  • Now upload your data from system or drag & drop from system.
  • Once input is uploaded select the output format and if you want to change coordinate reference system then click on the third option. And in the last click on Convert File.
  • You converted file is published on the map directly.
  • Check video for steps of conversion for Geojson to MIF.

Convert GeoJSON to MIF using GDAL utility-

Gdal library should be available in system when converting data format from one to another. This utility can be installed in system by following the given commands.

Convert Geojson to MIF MapInfo file
Convert Geojson to MIF

The options available with ogr2ogr utility cab seen by typing ogr2ogr in command prompt.

Convert Geojson to MIF MapInfo file

The drivers or format supported by utility can be seen by typing the following command.

–> ogr2ogr –formats

Convert Geojson to MIF MapInfo file

Convert the Geojson data in MIF with given command.

–> ogr2ogr -f  ‘MapInfo File’ -a_srs EPSG:4326 MIF_output.mif geojson_input.geojson

The option -a_srs is used to assign coordinate system to generated output file.

Output in QGIS software- Convert Geojson to MIF

The generated output file can be open with QGIS open source software.

Convert Geojson to MapInfo file

You can also use conversions using gdal utility as netcdf to geotiff, Hdf to geotiff, shapefile to topojson and many more.

Please comment in the given comment box for any help and suggestions. We are always ready for your help.

You might be interested in Different ways to convert Shapefile to GeoJSON

Convert GeoJSON to KML

In this article we would be discussing about conversion of GeoJSON data to KML (Keyhole Markup Language). This conversion is required when you are using software such Google earth to see the data. KML works great with Google earth. There is simple step to Convert GeoJSON to KML using ogr2ogr utility from GDAL library. Before that we must go through specification of GeoJSON and KML.

Here is the way to Convert the GeoJSON to KML online

Specification of GeoJSON – Convert GeoJSON to KML

Geojson data is open standard format, contains simple geographical feature with non-spatial data. In type element it has feature collection. That contains name, CRS (coordinate reference system) and features. These features can be line, point, polygon, Multi-Line string and multi-polygon.

Convert GeoJSON to KML
Convert GeoJSON to KML

Specification of KML- Convert GeoJSON to KML

The KML (Keyhole Markup language) this data format contains information in tags. SimpleField contains attribute information with name and type. Style tag contains the style of file as color of lines, points and polygons. Geometry is stored as coordinates in file.

Convert GeoJSON to KML

Convert GeoJSON to KML using GDAL Utility-

The conversion requires Gdal utility. This utility can be installed in the system by following the given commands.

Convert GeoJSON to KML

By typing ogr2ogr in command prompt you can get the following result. This result shows the presence of ogr2ogr utility in system.

To know the version of installed GDAL library you can type,

–> gdalinfo –version

Convert GeoJSON to KML

Before executing the conversion command, you should check the drivers. The drivers can be checked by typing

–> ogr2ogr –formats

in your command prompt. Now check for the GeoJSON and KML driver.

Convert GeoJSON to KML

After checking the drivers you can execute the following command.

–> ogr2ogr -f ‘KML’ -a_srs EPSG:4326 Output_fileName.kml Input_FileName.geojson

Output of Convert GeoJSON to KML-

The generated output file can be open in editor to see the content.

Convert GeoJSON to KML

In the similar way you can also convert shape file to MIF, shapefile to sql and shape file to excel file.

You can also comment in given comment box for any query, help or suggestions.

NetCDF Multidimensional data

NetCDF (network Common Data Form) is multidimensional data format only supports EPSG 4326 (WGS84). Multi dimensional simply means that it can grow in all direction with time. It has some important vocabulary to defines formation of NetCDF data structure. You may also look over HDF multidimensional Data, GRIB multidimensional data and all multidimensional data. To know about NetCDF you must go through this:

  1. Dimension
  2. Variables
  3. Coordinate Variables
  4. Attributes
  5. Conventions

MultiDimensional Data

Dimensions of NetCDF Multidimensional data:

NetCDF has dimensions from which only one dimension can be Unlimited that can grow up-to any length in any direction.  These dimensions can be physical quantities as latitude, longitude, altitude and time.

Variables:

Variable are array of values of same data type in NetCDF file. A variable has a name, data type, and shape described by its list of dimensions.

Coordinate Variables:

A one-dimensional variable with same name as a dimension is called coordinate variable. We can take an example from figure above float time(time). It is associated with a dimension and one or more data variables. Typically defines a physical coordinate corresponding to that dimension.

Attributes:

NetCDF attributes stores metadata of geographic data. Most attributes provide information about a specific variable. These attributes can be identified with structure variable name:attribute name.

Attribute as Long_name shows full name of given band and Unit shows is measurement unit.

Conventions:

The conventions define metadata that provide a description of the data in each variable and their spatial and temporal properties. A convention helps users of data from different sources decide which quantities are comparable. The convention name is available in global attribute in a netCDF file as shown below.

NetCDF Multidimensional data

Details of NetCDF Multidimensional data:

To see all these you can use GDALinfo or ncdump command.

To use gdalinfo command for having netcdf information, you need to write

–> gdalinfo -json filename.nc

NetCDF Multidimensional data

To use ncdump command for viewing information about NetCDF data, you need to write

–> ncdump filename.nc | more

NetCDF Multidimensional data

If you face any problem in understanding NetCDF multidimensional data, please let us know via comments.

 

HDF MultiDimensional Data

Hierarchical Data Format HDF multidimensional data, which can grow in space and time dimension. It is specially designed by National Center for Supercomputing Applications (NCSA) for storing scientific data in mosaic datasets. You may also look over GRIB, netcdf and all multidimensional data.

Here the data is stored in hierarchical format i.e. in tree like structure. It contains band information in variables. Variables may have one or more variable. Each band data in this variables may differ in size and dimension. Also each data can contain information of different regions.

 HDF Multi-Dimensional Data

HDF 4 (Hierarchical data format release 4) – HDF MultiDimensional Data

HDF supports two formats, both are completely different and NOT compatible. It supports multidimensional arrays, raster images and table data. It has some limitations as it supports multiple (arrays, table and images) data hence makes complex API.

HDF 5 (Hierarchical data format release 5)- HDF MultiDimensional Data

This format is designed to overcome the limitations of HDF 4. This structure consist of datasets and groups.

  • Groups, which are container structures which can hold datasets
  • Datasets, which are multidimensional arrays of a homogeneous type.

Get information of HDF multidimensional data bands-

As data is arranged in hierarchical format, we need to run two command to get band details, both from GDAL utility.

1. Gdalinfo- This commands gives the information about number of  subdatasets present in file. Each sub-dataset detail is stored in SUBDATASET_n_NAME metadata item. The related description is stored in SUBDATASET_n_DESC metadata item.

HDF Multi-Dimensional Data

2. Gdal_translate- The gdal_translate utility is used to import the bands or convert in desired format. Here we have converted HDF data in NetCDF format.

HDF Multi-Dimensional Data

Hope this article help you to understand HDF data format. You can also visit multidimensional data for more information. Please let us know if you require any help, by commenting in given comment box.

GRIB Multidimensional Data

General Regularly-distributed Information in Binary GRIB multidimensional Data that can grow in space (Latitude, Longitude and altitude) and time. GRIB data is standardized by World Meteorological Organization (WMO). This contains various raster data in mosaic datasets.  This stores data from meteorological department and weather forecast. You may also look over NetCDF multidimensional data, HDF multidimensional data and all multidimensional data format.

GRIB Multidimensional Data versions

It has two versions GRIB1 and GRIB2.

  1. GRIB 1: This format is no longer used. It is recognized just because it is stilling using by World Area Forecast system of the ICAO. The CMC (Canadian Meteorological Center) will stop producing data in this format.
  2. GRIB 2: This is a great modernization of GRIB data format. It does not support and compatible for GRIB 1 version.

Get Details Of GRIB Multidimensional data

To get details of GRIB data we can use gdalinfo utility from GDAL library. This command helps us to see the sub datasets present in GRIB file with their description, bounding box etc.

GRIB Multi-dimensional Data

To convert it in NetCDF format or any other format we can use gdal_translate command. Here with the help of gdal_translate options with can also assign SRS (Spatial reference system) of output file.

–> gdalwarp -overwrite -to SRC_METHOD=NO_GEOTRANSFORM -t_srs EPSG:4326 Input_GRIB.grb -of netCDF Output_NETCDF.nc

GRIB Multi-dimensional Data

If you need any other information regarding multidimensional data such as NetCDF or HDF you can visit are tutorials and also comment in given comment box. We are always available for your help.

MultiDimensional Data – NetCDF, GRIB, HDF Format

In this article we are going to discuss about multidimensional data. The dataset comprises space (latitude ,longitude and altitude) and time. Here we can have temperature dataset as an example which spreads in all direction and increases/decreases with time.MultiDimensional Data

Multi-Dimensional data comprised of multiple dataset for specific purpose. Data can be for Atmospheric, oceanographic and earth sciences purpose. These multidimensional data can capture using satellite and generated from numerical models where data is interpolated from other data sources.

In GIS, data formats such as NetCDF, HDF and GRIB are multidimensional data. Here we can store feature and raster data in these formats.

NetCDF Multidimensional data format

NetCDF (network Common Data Form) is a data format for storing multidimensional data. This data can be temperature, humidity, pressure, wind speed and direction in both vector and raster format. Each variables can displayed through a dimension in GIS with layers or table from the netCDF file.

NetCDF is a self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. Currently, Network common data format (NetCDF) raster types support Climate and Forecast(CF) and Cooperative Ocean/Atmosphere Research Data Service (COARDS) conventions.

MultiDimensional Data

GRIB Multidimensional data format

GRIB (General Regularly-distributed Information in Binary) is a data format stores meteorological data and forecast weather data. The GRIB raster type allows two format GRIB 1 and GRIB 2. This also stores a large number of rasters with different dimensions in mosaic images.

MultiDimensional Data

HDF Multidimensional data format

HDF (Hierarchical Data Format) is a format designed by the National Center for Supercomputing Applications (NCSA) to store scientific data. The HDF raster type data format allows to add multiple raster data in HDF4 or HDF5 format in an image mosaic. Image mosaic is merge of two or more datasets.

MultiDimensional Data

Hope this article helped you to understand Multidimensional data. You can also read NetCDF, GRIB and HDF multidimensional data in detail. We also have converted all three data in geotiff and other format.

Feel free to comment for any help and suggestions.

Convert GeoJSON to Shapefile

In this article we are converting GeoJSON to Shapefile shp format. You might be thinking why would anyone convert GeoJSON in shapefile. Answer is very simple Shapefile is very popular data format with open specification for data interoperability among GIS (Geographical information system) softwares. Before moving towards conversion steps we must look for GeoJSON and Shape file in detail. There Specification is given below.

Here is the Online Converter Tool from GeoJSON To Shapefile

Specification of GeoJSON-

Geojson data is open standard format, contains simple geographical feature with non-spatial data. In type element it has feature collection. That contains name, CRS (coordinate reference system) and features. These features can be line, point, polygon, Multi-Line string and multi-polygon.

Convert GeoJSON to Shapefile
Convert GeoJSON to Shapefile

Specification of Shapefile-

Shapefile is very popular data format specially among open source GIS softwares. It has some mandatory files, which contains various information such as index of geometry, attribute data and projection information.

  1. shx- contains geometry index,
  2. shp- contains geometry,
  3. dbf- contains attribute data,
  4. prj- contains projection data.

Convert GeoJSON to Shapefile using MapOG Tool

Convert GeoJSON to Shapefile

Convert GeoJSON to Shapefile Shp Using Gdal Utility-

Conversion from geojson to shapefile requires GDAL library in your system. For downloading it you can follow given commands.

Convert GeoJSON to Shapefile

To check the availability of library can be check by typing ogr2ogr in command prompt. You can also check the version of GDAL library by typing gdalinfo –version.

Convert GeoJSON to Shapefile

To convert data from geojson to shapefile we must have format available in library. To check the formats available you can execute the following command,

–> ogr2ogr –formats

you will get the following list that contains the drivers list. Check for the GeoJSON and Shapefile driver.

Convert GeoJSON to Shapefile

Now you can execute the conversion command given below,

–>ogr2ogr -f ‘ESRI Shapefile’ -a_srs EPSG:4326 Output_fileName.shp Input_FileName.geojson

Here Command shows some options of ogr2ogr utility as -f, which shows output file format, -a_srs shows SRS (spatial reference system) assigned to output file. The Generated output file can be seen on QGIS software.

Converted Output GeoJSON to Shapefile In QGIS software-

Convert GeoJSON to Shapefile

In similar way you can also convert Shp to geojson, shp to KML or many more.

Feel free to contact for any help or suggestions by commenting in given comment box.