QGIS Tutorial – Quantum GIS Guide

QGIS is one of the most common open source application used by GIS analyst, Geographers, Civil Engineers and many other professionals. If you are new in the field of Geographic Information System (GIS)  you should consider learning this application, as it will help you to solve many complex problems, analyze area, create reports etc. with just few clicks. Let me introduce you what is QGIS and why you should consider using it before providing all the QGIS tutorial links.

What is QGIS and its Advantages:

QGIS is a Desktop based Geographic Information System (GIS) Application for creating maps, editing, viewing and analyzing Geospatial data. Quantum GIS is a cross platform, free and open source application. It can be run on multiple operating system like Mac OS X, Windows, Ubuntu, Linux and Unix.

QGIS has many advantages over other application like:

  • Simple, easy and User friendly Interface(UI).
  • Is of small size and consumes less RAM memory compared to other GIS application.
  • Supports all kinds of GIS file formats – Either vector or Raster.
  • Tons of plugin are already developed for additional functionality which can be used and added directly. If you don’t the plugin you need, then you can
  • Code in Python or c+++ for integrating the one.
  • A free software application under GNU GPL License
  • And many more.

Download QGIS from Official Website

QGIS 3.4.4 tutorial:

Download, Uploading and Converting geo files in QGIS

Digitizing, Processing, Analyzing, Georeferencing in QGIS

Visit IGIS MAP Youtube Channel for free QGIS Tutorial

QGIS Database Linking

This list will continuously updated as the number of articles for tutorial would be published. If you are an expert in QGIS please consider contributing a tutorial article for same here.

Free Trial of MapOG Tool

Quick Embed Customized Map on website

Quick Embed Customized Map on website is a easiest way of adding a map on your website. And make your website interactive by embedding map on it. Maps are more attractive then numbers and words. It is also beneficial for  your business.

Quick Embed Customized Map on website  – Using Igis Map Tool

Benefits of Embed Maps on your website

With the help of Igis Map Tool you can build your own customized map and share or add on your website. This interface encourage your clients to interact with you and it creates stronger bonds. Lets understand using some examples. It is helpful for many business like for grocery store or you have a franchise of store in a particular area and you want to locate your store on map and embed it on your business website. You can pin your shops location. With this customer can reach you very easily and it will save time of customer otherwise they have to go on google and search for your store address.

Like you owns a chain of School name New Harbor School. In a particular state you have number of school campus. One of your student parents want to shift to other end of the city because of job change and don’t change the school . Then using this embed map where address of your branches of school are pinned they can track near about campus. It takes hardly few second.

Build, Customized and Embed Map on Website

  • Go to GIS MapOG Tool, login or register for using the tool.
  • Create your customized map and pin your locations.  You can build Point, line and Polygon. Let suppose you owns boutique store in various states of US. You places the points on your location as shown below.

Quick Embed Customized Map on website

  • After putting boutique location tap on Map Tools and in the drop down select share Map.

Quick Embed Customized Map on website

  • In the Share Map box tap on Embed and copy the Embed Code.Quick Embed Customized Map on website
  • Paste code in the source code of your website.

Quick Embed Customized Map on website

This is all about of adding map on your website. Giving a visual representation of your business location and activities attracts from user of your services or product. Embed map screen shown below.

Quick Embed Customized Map on website

Using such a interface which is visually interactive and engages your clients better. This increases their comfort level and making them more likely to enter your doors. Try at your ends and if you face trouble then please do comment.

If you are new to IGIS Map Tool then Go To GIS MapOG Tool Guide

Convert Shapefile to DXF

Shapefile is a vector GIS format developed by Esri. It stores geographical information data. Shapefile have three geometries point, line and polygon. GIS data can be stored in different formats and the conversion of data from one format to other is also possible.

So in this post we convert Shapefile to DXF. Before conversion lets know what is DXF ?

What is DXF ?

DXF is a CAD (Computer Aided Design) fil format and it stands for Drawing Interchange Format or Drawing Exchange Format. DXF files make it possible to share drawing data and text-based formats across different CAD applications. DXF files are supported in several 3D applications and are completely open-source, so users can access AutoCAD files without using Autodesk programmes.

Convert Shapefile to DXF

For Shapefile to DXF conversion, go to GIS MapOG Online Convert Shapefile to DXF Tool, after logging in with your registered email and password. If you are a new user, click the Sign Up button in the Login popup and register to GIS MAPOG by filling the details.

There are three main steps for using GIS Converter:

  • Upload the data
  • Choose the format to which it should be converted
  • Download the converted file.

Step one is to upload your Shapefile which you want to convert. You can upload your file from system or select from the Recent Files.

Upload Shapefile
Upload Shapefile

Here we have uploaded the Shapefile of the Texas state of USA.

Step two is to select the output format from the dropdown for the converted file, in this case its DXF. You can also set the Coordinate Reference System of your preference. As a default CRS will set to WGS 84 (World) [EPSG:4326]. Now Click on the Convert File button.

Select DXF as Output Format
Select DXF as Output Format

After a few seconds, your Shapefile will be converted to a Shapefile file and will be available for downloading.

Download and Publish Shapefile
Download and Publish Shapefile

You can also choose to style the layer or continue with further conversion process by clicking the Convert Another File button.

Converted Files section from the dashboard contains the list of the details of all the conversion done in your account, providing both input and output data available for download their corresponding formats.

Other GIS data Conversions

If you are facing any problem in conversion or login then please let us know by mailing at support@igismap.com or drop comment.

Download Papua New Guinea Administrative Boundary Shapefiles – Provinces, Districts, Municipalities and More

Hello GIS enthusiasts, IGISMAP has now published the latest GIS vector data of Papua New Guinea administrative levels. Links for downloading the shapefiles of the important administrative divisions of Papua New Guinea are provided in the following. You can also download these data in KML, GeoJSON or CSV formats. 

Note:

  • All data available are in GCS datum EPSG:4326 WGS84 CRS (Coordinate Reference System).
  • You need to login for downloading the shapefile.

Download Free Shapefile Data of Papua New Guinea

Papua New Guinea officially the Independent State of Papua New Guinea is a country in Oceania that comprises the eastern half of the island of New Guinea and its offshore islands in Melanesia (a region of the southwestern Pacific Ocean north of Australia). Its capital, located along its southeastern coast, is Port Moresby. The country is the world’s third largest island country with an area of 462,840 km2 (178,700 sq mi).

Papua New Guinea National Boundary
Papua New Guinea National Boundary

Download Papua New Guinea National Outline Boundary Shapefile

Download Papua New Guinea Provinces Shapefile Data

For administrative purposes, Papua New Guinea is divided into administrative divisions called provinces. There are 22 province-level divisions, which include 20 provinces, the autonomous region of Bougainville and the National Capital District of Port Moresby.

Papua New Guinea Province Boundaries
Papua New Guinea Province Boundaries

Download Papua New Guinea Province Boundaries Shapefile

Download Papua New Guinea Districts Shapefile Data

Papua New Guinea District Boundaries
Papua New Guinea District Boundaries

Download Papua New Guinea District Boundaries Shapefile

Download Papua New Guinea Municipalities Shapefile Data

Papua New Guinea Municipality Boundaries
Papua New Guinea Municipality Boundaries

Download Papua New Guinea Municipality Boundaries Shapefile

Other GIS Data:

Please note that the Papua New Guinea data provided here is license under Open Data Commons Open Database License (ODbL). Please review the same before using it. If you want data under different license you can also look over to the post : Download Free Shapefile Maps – Country Boundary Polygon, Rail-Road, Water polyline etc

Download Free Shapefile for the following:

  1. World Countries Shapefile
  2. Australia
  3. Argentina
  4. Austria
  5. Belgium
  6. Brazil
  7. Canada
  8. Denmark
  9. Fiji
  10. Finland
  11. Germany
  12. Greece
  13. India
  14. Indonesia
  15. Ireland
  16. Italy
  17. Japan
  18. Kenya
  19. Lebanon
  20. Madagascar
  21. Malaysia
  22. Mexico
  23. Mongolia
  24. Netherlands
  25. New Zealand
  26. Nigeria
  27. Papua New Guinea
  28. Philippines
  29. Poland
  30. Russia
  31. Singapore
  32. South Africa
  33. South Korea
  34. Spain
  35. Switzerland
  36. Tunisia
  37. United Kingdom Shapefile
  38. United States of America
  39. Vietnam
  40. Croatia
  41. Chile
  42. Norway

Disclaimer : If you find any shapefile data of country provided is in correct do contact us or comment below, so that we will correct the same in our system as well we will try to correct the same in openstreetmap.

Download Denmark Administrative Boundary Shapefiles – Regions, Municipalities, Postal Areas and More

Hello GIS enthusiasts, IGISMAP has now published the latest GIS vector data of Denmark administrative levels. Links for downloading the shapefiles of the important administrative divisions of Denmark are provided in the following. You can also download these data in KML, GeoJSON or CSV formats. 

Note:

  • All data available are in GCS datum EPSG:4326 WGS84 CRS (Coordinate Reference System).
  • You need to login for downloading the shapefile.

Download Free Shapefile Data of Denmark

Denmark is a Nordic country in Northern Europe. It is the most populous and politically central constituent of the Kingdom of Denmark, a constitutionally unitary state that includes the autonomous territories of the Faroe Islands and Greenland in the North Atlantic Ocean. European Denmark is the southernmost of the Scandinavian countries, lying southwest of Sweden, south of Norway, and north of Germany. Spanning a total area of 42,943 km2 (16,580 sq mi), it consists of the peninsula of Jutland and an archipelago of 443 named islands, of which the largest are Zealand, Funen and the North Jutlandic Island. Denmark’s geography is characterized by flat, arable land, sandy coasts, low elevation, and a temperate climate. As of 2022, it had a population of 5.88 million (1 March 2022), of which 800,000 live in the capital and largest city, Copenhagen.

Denmark National Boundary
Denmark National Boundary

Download Denmark National Outline Boundary Shapefile

Download Denmark Regions Shapefile Data

Denmark is divided into 5 regions. The governing bodies of the regions are the regional councils, each with forty-one councillors elected for four-year terms.

Following are the list of regions:

  1. Hovedstaden – Capital Region of Denmark
  2. Midtjylland – Central Denmark Region
  3. Nordjylland – North Denmark Region
  4. Sjælland – Region Zealand
  5. Syddanmark – Region of Southern Denmark
Denmark Region Boundaries
Denmark Region Boundaries

Download Denmark Region Boundaries Shapefile

Download Denmark Municipalities Shapefile Data

Denmark Municipality Boundaries
Denmark Municipality Boundaries

Download Denmark Municipality Boundaries Shapefile

Download Denmark Postal Areas Shapefile Data

Denmark Postal Area Boundaries
Denmark Postal Area Boundaries

Download Denmark Postal Area Boundaries Shapefile

Other Administrative Boundary Data:

Other GIS Data:

Please note that the Papua New Guinea data provided here is license under Open Data Commons Open Database License (ODbL). Please review the same before using it. If you want data under different license you can also look over to the post : Download Free Shapefile Maps – Country Boundary Polygon, Rail-Road, Water polyline etc

Download Free Shapefile for the following:

  1. World Countries Shapefile
  2. Australia
  3. Argentina
  4. Austria
  5. Belgium
  6. Brazil
  7. Canada
  8. Denmark
  9. Fiji
  10. Finland
  11. Germany
  12. Greece
  13. India
  14. Indonesia
  15. Ireland
  16. Italy
  17. Japan
  18. Kenya
  19. Lebanon
  20. Madagascar
  21. Malaysia
  22. Mexico
  23. Mongolia
  24. Netherlands
  25. New Zealand
  26. Nigeria
  27. Papua New Guinea
  28. Philippines
  29. Poland
  30. Russia
  31. Singapore
  32. South Africa
  33. South Korea
  34. Spain
  35. Switzerland
  36. Tunisia
  37. United Kingdom Shapefile
  38. United States of America
  39. Vietnam
  40. Croatia
  41. Chile
  42. Norway

Disclaimer : If you find any shapefile data of country provided is in correct do contact us or comment below, so that we will correct the same in our system as well we will try to correct the same in openstreetmap.

Download Poland Administrative Boundary Shapefiles – States, Counties, Municipalities and more

Hello GIS enthusiasts, IGISMAP has now published the latest GIS vector data of Poland administrative levels. Links for downloading the shapefiles of the important administrative divisions of Poland are provided in the following. You can also download these data in KML, GeoJSON or CSV formats.

Note:

  • All data available are in GCS datum EPSG:4326 WGS84 CRS (Coordinate Reference System).
  • You need to login for downloading the shapefile.

Download Free Shapefile Data of Poland

Poland, officially the Republic of Poland, is a country in Central Europe. It is divided into 16 administrative provinces called voivodeships, covering an area of 312,696 km2 (120,733 sq mi). Poland has a population of over 38 million and is the fifth-most populous member state of the European Union. Warsaw is the nation’s capital and largest metropolis. Other major cities include Kraków, Łódź, Wrocław, Poznań, Gdańsk, and Szczecin. Poland’s territory extends from the Baltic Sea in the north to the Sudeten and Carpathian Mountains in the south. The country is bordered by Lithuania and Russia to the northeast, Belarus and Ukraine to the east, Slovakia and the Czech Republic to the south, and Germany to the west. Poland also shares maritime boundaries with Denmark and Sweden.

Poland National Boundary
Poland National Boundary

Download Poland National Outline Boundary Shapefile

Download Australia Provinces Shapefile Data

IGISMAP provides GIS vector data of province level division of Poland containing polygon boundaries of the polygon provinces

  1. Greater Poland
  2. Lesser Poland
  3.  Kuyavian – Pomeranian (Kujawsko – pomorskie)
  4. Lodz (Lodzkie)
  5. Lower Silesian (Dolnoslaskie)
  6. Lublin (Lubelskie)
  7. Lubusz (Lubuskie)
  8. Masovian (Mazowieckie)
  9. Opole (Opolskie)
  10. Podlasie (Podlaskie)
  11. Pomeranian (Podlaskie)
  12. Silesian (Dolnoslaskie)
  13. Subcarpathian (Podkarpackie)
  14. Swietokrzyskie (Swietokrzyskie)
  15. Warmian-Masurian (Warminsko – mazurskie)
  16. Western-Pomeranian (Zachodniopomorskie)
Poland Province Boundaries
Poland Province Boundaries

Download Poland Province Boundaries Shapefile

Download Poland Counties Shapefile Data

Following GIS data of Poland contains polygon boundaries of 391 counties of Poland

Poland County Boundaries
Poland County Boundaries

Download Poland County Boundaries Shapefile

Other GIS Data:

Please note that the Poland data provided here is license under Open Data Commons Open Database License (ODbL). Please review the same before using it. If you want data under different license you can also look over to the post : Download Free Shapefile Maps – Country Boundary Polygon, Rail-Road, Water polyline etc.

Download Free Shapefile for the following:

  1. World Countries Shapefile
  2. Australia
  3. Argentina
  4. Austria
  5. Belgium
  6. Brazil
  7. Canada
  8. Denmark
  9. Fiji
  10. Finland
  11. Germany
  12. Greece
  13. India
  14. Indonesia
  15. Ireland
  16. Italy
  17. Japan
  18. Kenya
  19. Lebanon
  20. Madagascar
  21. Malaysia
  22. Mexico
  23. Mongolia
  24. Netherlands
  25. New Zealand
  26. Nigeria
  27. Papua New Guinea
  28. Philippines
  29. Poland
  30. Russia
  31. Singapore
  32. South Africa
  33. South Korea
  34. Spain
  35. Switzerland
  36. Tunisia
  37. United Kingdom Shapefile
  38. United States of America
  39. Vietnam
  40. Croatia
  41. Chile
  42. Norway

Disclaimer : If you find any shapefile data of country provided is in correct do contact us or comment below, so that we will correct the same in our system as well we will try to correct the same in openstreetmap.

Download South Korea GIS Data – Provinces, Highway Lines, Airport Locations and More

Hello GIS enthusiasts, IGISMAP has now published the latest GIS vector data of South Korea administrative levels. Links for downloading the shapefiles of the important administrative divisions of South Korea are provided in the following. You can also download these data in KML, GeoJSON or CSV formats. 

Note:

  • All data available are in GCS datum EPSG:4326 WGS84 CRS (Coordinate Reference System).
  • You need to login for downloading the shapefile.

Download Free Shapefile Data of South Korea

South Korea, officially the Republic of Korea (ROK), is a country in East Asia, constituting the southern part of the Korean Peninsula and sharing a land border with North Korea. Its western border is formed by the Yellow Sea, while its eastern border is defined by the Sea of Japan. South Korea claims to be the sole legitimate government of the entire peninsula and adjacent islands. It has a population of 51.75 million, of which roughly half live in the Seoul Capital Area, the fifth largest metropolis in the world. Other major cities include Incheon, Busan, and Daegu.

South Korea National Boundary
South Korea National Boundary

Download South Korea National Outline Boundary Shapefile

Download South Korea First Level Divisions Shapefile Data

South Korea is divided into 8 provinces (do), 1 special autonomous province (teukbyeol jachido), 6 metropolitan cities (gwangyeoksi), and 1 special city (teukbyeolsi).

South Korea First Level Divisions Boundary
South Korea First Level Divisions Boundary

Download South Korea First Level Division Boundaries Shapefile

Other GIS Data:

Please note that the South Korea data provided here is license under Open Data Commons Open Database License (ODbL). Please review the same before using it. If you want data under different license you can also look over to the post : Download Free Shapefile Maps – Country Boundary Polygon, Rail-Road, Water polyline etc

Download Free Shapefile for the following:

  1. World Countries Shapefile
  2. Australia
  3. Argentina
  4. Austria
  5. Belgium
  6. Brazil
  7. Canada
  8. Denmark
  9. Fiji
  10. Finland
  11. Germany
  12. Greece
  13. India
  14. Indonesia
  15. Ireland
  16. Italy
  17. Japan
  18. Kenya
  19. Lebanon
  20. Madagascar
  21. Malaysia
  22. Mexico
  23. Mongolia
  24. Netherlands
  25. New Zealand
  26. Nigeria
  27. Papua New Guinea
  28. Philippines
  29. Poland
  30. Russia
  31. Singapore
  32. South Africa
  33. South Korea
  34. Spain
  35. Switzerland
  36. Tunisia
  37. United Kingdom Shapefile
  38. United States of America
  39. Vietnam
  40. Croatia
  41. Chile
  42. Norway

Disclaimer : If you find any shapefile data of country provided is in correct do contact us or comment below, so that we will correct the same in our system as well we will try to correct the same in openstreetmap.

GIS Tutorial – Basic Spatial Elements – Points, Lines and Polygons

In GIS (Geographical Information System) vector data represents the information in points, lines and polygons. In GIS, you connect data with geography. So in this blog we discuss about GIS Tutorial basic spatial elements – Points, Lines and Polygons. Vector data formats represents geographical space that is intuitive and reminiscent of analog maps.

With the MAPOG Spatial Tool You can Create Point, Line and Polygon Shape Online

Basic Spatial Elements – Points, Lines and Polygons

Vector Point Data –

A point uses a single coordinate pair to define its location. Attributes of point describes its features.  Points are considered to have no dimension even though in real world it have dimensions. Examples of Point data is power poles, telephone poles, a building.

In the below GIF you can see point feature.

GIS Tutorial - Basic Spatial Elements - Points, Lines and Polygons

In the below image you can see different points but all are representing railway station.

GIS Tutorial - Basic Spatial Elements - Points, Lines and Polygons

Vector Line Data –

When these points are connected then point data is converted into vector line data but it should not be enclosed . It uses a ordered set of coordinates. Line feature have multiple lines and points. Attributes may attach in every line, node and vertices. Hence each line may have multiple attributes rows of table. Examples of vector line data is road lines, topographic lines, power line, object outlines.

GIS Tutorial - Basic Spatial Elements - Points, Lines and Polygons

In the above GIF you can see vector line feature. It defines GIS very well by connecting data with location.

Vector Polygon Data –

When lines are connected into enclosed shape then this type of data termed as polygon data. Polygon should be closed. The start and end point should have the same coordinates. Examples of vector polygon feature are school boundary, city or any political line.

GIS Tutorial - Basic Spatial Elements - Points, Lines and Polygons

Above GIF showing the vector polygon feature.

MAPOG Online Tool to Create Line Polygon and Point

This is all about vector point, line and polygon feature. We have learned that vector data is used to represent real world data into point, line and polygon features. And each vector feature has attribute which shows its information. We try our level best, still you have doubt please do comment below.

More  free Tutorial are –

Create Map Layer – Point, Polygon, Multiline

Hey GIS enthusiast using GIS MapOG Tool you can easily create map layer – point, polygon, multiline and multipolygon. After creating Layer you can export layer in any format like Shapfile, KML, KMZ, Geojson and more.

If you want to learn GIS please Contact akshay@engineerphilosophy.com

For detailed steps watch video –

Create Map Layer – Point, Polygon, Multiline

Go to IGIS Map Tool Now MAPOG, Login or Register on the tool. After Login you will be directed to the next screen i.e Dashboard where, click on Add map.

Create Map Layer - Point, Polygon, Multiline

  • Now fill the tittle and description of map. Click on Save Map.

Create Map Layer - Point, Polygon, Multiline

  • You will be directed to the canvas of IGIS Map Tool.

Create Map Layer - Point, Polygon, Multiline

  •  Now choose the type of geometry of the layer you want to create. For Point select point from left hand side button.

What is Point, Line and Polygon ?

Create Map Layer - Point, Polygon, Multiline

  • Suppose we selected Point button then fill the layer name and enter the attributes. After filling all the fields click on create. In a map you can select multiple layer.

Create Map Layer - Point, Polygon, Multiline

  • Select add point and go to base map where you want to create point layer. Save the points on the map.

Create Map Layer - Point, Polygon, Multiline

  • We can  Add, Delete, Duplicate, View Data table,  and Export layer.

Create Map Layer - Point, Polygon, Multiline

  • We can do styling of layer like change the colour of icon and increase or decrease the size of point or you can custom the icon.

Create Map Layer - Point, Polygon, Multiline

Same as to be done for line and polygon.

This is all about creating map layer. If you face problem in implementing this above steps please do comment below.

More on GIS Tutorial :

Switching between Google Maps and OpenStreetMap in React Native

Switching between Google Maps and OpenStreetMap in React Native : In this post I am going to discuss about Google Maps and OpenStreetMap in react native with one example.This example code  will just show the Google Maps and OpenStreetMap on the screen of mobile ,but before going to detail of this article I  suggest you to read the following page:

react-native-maps

Switching between Google Maps and OpenStreetMap in React Native

Installation :

First create a react native project by following command :

react-native init MyProject

Install React Native Map components  in your React Native project:

cd MyProject

npm install react-native-maps --save

Build configuration on iOS :

For this go to Link

Build configuration on Android:

Define the react-native-maps project in android/settings.gradle:

...
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')

Add the react-native-maps as an dependency of your app in android/app/build.gradle:

...
dependencies {
  ...
  implementation project(':react-native-maps')
}

In build.gradle of android(If you’ve defined project-wide properties ):

buildscript {...}
allprojects {...}

/**
 + Project-wide Gradle configuration properties
 */
ext {
    compileSdkVersion   = 26
    targetSdkVersion    = 26
    buildToolsVersion   = "26.0.2"
    supportLibVersion   = "26.1.0"
    googlePlayServicesVersion = "11.8.0"
    androidMapsUtilsVersion = "0.5+"
}

If you do not have project-wide properties defined and have a different play-services version then use the following instead :

...
dependencies {
   ...
   implementation(project(':react-native-maps')){
       exclude group: 'com.google.android.gms', module: 'play-services-base'
       exclude group: 'com.google.android.gms', module: 'play-services-maps'
   }
   implementation 'com.google.android.gms:play-services-base:10.0.1'
   implementation 'com.google.android.gms:play-services-maps:10.0.1'
}

Specify your Google Maps API Key:

Add your API key to your manifest file (android/app/src/main/AndroidManifest.xml):

<application>
   <!-- You will only need to add this meta-data tag, but make sure it's a child of application -->
   <meta-data
     android:name="com.google.android.geo.API_KEY"
     android:value="Your Google maps API Key Here"/>
</application>

To get API key:

Google maps API Key

Add import com.airbnb.android.react.maps.MapsPackage;and new MapsPackage() in your MainApplication.java:

import com.airbnb.android.react.maps.MapsPackage;
...
    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
                new MainReactPackage(),
                new MapsPackage()
        );
    }

Example: 

In our example ,there are four java script file as follow:

  • index.js
  • App.js
  • GoogleMapScreen.js
  • OpenStreetMapScreen.js

index.js:

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

App.js :

import React, { Component } from 'react';
import {View,Text ,ScrollView} from 'react-native';
import { createDrawerNavigator,createAppContainer,DrawerItems, SafeAreaView } from 'react-navigation'
import {Container} from 'native-base';
import GoogleMapScreen from './src/GoogleMapScreen';
import OpenStreetMapScreen from './src/OpenStreetMapScreen';

const CustomDrawerContentComponent = (props) => (
     <ScrollView>
        <View style={{height:80,backgroundColor:'#1a8cff',alignItems:'center',justifyContent:'center'}}>
         <Text style={{ color:'white',fontSize:30}}>Maps</Text>
        </View>
        <SafeAreaView style={{flex:1}} forceInset={{ top: 'always', horizontal: 'never' }}>
        <DrawerItems {...props} />
       </SafeAreaView>
     </ScrollView>
);

const MyDrawerNavigator = createDrawerNavigator(
   {
    GoogleMap:GoogleMapScreen,
    OpenStreetMap:OpenStreetMapScreen,
   },
   {
    contentComponent:CustomDrawerContentComponent
   }
);

const MyApp = createAppContainer(MyDrawerNavigator);

class App extends React.Component{
   render(){
      return(
        <Container>
          <MyApp />
        </Container>
     );
   }
}

export default App;

Explaination of App.js : 

In App.js java script file,we are importing component from native-base and React-Navigation 3.x ,we need to install:

Install NativeBase

npm install native-base --save

Install Peer Dependencies

react-native link

Install the react-navigation package

npm install --save react-navigation

install react-native-gesture-handler :

npm install --save react-native-gesture-handler

Link all native dependencies:

react-native link

In this code , one drawer is created for two screen namely GoogleMapScreen and OpenStreetMapScreen , for more detail on drawer in react-navigation 3.x ,you can refer to following post:

drawer in react-navigation 3.x

GoogleMapScreen.js

import React, { Component } from 'react';
import {
StyleSheet,
View,
Dimensions,
ScrollView,
Image
} from 'react-native';
import {Button,Container,Header,Left,Right,Icon,Text,Body } from 'native-base';
import MapView from 'react-native-maps';

const { width, height } = Dimensions.get('window');

const ASPECT_RATIO = width / height; //,
const LATITUDE = 22.720555;
const LONGITUDE = 75.858633;
const LATITUDE_DELTA = 0.0922;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;

class GoogleMapScreen extends React.Component {
   static navigationOptions = {
     drawerLabel: 'Google Maps',
     drawerIcon: ({ tintColor }) => (
           <Image
                 source={require('../image/icons8-google-maps-48.png')}
            />
     ),
};
constructor(props) {
  super(props);
  this.state = {
    region: {
      latitude: LATITUDE,
      longitude: LONGITUDE,
      latitudeDelta: LATITUDE_DELTA,
      longitudeDelta: LONGITUDE_DELTA,
    },
  };
}
render() {
  return (
   <Container>
    <Header>
     <Left style={{ flexDirection: 'row' }}>
      <Icon onPress={() => this.props.navigation.openDrawer()} name="md-menu" style={{ color: 'white', marginRight: 15 }} />
     </Left>
     <View style={{alignItems:'center',justifyContent:'center'}}>
       <Text style={{ color: 'white' }} >Google Maps</Text>
     </View>
     <Right>
       <Icon name="md-cart" style={{ color: 'white' }} />
     </Right>
    </Header>
    <View >
     <MapView
        provider={this.props.provider}
        style={styles.map}
        scrollEnabled={true}
        zoomEnabled={true}
        pitchEnabled={true}
        rotateEnabled={true}
        initialRegion={this.state.region}
     />
    </View>
  </Container>
  );
 }
}// End of MyHomeScreen class
export default GoogleMapScreen;

const styles = StyleSheet.create({
   map: {
    width: 400,
    height: 800,
   },
});

Explaination of GoogleMapScreen.js: 

This code is going to show google maps on the screen of mobile. These constants are define :

const { width, height } = Dimensions.get('window');

const ASPECT_RATIO = width / height;
const LATITUDE = 22.720555;
const LONGITUDE = 75.858633;
const LATITUDE_DELTA = 0.0922;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;

In constructor ,region object is initialize as follow:

this.state = {
  region: {
    latitude: LATITUDE,
    longitude: LONGITUDE,
    latitudeDelta: LATITUDE_DELTA,
    longitudeDelta: LONGITUDE_DELTA,
  },
};

The following MapView tag  will shaow Google Maps on screen:

<MapView
   provider={this.props.provider}
   style={styles.map}
   scrollEnabled={true}
   zoomEnabled={true}
   pitchEnabled={true}
   rotateEnabled={true}
   initialRegion={this.state.region}
/>

OpenStreetMap.js

import React, { Component } from 'react';
import {View,StyleSheet,StatusBar,Image,Dimensions} from 'react-native';
import {Button,Container,Header,Left,Right,Icon,Text,Radio } from 'native-base';
import MapView ,{ MAP_TYPES, PROVIDER_DEFAULT,UrlTile } from 'react-native-maps';

const { width, height } = Dimensions.get('window');

const ASPECT_RATIO = width / height;
const LATITUDE = 22.720555;
const LONGITUDE = 75.858633;
const LATITUDE_DELTA = 0.0922;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;

class OpenStreetMapScreen extends React.Component {
  static navigationOptions = {
    drawerLabel: 'OpenStreetMap',
    drawerIcon: ({ tintColor }) => (
    <Image
         source={require('../image/Openstreetmap_logo.png')}
         style={{width:40,height:40}}
    />
   ),
};
constructor(props) {
   super(props);
     this.state = {
       region: {
         latitude: LATITUDE,
         longitude: LONGITUDE,
         latitudeDelta: LATITUDE_DELTA,
         longitudeDelta: LONGITUDE_DELTA,
       },
     };
 }
get mapType() {
   return this.props.provider === PROVIDER_DEFAULT ? MAP_TYPES.STANDARD : MAP_TYPES.NONE;
}
render() {
  return (
   <Container>
    <Header>
     <Left style={{ flexDirection: 'row' }}>
      <Icon onPress={() => this.props.navigation.openDrawer()} name="md-menu" style={{ color: 'white', marginRight: 15 }} />
     </Left>
     <View style={{alignItems:'center',justifyContent:'center'}}>
      <Text style={{ color: 'white' }} >OpenStreetMap</Text>
     </View>
     <Right>
      <Icon name="md-cart" style={{ color: 'white' }} />
     </Right>
    </Header>
    <View >
     <MapView
       region={this.state.region}
       provider={null}
       mapType={this.mapType}
       rotateEnabled={false}
       style={{flex: 1}}
       style={styles.map}
       showsUserLocation>
       <UrlTile
urlTemplate="http://a.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png"
maximumZ={19}
/>
      </MapView>
     </View>
    </Container>
   );
  }
}
export default OpenStreetMapScreen

const styles = StyleSheet.create({
   map: {
    width: 400,
    height: 800,
   },
});

Explaination of OpenStreetMap.js :

Code of OpenStreetMap.js is  similar to GoogleMapScreen.js  only difference is in MapView tag as follow:

<MapView
  region={this.state.region}
  provider={null}
  mapType={this.mapType}
  rotateEnabled={false}
  style={{flex: 1}}
  style={styles.map}
  showsUserLocation>
  <UrlTile
urlTemplate="http://a.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png"
maximumZ={19}
/>
</MapView>

Here MapView has one child tag <UrlTile> and prop of this tag is set to url as shown above in code which will print OpenStreetMap.

prop

mapType={this.mapType}

Here mapType function is called ,and return of this function is assign to mapType  prop.

mapType function:

get mapType() {
    return this.props.provider === PROVIDER_DEFAULT ? MAP_TYPES.STANDARD : MAP_TYPES.NONE;
}

When you will run above Project ,following output will come:

Switching between Google Maps and OpenStreetMap in React Native

In the header ,we are having menu on left side. On the click of this menu,a drawer will open as shown below:

Switching between Google Maps and OpenStreetMap in React Native

We are having two option in drawer 1)Google Maps 2)OpenStreetMap. When we will click Google Maps ,Google Map will be on screen  as shown by first ScreenShot  , now when we will click second option of OpenStreetMap then output will be as shown below:

Switching between Google Maps and OpenStreetMap in React Native

 

So, this all about switch from Google Map to OpenStreetMap in react native. Please do comment if something’s missing.

Check out more on GIS Apps –

If you want to hire our team then visit Hire us