Creating a Basic Map – QGIS

QGIS 3.2.1 works well for creating interactive maps, using good set of tools and symbology its become easy to implement. In the previous post we learn how to open and view vector data. So, today we are Creating a Basic Map – QGIS. For creating  basic map we work with the vector data. Vector data is very common data format it describes the information in points, lines and polygons.

Creating a Basic Map: Adding vector layer

If you are not familiar with QGIS user interface then check our previous article QGIS 3.2.1 GUI

Creating a Basic Map - QGIS

  • In the dialog box, click on the Browse button. And navigate to the exercise data. (before using make sure to download the Exercise data)Creating a Basic Map - QGIS
  • Select the appropriate file, let say select road.shp
  • Here you are, this is your basic map
  • Save the project.

View attributes

If you are absolute beginners then question comes in your mind what is attributes. No worries when we are here, attributes is a data which store  information about spatial data. It gives where, what and why about spatial data in tabular form.

So for roads, the layer we loaded in our basic map we will view its attributes. ->>  Click on  this icon for opening attribute table or you can use F6 or Go to Layer>> Open attribute table.

Creating a Basic Map - QGIS

->>  This attribute table provides more data about road layer, the lines that you see in the map are spatial data. These lines represents the roads.

Creating a Basic Map - QGIS

Current basic map is not so easy to read. We will make it more understandable and interactive using Symbology (use of symbol).

Symbology

In the cartography design,  symbology  is technique to use symbols to represent graphic features of map. Visual appearance is very much important. Follow the steps for making your map more attractive –

  • Click two times on layer>> Layer properties dialog box will appear. Select symbology OR right on the layer>> click the layer properties in the menu.  Symbology window shown below.

Creating a Basic Map - QGIS

Creating a Basic Map - QGIS

This all the creating a basic map – QGIS. Symbology is useful but the information contained in the layer is still hidden. In the next blog we will learn how to represent this data on map.

Hope it will be useful for GIS professional. Suggestions and feedback are most welcomed.

More on QGIS:

Introduction of QGIS 3.4.4 for beginners

Quantum Geographical Information System is a open source platform for viewing, editing, managing and analysis of spatial data with various features which makes your analysis better. As we need word processor to deal with words similar to this for spatial information we require GIS application. In this blog I am providing Introduction of QGIS 3.4.4 for beginners. QGIS 3.2.1 ‘Bonn’ is released on 20 July 2018. QGIS 3.6.2 is the current version but its functionality is same as QGIS 3.4.4.  With the help of QGIS you can also create Interactive Web Map. 

Want to convert Shapefile into KML in QGIS 

QGIS supports both flavours of GIS datasets i.e Vector data formats and Raster data formats.

Download QGIS

You can also create map without using QGIS Click

QGIS 3.4.4 Interface or GUI

With the current version QGIS 3.2.1 many new features are added. Here we approach its feature one by one. You can also check How to open and view vector data in QGIS 3.4.4

QGIS desktop screen

Introduction of QGIS 3.2.1 for beginners
Introduction of QGIS 3.2.1 for beginners

Components of GUI

Main area of QGIS is called as canvas. Likewise other GIS applications toolbars, panels, status bar and menu bar is also. Lets start its study in brief.

Introduction of QGIS 3.2.1 for beginners

1. Menu Bar –

In the above image 1 number is showing main menu bar. You can access almost everything of QGIS from main menu. You can use various features and functions of the QGIS menu style. The Main Menu cannot be moved unlike the toolbars and panels.

2. Toolbar –

Toolbars have buttons that provide a one click access (i.e. shortcuts) to many of the features and functions found in the Main Menu. Toolbars are movable and free floating.

3. Canvas or Map Display Panel –

It shows geographic display of GIS layer or panel layers. It covers maximum area off course because of its function. Create a Basic Map on canvas

4. Browser Panel –

It provides a list of files on your computer. You can drag and drop GIS files into the Layers Panels to view them. This panel is movable and can be hidden/shown on the GUI. We can display it by right click at tool bar and choose the panels you want to use.

5. Layer Panel –

This panel shows map layers that are in your current project. Layers can be turned on/off, clubbed , change drawing order, etc. Extract or Select features in Layer.

6. Status Bar –

It display all the relevant information about the current project. It  shows the current scale of the map display, coordinates of the current mouse cursor position,and the coordinate reference system (CRS) of the project.

Now, you get familiar with QGIS interface, how it works, what is the need. Hope this post is beneficial for amateur GIS professional. If you face any problem in downloading QGIS and in using QGIS 3.2.1 desktop drop you comments. Any suggestions are welcome.

Furthermore,  you can also check QGIS Server – Configuration and Deploying QGIS Project , QGIS Servr – Installation in Ubuntu

QGIS Tutorial:

Basics of Cartography: Map, Map Projection

Cartography is a science which deals with the study and drawing of maps. Simply, we can say it is related to mapmaking methods. Cartography is made of two words ‘Carto’ means map or chart and graphy means ‘to draw’ or ‘to write’. Here in this article we will understand Basics of Cartography: Map, Map Projection.

Create beautiful Maps without writing a Code

Cartography in GIS

Cartography is related to representation while GIS is concerned with the analysis of spatial data. Sometimes, maps becomes more popular than their makers.

What is Map?

A visual depiction of all or part of an area on a flat plane is termed as MAP. Simply, we can say art of representing the surface of sphere or three dimensional into two dimensional body.

Types of Map Projection:

A map projection is the method to represent the spherical surface or object like that in two dimensional plane or flat surface. So therefore, there are both distortion and projection.

There are three major types of Projections:

The name of the projection is the shape that the image is projected onto.

  1. Cylindrical Projection
  2. Conical Projection
  3. Planar Projection

 

  1. Cylindrical Projection –Basics of Cartography: Map, Map Projection

  • It is also known as Mercator Projection. One can imagine that a paper to be wrapped as a cylindrical around the globe, tangent to it along the equator.
  • In this projection size and shape of land near poles are highly distorted.
  • Area near the equator is lightly distorted.
  • Direction provided in this cylindrical map projection is accurate.
  • Cylindrical Map Projection is important for navigation.

 

  1. Conical Projection –

Basics of Cartography: Map, Map ProjectionIn a conic projection area of the Earth is projected on to the cone. Simply we can say when we place a cone on the Earth and unwrap it, then the result of the projection is termed as conic projection. It is tangent to the Earth along a line of latitude.

 

  1. Planar Projection –

Basics of Cartography: Map, Map ProjectionPlanar projection also known as azimuthal projection. In this projection a flat sheet of paper is tangent to Earth at one point. Point of contact may be any point on Earth surface; most importantly north and south poles are used for GIS database. Selection of point of contact depends on the reasons why we need projection or what type of function we want to do with the projection.

Even more Check : Formula to find bearing or heading angle between two points

See the Video for more clarification –


Hence, in this article we have covered Map projection. Hope this article filled the void by providing basics of Cartography.

Furthermore, you can sign up for free tutorials.

Subscribe to us on Youtube Channel Info GIS MAP

 

Fleet Management System – Requirement | Features | Cost

This blog post describes a detailed overview of fleet management system – Requirement, Time, Technology and functionality. All features of Fleet Management Systems are going to be provided in this post in details.

Fleet Management System:

Fleet Management System is the range of functions which allows transportation companies in business to minimize the risk related with the improving efficiency, proven return on investment, productivity in business and reducing the overall cost.
It is a modular based system that has been developed for the group of transportation or large companies using fleets/vehicles with the sole intention of operating the business in a timely manner and reliable way.
Fleet management includes a range of functions like tracking valuable assets; automate the fleet reports, Management of vehicles and security & control of the fleet.
We provide simple and versatile fleet management system which is backed up by mobile access and live support. We emancipate your fleet with the sharpest technology, outstanding features and 24 hr access.
Now you can have more time to achieve your destination then less time to worry about the fleet operations and route.

Requirement Gathering:

  • What do client requires?

    We have an absolute idea of our client’s needs for the Fleet Management System in their business, so here is a list of some main requirements we think that every client would want in their Fleet management system.

    • Reduce fleet management time and cost
    • Integrate fleet planning and execution
    • Real time tracking of fleet which includes vehicle tracking, driver detail and asset details.
    • Fleet scheduling management for on-time deliveries and customer service.
    • Automation of fleet reports.
    • Management of fleet/vehicle Maintenance
    • Fleet utilization management
    • All time fleet monitoring
    • Route tracking
    • Expense tracking
    • Fleet analytics
  • Hardware requirements:

    Implementation of fleet management system would require hardware entities for Real time tracking of fleets and driver, which can be listed as:

    • Mobile Phones (iOS/Android/Windows): Any Mobile phone with the driver with GPS enabled in it can be used for the real time tracking of the vehicle and the driver. This provides you the location access to any of the mobile or immobile fleet.
    • GPS Device: Live GPS tracking devices are ideal for most vehicle tracking needs. With live GPS tracking systems in the fleet, you can have access to real-time data about vehicle location, use, driving speed and etc. This can be used to track driving habits, route vehicles more effectively, keep tabs on equipment that is at high risk of theft, and improve your dispatch processes.
      You can use both of these for the combine and separate tracking of the fleet and the driver.
  •  Software requirements:

    These are some software requirements for the implementation of the fleet management system:

    • Server: We can use any server for this management system but we prefer these two servers to be precise that we will be working on:
      1. NGINX Server – Nginx is an open source web server which can handle a website with a huge amount of traffic. It is a high performance web server developed with an intention to handle websites with large number of users. Its speciality is that it can run on a minimal amount of resources and handle a large number of requests.
      2. Digital Ocean Server – Digital ocean server or ‘droplets’ is a cloud server which is designed to store and server massive amount of data while making it easy and cost effective. Digital ocean server use KVM as hyperviser and can be created in various sizes. It helps in build deploy and scale cloud application faster and more efficient

      We personally recommend to use Digital Ocean Server, as it is much faster, easy and cost efficient.

    • Socket connection: One of the main software components of the Fleet management system is socket communication server. It is a central server component that communicates with the tracking units. Socket connection is capable of communicating with multiple clients units using multiple threads as it establishes TCP/IP socket connection with the remote hardware units. When the fleet GPS is connected, the server will authenticate the connection and proceed to receive information from the device.
    • RabbitMQ: RabbitMQ is the most used open source message broker software. It originally implemented the Advance message Queuing Protocol, which we will be using in this system. If we add single entries from server multiple times in database it will lock itself. So for preventing that from happening we will use RabbitMQ, which stores a information until a receiving server connects and takes a message off the queue. The receiving server then processes the information in an appropriate manner. So we can insert bulk information in the database in particular time as we want.
    • Database: We will be using any of these two databases for storing the data we collected from the tracking devices of the fleet:
      1. PostGIS/PostGreSQL
      2. MySQL
    • Mapping Systems: This is the main software component of the Fleet management system. This whole system is dependent on the web mapping of the data or information that the GPS devices provide. For mapping the data we can use any of these two Mapping systems.
      1. Google Maps: Google Maps is the tool which is used to display geographical information on a map which is in a widely accepted standard format for digital maps.
      2. OSM (Open Street Map): OSM is the software that creates and distributes the open source graphic data of the world. OSM has no restriction of technical or legal type. It allows free access to its map images and underlying map data. Here we can show our tracking data in real time.

    Features:

    •  Managing vehicles:

      We will provide you all the information regarding the fleet/vehicles in the web portal’s dashboard like vehicles insurances details, vehicle renewable reminders and Maintenance/service reminders for vehicles etc. Our system provides automated reports for every penny you spent on the vehicle and each expense you are going to do in meantime. We provide vehicle orders bar where you can manage orders and get previous order details.

    • GPS Tracking:

      The tracking unit collects the location information with the help of the GPS (Global Positioning System) device which we used in our system as hardware. Global Positioning System can be used for providing the route to the fleet. GPS formats collected information into the system–specific packet format and sends it to server via socket connection server. Global Positioning System tracking system uses the Global Navigation Satellite System (GNSS) network. This network incorporates a range of satellites that use microwave signals that are transmitted to GPS devices to give information on location, vehicle speed, time and direction by which we can manage Real time tracking of fleet which includes vehicle tracking, driver detail and asset details and Fleet scheduling management for on-time deliveries and customer services.

    • Speed tracking:

      Driving with excessive speed is one of the main factors in fatal road accidents. Driving at a safe speed can help save lives. Fleet managers have an interest in keeping their drivers on the road and out of the troubles, and they also want to ensure that their fleet is operating in an efficient and timely manner. Speed tracking and reporting is a principal feature in Fleet Management System. In terms of reporting, our systems will report all offences to base in real time (even have the capacity to set an SMS alert).

    • Geofence:

      Geofence is described as the circular areas which are defined around a particular location. It is set by the client in Fleet Management system by able to define the radius of the area. The GPS location of the center of the circle and the radius define a Geo-fence. If a vehicles GPS location is within the Geofence, then they are in safe area and if any vehicle go outside the area of geofence the client is notified by a text or email alert and the event is recorded.
      geofence- fleet management system

    • Automate the fleet report:

      We surely provide the automated report on each transaction or order. We provide automated report of the previous orders of fleet which you can check any time or download the file.

    Cost:

    Contact us at our mail or put a comment below to discuss the expected cost.

PostGIS, Geoserver and Leaflet | GIS Web Development

In this article we will see how data can query in Postgres and store and view at Geoserver and Leaflet i.e GIS Web Development with PostGIS, Geoserver and Leaflet. For this you will require setup of all three. You can visit our tutorial to install Geoserver For Linux or geoserver install in windows, Postgres and Postgis installation for Ubuntu 16.04. and a basic of Leaflet Js Javascript Library. If you are done with intial setup, then we can first start with to adding Shapefile in postgres by creating  database in database.

PostGIS, Geoserver and Leaflet | GIS Web Development – Steps

Step 1: After installing Geoserver and Postgress postgis in your system you need to download dataset. The data we are using is shapefile for this tutorial, which you can download from the sources given in this post. The shapefile can be administrative boundary or road network etc. For any region. This website will help you to download zip file as well, which will have all supporting file for shapefile.

Step 2: Now you need to open Postgres, add database, table and add shape file using shp2pgsql. This all has been explained in our tutorial.

Step 3: Start Geoserver by running shell file provided in bin folder of geoserver. That can be run by executing the given command on terminal.

cd <path to Geoserver/bin>
sh startup.sh

Then Open browser and type

http://localhost:8080/geoserver 

and login by using your credentials. Generally its admin as username and password as geoserver.

Step 4: Now create a new workspace on Geoserver. Now Move to workspace option in data section by providing required information. Create new store as PostGIS and provide information required.  Here you need to give workspace name and data source name you created. If you want you can write the description about your data.

PostGIS, Geoserver and Leaflet | GIS Web Development
PostGIS, Geoserver and Leaflet | GIS Web Development

Now you need to provide connection parameter.

PostGIS, Geoserver and Leaflet | GIS Web Development

Dbype is the type of database, you can leave it as default or can specify your database type. Host and port: these are the parameter, which help geoserver to connect with postgres. The Host is space where database exist. The port to connect with postgres host, you can provide if you have set any otherwise make it as 5432.

Database: this is the database, which you have created using postgis. You are not sure about the name you can check it on pgAdmin or in terminal.

\l : this will provide you the list of available database. For this you must work with proper user-name.

Schema: to know your table, which you have created in database you can execute \d as this will provide you list of table associated database with their schema.

User and Password: this the USER with whom you have created database. In postgres you can create a new user with proper password.

Namespace: Namespace to be associated with the database. This field is altered by changing the workspace name. Remaining option you can leave as it is. And save the information.

Stpe 5: Now open the Layer option in data section, searched for your workspace and publish the layer.

Stpe 6: Here you will see tabs as data and publishing. In data tab you need to provide the reference coordinate system (CRS) by clicking on compute from data or compute from native bounds. After this you can save this layer with default styling. If you want to style your layer, which includes color, symbols etc. You can visit our tutorial styling vector data.

Step 7: Now moving to layer preview option in same data section. Here you can see your shape file.

Step 8: The shape file now can be render on map using leaflet javascript library.

For that you need to create HTML file, add leaflet library. After this create a div, which will contain map. Using L.map() and initialize the map and set view using setView() this takes center latitude longitude and zoom as arguments. You can check how to load a layer of polygon, point or polyline in leafletjs.

After that the shape file using L.TileLayer.WMS() , provide the base WMS URL, and specify whatever WMS options you need. The option can be layer, transparent and format etc. After this  use addTo() function to add layer to initialized map. Open that HTML file on browser to see the map with rendered shapefile.

Hope this PostGIS, Geoserver and Leaflet | GIS Web Development helped you in creating a map layer of shapefile which is loaded in postgis, and added the wms layer from geoserver which is then served as map in browser with leafletjs. If you find any problem in understanding the same, do let us know by commenting below.

GIS in Healthcare Industry – Mapping, Tracking, Discover

Healthcare Industry or the Public healthcare Industry deals with public medical care on a very large scale and there are many outbreaks and crisis happens some particular areas or some routes. The Ability to map out  and visually represent a region is necessary for planning responses to health crises and  identified outbreaks which is done by GIS in Healthcare Industry.

GIS in Healthcare Industry :

In this post we are going to focus on How can we use GIS in Healthcare Industry and for that let us first talk about Healthcare Industry.

Health care industry is one of the most important and organized sector in the world, It deals with public medical care on a vast level. Health care industry is just beginning to realize the tremendous potential of GIS to benefit the public medical care. Either private or public organisation, both sectors are evolving innovative ways to harness the data integration and spatial visualization tech, which can be used with GIS in Health Industry.

Now That we had a brief of Healthcare Industry, lets discuss how would they make use of GIS in their working. GIS is helping every sector and so does it with the Health care. So lets see the benefits of the GIS in Healthcare Industry.

Benefits of GIS in Healthcare Industry :

Healthcare Industries are using the resource integration capabilities of geospatial technologies to create analytical and descriptive solutions for major health issues. Geographical Information System impersonates an important role in improving the quality of care, integrating and analyzing clinical data — alongside environmental data, increasing accessibility of services, finding cheap cost delivery modes, and preserving patient confidentiality while satisfying the needs of the research community for data accessibility.

Here we list out some of the main benefits of using GIS in Healthcare Industry:

  • Mapping :

    GIS uses maps to analyze and understand the location of doctor or patients or hospitals. GIS mapping of data helps you make informed decisions with a web portal or application. It can provide a web- based portal for every patient or doctor, as you can find your closest doctor or right doctor for your specific need etc. This System includes comprehensive hospital listing locations and the no. of healthcare and social associated employees. These data provide a complete framework for exploring care provider locations.
    Mapping - GIS in Healthcare Industry

  • Tracking :

    Tracking is one of the most powerful aspect provided by GIS in Healthcare Industry. It has ability to use geography and other inputs to identify many new aspects. Let us discuss about two of them.

    1. Tracking of Infectious Diseases : GIS can identify where diseases are most likely to spread next when an Infectious disease is effecting over a wide range of area. Collecting this kind of data can be essential to on-ground working personnel working to save lives because it enables them to prepare in advance for a disease and can severely impact.
    2. Tracking Children Immunizations : GIS tracking can also be used as tracking child immunizations. GIS provides a way to move data from the project level so that it can be used by the entire organization, as it is used to gain a better understanding of Immunizations rates to determine which locations could be rescued during an outbreak.

    Tracking - GIS in Healthcare Industry

  • Helps in Research – GIS in Health Care:

    For broad regional treatment plans the collection of vast amount of accurate personal data is expected to reveal a great deal, but it can also greatly impact personalized healthcare. It has the potential to uncover long-term geographic trends in the health of certain demographics of people living within certain regions of the world.  If the people or individuals have same health condition on same regions, like in a particular area, 70% of the population is suffering from the same common disease. So we can discover about why they all have the same disease? and we could open new realms of healthcare research.
    Research - GIS in Healthcare Industry

  • Discovering Health Trends – With GIS Tool :

    The Geographical Information System provides healthcare industry personnel the ability to recognize health related trends. The GIS offers public healthcare target healing endeavor based upon the result of health related trends. GIS offers a method for health care professionals in which they can address where the diseases are more prevalent or likely to be  widespread in mean time and proactively begins implementation of preventative strategies or begin staffing skilled medical specialists healthcare professionals.

  • Improving Healthcare Services by GIS tool :

    The Geographical Information System helps in identifying the greater needs of specific healthcare services in a large area or country. GIS helps in providing  quick access to medical records, which is crucial to effective treatment. The use of GIS improves national healthcare services as it enables leaders and developers to work more closely with hospitals. And healthcare to take larger steps in addressing national healthcare needs. The geography of health care systems, which  deals with  the planning, management and delivery of suitable health services after determining healthcare needs of target community and service catchment zones. Improving healthcare services is the most important benefit of using GIS in Healthcare Industry.

So, This is how Healthcare System is using GIS for performing their tasks more efficiently. Geographical Information System is a powerful tool that has been successfully implemented to assist address a number of noteworthy health issues ranging from mapping to improved services. Using GIS in Healthcare System is one of the best method to have some control over the management and services. As the healthcare professionals start to adopt and integrate GIS. The number of benefits is likely to rise including the relationship between hospitals and communities. Which is perhaps the most important connection to be made.

Do let us know how this Article is helpful for you, by commenting below in the comment box.

GIS in Banking Sector – Scope | Benefits | Uses

In last decade, the Banking sector has been undergone drastic changes, reflecting a huge development in services. The impressive advancements in communication and information technology accelerated and broadened  the expansion of financial information and services in the first place. As a matter of fact there is an imperative necessity to standardize the industry processes through interactive portals and location analytics. As both these sectors are location-based, by understanding the location of customers and their transactions, they can better manage the branch networks. It will also enable them to understand the competition and regulators. In this post we are going to focus on one of the key component of banking sector i.e GIS and Find out How useful is GIS in Banking Sector.

GIS in Banking Sector – Scope | Benefits | Uses

A customer-centric business model can help address the challenges in banking sector like ease of usability, skimming, web hacking and problems with customer services. Financial product and services and delivering them to customers are the  major functions of banks. One of the required feature of Banking industries and financial services is Market analysis.

Banks and Financial services manages a ton of information data about their consumer, consumer’s profile and so much more, so database management for bank data and customer relationship management is one of the main functions of the banks and this can be easily achieved by the GIS. Using GIS in banking sector or Geographic modeling with future plans provides paramount benefits to the banking industry.

Benefits of GIS in Banking Sector :

  • Expansion of Customer base and managing its database
  • Improving Quality of the Services using GIS
  • Increasing Consumer Satisfaction
  • Consistent Business/ financial Growth and expansion
  • Increase in Profitability

GIS can help in banking sectors various functional areas by providing support in decision-making and strategic planning of the Business and consumer. Effective resource management and operations management can possible by adopting GIS in banking sector.

How Useful and important is GIS in Banking Sector

  • Customer Analysis and Management: Customer analysis is useful in determination of customer characteristics like characterizing market segmentation of locations. It can help in convert a Postal address to a location reference such as to its corresponding position on the map. Catchment area for the branches can be drawn and areas which are not served can be easily identified. It helps displaying customers location on map in relation to a bank branch.
    customers - GIS in Banking Sector
  • Market Analysis : Defining the target group of audiences/customers for banks, we need GIS to develop the market segmentation. Marketing is a customer-orientated operation that is essential for business success of any bank. GIS based marketing analysis proves relevant and useful in understanding financial needs of market and potential customers for their finance products and services. GIS helps in pinpoint demand and supplies to their geographic locations.  It also reveals the importance of geo-demographic research to marketing.
  • Performance monitoring : Using GIS in banking sector, you can analyze and monitor performance of the branches using spatial components. GIS component of a branch review involves defining a trade area and identifying the nearby competitors. It can also help in drawing potential customers zones based on the spatial distribution of the customers.
    monitoring - GIS in Banking Sector
  • Asset Management: Bank management needs to monitor a large amounts of information over an ever-changing inventory of physical assets. GIS helps us in managing Banks all the modern or traditional assets. This makes it possible to operate, maintain, and upgrade physical assets cost-effectively. Asset management includes management of mortgaged properties location and cost. As well as online tracking of cash status in ATMs and their distribution by using cash Van Fleet management. the spatial components  puts requirements to maintain minimum asset condition.
    Asset- GIS in Banking Sector

Banking Sector manages all over world’s customer information, and the GIS in Banking sector database manages the data and customer relations of the bank. Geographic modeling with astonishing future plans provides crucial benefits to banking sector. GIS in banking can work as a strategic tool providing a competitive advantage. Geography based network analysis can be used for better business opportunities and will allow better understanding of market strength.

Do let us know how this Article is helpful for you, by commenting below in the comment box.

 

Traffic Congestion Modelling – GIS

In this modern society’s substructure, roads behave as the key medium for transportation and lending a great deal to the allocation of goods, funds and individuals.  The trend of urbanization, the increase in population and increase in number of registered vehicles on roads induces pressure on traffic movements and causing the traffic congestion problem on roads in almost every part of the world which makes living in urban area more difficult.  Application of GIS in road traffic management renders many useful functions for assuring an efficient flow in the traffic systems of a country. In this post we are going to discuss about the Traffic Congestion Modelling – GIS . but let’s first talk about what actually is Traffic Congestion.

What is Traffic Congestion?

Congestion is a possibility for any mode of transportation, Traffic congestion is a condition on transport networks. When traffic demand on road is great enough that the interaction between vehicles slows the speed of the traffic stream, this results in some congestion.

Traffic Congestion Modelling – GIS

The Traffic Congestion Modelling is the strategic planning to influence the traffic with the  monitoring and control over the traffic systems. The traffic congestion management is used to expand the potential of State and local transportation systems. Traffic congestion management is one of the tough task of the local authorities because of the rapid urbanization. Improper traffic management and planning may lead to severe traffic congestion and accidents in the city. For inventing and implementing new solution on such problems it is necessary to get current traffic data and right decision making tool. In recent years, GIS has emerged as one of the most efficient tools in the transportation sector and GIS is one of the management decision making tool which analyses stores huge amount of data efficiently and effectively. Expected project output will be the recommendation for better traffic management using GIS tool on the basis of data collected, analysis and design.

Benefits of Traffic Congestion Modelling – GIS

  • Effortlessness movement of traffic
  • Minimum time spent on roads due to traffic
  • Improving the travelling mobility
  • Increased roadway safety and personal protection
  • Efficient transport planning and designing
  • Reliable and safe operation of transport
  • Conserving the energy while protecting the environment

GIS can help in the assessment and management of traffic congestion by mapping out these various factors that influence the speed of moving vehicles, like width of road, construction work, road’s structure, various land uses that attract vehicle traffic. GIS represent the modern entry of multi-discipline fields in subject areas like computer science, surveying, geography, and cartography into statistical analysis and the management of transportation systems.

Use of Traffic Congestion Modelling – GIS

  • Routing with GIS: GIS provides alternative routes to road user so that they don’t get in any congestion on road. Roads and traffic information is crucial data and road traffic mangers normally organize this material by compelling the data into table used in statistical analysis. spatial analysis, allows the tool to start responding to various events, evaluate impact and answers the best route for the road users.
    Routing-Traffic-Congestion-GIS-Modelling
  • Monitoring with GIS: GIS can render large database easily, which can integrate data from disparate sources.  The monitoring allows the tool for proper signal controlling on busy or congestion squares. for example if Square A shows as the congestion spot with high congestion, then for reducing the congestion of square A, we can divert the traffic coming to this square by using proper signalling of near by square B and square C with low congestion with the help of monitoring. Monitoring helps us understand the right timing and how can we properly control the signals, which can help in Traffic congestion model.
    Monitoring-Traffic-Congestion-GIS-Modelling
  • Accidents minimization : In Traffic Congestion Management, accidents can be minimized via GIS by generating a data of most accidents prone spots. The information can be provided either in the graphical format to the users or user’s driver and when the users gets the information about nearest dangerous area the drivers become extra cautious at such spots hence free flow can be maintained.Accident-minimization-Traffic-Congestion-GIS-Modelling
  • Reduction of Congestion spots : GIS is one of the powerful tools for analysis the spatial and attribute data for effective traffic management. Regional
    planning is essential for proper transportation management. GPS data was used to identify the spatial location of traffic congestion and other location based spatial information. One of the useful GIS functions to be used for this purpose is known as shortest path. It refers to the process of creating map of the shortest path from one point to another. The GIS tool requires that the user should have road direction table containing a list of directions stored as a database table as well as a set of reference data such as roads on which the addresses can be located. This can help in Reducing the congestion spots on the roads by providing the shortest and easiest part to the user.

GIS has a wide variety of applications in road traffic direction and traffic planning in transportation networks. GIS is a bonus to all sorts of traffic direction; the blending of GIS with other schemes is perhaps the best principal potential for the expectations of GIS. The priority results are utilized in evaluating congestion points according to roads direction. Results obtained from this tools compare alternate improvement strategies, and solutions thus giving the best possible solution. This is how you can use GIS in Traffic Congestion Modelling.

Do let us know how this Article is helpful for you, by commenting below in the comment box.

 

PHP PostGIS connection – Codeigniter and GIS Database

PHP PostGIS connection.  Let see first, what is PHP (Code igniter), PostGIS and why we are connecting them? PHP (Hypertext Preprocessor) is a server scripting language, and a powerful tool for making dynamic and interactive Web pages where as PostGIS is a spatial database extender for PostgreSQL object-relational database. It adds support for geographic objects allowing location queries to be run in SQL. We are connecting both of them to query spatial data stored in PostGIS and send them server.

Before looking into this post you may try to look for installing postgis and postgresql in your system or server.

PHP PostGIS connection – Codeigniter and GIS Database

There are many exciting things that you can do, for example you can use pgrouting and see the shortest path. Codeigniter is an Application Development framework. It is well designed structure to write code in PHP.

PHP codeigniter Desciption – connection with postgis

There are three main component, which separates the logical and presentation.

Part – 1. Model – This component connects you with your database. Here you can insert, update or delete data from your connected database.

Part – 2. View – This component is mainly about presentation part. This is PHP file which contains information, which you need to show to users.

Part – 3. Controller – This one is main component of the codeigniter as model and view or any other resources are loaded here.

This helps to process the HTTP request and generates the web pages.

Step for PHP PostGIS connection – Codeigniter and GIS Database

There are few steps for doing this-

1. Very first step is to download the code igniter, PostGIS and have knowledge about PHP.

2. Download  codeigniter framework or which every framework you use. Then unzip the downloaded file. If you are using Ubuntu system then place it inside /var/www/html folder.

3. You need to do some settings such as set base url by navigating your self to application/config/config.php path. (for Codeigntier php people)

4. As in controller the index function loads the welcome page so by entering base URL in browser you will see the welcome page.

5. Installation of PostGIS in described in last article please follow that.

6. Now as we want Postgres to connect with code igniter So we need to open application/config/database.php file.

Here in the end of page you will see the

$db['default'] =  array( 'dsn' => '', 
 'hostname' => 'localhost', 
 'username' => 'root', 
 'password' => '', 
 'database' => 'database_name', 
 'dbdriver' => 'mysqli', 
 'dbprefix' => '', 
 'pconnect' => TRUE, 
 'db_debug' => TRUE, 
 'cache_on' => FALSE, 
 'cachedir' => '', 
 'char_set' => 'utf8', 
 'dbcollat' => 'utf8_general_ci', 
 'swap_pre' => '', 
 'encrypt' => FALSE, 
 'compress' => FALSE, 
 'stricton' => FALSE, 
 'failover' => array() 
 );

Here Mysqli driver is connected. Now we will change the Username by Postgres. If you have change the username of Postgres replace ‘root’ by that name. If this this password protected then provide the password in third row. Change the database name with one available in postgres. Now write postgre in place of mysqli. Let rest all fields as it is. In the last you can add port number for postgres by typing this ‘port’ => 5432.

So this will look like:

$db['default'] = array( 
 'dsn' => '', 
 'hostname' => 'localhost', 
 'username' => 'Postgres', 
 'password' => 'password', 
 'database' => 'postgres', 
 'dbdriver' => 'postgre', 
 'dbprefix' => '', 
 'pconnect' => FALSE, 
 'db_debug' => (ENVIRONMENT !== 'production'), 
 'cache_on' => FALSE, 
 'cachedir' => '', 
 'char_set' => 'utf8', 
 'dbcollat' => 'utf8_general_ci', 
 'swap_pre' => '', 
 'encrypt' => FALSE, 
 'compress' => FALSE, 
 'stricton' => FALSE, 
 'failover' => array(), 
 'save_queries' => TRUE, 
 'port'=> 5432 
 );

Now to check that your database is successfully connected with codeigniter you can run query to insert data in available table.

As after connection with PostGIS i.e with GIS extension enabled, you may look forward to insert shapefile data into postgis or import osm data into postgis.

For example- First of all create a view which shows that we are passing username and password, Which will get store in database table. Go to the application/view and create php file and write the given code. For this can use any test editor.

    <h2>Login Details</h2>

<form action="<?php echo base_url()?>index.php/User_Authentication/checkUser" method="post">
<label>UserName :</label>
<input type="text" name="username" id="username" placeholder="username"/><br /><br />
<label>Password :</label>
<input type="password" name="password" id="password" placeholder="**********"/><br/><br />
<input type="submit" value=" Login " name="submit"/><br />
</form>

Model will have query to insert data. Provide proper table name and data to be entered coming from view page.
public function registration_insert($data) 
{
  $rs=  $this->db->insert('user_login',$data);
  if($rs)
  {
      return TRUE;
  }else{
      return FALSE;
  }
}

Finally in controller load the model and created views.
class User_Authentication extends CI_Controller {

public function __construct() {
parent::__construct();

// Load form helper library
$this->load->helper('form');

// Load form validation library
$this->load->library('form_validation');

$this->load->helper(array('form', 'url'));
// Load database
$this->load->model('Login_Database');
}


// After loading model and views write a function whcih will take data coming from view, will make a array and sent this data to function registration_insert() in model.

public function newuser(){

$data = array(
   // 'id'=>'2',
'user_name' => $this->input->post('username'),
'user_email' => $this->input->post('email'),
'user_password' => $this->input->post('password')
);
$this->Login_Database->registration_insert($data);
$this->load->view('Login_Form');
}

Want to visualize the postGIS data, you can use QGIS to connect with PostGreSql and postgis.

Similarly after processing the data, you may be looking for exporting the PostGIS postgresql data in Shapefile or other format.

After this you can load the base URL in browser and pass data needed to insert in database table. Now open postgres and see the data hase updated accordingly. If you find any problem in connecting between php and postgis, do comment below.

Leaflet Print Map – Legends, Title, Layer, Color

This article i.e Leaflet Print Map – Legends, Title, Layer, Color is for how can we take a beautiful map on paper from web by making it printable, with all map elements as map title and legends etc. Here we will use leaflet-image plugin from leaflet JavaScript library. This plugin uses the map and canvas HTML tag.

Leaflet Print Map – Legends, Title, Layer, Color

This plugin can be downloaded from https://github.com/mapbox/leaflet-image/blob/gh-pages/leaflet-image.js link. To implement this plugin on your system, you first need to create map, which can be done by following this article.

First of all add the leaflet library in your document by adding these scripts.

 <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css"/>
 <script  scr="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js" ></ script>

Thereafter, create a division using

Leaflet Print Map - Legends, Title, Layer, Color

After adding the leaflet-image plugin in document you can call the leafletimage() method, which takes map as input and calls to callback function.

This function create a canvas html tag sets its width and heigth. Which draws layer in same order as drawn on map i.e. tile, path and markers. Before calling this function you must create function to get legend and map title with leaflet.

Here we have create getMapHeading() function which takes context and canvas as input. So what is Content?

var context = canvas.getContext(contextType);

getContext()– method returns a drawing context on the canvas.

contextType-Is a DOMString containing the context identifier defining the drawing context associated to the canvas.  “2d”, leading to the creation of a CanvasRenderingContext2D object representing a two-dimensional rendering context.

canvas– element is used to draw graphics on a web page.

Map Title in Leaflet Map

Take the map title in a variable and measure its width. if its width is less than one forth of canvas width then set its width according to canvas width. else the tile is larger then split it.

function getMapHeading(context,canvas){
 var mapheading = $("#mapTitle").html();
 var pix = context.measureText(mapheading).width;
 if(pix<(canvas.width/4))
 {
 var xval = (canvas.width-pix*4)/2;
 context.font = "bold 35px proximanova-semibold-webfont";
 context.fillText(mapheading,xval,40);
 }
 else
 {
 mapheading = mapheading.split(" ");
 //console.log("mapheading",mapheading);
 //mapheading = mapheading.toString();
 pix = canvas.width/4;
 var line = "",nextline = "";
 for(var i=0; i<mapheading.length; i++)
 {
 if(context.measureText(line).width<pix)
 {
 line += mapheading[i] + " ";
 }
 else
 {
 nextline += mapheading[i] + " ";
 }
 }
 context.font = "bold 35px proximanova-semibold-webfont";
 context.fillText(line,25,40);
 if(nextline.length>0)
 {
 context.fillText(nextline,25,80);
 }
 }
 }

Map Legends in Leaflet Map Printable

Similarly function is created for legend as getLegeds(). In this function we have taken legend title, icon, range and containing div in variables. Check everything and recreate the context as you want it to be appeared on print.

Leaflet Print Map - Legends, Title, Layer, Color

function getLegends(context,canvas){
 var legendheading = $("#legendTitle").html();
 var paralegend = $('.paralegend');
 var legendclr = $('.paralegend i');
 var divlegend = $('.leaflet-control.leaflet-bottom.leaflet-left');
 var width = divlegend.width(),height = divlegend.height();
 var x =10,dx=20,dy=20;
 var y = canvas.height-height+15;
 var legendtext = [],legendcolor = [],rects = [];
 for(var i=0; i<paralegend.length;i++)
 {
 legendtext.push(paralegend[i].innerText);
 }
 for(var j=0; j<legendclr.length; j++)
 {
 legendcolor.push(legendclr[j].style.background);
 }
 for(var l=0;l<legendcolor.length;l++)
 {
 rects.push(new shape(x,y,dx,dy,legendcolor[l],legendtext[l]));
 y=y+25;
 }
 context.font = "bold 15px proximanova-semibold-webfont";
 context.fillText(legendheading,x,canvas.height-height);
 for(var k=0;k<rects.length;k++)
 {
 var sqr = rects[k];
 context.fillStyle = sqr.fill;
 context.fillRect(sqr.x,sqr.y,sqr.dx,sqr.dy);
 context.strokeStyle='#000';
 context.lineWidth=1;
 context.strokeRect(sqr.x,sqr.y,sqr.dx,sqr.dy);
 context.fillStyle = 'black';
 context.font = "15px proximanova-semibold-webfont";
 context.fillText(sqr.text,sqr.x+25,sqr.y+15);
 }
 }

Leaflet-image plugin for printing map – Leaflet Print Map – Legends, Title, Layer, Color

Now Call the leafletImage() function and provide the create map and call the callback function. In this callback you can call the getMapHeading() and getLegends() functions. For this function we have taken the image data in data variable by using getImageData() method. And The getImageData() method returns an ImageData object that copies the pixel data for the specified rectangle on a canvas.

So the rectangle is given as whole canvas. Then set the globalCompositionOperation as destination-over. The globalCompositeOperation property sets or returns how a source (new) image are drawn onto a destination (existing) image. The putImageData() puts the image data back onto the canvas. The drawImage method draws an image onto the canvas.

leafletImage(map, function(err, canvas) {
 var context = canvas.getContext("2d");
 getMapHeading(context,canvas);
 getLegends(context,canvas);
 var data = context.getImageData(0, 0, canvas.width, canvas.height);

//store the current globalCompositeOperation
 var compositeOperation = context.globalCompositeOperation;

//set to draw behind current content
 context.globalCompositeOperation = "destination-over";

//set background color
 //context.fillStyle = "grey";
 context.fillStyle = "#ddd";
 //draw background / rect on entire canvas
 context.fillRect(0, 0, canvas.width, canvas.height);

var dataURL = canvas.toDataURL("image/png");
 console.log(dataURL);
 context.clearRect (0,0,canvas.width, canvas.height);

//restore it with original / cached ImageData
 context.putImageData(data, 0,0);

//reset the globalCompositeOperation to what it was
 context.globalCompositeOperation = compositeOperation;

context.drawImage(canvas,0,0);
 print.href = dataURL;
 print.download = "map.png";
 });

finally On printing the map will look like
Leaflet Print Map - Legends, Title, Layer, Color
Leaflet Print Map – Legends, Title, Layer, Color

Hope you enjoyed this article and are now able to create Leaflet Print Map – Legends, Title, Layer, Color. If you find any problem in implementing a printable map, do comment below. Thanks.