Blog

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.

What is Remote Sensing ?

Hey GIS learner today we assimilate  about  what is Remote Sensing ? The word Remote means not exactly in contact or physical contact, something which is situated far away or distant, far away could be slightly far away or very far away and Sensing means getting information  and data.

In the above gif you can see sensor senses the  information from different sources.

Download free Satellite Images

What is Remote Sensing ?

Remote Sensing is any technique used to gather information about an object that doesn’t require touch or physical contact with the object.

Formal definition of Remote Sensing given by  AAPR in 1988 is Remote Sensing is an art, science and technology of obtaining reliable information about physical objects and the environment through the process of recording, measuring and interpreting imagery and digital representation of energy patterns derived from non-contact sensor system. Science means how scientifically accurately we are measuring and acquiring information.

So when we plan development of any area we need to map or see the what is the area, where it is and how much it is for this we uses satellite data.

Humans are also naturally designed remote sensors with the aid of their eyes, ears and nose.

Process of Remote Sensing

Simply we can say anything which record or get information from any object without touching it physically like camera, x- ray machine etc termed as sensor. Suppose you are recording video from a camera (mobile camera or any professional camera) . Suddenly power fails and there is no light then in that situation camera is on (recording) but  it couldn’t detect or record object. So with this one thing is clear that we need some light source or any illumination source for capturing information. Energy source is the first requirement for remote sensing. Conventionally Illumination would be only  in the visible spectrum as our eyes perceive light. Remote sensing is also done in wavelength like in infra red or radar waves.

What is Remote Sensing

In the above gif you can see illumination source is natural i.e Sun  emit radiation (light) on Earth surface. Some quantity of emitted light is absorbed by the surface of the Earth and remaining light is reflected through the surrounding of the surface. And that reflected radiation is sensed by the satellite orbit. This type of sensing is known as passive remote sensing. Types of remote sensing are given below.

Classification of Remote Sensing

There are two types of remote sensing technology  first is active remote sensing and second is passive remote sensing.

ACTIVE REMOTE SENSORS

These type of  Sensors doesn’t depends on Sun energy. Active sensors are used in active remote sensing which uses a platform, which allows sensors to direct energy at a object in the form of electromagnetic radiation for data collection.  It measures the energy reflected from the object and gather the information about the object.  Examples of such sensors are LIDAR which stands for Light Detection and Ranging which uses light in the form of pulses to measure ranges. In simple words it project laser light to measure the distance of targeted object.

Download Landsat 8 Images

What is Remote Sensing

Passive Remote Sensors

Passive sensors can only be used to detect energy when the naturally occurring energy is available. It detect natural radiation that is emitted or reflected by the object or surrounding area being observed. Reflected sunlight is the most common source of radiation measured by passive sensors. Film photography is one of the example of passive remote sensors.

What is Remote Sensing

Remote Sensing: Electromagnetic Spectrum

Energy source is the prime requirement of remote sensing that might be external or internal energy source. It illuminates the target  unless the sensed energy emitted through the targetWhat is Remote Sensing

…………………….to be continued

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

 

Drawer React Navigation 3.x – react native

Drawer React Navigation 3.x – react native: In this post we are going to learn about drawer navigation of React Navigation 3.x with one example,, but before going to detail of this article I  suggest you to read the official documentation of React navigation 3.x as follow:

React Navigation 3.x

Drawer React Navigation 3.x – react native

In the below example  we are going to learn basics of drawer and how to implement  it in our application.

Installation :

First create a react native project by following command :

react-native init MyProject

Install the react-navigation package in your React Native project.

cd MyProject
npm install --save react-navigation

# or with yarn 
# yarn add react-navigation

install react-native-gesture-handler :

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

# or with yarn
# yarn add react-native-gesture-handler

Link all native dependencies:

react-native link

After all this my project’s package.json file is as follow:

{
  "name": "MyProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
      "start": "node node_modules/react-native/local-cli/cli.js start",
      "test": "jest"
   },
   "dependencies": {
   "react": "16.6.1",
   "react-native": "0.57.7",
   "react-native-gesture-handler": "^1.0.10",
   "react-navigation": "^3.0.5"
  },
  "devDependencies": {
  "babel-jest": "23.6.0",
  "jest": "23.6.0",
  "metro-react-native-babel-preset": "0.50.0",
  "react-test-renderer": "16.6.1"
  },
 "jest": {
   "preset": "react-native"
  }
}

In our Project we are having two java script file as follow:

  • index.js
  • App.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 } from 'react-native';
import { createDrawerNavigator,createAppContainer } from 'react-navigation'
import { Button,Container,Header,Left,Right,Icon,Text } from 'native-base';

class MyHomeScreen extends React.Component {
  render() {
    return (
      <Container>
        <Header>
          <Left style={{ flexDirection: 'row'}}>
           <Icon onPress={() => this.props.navigation.openDrawer()} name="md-menu" style={{ color: 'white', marginRight: 15 }} />
          </Left>
          <Right>
           <Icon name="md-cart" style={{ color: 'white' }} />
          </Right>
        </Header>
       <View style={{ marginTop:100,marginLeft:100}}>
         <Button onPress={() => this.props.navigation.navigate('Notifications')} >
           <Text>Go to notifications</Text>
         </Button>
        </View>
       </Container>
     );
   }
 }// End of MyHomeScreen class

class MyNotificationsScreen extends React.Component {
   render() {
     return (
       <View style={{ marginTop:100,marginLeft:100}}>
         <Button onPress={() => this.props.navigation.goBack()} >
           <Text>Go back home</Text>
         </Button>
       </View>
     );
    }
}//End of MyNotificationsScreen class

const MyDrawerNavigator = createDrawerNavigator({
   Home:{ 
      screen: MyHomeScreen,
   },
   Notifications: {
      screen: MyNotificationsScreen,
   },
 });
 
const MyApp = createAppContainer(MyDrawerNavigator);

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

export default App;

In above code of App.js file we have used component of native base ,and therefore we will install native base as follow :

Install NativeBase

npm install native-base --save

Install Peer Dependencies

react-native link

Explaination of App.js :

In this file App.js, we have define three class namely as follow:

  • MyHomeScreen
  • MyNotificationsScreen
  • App

and two constants as follow:

  • MyDrawerNavigator
  • MyApp

We are creating two screen with the help of two class MyHomeScreen and MyNotificationsScreen 

class MyHomeScreen :

class MyHomeScreen extends React.Component {
  render() {
    return (
      <Container>
       <Header>
        <Left style={{ flexDirection: 'row' }}>
         <Icon onPress={() => this.props.navigation.openDrawer()} name="md-menu" style={{ color: 'white', marginRight: 15 }} />
        </Left>
        <Right>
         <Icon name="md-cart" style={{ color: 'white' }} />
        </Right>
       </Header>
       <View style={{ marginTop:100,marginLeft:100}}>
        <Button onPress={() => this.props.navigation.navigate('Notifications')} >
         <Text>Go to notifications</Text>
        </Button>
       </View>
      </Container>
    );
  }
}// End of MyHomeScreen class

Explaination of MyHomeScreen class :

In this class we are creating header of screen ,on left side of header we are creating Icon of “md-menu”,and onPress of this Icon we have open the drawer with the help of this code :

onPress={() => this.props.navigation.openDrawer()}

In this home screen one button is also given ,on press of this button MyNotificationsScreen is called with following code :

onPress={() => this.props.navigation.navigate('Notifications')}

class MyNotificationsScreen :

class MyNotificationsScreen extends React.Component {
  render() {
   return (
     <View style={{ marginTop:100,marginLeft:100}}>
      <Button onPress={() => this.props.navigation.goBack()} >
       <Text>Go back home</Text>
      </Button>
     </View>
   );
  }
}//End of MyNotificationsScreen class

Explaination of MyNotificationsScreen class :

In this class we are creating a button ,and on press of this button we are going back to home screen from this notification screen ,for this we are using following code:

onPress={() => this.props.navigation.goBack()}

Constant MyDrawerNavigator :

const MyDrawerNavigator = createDrawerNavigator({
   Home: {
      screen: MyHomeScreen,
   },
   Notifications: {
      screen: MyNotificationsScreen,
   },
});

Constant MyApp :

const MyApp = createAppContainer(MyDrawerNavigator);

Class App :

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

Explaination of App class:

In this class we are using <MyApp /> tag .

When you will run the above code,  following output will come

Drawer React Navigation 3.x - react native
On Left side of Header we are having menu ,on press of this drawer will be open as follow:

Drawer React Navigation 3.x - react native

If you face any problem during implementing this tutorial, please let us know. Feel free to comment in given comment box.

You might be interested React Native Geolocation

React Native Geolocation – GPS – GIS Mobile App

Geolocation in React Native is the identification or estimation of the real-world geographic location of a mobile phone .

In this post, we will  discuss  how to find Geolocation of mobile phone in react native with one example, but before going to detail of this post I  suggest you to read the official documentation.

React Native Geolocation

React Native Geolocation – GPS – GIS Mobile App

Installation

iOS : installation for ios

Android:

Our App will request  access to location, for this we need to add following line of code in our App’s AndroidManifest.xml which is located at  android/app/src/main/AndroidManifest.xml in our App.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

API Overview

The geolocation api exists on the global navigator object in React Native,  so we would access it via navigator.geolocation.

I will be covering only one method available  on   navigator.geolocation

getCurrentPosition

The getCurrentPosition   method allows us to request a user’s location at any time. This method take three parameter as follow:

geolocation.getCurrentPosition(geo_success, [geo_error], [geo_options]);

parameters of method :

geo_success - a success callback
[geo_error] -an error callback
[geo_options]-a configuration object

The success callback will be passed an object that looks like :

{
    "timestamp": 1484669056399.49,
     "coords": {
           "accuracy": 5,
           "altitude": 0,
           "altitudeAccuracy": -1,
           "heading": -1,
           "latitude": 37.785834,
          "longitude": -122.406417,
          "speed": -1
     }
}

The error callback will be passed a standard error message.

The config object has

  • enableHighAccuracy (boolean)— which allows you to get the most accurate location.
  • timeout (milliseconds)— how long does the API have to return the position before throwing an error?
  • maximumAge (milliseconds) — if a location exists in the device cache, how old can it be before it’s no longer valuable to your app?

Example

Here we are discussing one example in which we will try to find out the current position of mobile( latitude,longitude).In our project there are two file:

  1. index.js
  2. App.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 } from 'react-native';
import { Container, Header, Content, Card, CardItem, Body, Text } from 'native-base';

class App extends Component {
constructor(props) {
super(props);

this.state = {
latitude: null,
longitude: null,
error: null,
};
}

componentDidMount() {
navigator.geolocation.getCurrentPosition(
(position) => {
this.setState({
latitude: position.coords.latitude,
longitude: position.coords.longitude,
error: null,
});
},
(error) => this.setState({ error: error.message }),
{ enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 },
);
}

render() {
return (
<Container>
<Content>
<Card>
<CardItem style={{backgroundColor:'grey'}}>
<Body>
<Text>Latitude: {this.state.latitude}</Text>
<Text>Longitude: {this.state.longitude}</Text>
{this.state.error ? <Text>Error: {this.state.error}</Text> : null}
</Body>
</CardItem>
</Card>
</Content>
</Container>
);
}
}

export default App;
Explaination of App.js :

In this code we are importing some component from native base ,so we need to add this dependency in our project as follow:

npm install native-base --save

and

react-native link

In App class we have constructor and two function namely  componentDidMount() and render()

constructor
constructor(props) {
super(props);

this.state = {
latitude: null,
longitude: null,
error: null,
};
}

In this constructor initial value of latitude, longitude and error are define to null.

componentDidMount() method:
componentDidMount() {
navigator.geolocation.getCurrentPosition(
(position) => {
this.setState({
latitude: position.coords.latitude,
longitude: position.coords.longitude,
error: null,
});
},
(error) => this.setState({ error: error.message }),
{ enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 },
);
}

The componentDidMount() method is  called at the time of  initializing of a component .so when this method is called we find the location of mobile by calling getCurrentPosition() method as shown above in code.

 

navigator.geolocation.getCurrentPosition() has three argument
(position) => {
this.setState({
latitude: position.coords.latitude,
longitude: position.coords.longitude,
error: null,
});
}

This is a  success callback parameter of getCurrentPosition() method ,we are collecting result in position .

and position object look like:

{
    "timestamp": 1484669056399.49,
     "coords": {
           "accuracy": 5,
           "altitude": 0,
           "altitudeAccuracy": -1,
           "heading": -1,
           "latitude": 37.785834,
          "longitude": -122.406417,
          "speed": -1
     }
}

from this position object we collect the latitude and longitude as follow:

position.coords.latitude

position.coords.longitude

These values are assign to latitude and longitude of App class by following code

this.setState({
latitude: position.coords.latitude,
longitude: position.coords.longitude,
error: null,
});
(error) => this.setState({ error: error.message })

This is the second argument of getCurrentPosition() method ,and this is an error callback parameter of method ,in this we are collecting error in error if it occur. and with the help of setState() method ,we are storing the error message into error of App class.

{ enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 }

This is the third argument of getCurrentPosition() method, a configuration object, in this we are suppling three value   enableHighAccuracy: true, timeout: 20000, maximumAge: 1000.

render() {
return (
<Container>
<Content>
<Card>
<CardItem style={{backgroundColor:'grey'}}>
<Body>
<Text>Latitude: {this.state.latitude}</Text>
<Text>Longitude: {this.state.longitude}</Text>
{this.state.error ? <Text>Error: {this.state.error}</Text> : null}
</Body>
</CardItem>
</Card>
</Content>
</Container>
);
}
}

In this render method we are creating a card and on this card we are printing the location of mobile in terms of latitude and longitude if error is null otherwise we print the error on screen of mobile.

So this about all about React Native Geolocation- GPS. If you phase any  problem in implementing please let us know by commenting below.

Want GIS application – Please contact us at juhi@engineerphilosophy.com

More on GIS –