Blog

Sorting feature from left to right – MySQL Spatial Sorting

MySQL Spatial Sorting. Let’s think of the situation where you want to color the map in such a way, that no adjacent group of features should have the same color, where group of feature is more than the number of colors you can draw. Obviously this problem can be solved if we sort feature group from left to right and assign the color in the same order. The above described situation has to be solved by us where we need to restrict our technology to only to, GeoJSON, Leaflet, Php and MySQL and no server side API or any GIS server as per the  Client requirement.

MySQL Spatial Sorting
MySQL Spatial Sorting from left to right

Now as the task is assigned to us, we need to identify and solve the same maintaining the time complexity and load at both client as well as server end.  Here we need to sort the feature according to upper left latitude longitude values  of each feature bounding box and not with an area or length or with any other attribute in ascending or descending order. Someone can think to sort the features by finding the center latitude longitude point of the features and then sort feature according to the center, but this will only work, when all features are of same size which is not in real world case.

Sorting the features with known bounding box from left to right can be performed with the array of geoJSON feature and leaflet alone at client side, but this will definitely increase the time complexity and load on the browser when spatial data file is very big. The last and the final option we have, is to store the Shapefile or GeoJSON file in MySQL Spatial Database and perform the spatial operation in MySQL to get selected feature in sorted order.  Sorting feature from left to right order means we need to work with longitude values of bounding box of feature. If you want to perform sorting the features from top down then use latitude values.

If you understand the store procedure easily then you may navigate to bottom of the page else you can follow the tutorial to know what steps are taken to make the complete stored procedure to sort the features in MySQL.

Note: The tutorial given here for the GI S person who don’t know to operate on database. To make them understand every step is detailed clearly. If you are expert in database, do navigate to bottom of the post and find the stored procedure.

MySQL Spatial Sorting – Steps Performed to Sort the features in MySQL:

1.) First step is to import the shapefile in the Database using ogr2ogr command tool and check whether every feature is inserted correctly in the desired table. Once inserted the next step we need to perform is to calculate MBR(minimum bounding rectangle) for each feature and only select the longitude values of the first starting point, as the first point is the upper left corner point of MBR.

2.) Let’s start our task by finding the MBR for the entire features. We can also call MBR as bounding box of the feature. If you noticed after importing the shapefile in MySQL all the features are saved in a column named SHAPE with a datatype GEOMETRY which makes us eligible to perform spatial query on this column. To find the bounding box of the feature there is a spatial function envelope(g) which returns the MBR for the geometry

SELECT ASTEXT( ENVELOPE(  `SHAPE` ) ) FROM  `feature`

  • In the above query ‘feature’ is the name of the table.
  • ASTEXT() function returns as text the result returned by the ENVELOPE().

Using this query you will get the MBR but we don’t need all the coordinates we only need the longitude of the first point of the result. So we need to take out that longitude and save it to the new column which will ultimately make very easy to sort feature in ascending order.

Unfortunately, we cannot save the result of the select query to the same table so we have to go little further and have to save the result into a new table or a view. Make a new table with two columns, one column for saving the longitude value having data type as text and one for foreign key referenced to the ID column in the main table. Don’t insert any other values or column in the table.

Now let’s do this tedious task:

INSERT INTO new_feature( stpoint ,id)  SELECT SUBSTRING( SUBSTRING_INDEX( ASTEXT( ENVELOPE(  `SHAPE` ) ) ,  ‘,’, 1 ) , 10, 9 ),id  FROM  `feature`

  • Above query take out the longitude of the starting point and save it into stpoint in the new_feature table and at same time save the same value of the id from feature table to the id in the new_feature table.
  • SUBSTRING_INDEX() function will take out the text before the first comma that appears in the result given by ASTEXT( ENVELOPE( `SHAPE` ) ).
  • SUBSTRING() will give us the required longitude value. 10 in this function represents the starting value and 9 represent the length of the value that we want.

If you analyse the result of the query i.e by

SELECT ASTEXT( ENVELOPE(  `SHAPE` ) ) FROM  `feature`

You will find that the result is in the form POLYGON((long lat,long lat…)).

From this result 10 and 9 came characters to be used in SUBSTRING(). Now we can join the two table using id column in both table and get the desired result. But the sorted result we get is wrong.

If you noticed during the process we get the result as text and we apply all the operation on the text and our stpoint column have data type as text. So the sorting will be done as text sorting so any longitude value starting with 1 will come first and values starting with 9 will come last. To avoid this problem we have to change the data type of the stpoint column to decimal.

ALTER TABLE new_feature MODIFY stpoint DECIMAL( 7, 4 )

In DECIMAL( 7, 4 ) 7 represent the length of the number. That we need and 4 represent the numbers after the decimal so the result be something like 23.4567 or 123.4567.

3.) Now we will join the two table and simultaneously sort the result:

SELECT feature.*, new_feature.stpoint FROM feature INNER JOIN new_feature ON feature.OGR_FID = new_feature.OGR_FID ORDER BY stpoint

We want all the columns from the main table and only stpoint from new_feature. The above query by default will sort the feature in ascending order. Save the result. MySQL will export the result as excel file.

MySQL Spatial Sorting
MySQL Spatial Sorting from left to right

You can also write a stored procedure for this process. In stored procedure you don’t have to create a new table instead you just need to create a temporary table which will destroy after the end of the session. Here is the Stored procedure:

MySQL Spatial Sorting from left to right – Stored Procedure:

CREATE DEFINER=`root`@`localhost` PROCEDURE `SortFeature`() MODIFIES SQL DATA COMMENT ‘sort feature in ascending order(long of 1st co. of mbr)’
begin

CREATE TEMPORARY TABLE longitude(OGR_FID int(4) not null , stpoint text(10));

INSERT INTO longitude( stpoint,OGR_FID )
SELECT SUBSTRING( SUBSTRING_INDEX( ASTEXT( ENVELOPE(`SHAPE`)) , ‘,’, 1 ) , 10, 9 ) , OGR_FID
FROM feature ;

ALTER TABLE longitude MODIFY stpoint DECIMAL(7,4);

SELECT feature.*, longitude.stpoint
FROM feature
INNER JOIN longitude ON feature.OGR_FID = longitude.OGR_FID ORDER BY stpoint ASC;

end

I hope the above lengthier post might helped you to find a way to sort the features from left direction to right direction with MySQL Spatial Sorting query.

Measure Area in Google Map – Print and share measurement

Google Maps, a web mapping service of Google provides a very easy way to calculate and measure Area in google Map along with distance measurement. This would let you measure an area of any geographic location viz home, buildings, Grounds, city, etc from any where without visiting the location with just few clicks with Google Maps.

Measuring area is of the most important part of GIS analysis before coming to a conclusion of any project of construction or any other industries. Yes, as a fact to show to your customer or client, you need to provide a printed or soft-copy version of area and its measurement. Google Map provide the feature to print and save soft copy of the map after performing operation, which can be performed with the steps written below.

measure area in Google map

Steps to Measure Area in Google Maps:

1.) Open Google Map and check whether you are not in a Lite Mode Google Map, as Lite Mode does not provide an option to calculate and measure area. If you are in Lite mode than switch back to Full mode of Google Maps.

2.) Navigate to area in a Map of which you want to calculate the area.

3.) Right click on Map from the starting point of the area and select Measure Distance as shown below. (Don’t worry and continue the process as it will calculate area also along with distance.)

measure area in Google map

4.) Click on the map to create points so as to create an appropriate area. If you want to get the correct and good result, you should zoom in the map and click along the points to make an area. Remember to get the result in area, you need to connect the last point with the first point on Google Map other wise the measured unit will always be length and not area. Once you connect last and first point, you will get the measurement in distance as well as area.

measure area in Google map
measure area in Google map

If you find any point to be incorrect you may drag the point to get in the correct position or you may again click the point to remove the same. You may also clear measurement with the option provided with the right click on map.

  • Note : Both English and Metric unit System is supported in Google map depending upon your location. If your map is zoomed out and you are measuring a large area, the distance unit will appear in square miles (sq m) or square kilometers (sq km) while if the distance measured in Zoomed in map, then the area unit appear to be in the square feet (sq ft) or square meters (sq m).

You can explore Google Map more feature with the following articles listed:

Print Measure Area in Google Maps

You can easily make a print of the area along with the measured unit, the area covered and the title of the map shown. After performing the above steps. Right click on Google map and select print option. It will take to print section where you can also put up your notes which will appear on just above the maps and the measurement units just below the map.

measure area in Google map

Now you can easily share the printed or soft copy of the measured area on the map. A sample example of the image generated by google map is shown below.

Print measure area in Google map
Print measure area in Google map

Comment below if you are getting any problem in performing the above steps. You may also list the tools which provide the same solution and which you prefer by commenting on the section provided below.

Add table attributes with joining two files in QGIS

Want to add more attributes in your Shapefile to respective feature? QGIS an open source tool, which I recommend to every Geographer for use, can give you direct solution. Sometimes we need to join more attribute to a GIS vector files which ultimately provide more power to you for analysis with more attributes. For joining two file to add more attribute you need to have a common attribute field in both the files, same as like you need to have primary and foreign key to join two table data in SQL. QGIS provide us the facility to Add more table attributes with joining two files .

You may also be interested to see how to perform Spatial Join in QGIS and other tutorial in QGIS.

 

Add table attributes with joining two files

Steps to Add table attributes with joining two files in QGIS:

We are performing this steps with Shapefile and csv file, while you can also perform the same steps with other GIS vector file and csv file.

1.) Open QGIS and add a shapefile and observe its attribute table.

Add table attributes with joining two files

Here we have two columns.

Add table attributes with joining two files2.) Now We have a comma separated file(.csv) which has to be added. Having two columns i.e osm_way_id and amenity as shown below.

Add table attributes with joining two files
Add table attributes with joining two files

Note : Both the field will store in String format as we have not defined the field type. To define field type, create a new file with the same name of that of csv file but with csvt format in the same folder. For above instance the content should be written as :

“Integer”,”String”

in the file. We can see that osm_way_id is the column which is common in attribute table of shapefile and .csv file. So we can join this two using the same.

3.) First we have to import this file in QGIS. QGIS provide us the facility of importing files which do not have any geographic information also. While importing .csv file we have to take care that default type for .csv file is string if .csvt file is not present in the folder.

QGIS will look for .csvt file for data type in the same folder of same name. If not found all the data would be imported as default type i.e String. Now here all the columns are string so we are not creating a .csvt file.

4.) Lets import this file in QGIS. Click layer than Add Layer and select Add Delimited Text Layer.

Add table attributes with joining two files5.) Select csv radio button and then select no geometry radio button.

Add table attributes with joining two files
Add table attributes with joining two files

6.) Click ok. The file is imported.

Add table attributes with joining two files7.) Let’s join both tables. Open properties dialog box of the layer for which we want to perform join.

Add table attributes with joining two files8.) Click on join.

Add table attributes with joining two files9.) Click on plus sign.

Add table attributes with joining two files10.) Set the dialog box as in the image. We have chosen the field according to which we want to join and the field which we want to join with the table. By default all the fields are added.

Add table attributes with joining two files
Add table attributes with joining two files

11.) Click ok.

Add table attributes with joining two files12.) Click ok for properties dialog box.

13.) The tables are joined. Open the attribute table for the layer for which you performed join. The column name Book1_amenity shows that it was imported from Book1.

Add table attributes with joining two files
Add table attributes with joining two files

Comment below if you are facing any problem in adding attributes data to respective features in QGIs with Join function.

QGIS 3.2.1 User Interface

 

Insert Shapefile in MySql as Spatial Data

MySQL supports Spatial data type that corresponds to OpenGIS Classes. While MySQL is not one of the recommended database to store spatial data, but it definitely adds value if you have only one option to store GIS data. For instance I need to dump the Shapefile in MySQL, when I need to render the spatial data with leaflet in order of sorted latitude longitude one by one. This could be easily possible to get the spatial data from MySQL where we don’t need to use any GIS API to get and perform spatial operation.

Insert Shapefile in MySql as Spatial Data

To dump or insert a shapefile in a MySQL server we need to install ogr2ogr tool in our machine. If you have a windows machine and you have installed QGIS using OSGeo4W then this tool comes with the org2ogr package.

update: You may also see the ogr2ogr in program files folder of QGIS as shown below.

Insert Shapefile in MySql as Spatial Data

Insert Shapefile in MySql as Spatial Data

1.) Now open the MySQL server and create one database or use one of the existing database. I have made a database named as “spatial”.

2.) Open the command prompt as administrator. I have ogr2ogr file in C drive->OSGeo4W->bin folder. So navigate to this path in command prompt with change directory command (cd).

Insert Shapefile in MySql as Spatial Data

3.) Now write the command as follows:

ogr2ogr –f MySQL MySQL:database_name,host=localhost,user=database_username, password=database_password path/to/shapefile  -nln datatable_name -update -overwrite -lco engine=MYISAM.

Where you need to edit the bold word written above according to system configuration and need.

Note: If table and its column is not created, then the above command will automatically will create the table name as “datatable_name” as indicated above. You may also define SRS by giving argument as  ‘-a_srs “EPSG:4326″‘.

Reference : http://www.bostongis.com/PrinterFriendly.aspx?content_name=ogr_cheatsheet

I hope this post would helped you to insert spatial data in MySQL easily and you are now eligible to perform Spatial Queries on MySQL data. If you still find problem in performing any step above, do comment below with details, we may look and discuss over the same.

Everything about Web 3D Map – Examples, Tools, Library and Uses

Map with third dimension on Web gives you a new way to visualize reality. Isn’t that cool if you get to know building level detail,  Analyze the surface by getting elevation detail and get the actual visualization to some extent even without visiting the area. Adding third dimension to a map is an add-on for geographers, government bodies and to every individuals for proper understanding the geographic area.

Website with power of internet is connecting every people in this world, to acquire knowledge and now creating and viewing a 3D map on website without adding a plugin is an awesome. Before moving to see Examples and Libraries lets list out some uses for 3D Map.

3D Map

Uses of Interactive 3D map:

Several industries like Retail, Real Estate, Tourism, Geo Advertising, Smart cities etc can take advantage of Web 3D Map with existing GIS database knowledge.

1.) Get introduced to a new place before taking a tour to an unknown area.

2.) Create a walk-through of newly constructed building to visualize new concept easily.

3.) Visualize 3D Flood modeling simulation while planning construction development.

4.) 3D urban map with existing GIS databases.

5.) Get better understanding of 3D elevation view of natural features like mountain, canyons etc.

6.) Campus planning – Better understanding shadow effects, sun exposure, road etc.

Finally 3D Map brings more idea to your GIS analysis.

Amazing Library which helps you to create web 3D Maps easily:

You can now easily build and visualize your 3D Map model on website without adding any plugin or additional addon. This all can be possible with the help of WebGL technology which is a JavaScript API for rendering interactive 3D graphics. This libraries can help you to create interactive map which helps you to see the data on basemap, zooming and panning functionality which can be incorporated easily with the help functionalities provided.

1.) OSMBuildings GL – 3D Map Library:

Osmbuilding 3D map

Demo : OSMBuilding Demo

Download Library Code : Github Code

Type : Open Source, MIT License

Technology : WebGL, OpenStreetMap, OpenCage Geocoder, MapBox tiles

Developed By : Jan Marsch

2.) ViziCities – 3D Map library:

Vizicities 3D map

Demo : ViziCities Demo

Download library Code : Github Code

Type : Open Source, MIT License

Technology : WebGL via Three.js and openstreetmap

Developed By : Robin Hawkes & Peter Smart

3.) CesiumJS – 3D Map Library:

Cesium 3D map

Demo : CesiumJS Demo

Download Library Code: Github Code

Type : Both Commercial and Open Source with Apache 2.0 License

Technology : WebGL

Developed By : Analytical Graphics, Inc. (AGI)

4.) Tangram – 3D Map Library

Tangram 3D Map

Demo : Tangram Demo

Download Library Code : Github Code

Type : Open Source, MIT License

Technology : WebGL, OpenStreetMap

Developed By : Mapzen

Other Libraries, Tool and Examples for 3D Map

ESRI CityEngine: A software which Transform 2D GIS Data into Smart 3D City Models. You may look further docs here.  An Awesome Example of 3D Map with the help of ESRI CityEngine.

Octomap: Probabilistic 3D Mapping framework. Its an open source map under New BSD license. You may see Github code from here developed by Kai M. Wurm and Armin Hornung, University of Freiburg.

Android 3D map with Nutiteq SDK: You may see the github code from here and is licensed under MIT License.

You may Further research over Glob3Mobile which is the multiplatform advanced visualization framework and
Ol3-Cesium – 3D for OpenLayers map.

What you think about 3D map on website. Do comment below with  if you are looking to develop or want to create a sample or you know any new libraries which I have not listed here?

How to Georeference Map Image with Geo Coordinate Control points

How to Geo-reference Map Image with Geo Coordinate points in QGIS (Quantum GIS). Georeference is a process to associate geographic location coordinates to any kind of physical object which is physically present over a Raster image map or to a physical map, with help of other georeferenced data or with know location coordinates of some points of image which is effectively called as control points. Georeference is one of the important concept of GIS (Geographic Information System). Here we will see how to Georeference map manually in QGIS. You can also see how to georeference from one map to another and other QGIS tutorial.

Here is the steps to georeference raster image map in QGIS:

1.) Open QGIS and Import your image map using ADD RASTER LAYER in QGIS.

Georeference Map Image with Geo Coordinate Control points in QGIS2.) We need to find the control point and known geolocation coordinates. I prefer Google Maps to get the Latitude and Longitude values.

Go to google map and search the location which matches your image map location on it. Select a point in google map which matches in your map. You can also switch to satellite view. Select a point such as any land mark place as per your convenience. Right click on that point in Google Map and click what’s here you will see it will display latitude and longitude of the point.

Georeference Map Image with Geo Coordinate Control points in QGIS 1
Georeference Map Image with Geo Coordinate Control points in QGIS 1

Georeference Map Image with Geo Coordinate Control points in QGIS 1

3.) Latitude is written first and the second one is longitude. Also notice (-) sign (if present). Note down the points. Likewise select at least 4 points in different directions and note down the latitude and longitude of them.

4.) Moving to QGIS tool, Right click on the Raster layer and click remove.

5.) Now go to Georeferencer, you will find it in Raster tab, if you already have installed georeferencer plugin. If you don’t see the option, click Plugins and then select manage and install plugins. Search for georeferencer and install the same as shown below.

Georeference Map Image with Geo Coordinate Control points in QGIS
Georeference Map Image with Geo Coordinate Control points in QGIS

Georeference Map Image with Geo Coordinate Control points in QGIS 56.) Import your map here and click add points. You can pan and zoom here.

Georeference Map Image with Geo Coordinate Control points in QGIS

Georeference Map Image with Geo Coordinate Control points in QGIS

7.) Click on the location on your map which you selected on google map as control points. You will see a window demanding X,Y values. Put longitude value in X and latitude value in Y.

Georeference Map Image with Geo Coordinate Control points in QGIS8.) Like wise add all the points. Go to Settings and click Transformation Setting.

Georeference Map Image with Geo Coordinate Control points in QGIS9.) Select any one Transformation Type and Give your output raster name.

Georeference Map Image with Geo Coordinate Control points in QGIS
Georeference Map Image with Geo Coordinate Control points in QGIS

10.) Click load in to map canvas when done or if you forget to do so you can import the georeferenced map from the location where you saved it. The extension for the map will be .GeoTiff.

11.) Select CRS WGS: 84 because we are using Latitude and Longitude.

Georeference Map Image with Geo Coordinate Control points in QGIS12.) Now click start Georeferencing symbol as shown below:

Georeference Map Image with Geo Coordinate Control points in QGIS

13.) Close georeferencer. You will see georeferenced image in canvas. Note the coordinates.

Georeference Map Image with Geo Coordinate Control points in QGIS

I hope this article would be helpful for you to know the basics of how to georeference raster image with the help of control points. You are getting problem in implementing the process do comment below, so that we can discuss over it.

8 Best Alternative to Google Map Engine API

Alternatives to Google Map Engine API. You might be looking for this, as Google have announced earlier in January 2015 for Map Engine API depreciation and deactivated after January 29, 2016. This would also result in all your account Geo-referenced data losses, which you should have already exported.

GME as a Google product provides mapping services to many individual and organization. This leads us to explore for more alternative with features which is provided by GME, which are listed. Many of the below listed mapping services have different pricing plans, which you can choose after experiencing free trial plan and options from them.

Following are few of the listed services provided by Google Map Engine, which you may look before comparing the alternatives:

  • Upload vector or raster data of different formats
  • Display vector or raster data over Google Base Map
  • Edit features of layers uploaded from Google Map Editor interface
  • Make legends from layers
  • Export or import map data
  • Style layers directly according to the data classification
  • Access and share data from any where, any device and anytime and many more…

We have also listed Alternatives to Google old map after their switch from Google old or classic map to new Google map.

Alternative to Google Map Engine API
Alternative to Google Map Engine API

List of 8 Best Alternatives of Google Map Engine API

IGIS Map – An Alternative to Google Map Engine

map.igismao.com

MapOG Analysis (Earlier named as IGISMAP now changed to MAPOG) is a web based GIS application. Here you can create your own map, convert GIS format into other format, share your created map. IGISMAP tends to be number 1 choice for many GIS and all other industries users who want to create, share, analyse and embed map.

Feature of IGISMAP :

  • No coding skills required – Just drag and Drop and Few clicks to create Map
  • Simple and Easy User Interface
  • Multiple Base map supports
  • Ultimate Query and Analysis Tool
  • Best Data security and User access control feature
  • Multi roles support – Admin, Developer or Business User
  • User Cloud data security is our first priority – Scalable and reliable
  • Cost Effective and simple pricing – much cheaper and more storage with data hosting on AWS secured servers.
  • All Major GIS Spatial files support – Shapefile, CSV, Excel, MapInfo, GPX, KML, KMZ, TopoJSON, GeoJSON, GeoTiff, DXF etc.
  • Digitise map by creating point, line and polygon layer – only available feature in IGISMAP Analysis.

Mango Maps -Alternative to Google Map Engine

Mango Map - Alternative to Google Map Engine API

Without writing a single line of code you can easily make web map application which are hosted of a secure cloud server of Mango Maps. Even non technical users can quickly create stunning interactive web maps and can be shareable easily with private groups or to the public around the world. Mango Map provides maximum features which GME tends to provide to their users.

You can try their free account that allows you to make upto 3 maps with unlimited number of layer and 200 MB of data storage.

Over 20,000 and more users are using Mango Map. You may look on map gallery of Mango Map which users of Mango explored.

You may also look to their blog post explaining how they are best fitted as an alternative to Google Map Engine API.

CartoDB – Alternative to Google Map Engine

CartoDB - Alternative to Google Map Engine API

CartoDB is a Geo-spatial database on cloud. It is capable to quickly create map application on top of Google map platforms. CartoDB provides Interface to manage data and create maps and with help of APIs create applications. As Google Map Engine provides a simple interface, you would also look over to CartoDB Editor interface which also tends to be very simple interactive and User friendly.

They also provide a free plan to access unlimited datasets, unlimited mapviews, limited to upload 4 layers with 250 MB of vector data and 10,000 tweets per month, while if you may opt for other enterprise plan too.

Maximum GIS data are supported in CartoDB for uploading i.e csv, .tab, .shp, .kml, .kmz, .xls, .xlsx, .geojson, .gpx, .osm, .bz2, .ods as Vector and tif as Raster data.

CartoDB also provides MAP API, SQL API and Import API which also uses PostGIS to provides lots of GIS processing function. They provide the service on Google Cloud platform.

You might also be looking for the alternative of Carto Db.

To take a detailed look on CartoDB you may look their article with title as “Introducing CartoDB on Google Platform: An Alternative to Google Maps Engine“.

Mapbox – Alternative to Google Map Engine

Mapbox - Alternative to Google Map Engine API

Mapbox is an another cloud based solution which we can look as an alternative to Google Map Engine to some extent. Its scalable, cheap and uses open source technology. User can easily choose nicely designed base map from their predefined maps and can add them to their own custom application easily.

They also provides Android and iOS SDK along with Javascript API for development of map application. Their tools and APIs will help you to add location to any application.

You may look to mapbox from here.

Openstreetmap – Alternative to Google Map Engine

Openstreetmap - Alternative to Google Map Engine API

uMap is an OpenStreetMap Project which help you to “create maps with OpenStreetMap layers in a minute and embed them in your site”.

It lets you choose the layers of your map, add POIs as markers, lines or polygon with managing colors and icons, import geo-reference vector data like geojson, gpx, kml, osm etc, choose and add license from your data and finally embed and share your map.

You can try uMap from here.

Simialy to uMap which made over openstreetmap, you may also look geojson.io which is also a fast, simple tool to create, change and publish maps. You may try geojson.io from here.

Both uMap and geojson.io is opensource project and can be treated as an alternative to Google Map Engine (GME).

Esri – ArcGIS Online – Alternative to Google Map Engine

ESRI - ArcGIS Online - Alternative to Google Map Engine API

Esri is an international supplier of Geographic Information System software, web GIS and Geo-database management applications. ArcGIS online is product of ESRI and is used for creating interactive maps for website and applications which gives an ability to discover, use, make and share maps from any device from anywhere, anytime. ArcGIS online provide ready to use Maps comprised of authoritative maps with data, visualize large amount of data, brings power of analytics, API tool for developers and many more.

Esri also provide 60 days free trial, which you can opt for before subscribing the tool. You can try ArcGIS online from here.

You might also be interested in looking for the best alternative of ArcGIS Online.

GISCloud – Alternative to Google Map Engine

GISCloud - Alternative to Google Map Engine API

GIS cloud is a cloud storage platform where you can easily create, edit and customize your maps and can share and publish maps in web and applications. It provides to quickly integrate with Google base Map, customize your application like layout, style, and custom logo effortlessly, use data collection and populate your data into a map layer in real time and can share your data in a blink of eye. GIS Cloud can be considered as a good alternative to Google Map Engine, for further detail, you may look to this link explaining how it can be an alternative to GME.

iSpatial – Alternative to Google Map Engine

iSpatial uses Google Maps and Google Earth product in a task based approach to solve complete problems. It is used to create, annotate, add layer data, combine all datasets and search and manage real time updated data. You can easily share your data, communicate effectively and export data to other users or systems. You can opt iSpatial as one of an option for being an alternative to GME. Have a look of iSpatial from here.

espatial – Mapping software – Alternative to Google Map Engine

While eSpatial cannot be treated as a direct alternative to GME, but you take a look on it if you are working mostly with Excel data and wanted to convert the excel spreadsheets into maps in a go, then, this tool can become one of the most powerful mapping software for you. eSpatial uses Google Maps as a powered base map. Here is the link to visit eSpatial website.

Are we missing any other best alternative which should be in the list above. Have you tried any of the above services before and whats your experience with the same, do provide a review below as comment so that we could discuss and make some gist out of it. I hope you would figure out the best alternative mapping services.

Spatial Join in QGIS

Spatial Join in QGIS – Quantum GIS an open source software. Spatial join is used for joining or transferring attributes of two vector layer based on their  spatial relationship. In QGIS we can perform this task using Join Attribute by Location tool.

Spatial Join in QGIS

Here we have a university spatial data where, there are 21 teaching departments in this university. Each department runs a number of courses. The no. Of courses of each department is given. We want to find out total no. Of courses run by the university. We can find this by simply adding all the numbers, but here we will see how to use Join attribute by location tool.

More QGIS tutorial can be found here.

Spatial Join in QGIS
Spatial Join in QGIS

Spatial Join in QGIS

Spatial Join in QGIS – Steps

1.) Open Join attribute by location tool.

Spatial Join in QGISIf these tools are not enabling by default you can enable these tool by going into plugin manager, as shown below in image.

Spatial Join in QGIS
Spatial Join in QGIS

2.) Set the Dialog box as follows: Target vector layer is the layer to which we want to add the attribute. The join vector layer is the layer from which we are transferring the attributes. Click on take summary of intersecting features because we want all features covered by the location and we want to keep all the records as there are no matching records. Click OK.

Spatial Join in QGIS
Spatial Join in QGIS

3.) A new layer is added to the table of contents. Open the attribute table of new layer. where you will get the Count Column as total number of University department, which was our desired result.

Spatial Join in QGIS4.) Here we have got some unwanted fields also. As we only want SUM of courses as a field, so we will delete the other fields. We can delete column only in editing mode. So click on toggle editing tool and click on delete column. Select the column which you want to delete and then click ok. Click save edits, and again click on toggle editing tool.

For exploring more editing tool, you may follow this aritcle: Digitization in QGIS – Exploring tools for Digitizing.

You may also explore other QGIS tutorials:

Select and calculate area, length and perimeters of features in QGIS

Select and calculate features according to area, length and perimeters in QGIS. Let us explore some selection technique and also how to use calculation in QGIS. To calculate these parameters we have to change the unit of the calculation to meters. If the layers are in WGS84 CRS we will get measurement in degrees, so first we have to change the CRS of our layers as well as our project. You can also look over other tutorials in QGIS.

To do this, we will import the vector layers which are in projected CRS and change the project CRS by changing project properties. For this map we have selected WGS 84/ UTM Zone 43N CRS you can select zone as per your region.

Select and calculate area, length and perimeters of features

Let us select the features which have area greater than 1000 meter square and save these features into different layer. To complete this task we need to implement following steps:

1.) Open QGIS and open a polygon shapefile layer in QGIS. Select the opened layer for which you want to calculate area.

Select and calculate area, length and perimeters of features 2.) Now click select feature using expression, from the tool box.  This will open up one window as shown below.

Select and calculate area, length and perimeters of features

3.)Find $area by going into geometry and select it by double clicking on it.

Select and calculate area, length and perimeters of features
Select and calculate area, length and perimeters of features

4.) Set the query as shown in image. Click select and then close.

Select and calculate area, length and perimeters of features5.) Feature which have area > 1000 have been selected and highlighted as yellow color.

Select and calculate area, length and perimeters of features

Select Within Selection Filter

1.) Now we want our selection to be more specific. We don’t want grounds in our selection but only buildings specifically which are university teaching department. To do this, lets implement steps.

2.) Again open select feature using expression tool. We will go to fields and values and select amenity. On clicking it we will get all unique values in the amenity field. We set the query as shown in the image.

Select and calculate area, length and perimeters of features
Select and calculate area, length and perimeters of features

3.) Don’t click on select instead click on drop-down near it and click select within selection and then close.

Select and calculate area, length and perimeters of features4.) Look at the results.

Select and calculate area, length and perimeters of features

5.) This selected layer can be saved as another file by just Right click on the layer and click save as.

Select and calculate area, length and perimeters of features6.) Click on the option save only selected features. Click on browse button and save the layer to the desired destination. The layer will be saved and added to your canvas.

Select and calculate area, length and perimeters of features
Select and calculate area, length and perimeters of features

Calculate Length of features

There are many ways to calculate these Length, area, perimeter etc parameters. It depend on us which way we select. The result will be the same all the time. Let us check them one by one.

1.) Open the attribute table of the roads layer and then Click on the field calculator.

Select and calculate area, length and perimeters of features

Select and calculate area, length and perimeters of features

2.) You will find three options to calculate and take a look on values, as follows:

  • Create a new field: A new field will be created and editing will be automatically enabled so that you can save the new field.
  • Create a virtual field: A new field will be created and editing will be automatically enabled so that you can save the new field, and if you don’t want to save it will automatically delete the column when you close the attribute table.
  • Update existing field: This will update the existing field with the new data.

3.) Set the calculator as shown in image. Click OK and take a look at the attribute table.

Select and calculate area, length and perimeters of features
Select and calculate area, length and perimeters of features

Select and calculate area, length and perimeters of features4.) You can see that the toggle editing tool has been activated automatically. Save edits. And close the attribute table.

5.) Now let’s calculate length with another method. Click on toggle editing tool in the attribute table. Then click on new column.

Select and calculate area, length and perimeters of features

Select and calculate area, length and perimeters of features

Select and calculate area, length and perimeters of features6.) Fill the text boxes and click ok. And then click save edits.

7.) Now again click on the field calculator and click on the update existing field, select length from the Drop-down menu.

Select and calculate area, length and perimeters of features8.) Calculate the length as above and click ok.

Select and calculate area, length and perimeters of features9.) The field is updated. Click on save edits and then click toggle editing to disable editing. You can also delete a column or two by going into editing mode and click delete column.

Select and calculate area, length and perimeters of features10.) Now let’s take a look at another method. We can calculate length without going into field calculator also. Create a new column as shown above and then select the column here as shown in image.

Select and calculate area, length and perimeters of features11.) Click on the expression dialogue sign in front of the column name.

Select and calculate area, length and perimeters of features
Select and calculate area, length and perimeters of features

12.) Now you can calculate the length by selecting $length. Click ok. You will see the column is not updated.

Select and calculate area, length and perimeters of features13.) Click on update all button.

Select and calculate area, length and perimeters of features14.) Now the column will be updated. Click on save edits. Then disable editing.

15.) If you want to calculate length for a particular feature only for example length of primary roads only so first select the row which contains primary roads and then calculate length and then click on the button update selected.

Similarly you can select filter features and also calculate length, area, perimeter etc in QGIS. If you are getting any problem in following the steps provided, do comment below with the problem statement. This will let us to discuss over it.

Edit – Export – download data from OpenStreetMap in QGIS

Edit – Export – download data from OpenStreetMap (OSM). Open Street Map is a free editable map of the world, and is very easy to handle. Here in this post we will see how to edit and create geometries on open street map. Also how to export, download and convert the .osm file to any other file.

Steps to Edit – Export – Download data from OpenStreetMap:

1.) Sign in – Before starting editing you need to have one Account in OpenStreetMap to your, so create the one if you don’t have any and login with your account.

2.) Click the Edit dropdown menu button, placed at the upper left of the map, where you will find following three options:

Edit - Export - download data from OpenStreetMap
Edit – Export – download data from OpenStreetMap

Where In-Browser editor are used to edit online and JOSM is used for offline editing.

3.) Lets try with iD In-Browser editor for demonstrating editing here. So click Edit with iD option.

4.) Screen will shows up as follows:

Edit - Export - download data from OpenStreetMap

In right hand side you have various option which you can explore one by one and is very easy to understand. Bing Ariel imagery is preferred in background which is by default is in background however you can select any background you want.

Edit - Export - download data from OpenStreetMap

5.) Now we can start editing. You can select either Point, Line or Polygon from your screen.

6.) Click on the screen on the location where you want to edit. If you selected a point then just click on the location and press enter and then fill the entries on the left hand side and give necessary information.

7.) Click save and your edits will be saved, which you may see it again by opening the osm in another session. Likewise you can digitize lines and polygons.

8.) You can export the map from osm and it will be downloaded to your computer with extension .osm.

Edit - Export - download data from OpenStreetMap
Edit – Export – download data from OpenStreetMap

The exported .osm file can be opened in QGIS or many other GIS tools.

Here I am showing you how to open .osm file in QGIS. Select Add Vector Layer icon as shown below, and browse to the location where you saved the downloaded file and click open.

Edit - Export - download data from OpenStreetMap

A pop-up will open. Select layers as shown in figure.

Edit - Export - download data from OpenStreetMap
Edit – Export – download data from OpenStreetMap

Now select OK. The downloaded map will be imported on the map canvas. In the layers space, you can see four layers which was exported as an example which are .osm layers and can be easily converted to any other GIS vector file like shapefiles.

Download OpenStreetMap OSM data directly from QGIS:

1.) We can also download osm map of our desired location to our computer using QGIS.

2.) In QGIS click vector and click openstreetmap and click download data.

Edit - Export - download data from OpenStreetMap

3.) Enter the coordinates. Click … and give the name of the output file and click download.

4.) Downloading will take some time depending on the size of the data.

QGIS tutorial – A simple Guide

After downloading map you can convert back the osm data to any other spatial data, preserving database attributes too. You can also use some advance plugin given in repository of QGIS. I hope this post would have helped you to export Spatial data with the help of OpenStreetMap. If you are getting any problem in performing the steps do comment below also, if have any other tricks to export spatial data from openstreetmap or any other source do provide us the reference by commenting below.