Normalize values in a matrix to be between 0 and 1 (Matlab Tips)

I’m run a function in Matlab and it requires a matrix of variables within 0 and 1. The way to normalize the values to be between 0 and 1, and transform back to the original matrix as follows:

b = [10; 0; 1; 1];

%% normalized matrix B to 0 and 1
normB = b - min(b(:));
normB = normB ./ max(normB(:))

%% transform normalized matrix B to the original matrix
B_sim = normB_sim .* max(b(:))

Make sure, when transforming normalized matrix to the original matrix, you provided the maximum value of the original matrix. It not, the code cannot be run.

Original source: (Link) 

Please follow and like us:

Multiple colors to features within a single shapefile

I have received one shape file from a friend, who has a lot of features and attributes. However, it is within a single shapefile. So, it is difficult to me to recognise their features, since QGIS is only displayed one colour.

There is actually a way to display multiple colours of features although you have a single shape file. You can change the styles of the shape file in the layer properties. Double click the layer and select style. Select Categorized style and choose a field you want to visualize. Remember to classify your values before leaving the dialogue.

Reference: https://gis.stackexchange.com/questions/20404/how-to-give-multiple-colors-to-features-within-a-single-shapefile

Please follow and like us:

Import “starred places” into a My Map

There is a situation, you have saved several places in Google Maps and you want to display all those places in one map in Google Maps. How to do it? It is a way to do it, by using My Maps. However, there is no way to add them through My Maps directly. Here the tips from this link to do it:

  1. Export them using Google Takeout
    https://www.google.com/settings/takeout
  2. Export them from “Google Maps (My Places)”, not from “Bookmarks”. They will be downloaded as a GeoJSON file.
  3. Use this site to convert the file to KML GeoJSON
    http://nearby.org.uk/convert-saved-places.php
  4. Once download the KML file, can import it into the custom map.
Please follow and like us:

Using HEC-GeoRAS for the HEC-RAS modelling

If you do HEC-RAS for the flood or water quality modeling, HEC-GeoRAS may help you. In general, HEC-GeoRAS is a plugin in ArcGIS, to help to process geospatial data from the raster image. 1) It is very helpful that allows the preparation of geometric data for import into HEC-RAS and 2) helps to display the GIS outcome, based on the outcome of HEC-RAS. This software can be download from this link.

Preparation of geometric data for import into HEC-RAS

To create the import file, the user must have an existing digital terrain model (DTM) of the river system in the ArcInfo TIN format. The user creates a series of line themes pertinent to developing geometric data for HEC-RAS. The themes created are the Stream Centerline, Flow Path Centerlines (optional), Main Channel Banks (optional), and Cross Section Cut Lines referred to as the RAS Themes.

These are the best tutorial that I obtained from youtube:

Part 1

Part 2

Part 3

Part 4

Helps to display the GIS outcome

Water surface profile data and velocity data exported from HEC-RAS simulations may be processed by HEC-GeoRAS for GIS analysis for floodplain mapping, flood damage computations, ecosystem restoration, and flood warning response and preparedness.

The tutorial to export the data from HEC-RAS to GeoRAS as follows:

Credit: Yasir A. for the good tutorials.

Please follow and like us:

Field Calculator in QGIS

In QGIS, if you want to calculate the real geometries (such as area, parameter, length etc.) of polygon/point based on the current coordinate system, we need using the field calculator.  If we use this calculator, we able to show the geometries in the features table. I list a few field calculators that may interest the QGIS user as follows:


latitude and longitude

$x or $y as a variable to get the x and y

Please follow and like us:

How to export string with timeperiod to .dat file? (Re-Post)

Here a question (original link) that I ask at Matlab Community that the reader may found useful.


Question:

I have a large string that containing time period such as 23-May-2009 02:00:00 (as attached). Variable editor in Matlab is unable to display these variables, since the variables have more that 524288 elements. I want to export the variables to .dat file, so I can see the list of the variables. I try to use fopen and fprintf functions to export the variables, but unsuccessful. Any help? Thank you.

Answer:

load hourlyperiod.mat
d = hourlyperiod ;
fid = fopen('iwant.dat','w') ;
for i = 1:length(d)
 fprintf(fid,'%s \n',d(i,:)) ;
end
fclose(fid) ;
Please follow and like us:

Menukar sistem koordinat menggunakan ArcGIS

Bila dapat shp files dari client dalam sistem koordinat kertau, mesti pening kepala. Mananya tidak, saya adalah pengguna QGIS dan function “on the fly” CRS transformation dalam QGIS sangat tidak membantu, berbanding function yang sama dalam ArcGIS. That why, ArcGIS sangat disukai oleh ramai orang sebab lebih muda berbanding QGIS. Tetapi, since ArcGIS perlu dibeli dan license sangat mahal, ini menyebabkan saya lebih suka menggunakan QGIS.

Berbalik kepada masalah saya, saya perlu ubah sistem koordinate kertau kepada WSG84, since default sistem QGIS adalah WSG84. Tambahan, kalau import files dari Google Earth, WSG84 akan digunakan. Dengan basic knowledge dlm QGIS dan ArcGIS yang sangat shallow, google lah cikgu saya. Saya terjumpa satu link orang Melayu yang ajar step by step macam mana hendak tukar. Saya repost balik post dia disini untuk rujukan saya dan pembaca disini.

Post beliau seperti berikut:


Di sini saya akan tunjukkan cara-cara menukar sistem koordinat tu menggunakan ArcMap. Contoh yang akan saya berikan ialah menukar data dari RSO ke WGS84.

1. Pastikan sistem koordinat sumber data

Mula-mula anda perlu pastikan apakah sistem koordinat yang digunakan oleh data yang ingin anda tukarkan sistem koordinat tu. Contohnya katalah saya ingin menukar data mukim saya ke WGS84. Saya perlu pastikan apakah sistem koordinat yg digunakan oleh mukim tu. Katakan saya tahu data mukim tu adalah data RSO,.. saya perlu pastikan pada ruangan XY Coordinate data tu tertera Kertau_RSO_Malaya_Meters dan bukannya Unknown.

Sekiranya nilai yang dipapar adalah Unknown, anda perlu define dahulu sistem koordinat pada data tu sebelum proceed langkah seterusnya. Contoh, kalau data mukim saya tu adalah data RSO, saya perlu define dahulu data tu sebagai RSO. Proses ni anda perlu buat dalam ArcCatalog ataupun Catalog Window.


Klik butang Select.. untuk define sistem koordinat sumber data
2. Set sistem koordinat untuk Data Frame.

Kemudian setkan sistem koordinat Data Frame mengikut sistem koordinat apa yang anda hendak convert. Macam contoh saya ni, saya nak convert mukim tu dari RSO ke WGS84, jadi sistem koordinat Data Frame tu saya perlu set dahulu sebagai WGS84.

3. Pastikan adakah terdapat perbezaan datum antara sistem koordinat.

Step ni agak penting juga untuk pastikan ketepatan data yang akan anda hasilkan nanti. Anda perlu tahu apakah datum yang digunakan antara sistem koordinat yang terlibat. Contohnya data mukim saya adalah RSO. RSO untuk Semenanjung menggunakan datum Kertau. WGS84 pula menggunakan datum WGS84…. bermaksud kedua-dua sistem koordinat menggunakan datum yang berbeza.

Sekiranya terdapat perbezaan datum, proses Datum Transformation perlu dilakukan. Mudah saja, klik saja butang Transformation pada dialog Data Frame Properties dan setkan transformation seperti gambar kat bawah ni.

4. Export data menjadi layer baru.

Kemudian export saja sumber data tu menjadi layer baru. Tapi jangan lupa, pastikan anda pilih option Use the same coordinate system as : the data frame. Kalau tak pilih option tu, nanti data yang dihasilkan tetap tak berubah, masih lagi sistem koordinat yang asal. Dalam contoh di bawah ni, data mukim tu saya convert menjadi shapefile dan saya namakan sebagai MukimWGS.shp.

OK …selesai sudah proses. Data mukim saya telahpun diconvert daripada RSO menjadi WGS. Secara ringkasnya, anda bolehlah rujuk gambarajah bawah ni untuk step-step yang telah saya huraikan tadi.

Kredit:www.sukagis.com

Please follow and like us: