Saturday, October 15, 2022

How to convert vector to raster in QGIS?


Converting a vector to a raster is a very common process in GIS. In this tutorial I’m going to show how it’s done in QGIS in detail.
Follow the following steps:

Step1: Load your desired vectors in layer panel like shown below. Here I will rasterize ‘clipped_building’ vector.

Step2: Processsing Toolbox panel

Go to Processing Toolbox panel -> search ‘vector to raster’, -> under Vector conversion of GDAL section you will get Rasterize(vector to raster).


Step3: Choosing parameters

In input layer select vector that you want to rasterize, choose 1 as fixed value to burn, Georeference units as output raster size units, 15 as Width/Horizontal and Vertical/Height, Output extent as butwal_44N, Assign no data value as Not set. At last save it to a file as ‘Rasterized’.



Remember values you choose depends on for what purpose you are going to use the raster.

If everything is fine you will see output like this.


Definitions

Burn in value: pixel value that represents data(if set to 1 then your data will be white and rest all black).

No data value: invisible region outside the main data.

Vertical/Horizontal resolution: Determines no. of cells/pixels your raster will be formed. If you will give high resolution value then no of cells will be reduced and output raster resolution will be reduced and vice-versa for Georeferenced units.

Output raster size units:

Pixel units: Suppose if you set Vertical/Height resolution and  Horizontal/Width resolution as 5 then output raster will have pixels of 5 rows and 5 columns imagining raster as a matrix. This decides spatial resolution of raster.

Georeferenced units: Suppose if you set Vertical/Height resolution and  Horizontal/Width resolution as 5 then spatial resolution of each pixel will be 5*5(meaning height and width is 5) and it decides rows and columns of raster matrix.

Output extent: border of raster.

So, that’s all for today we will meet soon in next article.

References:

https://gis.stackexchange.com/questions/379889/qgis-3-16-rasterize-vector-to-raster-parameters

Pirotti, P. F. (n.d.). Multi Criteria Analysis ( MCA ) with GIS Find the best land for growing Mangoes in Madagascar using MCA !

https://www.qgistutorials.com/en/docs/3/multi_criteria_overlay.html




Thursday, October 13, 2022

How to log data in Madoca?


What is Madoca?
Madoca is a low cost GNSS receiver that uses QZSS signals to locate position. The whole instrument  consists of a dome shaped antenna, a receiver, a cable connecting antenna and receiver and a USB cable connecting laptop and receiver. Data is collected by precise point positioning method. The errors are automatically corrected by CORS stations and error free data is received by the receiver.

The best thing about Madoca is it is smaller in size, quite cheaper than survey grade receivers and give cm level of accuracy.

Logging data in Madoca
For logging data with Madoca receiver we need to have a desktop application called ‘Madoca Win’ installed on your laptop.

First of all open the ‘Madoca Win’  application. Once the application is opened there are some settings that  are to be adjusted. By default Rover is set to Online, Correction to Online and Processing mode to PPP-Kinematic. Configure  Rover as RX, Correction as DX and Processing mode as PPP-static in the application like shown below.

Fig1:  showing connection setup in MADOCA

Remember if the cables to the antenna or laptop is not connected properly or you don’t have them you won’t see the green loading symbol and values below ROVER, MADOCA and NMEA.

Now we will configure Setup for Rover and Correction

Rover setting
Click on Setup present on the right side of  Rover section. Keep Port and Baud rate value as  COM7 and 115200 respectively. Keep output data in .ubx format which will be later processed in RTKLIB.


Fig2: showing Rover setup setting of MADOCA

Correction settings
Click on Setup present on the right side of  Correction section. Keep Port and Baud rate value as  COM6 and 57600 respectively. Similarly, keep output data in .ubxformat.

Fig 3: showing Correction setup setting of MADOCA

Once all parameters are set data collection is started by clicking start/stop button. 
On successful parameter settingsyou will see the status screen like this.

Fig 4: showing status interface during data collection

You can wait for 30mins or more to log data. Lat/Lon Error goes on decreasing as more log time increases and more error free data can be obtained. You may also need to keep antenna on a tripod as it has better chances of getting QZSS signals quickly specially in crowded areas.

After Lat/Lon error are reduced significantly data log is stopped. Before stopping data log take screenshot of status menu and note down Latitude and Longitude. All logged data are stored in a folder MadocaLog in drive C. Inside MadocaLog folder you will see three folders ‘Correction’, ‘NMEA’ and ‘Rover’ and respective data inside them.

Further you can visualize collected Rover data in ‘RTKLIB’.



Friday, February 18, 2022

30DayMapChallenge

30DayMapChallenge is daily mapping/cartography/data visualization challenge  for the spatial community.  It is held every year in the month of November on Twitter. There are different themes of map making  for  30 days. Participants are expected to post their prepared  map each day  on Twitter based on a particular theme of that day with #30DayMapChallenge. Hundreds of people from different part of world participate in this event. It is not a competition but just a way to learn map making skill.

My experience

I had participated 30DayMapChallenge of last year. It was a beautiful  experience and a great way to learn and improve cartography skill. Those themes of map were not familiar to me before and instantly preparing a map takes time. Everyday we were supposed to prepare and post a map which  is challenging. Though I had prepared some  maps  in advance but it takes  time and effort to make a creative map. I was able to post only six maps in that month. 


Fig1: Map showing population density of Nepal 2020

It is among my  favourite map that I had prepared. Raster data was used and imported in Aerialod, an open source software for visualizing elevation data. With some settings configuration and in short time map was prepared and later exported to .jpg format.

This map simply shows the population with respect to height. Greater the height of those lines greater the population. Some other maps that I had prepared in that map challenge and their guidelines of making can also be viewed from here.


Fig2: Figure with different themes of map, Source: https://github.com/tjukanovt/30DayMapChallenge


Learnings

Whenever you get involved somewhere you get to learn something out of it. Some thing that I was able to learn through that event are listed below:

  1. Map making is not just limited to some GIS softwares like QGIS or ArcGIS. It can be done through R studio, Aerialod, web based platform like kepler.gl, python codes and in  many other ways.

  2. Map doesn't mean only as one generated through computers. A hand drawn sketch on paper, paintings on wall or cloths all with some spatial information and shape can be considered as map.

  3. Modern maps are shifting towards graphics/ visualization. One with some good sense and skill of graphics designing can get edge over the rest.

  4. Though webmaps are in trend these day but paper maps or one that doesn’t need coding still has a long stay.


Conclusion and Recommendation

Participating in these sort of event undoubtly helps to increase your skills. Beyond this there are also other things like #100DaysOfCode for improving coding skills. You can get engage there and work on the skill you want to improve.

I hope next time you will participate and prepare more maps than mine. 

Happy mapping!

Tuesday, November 16, 2021

Changed Butwal: From a Remote Sensing perspective

 Butwal is one of the most rapidly growing city  of Nepal. Places in major city centres are overcrowded and bare land is hardly seen. It lies in the intersection of Siddhartha Highway and Mahendra Highway and is only 33km far from neighbouring Indian border.

For better education, health facilities and employment opportunities many  people from Palpa, Gulmi, Arghakhanchi and neighbouring districts have migrated to this city. Over  the period of time , increasing population  has shown adverse effects on its natural resources. In this article I will be showing you how the city has changed with time using remote sensing.


fig showing 3D view of Butwal, interactive 3D map can be viewed here

First let's understand what is remote sensing? It is the art or science of acquiring information about distant objects without being physically present. For example our eyes  through which we can see distant objects without being there. Similarly, there are satellites in space which are constantly observing the Earth and getting information about it called ‘space borne remote sensing’. The very advantage of space remote sensing is that they provide a synoptic view (birds eye view) with which we can see things to a  large extent. Among various satellites present in the space Landsat is one of the series of earth observing satellite missions jointly managed by NASA and U.S. Geological Survey. Data provided by Landsat is historic  and free of cost .  In this context, I will be using two satellite images from Landsat5 and Landsat8 of October 1988 and October 2021 and their respective false color composite to show the changes.

 False color composite  is an image with a band (range of wavelength in electromagnetic spectrum) combination of at least one non-visible(infrared) wavelength and other visible wavelengths. As compare to true color image false image increases interpretability of data and has greater information content. Using false color we can get insights about plant health as plants reflect more infrared wavelengths and absorb red and green wavelengths. Generally, in such an image vegetation is represented by red, water body with black or dark blue and urban with gray color. Here for false color composite,  bands 5, 4, 3 and bands 4, 3, 2 of Landsat8  and Landsat5 are used respectively.

For this analysis google earth engine(gee), a  planetary-scale platform for Earth science data & analysis is used. The best thing about gee is that with a little bit of coding you can get amazing results. Both images are of the same month and have cloud cover of 0%.  The interactive map with split layers of image 1988 and 2021 can be viewed here. Click and drag split layer from left to right to see changes. Code link here.


fig showing gif image of Butwal in 1988 and 2021; red color represents vegetation, gray urban and black water.

On comparing the two images massive changes in vegetation, river, urban area and forest can be observed. The Tinau river which flows through the heart of the city seems to be shrinking and is occupied by settlement. Clearance of forest around ‘Butwal Mandap’ area and new built up things can also be seen. Vegetations in Sukkhanagar, Deepnagar, Shivnagar and  Devinagar have decreased greatly. Likewise urban region in these area have increased. Water bodies like lakes  have increased especially in Semlar area. 

The city has gone through a lot of changes in these thirty  three years. It has developed in the  field of infrastructure and facilities but at the same time its beauty is being lost due to human activities. Recent landslides  are also evidence of it. So, where do you see Butwal in upcoming years?



Friday, October 22, 2021

Mardi: A heaven on the Earth

 It was the month of December 2018  when my friend Keshav Chaulagain came to my room. He told me that his friends were coming to Pokhara for Mardi trek and  asked me if I was interested in joining them. Without a single thought in mind I said ‘Yes’. This was probably  the most hasty and worthy decision of my life. I had heard about Mardi and its beauty before as well. Deep inside,  I had made up my mind to go to Mardi when I heard about this exactly one year ago. With the bags packed the next day we were heading towards our destination ‘Mardi’.

Pokhara to Mardi

We took the local bus around 5am and reached Hari chowk. From there we took a bus which was going to Baglung. With an hour of ride we reached Kande, from where our real journey began. We started to walk through the trails. On the way we saw some  houses made of mud and wood. The entire region of this trekking route of Mardi is a conservation area and is managed by Annapurna Conservation Project Area(ACAP). After walking for some hours we reached the Australian Base Camp. We saw some brick made hotels and restaurants there. After resting for  some time we continued our journey. Succeeding some hours of walking, with pumping and hustling we went  to Pritam Deurali through Pothana  where we had our lunch. There was a junction to ABC via Landruk  and Mardi. With enough rest at Deurali we started stepping towards the Mardi way. Walking in the hills wasn’t easy for me as I never had such experience before.  My heart was pumping a lot. I felt as if I would die there and would not make it. But my friends motivated me and slowly and gradually after taking some rest I channelized all my energy and walked in. Finally, after some hectic walk we reached our stay of the day ‘Forest Camp’. We could see some horses there and just opposite of it was Ghandruk. We took a room in one of the hotels and had our dinner. We could see other groups of young people and  foreigners who had come to this Trek. Meanwhile we noticed a Korean Couple who also had come for the trek. This was their honeymoon trek. We also met with one of the guides who knew how to read palm. That palm reader was reading the palms of those Korean couples.  I was excited to see that and requested that Palmist read my hand. He didn’t match my past events and felt like he was lousy at this art. After having some fun with foreigners, taking clicks and a campfire we went to sleep.


Next day we woke up early around 5:30am  and after having some snacks we continued our journey. The best part of our trek was that we hadn't felt like we were tired and  were excited to see the Himal. The forest  was dense  and the algae covered on the ground made it look like a green carpet. After some hours of walking we reached Low Camp. We could see some hotels there and in one of them we planned to have a lunch.  From there we could see some glimpse of Fewa Lake. The sky was dark and slowly snow started to fall. There was no boundary of our ecstasy. We jumped, shouted and expressed our happiness. The last snowfall was 7 years back. For that, we consider ourself very fortunate. After having lunch we continued on our trail. The trek route was covered with snow and it was difficult to recognize the path. We met other trekkers on the way and together with them we walked. During the whole journey,  I had a short bamboo stick that helped me climb the hills. On the way,  we could see some Yaks. We also met with people carrying gas cylinders on doko. They were  going to Sidhing to refuel them. After a few hours of walking, we reached High Camp. It was our stay of the day. We could see the fish tail mountain very closely and realized the reason behind its name. There were very few hotels and in one of them we stayed. Although snow had just stopped, it was too cold outside. I hadn’t worn  proper trekking shoes. My feet were freezing because of the cold as water had reached there. 


View from Badaldada


We met with the hotel owner and with great delight heard his stories about conflicts regarding the claim for the mountains between Annapurna and Machhapuchhre Gaupalika. We had our dinner and were warmed by fire. The water in the restroom was frozen. Snow may seem to be beautiful for travelers like us but life in such an area is really difficult. Next day our aim was to reach Viewpoint and return back to Pokhara. We needed to go as early as possible as  mountains are covered with clouds after  some hours of sunshine. So, early we went to bed and were excited for tomorrow.


Image taken from High Camp

Next day, we woke up at 4am and were ready to go ahead. We didn’t know the exact route. Luckily, we met the same Korean couple and the guide whom we met in Forest Camp. We followed them. We had heard about the two routes to the viewpoint. One which takes an hour and another 15 min. We took an hour route as it was less risky. It was dark and with the help of a torch light we marched ahead. Our mobile battery had run out. The trail was very narrow and risky, 200 metres below  there was dense forest. It was thrilling. Yesterday's snowfall had further added hindrance. Despite all the problems, the journey was beautiful. After an hour,  we finally reached Mardi Viewpoint. The scenery was majestic. Even in the dark,  Annapurna and Mardi Himal were somehow visible. The hardship and struggle we went through the journey totally paid off. After sunshine  we had some clicks  and breakfast. We decided not to go to basecamp as said by local people. The view was almost the same. We were also bound by time and  headed back towards Sidhing.


Way to Mardi viewpoint


As we were walking from higher to lower altitude it was easier to walk and our pace had increased. Snow had melted and the route had become slippery. Passing through High camp and Badal Dada we reached Low Camp, where we had our lunch. After having some rest,  we walked through the steep downward route to Sidhing. With the rest in the middle, watching the beauty of nature and  some hours of walking we reached Sidhing. It was a small village. We waited  some time for the jeep to come in. It was already around 5pm. We also met other travelers who were going back to Pokhara. After an hour of wait the jeep arrived and together we sat inside. Through the route of Lwag Ghalel and Hemja and an hour we finally reached Pokhara.




Mardi Himal from viewpoint

It was a tough trek for a guy who had never walked on the hills. Although it was a three days trek,  the lessons learned were of years. The journey made me realize that life is beautiful and more  beauty is still to be seen.