MkrGeo http://www.mkrgeo-blog.com An original point of view Thu, 23 Dec 2021 20:52:21 +0000 en-US hourly 1 https://wordpress.org/?v=5.8.2 156105649 Batch import PDF document to Google Sheets – random data http://www.mkrgeo-blog.com/batch-import-pdf-document-to-google-sheets-random-data/ http://www.mkrgeo-blog.com/batch-import-pdf-document-to-google-sheets-random-data/#respond Thu, 23 Dec 2021 20:52:21 +0000 http://www.mkrgeo-blog.com/?p=65713 Batch import PDF document to Google Sheets – random data MkrGeo

Importing PDF documents directly to Google Sheets still remains a tricky issue. The first stop at this conversion route is using Google Docs, where you can extract the PDF content nicely. One more thing to add here is the content as a whole. Successful transferring of our PDF documents to Google Docs, and finally to […]

The post Batch import PDF document to Google Sheets – random data first appeared on MkrGeo.

]]>
Batch import PDF document to Google Sheets – random data MkrGeo

Importing PDF documents directly to Google Sheets still remains a tricky issue. The first stop at this conversion route is using Google Docs, where you can extract the PDF content nicely. One more thing to add here is the content as a whole. Successful transferring of our PDF documents to Google Docs, and finally to Google Sheets doesn’t mean the fulfillment of our process. Sometimes we might need just some particular data from our document instead of all content of our PDF file.

This article comes across some dexterous process, which eventually would help you to get some certain lines or specific data from your PDF document in the Google worksheet. A third-party application is still required, but instead of Google Docs, I will utilize VBA Excel. Furthermore, I am talking about batch conversion, which is also not often found on the web.

1. First of all we should collect all our files in the directory like shown below:

PDF documents in the directory

Pic. 1 Our PDF documents in the directory.

2. Create the Excel macro workbook .xlsm, where you will go straight to the “Developer” panel and create the new VBA module in which you should write the following code:

Sub PDF_To_Excel()

Dim setting_sh As Worksheet
Set setting_sh = ThisWorkbook.Sheets("Youur_Sheet_Name")

Dim pdf_path As String
Dim excel_path As String

pdf_path = setting_sh.Range("C4").Value
excel_path = setting_sh.Range("C5").Value

Dim fso As New FileSystemObject
Dim fo As Folder
Dim f As File

Set fo = fso.GetFolder(pdf_path)

Dim wa As Object
Dim doc As Object
Dim wr As Object

Set wa = CreateObject("word.application")

wa.Visible = True

Dim nwb As Workbook
Dim nsh As Worksheet

For Each f In fo.Files
Set doc = wa.Documents.Open(f.Path, False, Format:="PDF Files")
Set wr = doc.Paragraphs(1).Range
wr.WholeStory

Set nwb = Workbooks.Add
Set nsh = nwb.Sheets(1)
wr.Copy

nsh.Paste
nwb.SaveAs (excel_path & "\" & Replace(f.Name, ".pdf", ".xlsx"))

doc.Close False
nwb.Close False

Next

wa.Quit

End Sub

and next adjust your current worksheet.

In your current worksheet, you have to define the target directory both for the source file and for the converted file as well. It has been already defined in the code above in the emboldened section. You must stick to the cells defined in the code if you want to have your code working properly (Pic. 2).

PDF to Excel - defining cells in worksheet

Pic. 2 Defining our cells for the source files and converted file directories, which have been set in the VBA code.

The next thing I would advise you to add is the simple form control button, where you can assign your macro from above.

Finally, we can run our macro. The time of code execution depends on the number of our .pdf files in the folder. I have got them 5, so I had to wait for about 30-40s. It takes quite a long, as the VBA code converts them first to the .docx file and finally to the .xlsx one. Each of them is being opened and closed separately until the last one when the tool will ask you about keeping the last item opened (Pic. 3).

PDF to Excel - Word - last item opened

Pic. 3 The Microsoft Word alert before finishing the patch conversion between PDF and Excel.

I prefer to click “No” and have all my documents closed. Now go to our directory and see our job. It looks like everything is alright. We have made our batch file conversion between .pdf and .xslx (Pic. 4), which is great.

PDF to Excel batch conversion effect

Pic. 4 Our batch conversion from .pdf to .xlsx result in the folder.

3. Check the content of the PDF file and find the data you need to extract (Pic. 5). You can do it also in your Excel document either by checking roughly in which range of cells it appears. This is the primary thing, which must be done before we start to create another VBA Excel macro needed for the extraction of our data.

Data in PDF document

Pic. 5 Our essential data in PDF document, which must be transferred to Google Sheets.

4. Now, we can start to develop the macro “responsible” for extracting needed data from every .xlsx file converted in our directory. The code will include two pieces, as has been shown in this example. The first part will define the loop between all the Excel documents (specifically their particular worksheet) and our target file where we want to store our data. All the  .xlsx files extracted contain only one worksheet (Sheet1 – as default). Our workbook has one worksheet too, which name we changed to Your_Name_Sheet. The first part of our code will look like below:

Sub CopyData()
Dim wbSource As Workbook
Dim datTarget As Worksheet
Dim datSource As Worksheet
Dim strFilePath, strfile As String
Dim strPath As String

Set datTarget = ThisWorkbook.Sheets("Your_Sheet_Name") ' Target worksheet, where the extracted data will be stored
strPath = GetPath

If Not strPath = vbNullString Then

strfile = Dir$(strPath & "*.xlsx", vbNormal) ' Browse between all .xlsx files in the source directory

Do While Not strfile = vbNullString

Set wbSource = Workbooks.Open(strPath & strfile)
Set datSource = wbSource.Sheets("Sheet1") ' Pick up data from the default worksheet - Sheet1

Call Copy_Data(datSource, datTarget) ' Calling second macro

wbSource.Close False
strfile = Dir$()
Loop
End If
End Sub

Function GetPath() As String

With Application.FileDialog(msoFileDialogFolderPicker)
.ButtonName = "Select a folder"
.Title = "Folder Picker"
.AllowMultiSelect = False

'Get the folder path
If .Show Then GetPath = .SelectedItems(1) & "\"

End With

End Function

but this code doesn’t make sense without the second part, which defines which range of data should be roughly picked up. So far we have the PDF document checked (Pic. 5), but as I wrote above it’s not enough. We have to enter at least one extracted Excel document and see where roughly all interesting values are located (Pic. 6).

Location data in Excel document converted from PDF

Pic. 6 The range of our data in the .xlsx document extracted from .pdf.

As you can see above, the PDF extractor macro tool collects all the data in the very first column A. It’s good, but the result doesn’t look neat if it’s needed at all. When our PDF document has some pictures, they overlap some text beneath. Once removed, we can clearly define the range of data we need to extract (look at yellow boxes), which falls accordingly at A16, A21, A23, and A26.  It’s enough information for developing our second part of the code, which optionally could look like this:

Sub Copy_Data(ByRef shSource As Worksheet, shTarget As Worksheet)

Const LID_LIFTED As String = "A16"
Const ROOM_IN_CHAMBER As String = "A21"
Const CHAMBER_WATER_PUMP As String = "A23"
Const ADDITIONAL_INFORMATION As String = "A26"


Dim lRow1 As Long, lRow2 As Long, lRow3 As Long, lRow4 As Long

'Determine the last column.
lRow1 = shTarget.Cells(Rows.Count, "E").End(xlUp).Row + 1
lRow2 = shTarget.Cells(Rows.Count, "F").End(xlUp).Row + 1
lRow3 = shTarget.Cells(Rows.Count, "G").End(xlUp).Row + 1
lRow4 = shTarget.Cells(Rows.Count, "H").End(xlUp).Row + 1


'Copy the data.
shSource.Range(LID_LIFTED).Copy
shTarget.Range("E" & lRow1).PasteSpecial xlPasteValuesAndNumberFormats
shSource.Range(ROOM_IN_CHAMBER).Copy
shTarget.Range("F" & lRow2).PasteSpecial xlPasteValuesAndNumberFormats
shTarget.Range("F" & lRow2).Replace "Is there room in the chamber to install a new closure : ", "" ' removing unnecessary string
shSource.Range(CHAMBER_WATER_PUMP).Copy
shTarget.Range("G" & lRow3).PasteSpecial xlPasteValuesAndNumberFormats
shSource.Range(ADDITIONAL_INFORMATION).Copy
shTarget.Range("H" & lRow4).PasteSpecial xlPasteValuesAndNumberFormats


' Reset the clipboard.
Application.CutCopyMode = xlCopy

shTarget.Range("E2:H" & lRow4).Copy

End Sub

where copying data to the target column row by row could be included. Another thing, which was included is the Replace function which removes unnecessary string from the cell A21, as the interesting value is after the colon (Pic. 6). Finally, the last line of the code copies all the records to the clipboard.

5. I would prefer to create another form control button (Pic. 7).

Export and copy data button VBA Excel

Pic. 7 New form control button “Extract & Copy data” where we should assign our second macro.

By the right-click on this button we can assign macro, which in our case will be the second part of the code “Copy_Data“, which you can see below in the full VBA code captured (Pic. 8).

Extract data from Excel - full VBA code

Pic. 8 Extraction data from number of workbooks and bindinng them as the one file – VBA code.

6. Click the button with your “Copy_Data” macro assigned. Firstly, the macro will ask you about selection of the directory, where your converted .xslx files are stored. It will be the “MyFolder” as definied for the conversion output (Pic. 2, 9).

Excel data extraction folder selection

Pic. 9 Selecting the folder, where our converted Excel files are stored.

7. When selected, wait a minute, the tool will extract the data you need. The time of awaiting depends on the number of data requested as well as an amount of .xlsx files located in the directory. Anyhow at the end, you should see the data populated in the columns, where one column (as defined in the code) corresponds to the particular question and one row corresponds to the file. Moreover, all the data have been already copied to the clipboard as you can see the selection box around them (Pic. 10).

Extracting data from various excel documents and consolidating them as one master file

Pic. 10 Data from all the files in the directory have been extracted and consolidated in one table, which is now copied to the clipboard straight away.

8. As the very last step we can simply paste our data in Google Sheets roughly where we need (Pic. 11)!

Extracted Excel data in Google Sheets

Pic. 11 Our data extracted from the Excel files are already pasted to the Google Sheets workbook.

DISCLAIMER:

The data prepared here refers to the individual situation. If your collumns configuration is different, then you can change it in the code. Important is also to mention, that it applies to the PDF files fixed with their layout. In practise, the extracted data is placed always roughly in the same cells in Excel. When your PDF documents are similar but not exactly the same, probably more advanced approach is required, as the final range of selected data can be shifted.

Mariusz Krukar

Links:

  1. https://productivityspot.com/convert-pdf-to-google-sheets/
  2. https://blog.cometdocs.com/how-to-convert-pdf-tables-to-google-sheets
  3. https://itselectable.com/pdf-to-google-sheets
  4. https://www.pdftoexcelconverter.net/
  5. https://online2pdf.com/pdf2excel
  6. https://yagisanatode.com/2020/06/13/google-apps-script-extract-specific-data-from-a-pdf-and-insert-it-into-a-google-sheet/
  7. https://docparser.com/blog/pdf-to-google-sheets/
  8. https://hackernoon.com/3-best-ways-to-import-external-data-into-google-sheets-automatically-bw163yxm
  9. https://www.excelcampus.com/vba/find-last-row-column-cell/comment-page-1

Forums:

  1. https://stackoverflow.com/questions/16888863/vba-string-variables-does-not-put-constant-string-value-in-string-concatenating
  2. VBA code to move cursor down one cell
  3. https://stackoverflow.com/questions/16888863/vba-string-variables-does-not-put-constant-string-value-in-string-concatenating
  4. https://stackoverflow.com/questions/62381174/object-variable-or-with-block-variable-not-set-error-for-offset-function
  5. https://stackoverflow.com/questions/33405244/copying-a-range-from-all-files-within-a-folder-and-pasting-into-master-workbook
  6. Copy data specific data for all files within directory and consolidate in master file
  7. VBA: Declare a cell range as a value for a Constant
  8. https://www.excelforum.com/excel-programming-vba-macros/1166247-paste-copied-data-in-rows-not-columns.html
  9. https://stackoverflow.com/questions/44297686/vba-excel-find-words-in-a-range-and-replace

 

My questions:

  1. https://stackoverflow.com/questions/70424853/defining-just-part-of-the-string-as-a-constant/

Youtube:

 

The post Batch import PDF document to Google Sheets – random data first appeared on MkrGeo.

]]>
http://www.mkrgeo-blog.com/batch-import-pdf-document-to-google-sheets-random-data/feed/ 0 65713
A guide for displaying the Sweet Home 3D model in Google Earth http://www.mkrgeo-blog.com/a-guide-for-displaying-the-sweet-home-3d-model-in-google-earth/ http://www.mkrgeo-blog.com/a-guide-for-displaying-the-sweet-home-3d-model-in-google-earth/#respond Thu, 16 Dec 2021 18:19:58 +0000 http://www.mkrgeo-blog.com/?p=65669 A guide for displaying the Sweet Home 3D model in Google Earth MkrGeo

Sweet Home 3D is an open-source architectural design software, mostly dedicated to interiors, which helps users to create a 2D plan of a house with a 3D preview. In this design software, a user can also decorate exterior and interior views by placing a multitude of objects. These objects are mostly furniture and home appliances, […]

The post A guide for displaying the Sweet Home 3D model in Google Earth first appeared on MkrGeo.

]]>
A guide for displaying the Sweet Home 3D model in Google Earth MkrGeo

Sweet Home 3D is an open-source architectural design software, mostly dedicated to interiors, which helps users to create a 2D plan of a house with a 3D preview. In this design software, a user can also decorate exterior and interior views by placing a multitude of objects. These objects are mostly furniture and home appliances, which have been categorized by sections tailored for a specific room.
The most advantageous feature of this open-source software is creating the virtual environment, which can be eventually used for designing a blueprint of houses. Admittedly, the 3D preview giving a piece of virtual setting is nothing unusual in this type of software environment. The wide spectrum of other applications has the same capability for showing any 2D drawing in 3D. The primary advantage of the Sweet Home 3D above them is its marvelous intuitiveness in use. It means, that anyone can sketch a good-looking hose plan without knowledge of drawing, which is required i.e. for CAD-based applications.

The 3D model displayed in the Sweet Home 3D software may not be enough for users, as they potentially want to have it geolocated and embedded in the real scene. Therefore I am coming out with a solution how to make this step successful. The negative side of this solution is to use a third-party application, which in this case is Google Sketchup. On top of that, Google Sketchup is not free. However, you can get over it a bit by using the 30 days trial version or installing older versions for several hours.  Another problem is the lack of options for automatic geolocation, which might be the pain, but…not necessarily after reading this article!

1.   Our first step is to export the 3D view from the Sweet Home 3D program, which saves the file in the .obj format. We just need to right-click the area with our 3D view and select Export to OBJ format.

Sweet Home 3D export model to .obj format

Pic. 1 Export the 3D model from Sweet Home 3D in the .obj format.

2.   Now, open Google Sketchup and import your file. I assume, that you already have two extensions: TT_Lib and TT_QuadFaceTool installed. If not, please follow the Youtube footage attached below.

However in the 2017 version, all the extensions are placed in the “Extension Manager” section, as per below: (Pic. 2, 3).

Google Sketchup 2017 Extension manager

Google Sketchup 2017 Extension manager2

Pic. 2,3 The location of all extensions in Google Sketchup 2017.

When selecting the type of file you want to import, you should have to click the “Options” where are some things to define at the very beginning (Pic. 4).

Sketchup import .obj file and defining measurement units

Pic. 4 Import the .obj file to Google Sketchup. By clicking “Options” we can set the measurement units as well as the position of our coordinate system.

This is an important matter because leaving the default measurements in inches (Model Units) we will have our object enlarged by 2.54! Bear in mind this thing. Selection of the metric values at the very beginning will prevent you from additional and unnecessary size conversions later.
Alternatively, but BEFORE importing your file, you should choose the “Window” from the main toolbar, then “Model Info” -> “Units” and change them from “Architectural” to “Decimal” and pick up the “Centimeters” at the end. Next, you can simply import your .obj file without entering “Options” (Pic. 5).
The other thing is “Swap YZ Coordinates“, which should remain selected as default. If you deselect it at some point, your object will stand vertically.

Sketchup model info changing units

Pic. 5 Google Sketchup ->Window -> Model Info -> changing units before our object is imported!

Thereafter we can preferably set the number of decimals, as shown in the image above, but it’s not necessary.

3. First thing after import our file should be deletion of the person, which appear always in the blank Sketchup project. You can do it easily by selecting it and hitting the “Del” button (Pic. 6, 7). Alternatively, you can use the “Erase” tool for this purpose.

Sketchup pegman deletion

Sketchup pegman deletion2

Pic. 6, 7 Deleting the pegman in Google Sketchup by selecting the cursor on our main panel, afterward selecting the object and hitting the “Del” button.

4. Next thing – defining the cardinal points. In Google Sketchup, we have 3 axes: XYZ. As the Y-axis shows up, being swapped with the Z-axis, we should have a different orientation of the whole Cartesian System, as it is rotated along the X-axis. In turn, our X-axis (red) will indicate East, Y-axis (blue) will go to the top and Z-axis (green) will point the north direction (Pic. 8 – 10).

Google Sketchup north direction

Google Sketchup north direction3

Google Sketchup north direction4

Pic. 8 – 10 Defining the north direction in Google Sketchup which due to swapping Y and Z axes is now indicated by the Z-axis marked green.

5. Now, we should check the location of our building in reality. The example shown above has the garage door oriented roughly towards NW. In Sketchup, according to the default position, they head exactly south. In this case, we should rotate them at least by 90° to the left.  The first thing we should do here is to check the real building location against i.e. the nearest road. In the case of the example shown, the garage door should be a front of the road. You can check the exact location circumstances both in Google Maps and Google Earth. Next, you should measure the orientation angle of the nearest feature, which in my case is the road mentioned above. The easiest way to do it quickly is:

  • run the Windows 10 Snip & Sketch tool by holding: WINDOWS + SHIFT + S buttons simultaneously.
  • make the screenshot of your Google Map (preferably by the Box selection),
  • toggle the “Ruler” feature from the main toolbar, which includes an embedded protractor in the middle (Pic. 11).

Afterward, you can place the protractor roughly in the location of your object (precisely check the orientation of the nearest feature) and calculate the angles, which are separated by 15° roughly (Pic. 11).

Windows 10 Snip & Sketch - protractor tool in action

Pic. 11 Measuring the orientation angle of the road by counting it roughly from the North direction.

By looking at this road, where the protractor tool has been placed, we can see, that it goes from about SW direction to NE direction at azimuth around 45°. Next, we can add this 45 ° to another 90° which requires additional rotation of our garage door from the south to the west direction. Finally, they must be vis-a-vis the road, therefore head NW.

6. Since we know the location of our building against local area circumstances, we can rotate it gently in Google Sketchup. The task is quite straightforward, but you must remember some basic rules mentioned in the tutorial below.

Google Sketchup rotation Youtube

Pic. 10 The basic rules for rotation of an object in Google Sketchup (Youtube.com/TheSketchupEssentials).

Once you get it, please rotate the object gently and look at the “Angle” box in the bottom right at once. You will stop the rotation when the value there hits 135° (Pic. 12).

Google Sketchup rotation object

Pic. 12 Rotation of our feature in Google SketchUp with looking at the rotation value simultaneously.

7. After rotation of our object, we can spot, that it’s now quite far away from the place where all the axes cross each other (Pic. 12). In the practical sense, the point where all these axes meet each other corresponds exactly to our further object location. Therefore we should do our best to stick our object with the place of axes crossing. I am coming out with two solutions. The first one is just simply dragging our object towards this place (Pic. 13).

Google Sketchup moving element

Pic. 13 Moving objects in Google Sketchup.

The second one might be more interesting for you because you can simply adjust the point of access crossing to any part of your building. It sounds amazing, and the details can see in the video below.

When you select “Tools” -> “Axes”, just next to your cursor you will see the miniature of the Sketchup axes. By sticking them to the edge of your object you are setting the new point of axes crossing, which will be side by side to your object from now (Pic. 14).

Google Sketchup setting new point for axes crossing

Pic. 14 Setting the new point of axes crossing in Google Sketchup, which becomes sticky with an edge of our object from now.

8. The last thing before export is the geolocation of your object. If you have the Pro version or an account in Trimble, the previous two steps won’t be as much complicated as described above. You can geolocate your object automatically and adjust its orientation as per the map overlay underneath.
However, if your situation is the same as mine, and you have neither pro version nor account, then the only way to get our building located properly is using the manual way, which remains fortunately available so far.
You should go to the “Window” option in the main bar and select “Model info” -> “Geolocation“, where you should set the coordinates properly (Pic. 15).

Google Sketchup setting location manually

Pic. 15 Setting the location manually in Google Sketchup.

The best way to do it is to get the coordinates from Google Maps by right-clicking on a certain place and copying the first line to the clipboard as shown below (Pic. 16).

Google Maps getting coordinates and copying to the clipboard

Pic. 16 Getting coordinates from Google Maps and copying them to the clipboard. Red point shows roughly where we have clicked by the mouse. Blue bounded data is the coordinates data, which can be copied to the clipboard.

The most important thing to take a look at here is the red dot marked in the picture above. It shows roughly where we have clicked by the mouse. If we decide to use the coordinates populated in the box (bounded blue), this point will become the center of the axes in Google Sketchup! Therefore sticking our object with the place where all the axes converge is really important.

Google Sketchup model manually geolocated

Pic. 17 Our model is manually geolocated in Google Sketchup.

When we finish the manual geolocation of our object, we should see the geolocation icon in the bottom bar turned red instead of black as previously.

9. Now, finally we can export our object as the .kmz file. We can select “File” from our main top bar and next “Export” -> “3D Model” -> “Save as type” -> .kmz.

10. The essence of our work is opening our Sweet Home 3D model in Google Earth (Pic. 18).

Sweet Home 3D model in Google Earth

Pic. 18 Our Sweet Home 3D model in Google Earth.

However, there is one, very last thing to look at. Google Earth works on a slightly different basis as Sketchup does. The origin of the cartesian system falls at an opposite corner of the building, as you can see above. It means, that some shifts might be required when you transfer the 3D model from Google Sketchup to Google Earth manually. Fixing is simple. You should measure the difference in distance between the place where your 3D object has been set and the place, where it should be. Afterward, you can use this distance for moving your object in Google Sketchup and exporting it again.

ALTERNATIVE WAY OF GOOGLE SKETCHUP OBJECT MANUAL GEOLOCATION

According to the last sentence above, if you don’t want to move your object in Sketchup and export it again, you can always make these alterations within the .kmz file. First of all, you will need to extract the .kml component of this file in order to change some XML code inside. With the aim of it, you should be equipped with the 7Zip software, which can unzip your .kmz file properly.

KMZ file 7Zip

Pic. 19 Unzipping the .kmz file with our 3D model in 7Zip.

Next run for instance the Notepad ++ application, which can open the .kml file content and edit the values in the code shown below (Pic. 20).

KML file content changes in Notepad ++

Pic. 20 Rotation and coordinates can be changed manually in Notepad ++ or other applications able to read the content of the .kml file.

Upload the extracted .kml file back to the .kmz directory when you are done. Finally, you should get the same effect. If at some point the building is placed some distance away from the desired place, you can just get the coordinates from Google Maps and paste them in the code shown above (Pic. 20).

Sweet Home 3D model in Google Earth Pro

Pic. 21 Your Sweet Tome 3D model can look in Google Earth the same as mine.

Mariusz Krukar

 

Links:

  1. http://www.sweethome3d.com/
  2. Sweet Home 3D online
  3. Opensource.com: Interior design sweet home 3d
  4. Inches to centimeters converter
  5. AccuTrans 3D Software
  6. Sourceforge.net: Sweethome 3d – feature-requests/
  7. https://www.livehome3d.com/
  8. Help.sketchup.com: FAQ-add-location-changes-sketchup
  9. https://ladedu.com/how-to-use-the-snip-and-sketch-protractor-to-measure-angles/
  10. https://developers.google.com/kml/documentation/kmlreference#orientation

 

Forums:

  1. Viewing Sweet Home 3D model in Google Earth Pro
  2. Ways to get a better 3D view / Export to SketchUp and Google Earth
  3. Is there a way to enter building dimensions from a GPS device
  4. Export to Sketchup and Google Earth
  5. How to export from SweetHome3D to Sketchup for producing a cross section view

Wiki:

  1. Cartesian_coordinate_system
  2. Sweet_Home_3D

 

Youtube:

The post A guide for displaying the Sweet Home 3D model in Google Earth first appeared on MkrGeo.

]]>
http://www.mkrgeo-blog.com/a-guide-for-displaying-the-sweet-home-3d-model-in-google-earth/feed/ 0 65669
Populating multiple Excel sheet stuff in QGIS http://www.mkrgeo-blog.com/populating-multiple-excel-sheet-stuff-in-qgis/ http://www.mkrgeo-blog.com/populating-multiple-excel-sheet-stuff-in-qgis/#respond Mon, 06 Dec 2021 19:35:42 +0000 http://www.mkrgeo-blog.com/?p=65612 Populating multiple Excel sheet stuff in QGIS MkrGeo

Today I would like to discuss the process of how can we plot bulk data located in multiple Excel worksheets to QGIS and display them as the point layer. I definitely mean the situation, when your Excel data is equipped with the geometry, which allows the QGIS to locate all points correctly. The pivot of […]

The post Populating multiple Excel sheet stuff in QGIS first appeared on MkrGeo.

]]>
Populating multiple Excel sheet stuff in QGIS MkrGeo

Today I would like to discuss the process of how can we plot bulk data located in multiple Excel worksheets to QGIS and display them as the point layer.
I definitely mean the situation, when your Excel data is equipped with the geometry, which allows the QGIS to locate all points correctly. The pivot of this article is the explanation of how to cope quickly with the data located in various worksheets across the workbook. It might happen, that our data have been already categorized and put into different worksheets separately. When our workbook is comprised of, for instance, 20 worksheets we might think that you can’t handle this task relatively quickly. Nothing more wrong. With all the steps presented below, you will be able to cope with it within less than 5 minutes!

Imagine, that your Excel workbook with some data with address looks like this one below (Pic. 1):

Excel workbook multiple sheets

Pic. 1 Excel workbook with multiple worksheets, which store some data with the address. The total number of sheets was already calculated.

which has more than 40 sheets, calculated swiftly by the VBA code presented below.

Public Sub CountWorkSheets()
MsgBox "The total number sheets of this workbook: " & Application.Sheets.Count
End Sub

What you can do next? The first reasonable way, that comes to your mind is to put all this data together. We could do it in Excel by copying and pasting them to one sheet, but we don’t need to do that! Moreover, the final data, which we need must be in the .csv file, if we want to make it readable for the QGIS.

What we should focus on is extracting all sheets from our workbook and saving them as separate files, preferably the .csv files. Since our initial Excel workbook includes 44 worksheets, we will get 44 other files. Furthermore, it would be vital to keep the names of our sheets, as they appear in Excel in order to avoid a potential mess and ambiguity.

There is a nice VBA code, which would do this job for us! The code looks as follows:

Sub ExportSheetsToCSV()
Dim xWs As Worksheet
Dim xcsvFile As String
For Each xWs In Application.ActiveWorkbook.Worksheets
xWs.Copy
xcsvFile = ThisWorkbook.Path & "\" & xWs.Name & ".csv"
Application.ActiveWorkbook.SaveAs Filename:=xcsvFile, _
FileFormat:=xlCSV, CreateBackup:=False
Application.ActiveWorkbook.Saved = True
Application.ActiveWorkbook.Close
Next
End Sub

where you define the path of your new .csv files. It’s good to keep them in the same path where the mother Excel workbook is located, but you don’t need necessarily to do it. When your code is ready, just run it and give it some time (several seconds to 2-3 minutes), which depends on the total number of sheets to extract.
When everything is ready, your directory content should look like below (Pic. 2):

Excel extract workbook to separate .csv file

Pic. 2 Excel workbooks extracted to the separate .csv files located in the directory.

Now, since everything is located in our directory, we should find the quickest way to plot all of the files in QGIS as the point layers. The reasonable option here will be the Python console. One of the codes, which we can use look like below:

import glob, os

# Define path to directory of your csv files
path_to_csv = "C:/my/directory/Ely/"

# Set current directory to path of csv files
os.chdir(path_to_csv) 
# Find each .csv file and load them as vector layers
for fname in glob.glob("*.csv"): 
# Define your CRS and columns with geometry
uri = "file:///" + path_to_csv + fname + "?delimiter=%s&crs=epsg:27700&xField=%s&yField=%s" % (",", "Easting", "Northing")
name = fname.replace('.csv', '')
lyr = QgsVectorLayer(uri, name, 'delimitedtext')
QgsProject.instance().addMapLayer(lyr)

where we should define the CRS system we are working on as well as the columns which include the geometry data. It can be respectively “X” and “Y“, “Lon“, “Lat” or “Easting“, “Northing” like in my case. You will get to know simultaneously which .csv files have the geometry missing. In this event, they won’t be plotted in QGIS at all.
Wait a few seconds and see your result. All delimited text layers, which geometry columns titles match with these defined in the code above (“Easting”, “Northing”) are now visible in our QGIS project.
On the other hand, you can see the layers, which have not been loaded correctly because of the potential lack of geometry or at least the different names of columns defining it (Pic. 3).

CSV files plotted in QGIS at once by Python console

Pic. 3 The .csv files are plotted to QGIS at once by using the Python console. Red bounded 2 layers weren’t loaded correctly due to a lack of the geometry defined in the code. Therefore they’re not visible on the map.

Our next step seems to be making just one point layer from these all 44 provided. In this case, we can use the MMQGIS plugin, which will do it for us quickly. Once you install this plugin, you should have the MMQGIS options.
From the MMQGIS options select “Combine” -> “Merge layers” and next your first thing after selecting all the layers you want to merge should be the definition of the output file. You have the choice between the Shapefile, GeoJSON, Spatialite, KML or GPKG. When you defined your output file, just click “Apply” and see how the algorithm is running (Pic. 4).

MMQGIS merging point layers

Pic. 4 Merging point layers by MMQGIS layer.

The data should be merget successfully, but sometimes you might see the following error:

“Error: creation of data source failed (OGR error:Failed to create directory .geojson for shapefile datastore.)”

which means, that you didn’t specify the fiilename for the export. Even if the error such as this appear, your new file will emerge in the “Layers” panel. Now it looks like we are done. You have all the Excel data plotted to QGIS and finally merged as the one layer (Pic. 5).

QGIS merged point layer

Pic. 5 All point layers merged as one with changed styling and moving it to the top.

If you are not sure, that the process has been completed correctly, you can play with the styling a bit and move your final layer to the top, as you can see above.

Everything, I believe shouldn’t last more than 5 minutes, when considering some average Excel file with about 10K records as in the example provided.

Mariusz Krukar

 

Links:

  1. https://www.extendoffice.com/documents/excel/1585-excel-count-the-number-of-sheets.html
  2. https://www.extendoffice.com/documents/excel/2972-excel-save-export-convert-multiple-all-sheets-to-csv-text.html
  3. http://chris35wills.github.io/multi_csv_into_qgis/

 

Forums:

  1. https://gis.stackexchange.com/questions/212910/loading-multiple-csv-files-into-qgis-2-10
  2. https://gis.stackexchange.com/questions/25061/merging-multiple-vector-layers-to-one-layer-using-qgis
  3. https://gis.stackexchange.com/questions/93300/fixing-error-creation-of-data-source-failed-ogr-errorfailed-to-create-direct

 

The post Populating multiple Excel sheet stuff in QGIS first appeared on MkrGeo.

]]>
http://www.mkrgeo-blog.com/populating-multiple-excel-sheet-stuff-in-qgis/feed/ 0 65612
What determines the brightness of the star and how to measure it? http://www.mkrgeo-blog.com/what-determines-the-brightness-of-the-star-and-how-to-measure-it/ http://www.mkrgeo-blog.com/what-determines-the-brightness-of-the-star-and-how-to-measure-it/#respond Fri, 26 Nov 2021 22:46:04 +0000 http://www.mkrgeo-blog.com/?p=65499 What determines the brightness of the star and how to measure it? MkrGeo

The stary night is a nice view for everyone I guess quite often we like to lie on the ground and gaze at the sky full of stars. In the whole Milky Way, we have about 100K of stars, whereas only 7K can be visible by the naked eye under the pristine night sky, completely […]

The post What determines the brightness of the star and how to measure it? first appeared on MkrGeo.

]]>
What determines the brightness of the star and how to measure it? MkrGeo

The stary night is a nice view for everyone I guess quite often we like to lie on the ground and gaze at the sky full of stars. In the whole Milky Way, we have about 100K of stars, whereas only 7K can be visible by the naked eye under the pristine night sky, completely free of light pollution. I am heading to describe to you 50 of the brightest stars, which can be easily spotted even in intensively illuminated urban areas. However, this description cannot be progressed without the basic knowledge about the brightness of the stars and what elements rule them. I hope to expand this topic in the future because the subject of stars will be back here at least several times and some piece of knowledge compacted in the separate articles is essential. For now, my goal is to run you through the most basic information about the stars.

I. A FEW WORDS ABOUT THE HERTZSPRUNG-RUSSEL DIAGRAM

The Hertzsprung-Russel Diagram (known also as H-R Diagram) is a scatter plot of stars, which displays the relationship between the star’s absolute magnitudes or luminosities and their classification based mostly on the surface temperatures. The H-R Diagram comprises regions with different types of stars with respect to their types and evolutionary stages. Most of the stars occupy the middle region of the diagram along the main-sequence line. The main-sequence line is a continuous and distinctive band of stars which variation is based on their color (temperature) versus brightness. All these stars represent their “adult” period of the lifecycle, where the hydrogen is fused in their cores. The lower region of the main sequence is more crowded than the upper region. At the lower end, the stars are red in color (due to their low temperature) and small in size. They’re called therefore as the red dwarfs. The red dwarf is the most common type of star in the Milky Way, at least in the vicinity of the Sun.
At the bottom end of the H-R diagram, we can see the brown dwarfs. Brown dwarfs are substellar objects, that are not massive enough to sustain nuclear fusion. Their mass straddle somewhere between the most massive giant planets and red stars. It can correspond to between 13-80 masses of Jupiter on average.
The bottom left part of the H-R diagram is represented by white dwarfs – the stellar core remnants, which no longer undergo fusion reaction. They are very hot when form, but because they have no source of energy they gradually cool and radiate their energy away. In general, the white dwarfs are about 10 magnitudes fainter than the main sequence stars of the same spectral class and so must have a very small surface area and radius (Bhatia, 2001).
Between the white dwarfs and the main sequence, we can find subdwarfs. Subdwarfs are classified as stars with a magnitude 1.5 – 2 lower than stars from the main sequence at the same spectral type. We can distinguish cool subdwarfs, hot subdwarfs, and heavy metal subdwarfs.
Moving on the other side of the main sequence we can list the giant stars. The smallest in this region are subgiants, which represent the same type of star from the main sequence which is simply older. The subgiants can be treated as the former main-sequence stars. It means, that they have the same mass as their main-sequence counterparts, but their chemical composition includes more helium than hydrogen. Going up we have giant stars, which are substantially larger and brighter than stars in the main sequence. The typical giant stars are 10-100x larger than Sun and 10-1000x more luminous than Sun (Moore, 2002).
Between ordinary giants and supergiants, we have the bright (blue) giants. This type of star is at the finish of burning its hydrogen yet before it has started burning helium. The blue color and high temperature are the effects of the intensive burn of the remaining hydrogen. This process will last shortly until the star starts to burn helium and become the red giant.
Red giants represent the late stage of stellar evolution, where star burns helium. The atmosphere of the red giant is inflated and tenuous with a quite low surface temperature, giving the star a reddish appearance. The essence of the red giant has been explained later in this article.
Supergiants are brighter by giants by about 5 magnitudes and have about 100 solar radii (Bathia, 2001). Their mass exceeds between 8-12x solar mass. The supergiants mark the advanced evolutionary stage of the star, which starts to burn helium into carbon and oxygen. That heats the interior of the star and causes its exteriors to swell, which is typical before the star dies. The star at this stage can become the red supergiant or blue supergiant if other elements in its core are fused. The blue color of supergiant is an effect of a significant size drop from hundreds of solar radii to around 25 of solar radii. The biggest and very rare type of star is hypergiant. The hypergiants are the most massive stars in the universe and the most massive stars ever measured. They are significantly brighter than supergiants. They can be divided into blue, yellow, and red hypergiants. They live only a few million years.

The last interesting element, which can be noticed in the H-R diagram is the empty region, which is called the Hertzsprung gap. The primary feature of this region is the absence of stars, which is driven by rapid star evolution. This region covers the early evolutionary period when the hydrogen is being burnt in a shell around the core of helium before the onset of helium burning. The stars during their evolution move rapidly through the Hertzsprung gap compared to their whole lifetime. This stage can last as little as a few thousand years.

Thanks to the H-R diagram scientists can roughly determine the distance of a given star cluster or galaxy from Earth. This can be done by comparison of the apparent magnitude of the stars in the cluster to absolute magnitudes of stars with known distances. The H-R diagram is one of the most useful tools for the study of stars and their physical properties (Bhatia, 2001).

Hertzsprung-Russell Diagram

Pic. 1 The full Hertzsprung-Russel Diagram (Eso.org). Click to enlarge.

II. WHAT DETERMINES THE BRIGHTNESS OF THE STAR?

Watching the sky, we often ask ourselves – why some stars are brighter than others? By the naked eye, we can see up to 7000 stars in areas free of light pollution. In the next article, I would like to mention about just only 50 stars, the brightest ones? If you are a little green at astronomy, you might think that the brightest stars are also the biggest or the closest. Partially you will be right, but we should take into account also other factors. The crucial factors determining the brightness of the star are:

  • Spectral characteristic (temperature of the photosphere) – which is based on the Star’s electromagnetic radiation. The light from the star is analyzed by splitting it with a prism or diffraction grating into a spectrum likewise visible in the rainbow. Each element indicates a particular chemical element or molecule with the line strength indicating the abundance of that element.  They vary predominantly due to the temperature of the photosphere. Most stars are classified under the Morgan – Keenan (MK) system with the letters following the photosphere temperature from hot to cool: O, B, A, F, G, K, M. To be funny – it’s a good mnemonic for this sequence: “Oh Be A Fine Girl [or Guy], Kiss Me.” Each letter class is subdivided using numeric digits from 0 to 9, where 0 means hot and 9 means cool. Furthermore, additional letters have been used for describing novas, dwarfs, or carbon stars.  It’s also another  – Yerkes classification based on temperature and luminosity, which classifies the stars under roman numbers, but the Morgan – Keenan (MK) classification remains commonly in use.
    By knowing the color of the star we can estimate its surface temperature. The surface temperature determines the star brightness, which explains the Stefan-Boltzmann law. It says, that hotter stars emit more radiation per unit surface than cooler stars. If the reddish and bluish stars have the same luminosity, then the reddish star must be larger than a bluish star because the reddish star must have more surface area than the bluish star to produce the same luminosity, the Stefan-Boltzmann law says so. The law considers the effective temperature, which corresponds to the temperature of a black body with the same luminosity per surface area.  The dependence of the star colors from the temperature explains also Wien’s displacement law, which states, that for higher temperatures the wavelength of thermal radiation is shorter.  The star colors are the output of three electromagnetic wavelengths, whereas each of them represents the major chemical component building the star. The combination of these three wavelengths is referred to as the Plank’scurve.

    H-R diagram stars

    Pic. 2 Simplified H-R diagram including the stars only from the main sequence. It shows the clear evidence between size, temperature, and brightness (Borja Tosar/Bbvaopenmind.com.)

  • Mass – there is a strong relationship between the star’s mass and its luminosity, which can be described by the following formula: L = (M)3+β, where the L is the luminosity of a star in the main sequence and M the star’s mass given in the solar units.  It means that if the star’s mass is doubled by 2, the luminosity increases by a factor of 2 3.5 = 11 times. This relationship comes arises out of determining the size, radius, and temperature of the star and it’s called the mass-luminosity relation. In a practical sense, it’s the correlation between the mass of a star and the rate at which it emits (and therefore produces) the energy (Duric, 2004). The star masses vary across the main HR sequence. The lowest mass main sequence stars have about 0.07 of the solar mass, and the most massive stars commonly encountered have about 60 solar masses (Kutner, 2003).
  • Evolutionary stage – is somewhat an output of the major star properties like mass, size, temperature, or spectral type. All these factors combined together place stars in their evolutionary sequence. The same as spectral characteristic and mass, the evolutionary stage is an element of stars classification in the Hertzsprung-Russel diagram (Pic. 3).
    HR diagram life cycle of stars

    Pic. 3 The general life cycle of stars depicted on the HR diagram (Gdn.glos.ac.uk).

    The brightness of the star at its certain evolutionary stage is shaped by its mass and composition. Since the star reaches the main-sequence stage, the lifecycle is based on the fusion of hydrogen to helium, which accumulates in the star’s core eventually. As the percentage of helium, which is thought to be like “ash” from nuclear “burning” of hydrogen. As the helium accumulates in the center of the star, the temperature and density in the inner regions slightly increase. By increment of the temperature, the level of fusion goes up, thereby the rate at which energy is being generated also rises, which leads to gradual boosting of luminosity by that. As long as the star’s evolutionary stage remains in the main-sequence band these changes are minor. Everything changes when there is no more hydrogen for fusion reactions. Helium requires a much higher temperature for fusion, which is impossible. In turn, gravity takes over and the core begins to contract. The energy of inward-falling material is converted to the heat, which is generated this way flows outward to cooler regions, which now expand. The star grows until enormous proportions, whereas the temperature of its outer layers drops simultaneously shifting the star’s overall color towards red. This is the moment, at which the star is more luminous and cooler. The red giant stage indicates also the higher brightness of the star in its lifecycle.

  •  Chemical composition – as it has been told just previously, the chemical composition changes throughout the star’s lifecycle. In turn, it impacts its brightness slightly as per the evolutionary stage.  Looking at it from a different point of view, the chemical composition is the element, which helps to distinguish the types of stars. It refers mostly to the proportion of heavy elements against hydrogen and helium. Since the average atmosphere of the star consists mostly of hydrogen (87%) and helium (10%), the remaining 3% are heavy elements, which include carbon, sodium, silicon, iron, calcium, lithium, or magnesium. The star’s brightness is shaped mostly by the first two chemical elements, although when the star becomes older, the other chemical elements remain more visible through the emission of a particular wavelength. The relation between the chemical composition and temperature and therefore brightness is based on atom movement. As temperature increases the electrons are kicked up to higher levels by collision with other atoms. Large atoms have more kinetic energy, so their electrons are excited first, followed by lower mass atoms. At high temperatures, the collision is strong enough to atom ionization. In practice, the low-temperature stars will feature the abundance of heavy atoms like calcium or magnesium on the contrary of high-temperature stars, where lighter atoms (like hydrogen) prevail.
  • Size – can be gained by star radius measurement. Assuming, that two stars with the same surface temperature have a different radius, the star with a bigger radius will be brighter. The difference in the luminosity is proportional to the square of the size. The calculation here is really straightforward, and looks as below:
    L – luminosity, R – radius
    L = R2
    L = 52 = 5 x 5 = 25
    So according to the formula above, the star with a 5x bigger radius will be 25x brighter.
  • Distance – there is a simple relation between the brightness of the star and the distance to it. The brightness decreases proportionally to the square of the distance as one moves away from the star. It’s explained by the inverse square law.
  • Behaviour – it refers to any kind of variable star, which brightness, as seen from Earth, fluctuates. These brightness fluctuations might be driven by periodical swelling and shrinking of the star or by a simple change in the amount of light reaching Earth. The first case – intrinsic variable stars,  refers to pulsating variable stars, cepheids, or long period variable stars. The last ones are characterized by fairly regular light fluctuations and require many months or several years to complete the cycle. They can change even a hundredfold in brightness.
    Variable stars intrinsic

    Pic. 4 Intrinsic variable star types in the Hertzsprung – Russel Diagram (Wikimedia.org).

    The second group of variable stars – extrinsic variable stars is featured by changing the amount of light reaching Earth. As it has been told earlier, it can be caused by the following:
    -> rotation of the star – it applies to the stars with sizeable sunspots, which may show the significant variation of brightness as they rotate,
    -> eclipsing binaries – if we face the binary system of stars, then for the terrestrial observer, watching them from a certain angle, one star may eclipse another one resulting reduction in brightness.
    -> planetary transits – can also cause variations in brightness, although they are much smaller and can be detected by extremely accurate observations.

  • Lifespan – is strongly related to the star mass. Generally, the more massive a star is, the faster its fuel supply depletes, which translates into a shorter lifecycle. The reason behind it is, that as the star is heavier, the greater gravitational force makes it contract. Therefore the bigger internal pressure is needed to stop that contraction. It results in a hotter core by the increment of the nuclear reaction. The high rate of nuclear reaction decreases the lifespan of a star. As the star burns its fuel out much faster, it’s more luminous. By knowing the luminosity of a star we can determine how rapidly the star is using up its fuel supply. Thereby the lifetime of the star is proportional to the mass of fuel available divided by the luminosity. It’s associated with the mass-luminosity relationship explained above.
    From a practical point of view, more massive stars feature shorter lifecycle but are brighter.

III. HOW THE BRIGHTNESS OF THE STAR CAN BE MEASURED?

The basic unit, which measures the brightness of the star (or other celestial body) is a magnitude. The magnitude is the logarithmic-based scale, which appears to work in reverse. The dimmer object appears the higher the numerical value is given to its magnitude. This is because the initial scale system was designed like this. In the Hipparchus times, the brightness of the celestial objects was estimated by the eye and then split into 6 categories, where the 1st magnitude was meaning the brightest object and the 6th magnitude the faintest one. As humans developed proper instruments to make the brightness measurements more detailed, the astronomers decided to expand this scale. In turn, the magnitude scale remained intact to this day. Its basis is still the same as it was in ancient times – the brighter the object, the lower the number assigned as a magnitude.

There are two types of magnitude, which can define the star brightness. This is the apparent magnitude and absolute magnitude. Firstly we will discuss the apparent magnitude, on which the very first star’s brightness classification was based. Apparent magnitude defines the brightness of an object as it appears in the night sky. As of 1850, the magnitude scale is defined much more precisely than just eyeball judgment. The scale was expanded down to 30th magnitude (Inglis, 2007) for the least bright celestial objects, which are about 2,5 billion times dimmer than the faintest objects visible by the naked eye (Schaaf, 2008). The scale was also expanded up to the Sun, which is blindingly bright and 1.6 trillion times brighter than the faintest star we can see by unaided eye (Schaaf, 2008) It was also noticed, that the brightest stars at 1st magnitude were around 100x brighter than 6th magnitude stars, and conversely, the 6th magnitude star is 100x dimer than 1st magnitude star. It led to the split of this scale logarithmically, where five magnitude steps corresponded precisely to a factor of 100 in brightness (Tassoul, 2004). In practice, the gap between each magnitude is equal to the fifth root of 100, which corresponds closely to 2.5118864 exactly (Schaaf, 2008). This is the Pogson ratio.
The final formula for the apparent magnitude is: Magnitude formula2where:
m – magnitude (mref – reference magnitude)
I – brightness (Iref – reference brightness)

By using this formula we can attend to practical measurements of brightness instead of simple classification.

1m: brightness factor of 2.512
2m: brightness factor of 2.512 x 2.512 = 6.31
3m: brightness factor of 2.512 x 2.512 x 2.512 = 15.84
4m: brightness factor of 2.512 x 2.512 x 2.512 x 2.512 = 39.81
5m: brightness factor of 2.512 x 2.512 x 2.512 x 2.512 x 2.512 = 100
10m = 100 x 100 = brightness factor of 10,000 times
15m = 100 x 100 x 100 = brightness factor of 1,000,000 times
20m = 100 x 100 x 100 x 100 = brightness factor of 100,000,000 times
Apparent magnitude scale

Pic. 5 The apparent magnitude scale (Earthsky.org/GCSE Astronomy).

Apparent brightness graphic explanation

Pic. 6 The graphic explanation of the apparent brightness of the stars (Astronomy.swin.edu.au).

The apparent magnitude can be measured by three common methods:

-> photoelectric photometer – the most efficient method, because the instrument measures the intensity of light it receives. Moreover, it should be calibrated to the brightness of the Vega star, which apparent magnitude is close to 0. The measurement can be based on differential photometry, where the brightness of at least 2 stars is measured and absolute photometry, which is based on the instrument calibration, as mentioned above.
-> long-exposure photography – this kind of photography is nonlinear itself, although in digital cameras we can know the brightness number of each pixel. This number will be proportional to the number of photons falling onto that pixel during the exposure.
-> human eye – the least efficient method, which is based only on the visual comparison between the stars of known brightness and stars of unknown brightness. Some experienced astronomers can make a comparison such as this with 10% accuracy.

Apparent magnitude of well-known objects

Pic. 7 The apparent magnitude of well-known objects (Courses.lumenlearning.com).

Another way of defining the brightness of the stars is absolute magnitude. The basic difference between these two types of magnitude is the distance, from which the star is seen. Since the apparent magnitude defines the star’s brightness as seen from Earth, the absolute magnitude measures its brightness from a certain distance. This distance is roughly 10 parsecs, which corresponds to about 32.6 light-years.

Apparent magnitude vs absolute magnitude

Pic. 8 The graphic explanation of the difference between apparent magnitude and absolute magnitude (Ou.edu).

Moreover, the value of absolute magnitude is assumed to be free of extinction of the starlight caused by cosmic dust and interstellar matter. The absolute magnitude can be expressed by the following formula:

Apparent magnitude formula

where:

m – apparent magnitude
M – absolute magnitude
d – distance to the star measured in parsecs (pc)

The value of absolute magnitude allows scientists to compare the intrinsic brightness of stars.
If we know both the apparent magnitude and absolute magnitude of the given star, we can easily calculate the distance to this star.
The basic limitation of the absolute magnitude is the determination of the light wavelength for measurements and sensitivity of the instrument used for these measurements, which is different for various wavelengths of the light due to the type of light detector. That’s why we should mention the bolometric magnitude, which measures the total radiation of the star emitted across all wavelengths of the electromagnetic spectrum. The basic difference between monochromatic and bolometric magnitude states the spectrum of light measurement. Monochromatic magnitude measures a very narrow segment of the spectrum, which is the visual band of the spectrum. In turn, the bolometric magnitude measurements include a star’s entire radiation, including also the bands unobservable due to instrumental passbands and extinction by Earth’s atmosphere and interstellar dust. In the star brightness measurements, we can use the bolometric correction, which must be made to the absolute magnitude of an object in order to convert an object’s visible magnitude to its bolometric magnitude.

IV. RELATION BETWEEN BRIGHTNESS AND LUMINOSITY

Luminosity is the rate at which the star radiates energy into space. Otherworldly is the total power output of the star and another celestial object. The relationship between a star’s brightness and luminosity can be explained by the inverse square law. It can be expressed by the following formula:

Luminosity formula

where:

b – apparent brightness of the star,
d – the distance to the star,
L – the luminosity of the star,

Luminosity doesn’t depend on the distance to the star. It states roughly how “bright” the star is, and it’s expressed in Watt units. Luminosity can be measured by the amount of flux radiation hitting the Earth and the distance to the star. The flux is energy per unit area, which can be measured i.e. by detector attached to the telescope. Thereby we can get the distance to the star.

Relation between brightness and luminosity of the star

Pic. 9 Relation between luminosity and brightness of the star (Pages.uoregon.edu).

The image above shows the relation between a star’s luminosity and its brightness. Brightness decreases proportionally to the square of the distance as we move away from the star. The rate of energy which reaches the observer on Earth is the apparent brightness. Apart from the magnitude scale presented above, the apparent brightness can be expressed in watts/m2. For example, the apparent brightness of the Sun is 1370W/m2. It means, that if we could have the solar panel held perpendicularly to solar rays, we would receive 1370 Watts of electricity. It’s only the pure theoretical assumption because solar rays go through Earth’s atmosphere ad solar panels are not perfectly efficient. For the comparison, the brightest star – Sirius has its apparent brightness of 10-7 W/m2. It means, that if you would like to light u a 10 watt bulb with the energy of Sirius you would need a 10km length of solar panel.
The consideration about Sirius as well as other brightest stars have been left for another text immediatelly following this one.

Mariusz Krukar

 

References:

  1. Bhatia V.B., 2001, Textbook of Astronomy and Astrophysics with Elements of Cosmology, University of Delhi, Delhi
  2. Duric N., 2004, Advanced Astrophysics, Cambridge University Press, Cambridge
  3. Inglis M., 2007, Astrophysics is Easy!: An Introduction for the Amateur Astronomer, Springer International Publishing, Cham
  4. Jaschek C., Jaschek M., 1987, The classification of stars, Cambridge University Press, Cambridge
  5. Koupelis T., 2011, In quest of the Universe, Jones and Barlett Publishers, Mississauga
  6. Kutner M.L., 2003, Astronomy: A physical perspective, Cambridge University Press, Cambridge
  7. Moore P., 2002, Giant star (in:) Astronomy Encyclopedia, Oxford University Press, New York.
  8. Schaaf F., 2008, The brightest stars. Discovering the universe through the sky’s most brilliant stars, John Wiley & Sons, Hoboken
  9. Tassoul J.L., 2004, A concise history of solar and stellar physics, Princeton University Press, Princeton
  10. Zeilik M., 2002, Astronomy: The evolving universe, Cambridge University Press, New York

Links:

  1. The brightness of the stars
  2. https://www.scholastic.com/teachers/articles/teaching-content/all-about-stars/
  3. The astronomical magnitude scale
  4. Stellar brightness
  5. https://www.visualcapitalist.com/the-44-closest-stars-and-how-they-compare-to-our-sun/
  6. https://www.space.com/21640-star-luminosity-and-magnitude.html
  7. https://www.sidmartinbio.org/what-three-factors-determine-the-brightness-of-a-star/
  8. Apparent and absolute magnitude
  9. https://www.britannica.com/science/magnitude-astronomy
  10. Star magnitude calculator
  11. Star brightness calculator based on the apparent magnitude
  12. https://www.britannica.com/science/stellar-classification
  13. Libraries of the stellar spectra
  14. https://lco.global/spacebook/distance/magnitude-and-color/
  15. https://www.teachastronomy.com/textbook/Properties-of-Stars/Stefan-Boltzmann-Law/
  16. https://www.bbvaopenmind.com/en/science/physics/the-colour-of-stars-treasure-map-for-astronomers/
  17. https://www.britannica.com/science/star-astronomy/Numbers-of-stars-versus-luminosity
  18. https://www.cliffsnotes.com/study-guides/astronomy/the-hertzsprung-russell-diagram/mass-luminosity-relationship
  19. The evolutionary cycle of stars
  20. The life and death of the stars
  21. https://www.cliffsnotes.com/study-guides/astronomy/the-hertzsprung-russell-diagram/hertzsprung-russell-diagram-the-basics
  22. https://courses.lumenlearning.com/astronomy/chapter/evolution-from-the-main-sequence-to-red-giants/
  23. The life of a star
  24. How do we determine the life cycles of stars and tag some as “young” and some as “old?”
  25. https://courses.lumenlearning.com/astronomy/chapter/the-brightness-of-stars/
  26. Wien’s displacement law
  27. Astro.rug.nl: Basic properties of stars
  28. Plank Radiation Formula
  29. https://www.universetoday.com/130870/stars-different-colors/
  30. https://earthsky.org/astronomy-essentials/stellar-luminosity-the-true-brightness-of-stars/
  31. Luminosity – how far the things are
  32. Classifying stars
  33. Pulsating stars
  34. Long period variable star
  35. Stellar brightness
  36. https://answersdrive.com/what-are-the-factors-that-determine-the-brightness-of-a-star-7545092
  37. Stellar lifetimes
  38. Skyandtelescope.org: How do stars die and how long do stars live?
  39. Astronomynotes.com: Stellar evolution
  40. Are they planets or what?
  41. The difference between red giants and blue giants
  42. What are red giants?
  43. What are Hypergiant Stars Like?
  44. Astroquizzical.com: What’s the Hertzsprung gap?
  45. Earthsky.org: What-is-stellar-magnitude
  46. Dictionary.com: Pogson ratio
  47. Magnitudes – measuring the brightness of the stars
  48. https://astronomy.swin.edu.au/cosmos/a/Apparent+Magnitude
  49. https://www.phys.ksu.edu/personal/wysin/astro/magnitudes.html
  50. Brightness of the stars
  51. The stellar magnitude system
  52. How bright is a star?

 

Forums:

  1. https://www.quora.com/What-are-the-factors-that-affect-the-brightness-of-a-star
  2. https://astronomy.stackexchange.com/questions/36025/how-do-we-measure-the-brightness-of-the-stars
  3. https://www.quora.com/Does-blue-light-have-more-intensity-as-compared-to-red-light
  4. https://physics.stackexchange.com/questions/441695/with-the-same-power-output-which-color-of-light-give-the-most-intensity
  5. https://www.quora.com/When-viewed-from-Earth-a-red-star-and-a-blue-star-appear-to-be-equally-bright-What-can-you-infer-about-these-two-stars
  6. https://www.quora.com/How-is-a-blue-star-different-from-a-red-star
  7. https://www.quora.com/Is-a-star%E2%80%99s-brightness-the-same-thing-as-its-luminosity
  8. https://www.quora.com/Someone-says-the-Sun-seems-brighter-because-it-is-bigger-than-other-stars-What-would-you-say?top_ans=306517368
  9. https://www.quora.com/What-are-the-stages-in-the-life-of-a-star-and-what-happens-in-each
  10. https://www.quora.com/Why-are-stars-different-in-colour-and-in-brightness
  11. https://www.quora.com/What-is-the-chemical-compound-of-a-star
  12. https://www.quora.com/What-is-the-relationship-between-a-star-s-mass-and-how-long-it-stays-on-the-Main-Sequence
  13. https://www.quora.com/Why-do-high-mass-stars-have-shorter-life-spans-than-others
  14. https://www.quora.com/What-is-the-Hertzsprung-Russell-diagram
  15. https://www.quora.com/How-is-a-subdwarf-star-different-than-other-types-of-stars
  16. https://www.quora.com/What-is-the-difference-between-the-subgiant-stars-and-the-main-sequence-stars
  17. https://www.quora.com/What-causes-a-star-to-be-a-giant-or-a-supergiant
  18. https://www.quora.com/Why-do-stellar-magnitudes-get-smaller-into-the-negative-as-the-stars-themselves-get-visibly-brighter
  19. https://www.quora.com/How-do-you-judge-the-magnitude-of-a-star-with-any-accuracy
  20. https://www.quora.com/What-is-the-difference-between-apparent-magnitude-and-apparent-bolometric-magnitude
  21. https://astronomy.stackexchange.com/questions/19891/absolute-magnitude-and-absolute-bolometric-magnitude
  22. https://www.quora.com/How-is-the-size-and-luminosity-of-a-star-determined

Wiki:

  1. Absolute_magnitude
  2. Apparent_magnitude
  3. Brightness_temperature
  4. Bolometric_correction
  5. Brown_dwarf
  6. Effective_temperature
  7. Hertzsprung_gap
  8. Hertzsprung%E2%80%93Russell_diagram
  9. Inverse-square_law
  10. Luminosity
  11. Magnitude_(astronomy)
  12. Main_sequence
  13. Mass & luminosity_relation
  14. Planck’s law
  15. Red_dwarf
  16. Red_giant
  17. Stefan%E2%80%93Boltzmann_law
  18. Stellar_chemistry
  19. Stellar_classification
  20. Stellar_evolution
  21. Subgiant
  22. Supergiant
  23. Variable_star
  24. White_dwarf
  25. Wien’s_displacement_law

 

Read also:

  1. How bright the starlight is?
  2. The role of contrast in ability of human vision
  3. Light around us and how to measure it?

 

Youtube:

The post What determines the brightness of the star and how to measure it? first appeared on MkrGeo.

]]>
http://www.mkrgeo-blog.com/what-determines-the-brightness-of-the-star-and-how-to-measure-it/feed/ 0 65499
36 constructive tips & tricks for the Mapy.cz application http://www.mkrgeo-blog.com/36-constructive-tips-tricks-for-the-mapy-cz-application/ http://www.mkrgeo-blog.com/36-constructive-tips-tricks-for-the-mapy-cz-application/#respond Mon, 15 Nov 2021 19:02:12 +0000 http://www.mkrgeo-blog.com/?p=65390 36 constructive tips & tricks for the Mapy.cz application MkrGeo

The Mapy.cz is probably the best tourist map (and app) worldwide. It has been created by the Seznam.cz – one of the main web portals and search engines operating in the Czech Republic. The very first steps of this map portal have been taken in 1998. For long years the Mapy.cz was covering the Czech […]

The post 36 constructive tips & tricks for the Mapy.cz application first appeared on MkrGeo.

]]>
36 constructive tips & tricks for the Mapy.cz application MkrGeo

The Mapy.cz is probably the best tourist map (and app) worldwide. It has been created by the Seznam.cz – one of the main web portals and search engines operating in the Czech Republic. The very first steps of this map portal have been taken in 1998. For long years the Mapy.cz was covering the Czech Republic bounds only.  This situation started to change in 2011, when the Mapy.cz expanded on the Slovakian territory. A breakthrough year was 2014. In late 2014 the Mapy.cz service started to collaborate with the OpenStreetMap project, which has led to expanding the maps services all over the world, as all the maps could be browsed globally. Since that time the number of users rose incredibly reaching over 2 billion in 2017.  Nowadays the Mapy.cz service can firmly content with Google Maps and other maps platforms, because of a multitude of features available both in the desktop and Android version.
The Mapy.cz is a well-prepared Czech equivalent for Google Maps, which comes out with quite a lot of extra features, like for instance the outdoor map.  The service development is still in progress, which means, that some areas can be performed better than others. In fact, Czechia will have always the most details, as it’s the mother country of this fantastic application.
In this article I would like to describe all the practical and incredible things, which you can do having the Mapy.cz map platform opened a front of yourself. Some of them have been described already, but there is still a lack of description in English and if exist it’s quite lapidary.

I. WORLDWIDE MAP FEATURES

1. Check the historical satellite imagery – this is a cool option for comparing the satellite view in the span of last nearly 20 years. It does work the best for Czechia and Slovakia.

Mapy.cz satellite imagery selection

Pic. 1 The selection of satellite imagery with an example below.

2. Best, Biggest, Highest, Oldest (…) places in the given country or worldwide (Records or Curiosities) – by using the “Geographic Map”, a user can check i.e. the highest peak in the specified country, the oldest landmark, and so forth. All of them have been marked by the specified signatures on the map. Surely, the Czech Republic is best prepared on this map, but as the project develops we should expect a similar level for other countries soon.

Geographic map in the Mapy.cz

Pic. 2 The Geographic map includes all the best places in the given country or region.

3. Browse photos – the map “With photos” has been developed on the tourist background, so you can see all tourist trails underneath. This map works on the same basis as Yandex images or formerly Panoramio.com for Google.

Mapy.cz map with photos

Pic. 3 Map with photos and examples of the uploaded photo.

4. Zoom by image – you have found some interesting image thumbnail on the map and opened it, but you don’t know roughly where it is, because you used the wrong zoom level? It’s not a problem, you can easily zoom to the image location by using the map thumbnail in the bottom-left corner.

Mapy.cz zoom by selected image

Pic. 4 Zoom option by the selected image on the map “With photos”.

5.  Ski resort map – this is the Winter map, which includes all major ski resorts worldwide, marked with the blue sign of the skier

Mapy.cz ski resort map (winter map)

Pic. 5 The “Winter map” can be treated as the ski-resort map because it includes all major places for skiing worldwide.

Moreover, you are able to check how the ski trails look like after a close-up view of the map. This is very useful for planning winter sports with your family.

Mapy.cz Ski trails on winter map

Pic. 6 Detailed view at ski resorts on “Winter map”, where we can see also the trails for skiing. The map legend is on your right.

6. Check the inclination of ski slopes – a good feature, which represents 3 types of ski slope inclination and works for both the “Winter” and “Outdoor” maps, although it’s much better visible for the “Winter” one. It’s a nice way to check which slopes are possibly too steep for normal winter sports, but looking at it from a different angle they can be good for the extremal kind of sport.

Mapy.cz Ski slope inclination

Pic. 7 The example of ski slope inclination both on the “Winter” and “Outdoor” maps.

7. Tactile (Haptic) maps – this is an option dedicated to blind or partially sighted people. The maps can be used by touch. Here you can find detailed instructions on how to use them. This type of map is far simplified with a lot of cartographic elements visually merged for easier touch perception. This link explains more about how to read the maps like these. These maps can be downloaded by box signatures.

Mapy.cz Haptic maps selection

Pic. 8 Haptic maps selection from the main panel.

Mapy.cz Haptic (Tactile) maps

Pic. 9 An example of tactile maps. The user can download them as the zipped file, which includes the map for the area bounded in the selected box, legend, and also the list of abbreviations.

The maps can be found under the following address: https://hapticke.mapy.cz/. They cover a whole world.

Mapy cz tactile (haptic) maps Bangladesh Dhaka

Pic. 10 The haptic (tactile) map of the Dhaka region.

8. Check your area in the 3D view – the nice option, which renders perfectly the terrain on the same basis as i.e. Google Earth does. The primary malady here is the lack of artificial features like skyscrapers, towers, etc. Therefore it doesn’t work really for cities. Only some big Czech cities are equipped with the 3-dimensional view, which looks pretty cool. Regardless of urban areas, this view is awesome in any mountainous area.

3D view Brno Mapy.cz

Pic. 11 The example of a 3-dimensional view of Brno – the second largest city in Czechia.

Mapy.cz 3D view Alps

Pic. 12 The 3D view for the Alpine region.

A good hint is to use always the Aerial Map for this purpose. Then your terrain will be rendered nicely. You can switch this map off, which will be replaced by the Outdoor map, although the 3D view won’t be as perfect as you can see above, even if you keep the 1.25 exaggeration level on.

Mapy.cz 3D view for outdoor map

Pic. 13 The 3D view mode for Outdoor Map with the 1.25x vertical exaggeration option switched on (marked red) – the same view at Brno – the second largest city in Czechia.

The view above is similar to the one, which can be gained for Google Earth by overlaying various map canvas.

The biggest attitude of the 3D view is its compatibility with other features offered by this mapping platform. Recently Mapy.cz enabled the 3D view for the planning routes. We can also see our travel tips in this mode, which is simply fantastic!

apy.cz 3D view with travel tips

Pic. 14 The 3D view with travel tips. Once you hover or select one of them it will be highlighted on the 3D map.

Mapy.cz 3D routes

Pic. 15 Your calculated route in the 3D view.

The 3D view can be changed by the icons at the bottom or by using your mouse (check the information icon).

9. Search by and check it’s open or closed – this is a very handy option, allowing you to find anything nearby. You can search by keyword or by categories dedicated roughly to tourism. Apart from a pure search tool, you can also filter the results by opening hours. I mean, at the moment you do research you can check is the object opened or already closed. You should see on the right till what time the building is opened for the public.
The results will appear regardless the zoom level. If you localize yourself, all the features will appear nearby for zoom level 14 (E-W – 7km, N-S – 4km) covering about 28 square kilometers of your area.

Mapy.cz search by

Pic. 16 The Search by feature combined with the “Open” filter, which allows us to check until what time the object is open for the public.

10. Browse tourist map – the most desired feature for all hitchhikers, mountaineers, cyclists, and any types of tourists. The map is displayed very well and includes all tourist trails, mountain peaks, mountain huts, and many interesting places from the tourist point of view. Interesting is also the contour line layer, which helps us to estimate the height of some hills quickly. In places, the tourist trails haven’t been marked correctly, as they are not continuous or accurate enough, but it’s predominantly minor problem. Te most important thing is, that these maps are downloadable and can be used offline in the Android version wherever you are. In the vast majority, the countries are divided by their administrative units. You can click on any object marked on the tourist map by signature and see it in detail. This thread is explained more later in this text.

Mapy.cz outdoor map

Pic. 17 The Outdoor map with tourist trails, contour lines, tourist infrastructure, and interesting objects. By clicking any of them we can see the pop-up with some details.

11. Plan your route & use navigation – there are several options for planning your route. Obviously some of them you know already from Google for sure, although there are some extra, which are quite unique. For example, we can calculate the route by “Cross-country skiing” or “By boat”. All the routes can be exported as the .gpx files. Calculation by car is only road-based, which shouldn’t wonder anyone, but public transport can be calculated both by roads and railways. Calculation by bike can be computed both from tourist trails and roads and finally, calculation By foot is based predominantly on tourist trails. The remaining two computations are season-based, where skiing can be computed only when toggling on the Winter map and sailing when considering rivers or canals. See the full explanation and specification here. All your routes will be described by terrain profile, which can be useful especially for walking or cycling. Always on the top of your route details (just underneath the calculation), you will see the total length and estimated travel time. For mobile versions, the navigation uses voices (in English), which is really helpful.

12. Download tourist trail – this is a derivative option from calculating your route By foot. In this case, when we take into account some tourist trail instead of our private walk, we can set the starting point roughly at the beginning of the given trail route and set the termination of our route roughly where the trail ends. The platform will compute the route for us. In some cases, especially when the tourist trail is short enough, we don’t need to do anything. When the trail is longer or the area is crisscrossed by a lot of other trails, some additional points might be required. I have explained everything in the video attached at the very bottom.
We can save the tourist trail as the .gpx file and next convert it to some other GIS format.

Mapy.cz tourist trails download

Pic. 18 The example of downloading a short tourist trail, which can be done by route calculation “By foot”. Next, you can click the “Export” button and get this route in the .gpx file.

Mapy.cz downloaded tourist trail in Google Earth

Pic. 19 The example of a short tourist trail downloaded as the .gpx file, next converted to the .kml file and displayed in Google Earth.

13. Check the train times & bus timetables – this is such a fantastic option, but regrettably not in full functionality yet. As the application keeps developing, the urban areas are prepared better than the rural ones and any outskirts. It can be seen especially within the train routes, which in many places cannot be calculated at all.
When we use the route calculation by “Public transport”, we can get the most up-to-date buses or train times between two specified locations. I showed it in the video attached at the very bottom. The first step to making this type of calculation successful is setting both the start and the end of our route at bus stops or train stations (or tram stops). The route calculation will be possibly simplified by reducing the frill distances from the start point to the nearest bus stop, although it is only a hint for now, as the Mapy.cz development is still in progress.

Mapy.cz calculation route by train

Pic. 20 Calculation of our route by train from Potsdam to Berlin at the time when this text is produced.

Mapy.cz bus route

Pic. 21 The example of the bus route at the time when this text is produced. You can set the arrival or departure time other than the default.

As it was mentioned earlier, in some countries the public transport based calculations are not complete enough. For the United Kingdom, instead of bus routes, we can get train connections.

Mapy.cz train connection UK

Pic. 22 The example of bus route converted to train route. Both starting and ending points were defined at local bus stations.

But for Poland, we don’t have even train connections yet, but I am convinced that it will change in the nearest future!

Mapy.cz unable to calculate the route

Pic. 23 The “Failed to calculate the route” error means, that there is rather no data provided yet to the service.

Frankly speaking, the most fantastic things here are well-prepared bus or train timetables! By clicking on the bus stop (or bus station), tram stop, or train station signatures you will be issued with the full timetable, the same as exists there! This is such a wonderful thing for planning your trips!

Mapy.cz bus timetable example

Pic. 24 The bus timetable example for one of the suburban villages in Poland.

Mapy.cz train times

Pic. 25 The train times example for the main train station in Prague – this is the level of data I expect in the future for most the cities worldwide!

14. Travel tips for the local area – another brilliant option served by the Mapy.cz service. There are at least 2 ways of access to this option. One is by selecting the categories from the “Search by” option, another one is by selecting the “Travel tips” option from the pop-up of the different objects selected already. You will get all the tourist places within your area or specific address considered (based on the zoom level you set before) and any hovered from the list will be highlighted on the map turning other ones into grayscale.

Mapy.cz travel tips

Pic. 26 Travel tips option for the area defined by location and zoom level. When you hover one of them from the list, it will be distinguished from others, turned into grayscale.

Mapy.cz travel tips for any other object selected

Pic. 27 Travel tips for any other object already selected.

15. Check the terrain profile for your route or measurement – this is a nice outreach for any kind of route planning, but especially useful for hitchhikers, walkers, and cyclists. After calculating your route, you can see in which section you will have to go up and down. By this analysis, you can plan your route more efficiently, arrange some stops, breaks, etc. The vertical line with the altitude box as well as the white circle with a black border will help you to do so. This terrain profile works also for the measurement tool, which is described later in this text.

Mapy.cz terrain profile for walking route

Pic. 28 Terrain profile for a walking route. Analysis can be done by hovering some parts of the profile, where you can see the altitude (m.a.s.l.) combined with the circle showing this place on the map.

Mapy.cz terrain profile for route calculated by car

Pic. 29 Terrain profile for the driving route. You can check the altitude in any place across your route (profile) and see its correspondence on the map by the white, black bounded circle.

16. Local trips proposal – by the right-click on any location, we can see the local trips proposal by the Mapy.cz application. The option is pretty cool because it often computes your route with some interesting things to see nearby.  Every place will be highlighted on the map by image thumbnail or signature when hovered on the list. You can change the total length of your route as well as the transport type.

Mapy.cz local trips proposal

Pic. 30 Local trips proposal from the current location can be found in the list populated by the right-click. Next, you can adjust it by changing the transport type and length of the trip. All interesting places will be populated in the panel on your right.

Obviously, the same options still apply for these tracks as normal, we can see the terrain profile and the weather across our whole route.

17. Weather forecast for selected place or route – another good feature, which can be recommended. You can examine the weather for the next 5 days in the hourly forecast displayed. You can get to know weather conditions across your travel route too by selecting the specified time (up to 4 days in advance) of departure and the weather element (temperature & general, precipitation, wind). Once we have set it up, we must remember to click on the “Show on map” button.

Mapy.cz weather forecast for place

Pic. 31 The 5 days weather forecast for the specified location.

Mapy.cz weather forecast for our route

Pic. 32 The example of the weather forecast for our calculated route. We should remember about toggling this option on and selection of proper time and weather type.

18. Get the GPS coordinates for your place – this option can be found at the bottom of the information panel of the place you selected. By clicking it, the field with exact WGS84 coordinates will be populated with an instant copy option to your clipboard.

Mapy.cz GPS WGS84 coordinates of the place selected

Pic. 33 The exact GPS coordinates for our selected place (WGS 84) with a copy to our clipboard option on the right.

19. Get the info about the place – this option can be very useful for people who want to know a bit more about the selected place or landmark they want to go to. These mostly Wikipedia-based details are quite scant, but you always have the link to the main Wikipedia article, which is usually much longer. Apart from it, you can find the links to the main websites, where you can find more information for sure. Because Wikipedia’s coverage varies significantly across random types of places, we should expect some lack of information for some places. That doesn’t change the fact, that instant access to Wikipedia’s bunch of information can be really handy. On top of that is language-based. It means, if you select i.e. Czech version of your map, the Wikipedia page will open in the Czech language either.

Mapy.cz Wikipedia info

Pic. 34 The Wikipedia-based place description with the link to the full article (pointed red).

Mapy.cz place info with link

Pic. 35 The example of an external link to the main website of the selected place. A brief description and link to the full Wikipedia article are below.

20. Browse the image gallery of your interesting place – it can be accessed also via the “Map with photos”. Not all of the places have been equipped with the images yet, but I believe it will change in the nearest future, as this app platform becomes very popular. There is a lot of tourist sites, where a user can simply take a look at the images available. The access to them is very simple. You just need to head your cursor on the main image, which appears on the top of the information bar on your right.  Next, you can sort your image gallery by popularity or date. These images are downloadable by right-clicking and selecting the “Save image as” option. Each image has the detailed EXIF data provided.
On the other hand, you can also upload your own images by clicking the “Add photo” option.

Mapy.cz image galllery

Pic. 36 Browsing and adding our own images to the selected place. By clicking on the vertical three dots symbol, we can select the “Show EXIF” option and see the EXIF data of our image. Every image is downloadable.

21. Check the opening hours, telephone number, and other information – besides the nice description about the object, we can also check the opening hours or copy the telephone number available in the information panel. I have mentioned it above. The level of this information varies across the types of areas and objects. Sometimes we might have no information at all, however, in other cases, it will be presented well. The best, for sure, the Czech Republic is prepared. By clicking on any petrol station here you can even check the fuel prices.

Mapy.cz information panel

Pic. 37 The content of a random information panel, which includes stuff like the telephone number.

Mapy.cz fuel prices

Pic. 38 The example with more detailed information panel including i.e. fuel prices. It works only for the Czech Republic by now.

22. Embed the map (with selected object) in your website – another cool option available in the Mapy.cz service. We should click on the “Share” option and instead of “Copy link” toggle the “Insert map in my website”.

Mapy.cz embed map in your website2

Pic. 39, 40 The “Embed map in your website” option with the selected object, included already in the link.

There are 4 options for defining your map size. Interesting is also the map preview, which appears in the top-left corner after toggling on.

Mapy.cz embed map in your website3

Pic. 41 Additional options of embedding the map in our website.

23. Save & Share your map – it’s the trivial option, which appears in most interactive maps nowadays. Just to mention, that it exists, although for saving the current map view the signing in is required. In order to share your map, you can access it by selecting the “Share your map” option from the information panel of the selected object. Your map can be saved under a custom name.

24. Defining your current location – another common option, which helps you to define your current location. It becomes very handy when you are in the middle of nowhere between some mountains. You can then calculate your route, find the nearest place, etc.

Mapy.cz your location

Pic. 42 Finding your location.

25. Print & Capture screenshots of your map – another quite mundane option provided by this service, but it’s good to have it for sure. It grows into functionality especially in the situation when we need to have the map scale. If you want to have your map good-looking remember to hide the information panel on your right!

Mapy.cz save map as image

Mapy.cz save map as image2

Pic. 43, 44 Export map as an image with the information panel visible on the right. It, unfortunately, comes through as you can see in the lower image attached.

Mapy.cz save map as image3

Pic. 45 The screenshot map was taken when the information panel was hidden. Now it looks good, doesn’t it?

26. Add your own Points Of Interest (POI) – a useful option for someone, who wants to define his own locations on the map. We can define at least several points of our private interests. By adding them to the map canvas, we will see also detailed WGS84 coordinates of each point. They’re exportable to the .gpx format at roughly the same basis as transport routes and mountain trails described earlier.

Mapy.cz adding your own POI

Pic. 46 Adding your own Points of Interests (POII) with their rough GPS coordinates (WGS 84) and export option bounded red.

Mapy cz POI in Google Earth

Pic. 47 Our Points of Interests (POI) uploaded to Google Earth after conversion from .gpx to .kml.

27. Measure distance or area – another excellent option to try, all the more that simultaneously we can analyze the terrain profile of our measurement at exactly the same basis as for route calculation. The same applies to the downloading option, which is also available for our measurement tool.

Mapy.cz measurement tool

Pic. 48 The exemplar measurement with its terrain profile.

Mapy.cz measurement tool2

Pic. 49 Measurement tool in action with all options visible on the right.

Mapy.cz measured area exported to Google Earth

Pic. 50 The measured area converted to .kml file and imported to Google Earth.


All the options presented above don’t require setting up your account on this mapping platform. It means, that you can use them incognito. There are only a few features, which will work from your profile only. The setup is awkward because you cannot do it from your Gmail account. You have to create the other account on the Seznam.cz portal, but I hope it will change in the future.


II FEATURES WITH SIGN-IN REQUIREMENT

28. Import your own GPX file – a perfect option for someone, who wants to display his route on the map. These routes usually come from other web applications used for cycling, walking, etc, like Endomondo. We can add the .gpx file with our route by selecting the “Tools” and choosing the “Import GPX” option.

Mapy.cz upload GPX files

Pic. 51 Uploading your own .gpx files (Zive.cz).

29. Mark already visited places – if you travel a lot, not necessarily around the world but even within a small region, you can mark all the places you visited.

Mapy.cz visited places

Pic. 52 An example of visited places marked by one of the users (Zive.cz).

III FEATURES WITHIN THE CZECH REPUBLIC ONLY

Czechia is the mother country for this mapping application. You shouldn’t wonder about (sometimes) a significant difference in the information level between this country and the rest of the world. Most of the options described here are available worldwide, although there are some of them, which can be used only within the Czech Republic boundaries.


30. Browse maps from the XIX century – an ideal option for someone, who is interested in history. The coverage of the XIXth century maps includes the Czech Republic as it was that time under the Austro-Hungarian rule.

Mapy.cz historical maps

Pic. 53 XIXth century maps coverage.

31. Use local street view – maybe you didn’t know, but Seznam.cz launches its own street view, which covers the whole Czech Republic. Images aren’t the best in quality, but there is a lot of roads covered, even the dirt ones, which is pretty cool!

Mapy.cz Street View

Pic. 54 The Street View option, which often includes also various dirty roads.

The “Panorama”, which is the official name of Czech street view can be toggled just right of the 3D view or from the information panel. It disappears when you move out of the Czech Republic borders. The “Panorama” imagery is 4-8 years old. All images are going to be updated in the nearest future.

32. Bird’s eye view – the satellite view by the bird’s eye, which is going to supersede the 3D view gradually. In my point of view, it should remain as a separate function, as it’s not as perfect as the 3D view. Moreover, by now only the Czech Republic is covered.

Mapy.cz bird's eye view

Pic. 55 The Bird’s eye view coverage (Napoveda.Seznam.cz).

Mapy.cz bird's eye view example

Pic. 56 The Bird’s Eye view in action.

More information about the development of the Bird’s Eye view you can find here.

33. Share your experience & View ratings – the useful option, which can help you to choose for example the place to stay or visit. Beneath the general information, you can find the option of sharing your experience by giving the number of stars. In the case of accommodation Seznam.cz took care about fetching the rating directly from Booking.com, which is really handy. Some people’s feedback you can see down later.

Mapy.cz feedback and Booking ratings

Pic. 57 The “Share your experience” option and Booking.com ratings in the information panel.

34. Browse related places (points) – the feature available for the most remarkable sights across the country. By clicking one of them you will be instantly redirected to the place, which will be selected exactly on the same basis as the current one.

Mapy.cz related points

Pic. 58 The “Related points” options available for remarkable objects in Czechia.

IV MOBILE APPLICATION FEATURES

The mobile version seems to be the most important. We can take the maps away from our computer and use them in the field. Unfortunately quite a lot of features are available on desktop only. The producers equipped the application with absolutely the most needed options and rightly so.
Mapy.cz mobile options

 

Mapy.cz mobile options

Pic. 59,60 Mobile version options and map settings.

The biggest feature of the mobile version is its offline capability. A user can download maps divided by administrative regions worldwide. All the maps are vectorized, which means, that they don’t change resolution on different zoom levels.

Mapy.cz download maps offline

Pic. 61 Updating and downloading maps for offline usage.

Thanks to this the map can be a fantastic alternative to our paper maps used for mountain trips. Be aware, that they will be still needed, as the paper doesn’t need the current!  Moreover, there are still some noticeable mismatches in trail routes, which is an example you can see by watching my video below.
The maps render quickly, unlike other OSM products and every feature is easily accessible because of the friendly interface. Other good options are:
– day & night modes in navigation mode,
– three different map layers (outdoor, satellite, and winter),
– displaying ski slope inclinations,
– displaying hillshades,
– instant distance calculation,
– one finger zoom,
When you hold your finger for a few seconds you can switch on the information panel of your point, which includes:
– GPS coordinates,
– route planner,
– weather checking
– description (if available) with external links,
– other options (the same as in the desktop version)

Mapy.cz location information in mobile version

 

Mapy.cz location information in mobile version2

Pic. 62, 63 The information panel of the clicked point in mobile version.


35. Track your activity – this is the option, which appears only in the mobile version. The user can track his activity on the route calculated previously.

Mapy.cz track your activity

Pic. 64 Tracker ready to record your activity.

Mapy.cz track your activity2

Pic. 65 Activity tracker in action (Zive.cz).

By using an activity tracker we can learn about time spent during our walking, and so forth.

36. Alternative source to find the cadastre – it can be done in a mobile version by populating the information panel. Sometimes we can find information about the owner of a given building or land. It’s not everything we can get. Additional information will apply to the relevant municipality, cadastral area, and acreage.

V. SUMMARY

I have come across this brilliant ma platform in detail, which I hope will help you. At this moment I can’t see the better place, where I could plan my trip so smoothly. As it has been told several times, the level of detail remains subject to discussion across the different types of areas. The highest one is to be found in Czech, but I am convinced, that the same level will be met in any place worldwide in the future. Some things are still “fresh” and not all users know them. They will be developed in the future. We should treat this Seznam.cz product not only as of the pure mapping tool for activities or traveling but also as a beautiful, practical pack and a fantastic source for any information about tourist places and infrastructure. It grows up as a fantastic platform, which I am going to recommend highly to everyone.

Mariusz Krukar

 

Links:

  1. Play.google.com: Mapy.cz application
  2. Tekdeeps.com: 9 tips & tricks for the Mapy.cz application
  3. https://newsbeezer.com/czechrepubliceng/13-practical-tips-and-tricks-for-mapy-cz-you-may-not-know-zive-cz/
  4. https://www.drupal.org/project/mapycz
  5. Mapy.cz – FAQ
  6. Mapy.cz – brief description
  7. 13 practical tips for the Mapy.cz service (Czech)
  8. https://archive.md/20200816150207/https://czasopismo.legeartis.org/2017/10/aplikacja-mapy-cz-test/ (Polish)
  9. http://api.mapy.cz/ (Czech)
  10. Mapy.cz – adding to your website – terms of use and violation
  11. https://napoveda.seznam.cz/en/maps/what-are-tactile-maps/
  12. Mapotic.com: Add new routes to Mapy.cz service
  13. Using Google Street View with Mapy.cz
  14. https://starpath.com/gpx/ – convert a Google Earth path to a GPX route
  15. Import GPX routes to Mapy.cz (Czech)
  16. Mapy.cz – route planner
  17. https://justuseapp.com/cancel/411411020/mapy-cz-navigation-maps
  18. https://www.saashub.com/compare-mapy-cz-vs-maps-me
  19. https://www.active24.cz/en/how-to-website-creation/wordpress/jak-vlozit-mapy-na-webove-stranky
  20. https://cc.cz/tag/mapy-cz/ (Czech)
  21. 12 tips for Mapy.cz (Czech)
  22. Tourister.ru: Mapy.cz – Nezamenimij pomocnik dlja puteszestwij po Czechi (Russian)
  23. Street View for Mapy.cz (Czech)
  24. https://gpx2kml.com/
  25. https://miconv.com/convert-gpx-to-kml/
  26. Jsfiddle.net: Mapy.cz – various code examples
  27. https://napoveda.seznam.cz/en/birds-eye-view/
  28. Import your own GPX file to Mapy.cz

 

Forums:

  1. Mapy.cz WMTS layer for QGIS (Czech)
  2. https://www.reddit.com/r/OsmAnd/comments/gpgxmp/osmand_map_sources_and_mapycz/

Wiki:

  1. Mapy.cz
  2. Mapy.cz (Czech)
  3. Organised_Editing/Activities/Mapycz
  4. Seznam.cz
  5. Vertical_exaggeration

Read also:

  1. Travelling and sightseeing from home

Youtube:

The post 36 constructive tips & tricks for the Mapy.cz application first appeared on MkrGeo.

]]>
http://www.mkrgeo-blog.com/36-constructive-tips-tricks-for-the-mapy-cz-application/feed/ 0 65390
Original Street View colors without Google API Key http://www.mkrgeo-blog.com/original-street-view-colors-without-google-api-key/ http://www.mkrgeo-blog.com/original-street-view-colors-without-google-api-key/#respond Tue, 09 Nov 2021 08:40:17 +0000 http://www.mkrgeo-blog.com/?p=65317 Original Street View colors without Google API Key MkrGeo

Street View is a good tool, which can be incorporated into your own interactive maps like Leaflet or OpenLayers. Unfortunately, since 2018 Google doesn’t serve it for free. In turn, the Google Maps products can’t be set up properly, because you can see the “For development purposes only” information along with the poor quality of […]

The post Original Street View colors without Google API Key first appeared on MkrGeo.

]]>
Original Street View colors without Google API Key MkrGeo

Street View is a good tool, which can be incorporated into your own interactive maps like Leaflet or OpenLayers. Unfortunately, since 2018 Google doesn’t serve it for free. In turn, the Google Maps products can’t be set up properly, because you can see the “For development purposes only” information along with the poor quality of the map and Street View. Maps appear darker than usual and Street View is displayed on a negative scale. The current pricing for Google Maps you can find here. Maybe it’s not a huge amount to pay, but if you don’t want to do it, you probably won’t need to. In this short post, I would like to show you how to get over (at least partially) the negative scale of the Street View. You will still see the message “For development purposes only”, but your Street View won’t be negative anymore.

The issue lies in the CSS code included in the Street View implementation. In the OpenLayers example, this implementation includes 2 files, the .js and the .css one, which looks pretty much like this:

<link rel="stylesheet" href="ol-street-view.css" />
<script src="ol-street-view.js"></script>

and our alteration can be done in the .css file.
We should find the section, which defines our Street View panorama toggleable on our map. Next, just adding the filter argument and invert function should solve our problem.

#ol-street-view--panorama {
    display: none;
    background-color: #555555 !important;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -o-user-select: none;
    /*-webkit-filter: invert(1);*/
    filter: invert(1);
}

.ol-street-view--activated #ol-street-view--panorama {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    border-bottom: 3px solid #222222;
    /*-webkit-filter: invert(1);*/
    filter: invert(1);
}
Alternatively, you can use the webkit-filter argument, which has been quoted in the examples above. The result should make you happy (Pic. 1).
Street View revert from negative scale

Pic. 1 Reverting back the Street View negative scale by simple argument in CSS code.

On the other hand, all the Street View options will be negative this time (Zoom, compass, address) but it’s only a minor thing. The landscape captured by the Street View camera won’t be negative anymore.

Mariusz Krukar

Links:

  1. https://www.plugandplaydesign.co.uk/google-maps-for-development-purposes-only-error/
  2. https://developers.google.com/maps/documentation/javascript/streetview
  3. https://www.adoclib.com/blog/google-maps-shows-for-development-purposes-only.html
  4. https://tsh.io/blog/time-of-transition-what-are-the-google-maps-api-alternatives/
  5. https://www.eliassonmarketing.com/google-maps-api-what-you-need-to-know/
  6. Street View – coding library example – negative view
  7. Google Street View with negative colors – standalone version
  8. Google Maps Platforrms FAQ
  9. https://mapsplatform.google.com/pricing/
  10. https://rapidapi.com/blog/how-to-get-google-maps-api-key-free-tutorial/
  11. https://github.com/GastonZalba/ol-street-view
  12. https://gist.github.com/crofty/2197042
  13. https://mapsplatform.google.com/pricing/
  14. https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/invert()

Forums:

  1. https://stackoverflow.com/questions/13325798/invert-colors-of-an-image-in-css-or-javascript
  2. Py4u.net: Google Maps shows “For development purposes only”
  3. Support.ruckuswireless.com: Dashboard cannot load Google map correctly – Google Map API key

Youtube:

The post Original Street View colors without Google API Key first appeared on MkrGeo.

]]>
http://www.mkrgeo-blog.com/original-street-view-colors-without-google-api-key/feed/ 0 65317
What additional shapes can you draw on the OpenLayers map? http://www.mkrgeo-blog.com/what-additional-shapes-can-you-draw-on-the-openlayers-map/ http://www.mkrgeo-blog.com/what-additional-shapes-can-you-draw-on-the-openlayers-map/#respond Wed, 03 Nov 2021 19:49:26 +0000 http://www.mkrgeo-blog.com/?p=65293 What additional shapes can you draw on the OpenLayers map? MkrGeo

Drawing your own shapes in OpenLayers is a nice option, which gives us an opportunity for customizing the existing map. I mean not only the plain map set by the basic coding, but also the map, which is already equipped with some important data. A good example here is the map generated by the QGIS2Web […]

The post What additional shapes can you draw on the OpenLayers map? first appeared on MkrGeo.

]]>
What additional shapes can you draw on the OpenLayers map? MkrGeo

Drawing your own shapes in OpenLayers is a nice option, which gives us an opportunity for customizing the existing map. I mean not only the plain map set by the basic coding, but also the map, which is already equipped with some important data. A good example here is the map generated by the QGIS2Web plugin, which usually includes our product prepared in QGIS. In this case, when we still need to add something more than the standard map content, the drawing feature kit can be very vital.
We can draw at least several types of shapes in the OpenLayers maps, which have been developed across the existing libraries. For the most up-to-date library (at the time when this post is produced) – 6.9.0 the users can draw the following shape types (Pic. 1):
– lines,
– points,
– polygons,
– boxes,
– rectangles,
– circles,
– ellipses,
– stars,
– arrows.

OpenLayers custom drawings - standard shapes

Pic. 1 Standard shapes of the OpenLayers custom drawings, where: 1 – Circle; 2 – Box; 3 – Rectangle; 4 – Star; 5 – Points; 6 – Lines; 7 – Polygons; 8 – Ellipse; 9 – Oblique ellipse; 10 – Arrow.

All the codes for the aforementioned shapes you can find by searching the attached links beneath this text.

Apart from this standard kit presented above, the user can modify the JavaScript code slightly and get some additional objects in order to expand its signatures gear. It’s a really straightforward thing and can be achieved by modifying the code for the “Star” shape, which looks initially like this:

var starInteraction = new ol.interaction.Draw({
    source: vectorLayer.getSource(),
    type: 'Circle',
  geometryFunction: function (coordinates, geometry) {
    if (!geometry) {
      geometry = new ol.geom.Polygon([]);
    }
              var center = coordinates[0];
              var last = coordinates[1];
              var dx = center[0] - last[0];
              var dy = center[1] - last[1];
              var radius = Math.sqrt(dx * dx + dy * dy);
              var rotation = Math.atan2(dy, dx);
              var newCoordinates = [];
              var numPoints = 12;
              for (var i = 0; i < numPoints; ++i) {
                var angle = rotation + i * 2 * Math.PI / numPoints;
                var fraction = i % 2 === 0 ? 1 : 0.5;
                var offsetX = radius * fraction * Math.cos(angle);
                var offsetY = radius * fraction * Math.sin(angle);
                newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);
              }
              newCoordinates.push(newCoordinates[0].slice());
              geometry.setCoordinates([newCoordinates]);
              return geometry;
            }
});

where the most interesting lines have been highlighted by blue and red. The most profitable is the red code lines, where you can do the modification without disturbing the rotation features. Below I have listed the 15 new shapes, which we can implement easily in our drawing kit.

A. FLAT TRIANGLE

var numPoints = 3;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 50 === 0 ? 0 : 2;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

B. EQUILATERAL TRIANGLE

var numPoints = 6;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 2 === 0 ? 1 : 0.5;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

C. ISOSCELES TRIANGLE

var numPoints = 3;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 2 === 0 ? 0.5 : 2;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

other approaches:

var fraction = i % 2 === 1 ? 7 : 4;
var fraction = i % 10 === 0 ? 3 : 2;

D.  DIAMOND

var numPoints = 4;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 2 === 0 ? 1 : 0.5;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

E. PENTAGON

var numPoints = 5;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 2 === 1 ? 2 : 2;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

F. HEXAGON

var numPoints = 6;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 3 === 3 ? 1 : 0.5;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

other approaches:

var fraction = i % 0 === 0 ? 1 : 0.5;

G. OXAGON

var numPoints = 8;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 1 === 0 ? 1 : 10;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

H. BOW

var numPoints = 8;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 4 === 0 ? 1 : 10;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

I. PACMAN

var numPoints = 24;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 50 === 0 ? 0 : 2;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

J. 12 ARM STAR

var numPoints = 24;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 2 === 0 ? 0.5 : 25;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

K. 3 ARM CROSS

var numPoints = 6;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 2 === 0 ? 1 : 7.5;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

Other approaches:

var fraction = i % 2 === 1 ? 0.5 : 10;

L. 4 ARM CROSS

var numPoints = 8;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 2 === 0 ? 1 : 10;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

M. 4 ARM CROSS THIN

var numPoints = 8;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 2 === 0 ? 0.5 : 25;
               var offsetX = radius * fraction * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

N. PARALLEROGRAM

var numPoints = 8;
             for (var i = 0; i < numPoints; ++i) {
               var angle = rotation + i * 2 * Math.PI / numPoints;
               var fraction = i % 2 === 1 ? 1 : 1.5;
               var offsetX = (radius*3) * (fraction) * Math.cos(angle);
               var offsetY = radius * fraction * Math.sin(angle);
               newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);

O. SEMICIRCLE

var numPoints = 48;
              for (var i = 0.5; i * 2 < numPoints; ++i) {
                var angle = rotation + i * 2 * Math.PI / numPoints;
                var fraction = i % 2 === 0 ? 1 : 0.5;
                var offsetX = radius * fraction * Math.cos(angle);
                var offsetY = radius * fraction * Math.sin(angle);
                newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);
              }

As a summary of my approaches, please see all the considered shapes below:

OpenLayers additional shapes

Pic. 2 Additional shapes, which can be implemented to your drawing kit in OpenLayers, where: 1 – Flat triangle (A); 2 – Equilateral triangle (B); 3 – Isoscieles triangle (C); 4 – Diamond (D); 5 – Pentagon (E); 6 – Hexagon (F); 7 – Oxagon (G); 8 – Bow (H); 9 – Pacman (I); 10 – 12 arm star (J); 11 – 3 arm cross (K); 12 – 4 arm cross (L); 13 – 4 arm cross thin (M); 14 – Parallerogram (N); 15 – Semicircle (O).

and treat them purely as the proposal. I guess you can still fiddle with the code presented, both for the “Star” shape as well as others and provide your own geometry, which you need. This article is mostly for OpenLayers users, who are on entry level position with JavaScrit coding and can tweak just some values. If you are more savvy with these stuff, the geometry section will be something to big adjust.

Mariusz Krukar

References:

  1. Farkas G., 2016, Mastering OpenLayers 3, Packt Publishing, Birmingham
  2. Langley J.P., Perez A.S., 2016, OpenLayers 3.x Cookbook – Second Edition, Packt Publishing, Birmingham, ISBN 9781785287756

Links:

  1. https://openlayers.org/en/latest/examples/draw-shapes.html
  2. https://openlayers.org/en/latest/examples/draw-and-modify-features.html
  3. https://openlayers.org/en/latest/examples/regularshape.html
  4. OpenLayers – drawing shapes – code example 1
  5. http://tsauerwein.github.io/ol3/animation-flights/examples/draw-features.html
  6. OpenLayers – drawing geometric figures – code example
  7. https://www.giserdqy.com/wp-content/guids/ol-v4.6.5/apidoc/ol.interaction.Draw.html
  8. OpenLayers API draw (Chinese)
  9. https://openlayers.org/en/latest/examples/layer-z-index.php
  10. https://dolmenweb.it/viewers/openlayer/examples/draw-shapes.html
  11. https://openlayers.org/en/latest/examples/line-arrows.html
  12. https://openlayers.org/workshop/en/vector/draw.html
  13. Drawing regular shapes with OpenLayers

Forums:

  1. https://gis.stackexchange.com/questions/263626/drawing-shapes-and-features-in-openlayers-4
  2. OpenLayers can you draw some special shapes?
  3. https://stackoverflow.com/questions/45849772/styling-openlayers-draw-interaction
  4. https://gis.stackexchange.com/questions/303646/customize-behaviour-of-ol-interaction-draw-createbox-geometryfunction
  5. ol.interaction.Draw – start point
  6. https://stackoverflow.com/questions/46709716/openlayers-4-changing-the-draw-order-of-selected-features
  7. Draw shape – star
  8. https://stackoverflow.com/questions/41606206/draw-arrow-without-using-any-image-in-openlayers3
  9. https://stackoverflow.com/questions/50917824/openlayer-4-draw-arrows-on-map/50922088
  10. https://stackoverflow.com/questions/31647238/how-to-draw-an-ellipse-using-openlayers3
  11. https://gis.stackexchange.com/questions/270603/drawing-ellipse-in-openlayers
  12. https://stackoverflow.com/questions/23264721/how-to-draw-circle-with-radius-in-openlayers
  13. https://stackoverflow.com/questions/33996409/draw-a-circle-with-defined-diameter-in-openlayers

My questions:

  1. https://stackoverflow.com/questions/69301542/openlayers-cant-draw-the-star
  2. https://stackoverflow.com/questions/69768050/problem-with-drawing-arrows-in-openlayers
  3. https://stackoverflow.com/questions/69311837/openlayers-circle-coordinates-are-missing

 

The post What additional shapes can you draw on the OpenLayers map? first appeared on MkrGeo.

]]>
http://www.mkrgeo-blog.com/what-additional-shapes-can-you-draw-on-the-openlayers-map/feed/ 0 65293
Manual estimation of the visual range between two artificial objects – case studies http://www.mkrgeo-blog.com/manual-estimation-of-the-visual-range-between-two-artificial-objects-case-studies/ http://www.mkrgeo-blog.com/manual-estimation-of-the-visual-range-between-two-artificial-objects-case-studies/#respond Fri, 29 Oct 2021 19:28:14 +0000 http://www.mkrgeo-blog.com/?p=65166 Manual estimation of the visual range between two artificial objects – case studies MkrGeo

Anyone, who deals with long-distance observations knows all the most popular panorama or visibility cloak generators from the given place. Every user knows the primary malady of all these simulators – they’re based on the DEM (Digital Elevation Model) only. In practice, it means, that all the calculations are based on pure ground with no […]

The post Manual estimation of the visual range between two artificial objects – case studies first appeared on MkrGeo.

]]>
Manual estimation of the visual range between two artificial objects – case studies MkrGeo

Anyone, who deals with long-distance observations knows all the most popular panorama or visibility cloak generators from the given place. Every user knows the primary malady of all these simulators – they’re based on the DEM (Digital Elevation Model) only. In practice, it means, that all the calculations are based on pure ground with no forest, vegetation, and urban development too. Since a user can at least generate the visibility cloak from some hypothetic altitude, assigned usually to some existing construction or building, it will still cover the visual range based on pure DEM. Threading its way, the user is still not aware of the potential maximum distance of the line of sight from this viewpoint. In the world of mobile phones and media, we should take into account the local and regional transmitter distribution, which is sparkly quite dense, especially around large urban areas. Usually, but not always the presence of some telecom construction marks the highest or one of the highest points in the local area. It gives additional favorable conditions for the visibility cloak expansion from our elevated viewpoint.
This article should be an answer for the potential visibility conditions between one artificial object and another, as it shows the manual two methods of estimation the view such as this. The best simulator, which can be used for this purpose is Heywhatsthat, which gives us well-presented parameters of the considered line of sight.
The shape of this writing will be a bit different, than usual, as I am focused on the case studies.

1. INTRODUCTION

Considering the presence of any artificial objects being firmly integrated with the ground, we should be aware of their visual impact regardless of the distance to the observer. With this in mind, I should like to put the following questions:
– how tall does the building stand above the horizon?
– against which background the building is placed?
– does it cast the shadow on certain places?
– how well is the object visible from a certain location?

All these questions are subject to the VIS (Visual Impact Size) method, which determines at some point the “reversed viewshed” defining, from where the target point is visible (Caha, 2017). The method is related to the extended viewshed, very important from the long-distance observation’s point of view. The Extended Viewshed approach calculates additional visibility depending on the distance between the observer and the height of the target point (Fisher, 1996). The Visual Impact Size method refers to the maximum height for each point in the given area, above which a given facility can be seen (Czynska, 2018).
In our case, the Visual Impact Size will refer to the remote tall construction or skyscraper visible above the horizon from the place, where normally wouldn’t be visible if it would be lower. Considering only the distant object appearance, the Visual Impact Size won’t play a significant role, as it does within the cityscapes. However, VIS is “responsible” for any, even smallish change in the landscape caused by some tall construction until the edge of its viewshed. As was mentioned above, any elevations above the ground will result in the extension of the viewshed from that place. When the observer’s place is elevated by another artificial construction, then the viewshed gains an additional range. It has been also a subject of discussion occasionally, especially with relation to improving the effectiveness of watchtowers (Pompa-Garcia, et al., 2010), but mostly in terms of the wildfires or some military purposes, especially in the past. Nobody considered the effectiveness of high buildings or tall constructions with respect to the maximum viewshed range, desired for the long-distance observation purposes. This article should bring an example of answers about the target point visibility from some elevated location, which is firmly integrated with the ground. In this case, the viewable area won’t be limited to the area falling exactly within the line of sight from the top of some construction. Some analogy we could see within the aforementioned forest-fire observation towers, where the person can detect the fire of remote forest not by seeing the local surface but the smoke dispersed by wind, which is much higher. In a similar way, we can define the visual impact of an existing object, which is visible only because of its vertical difference between the ground and the visual line of sight.
In general, the viewshed calculation by using various GIS software seems to be very easy, unless we incorporate some build structures in our viewshed computation. Then our process becomes difficult, all the more that usually the heights of these buildings, as well as their shapes and locations, are often uncertain (Sander, Manson, 2007). Although most of these computations are able to bring quite genuine results if the proper amount you would need to raise ground by to see the distant feature. Next to the vertical proportion, we shouldn’t forget about the horizontal proportion of the distant feature. It will, in fact, play a minor role in the long-distance observations, but might happen quite often, that some remote construction will be too thin for the distinction by the human eye or even telephoto lens. In fact, it still means, that they’re theoretically visible, by the omission of the height of the forest or atmosphere disturbance. Again, this article will show you the methods of how to check are the two distant man-made constructions intervisible or not.

2. CASE STUDIES METHOD I EXPLANATION

Before I start to analyze the particular scenarios I would like to focus on the general explanation of the matter of this article. As it has been told above, we deal with the line of sight possible to achieve between two artificial structures. It can be simply depicted by the image below (Pic. 1) where both tops of the towers are intervisible.

Line of sight between two artificial objects

Pic. 1 The lines of sights between two artificial objects, where: A – tower 1 standing at small hill; B – big mountain range; C – tower 2 standing at the big hill.

By watching the image above, you realize, that the “place C” elevated by the height of the tower couldn’t be visible from the tower standing at the hill “A” if the tower standing at the top of the hill “C” wouldn’t exist.  This is how the visual range can be expanded by the initial DEM computations. I am convinced, that this issue is common worldwide, because of a quite high density of the telecom structures coverage as well as the common presence of various skyscrapers and tall buildings in urban areas, and finally, simple watchtowers located randomly, that help to see the vista above the forest.
Now, let’s figure out how to make the true viewshed computations from one of the towers, that could prove the visibility of another tower. It can be simply explained in the images below, where the sum of two altitudes is required for this purpose (Pic. 2, 3).

Tower viewshed 1

Tower viewshed 2

Pic. 2, 3. The manual approaches to the line of sight computation between two artificial objects, where: A – Tower 1 location; B – High mountain range; C – Tower 2 location; h1 – Height of tower 1; h2 – Height of tower 2.

Since we have tower 1 located at the top of the small hill A, the visual range from its top could advance of the tower 2 located at the top of the mountain C located beyond the big mountain range B, assuming that it’s not forested at all and neglecting the Earth curvature. In this case, an observer sitting at the very top of tower 1 (and optionally tied up by twine or chain) would be able to see just the top of tower 2, although the vertical difference between the top of tower 2 and the total range of visibility from tower 1 would be quite enough to make this object distinguishable above the mountainous horizon.  If, for instance, the very first pattern (Pic.1) would show the lines of sights roughly between the tops of these towers, then it could be merged with mountainous horizon B, making both of them finally not visible between each other. The actual pattern of these lines of sight gives a margin of visibility to these 2 towers between the high mountain range in area B.

Before we convert this understanding into real DEM computations, we should figure out, what should we do by making area C visible from tower 1, if tower 2 wouldn’t exist at all.
Usually, we know the height of two structures, so the challenge is straightforward. We should add one height to another, and the result will equal the line of sight between the tops of these structures. This is the simplest manual method to gauge the potential visibility between two artificial objects.
Imagine, that the height of tower 1 is 250m and the height of tower 2 is 125m.
If we add the height of tower 2 to the height of tower 1, as presented in the pattern above (Pic. 2), we should be able to reach horizon C since the Earth’s curvature is not taken into account seriously. The next pattern (Pic. 3) shows an opposite way.
In our first case, the following equation 250m+125m = 375m means, that if tower 1 would reach 375m altitude, then the ground, where tower 2 stands could become visible for an observer. As we have considered the margin of visibility for two lines of sight considered in the very first pattern (Pic. 1), this situation could obviously happen for a bit lower altitude.
Looking at it from the opposite place, place C, the equation could look like this: 125m+250m = 375m, which would give exactly the same result with regards to tower 1. The observer elevated 375m above place C would be able to see the grounds of place A and vice versa.

Regarding the viewshed computations, based on DEM, the discussed equations will be valid strictly only between one construction and another. It’s pointless to use these assumptions in different directions, as objects like those considered might not exist at all or have completely different altitudes if they do so.

3. USING HEYWHATSTHAT.COM FOR LINE OF SIGHT COMPUTATION BETWEEN TWO ARTIFICIAL OBJECTS – CASE STUDIES – METHOD I

For the purpose of this writing, the Heywhatsthat.com service seems to be the best, because unlike others it calculates the visibility cloak on the map and gives an option for analyzing the geometry of the line of sight.

CASE I: SUCHA GÓRA TV TOWER – KRAL’OVA HOL’A TV TOWER – 155KM

A. BRIEF DESCRIPTION

The Sucha Góra TV Tower is located in my Polish homeland. It has been maintained recently, which resulted in the increment of its total height from 116,5m to about 147m. The construction is located at the top of Sucha Góra (pron. Soohah Goorah /en. The Dry Mountain) rising 585m.a.s.l. on the Dynowskie Foothills in Carpathian Mts.
The Kral’ova Hol’a TV Tower is located at the easternmost edge of the Low Tatras range in Slovakia. The 137,5m transmitter stands at the top of Kral’ova Hol’a (pron. Kralovah Hallah/ en. The King’s Hall) counting roughly 1946m.a.s.l.

B. COMPUTATIONS

TaV - total altitude of visibility
h1a - height of Sucha Góra Mt - 585m.a.s.l.
h1b - height of Sucha Góra TV Tower - 147m.a.g.l.
h2b - height of Kral'ova Hol'a TV Tower - 137m.a.g.l. (altitude rounded down)
hf - height of forest - 35m
vm - visual margin of visibility - 25m
Tvm - total margin of visibility
Tvm = hf+vm

TaV = (h1a + h1b + h2b) - (hf + vm) /OR/ TaV = (h1a + h1b + h2b) - Tvm
TaV = (585+147+137)-(35+25)
TaV = (585+284)-60
TaV = 869-60
TaV = 809

We are assuming the visibility from 809m.a.s.l. then, or alternatively from 224m.a.g.l (284-60 = 224) (Pic. 4).

Heywhatsthat elevated visibility computations

Pic. 4 Two ways of the elevated line of sight computations: absolute – from the sea level and relative from the altitude of the local ground.

C. RESULTS

As per the captures below, the Kral’ova Hol’a TV tower is not visible from the top of Sucha Góra TV tower (Pic. 5,6).

Heywhatsthat.com visibility computation between two towers

Pic. 5 The Case I visibility computations. The Kral’ova Hol’a TV Tower remains invisible from Sucha Góra TV Tower under standard refraction coefficient, because of the Lewockie Hills. Click to enlarge.

Sucha Góra TV Tower Hetywhatsthat visibility computations

Pic. 6 Detailed views at the Lewockie Hills, which make the visibility barrier between the Sucha Góra TV tower and Kral’ova Hol’a TV tower (Mapy.cz).

In order to confirm our results, we can do the same in the reverse direction.

The formula will look like this:

h2a - height of Kral'ova Hol'a peak
h2b - height of Kral'ova Hol'a TV Tower
h1b - height of Sucha Góra TV Tower
Tvm - total margin of visibility (as discussed earlier)

TaV = (h2a+h2b+h1b)-Tvm
TaV = (1946+137+147)-60
TaV = (1946+284)-60
TaV = 2230-60 = 2170m.a.s.l.

and the Heywhatsthat.com preview accordingly:

Heywhatsthat.com visibility computation between two towers2

Pic. 7 The case I visibility computations in the reverse direction. Sucha Góra TV Tower remains invisible from the top of Kral’ova Hol’a TV tower because of Hanczowskie Mts and Magura Wątkowska’s hills in the Low Beskid range( black arrows) compared to the Lewockie Hills, which are cutting the line of sight from Sucha Góra TV tower (red arrow). Click to enlarge.

which shows completely different hills cutting the analyzed line of sight. The reason behind it is the Earth’s curvature, which detailed computation has been neglected in this article, as I base on the Heywhatsthat.com only. It will be a separate topic about it in the future. However, If you wish to get deeper into these calculations, you can try the following formula:

d = 3,854 * (√h1 +√h2) [km] (distances in meters)
d = 121,91 * (√h1 +√h2) [km] (distances in kilometers)

where:
d = distance
h1 - height of object 1
h2 - height of object 2

which is the basic one for the Earth’s curvature calculation.
I think I could bring another reason here, which is the discrepancy between these 2 profiles marked in the opposite direction. As the second method confirms (Pic. 14), the first line of sight profile between Sucha Góra TV Tower and Kral’ova Hol’a TV Tower could be set a bit inaccurately.

Kral'ova Hol'a TV Tower Hetywhatsthat visibility computations

Pic. 8 Detailed views at Low Beskid range, which some hills cut down the visibility of Sucha Góra TV Tower from Kral’ova Hol’a TV Tower (mapy.cz).

CASE II: BIRMINGHAM TV TOWER- STOKENCHURCH BT TOWER – 115KM

A. DESCRIPTION

Birmingham BT Tower is situated just north of the city center. It’s the tallest construction in the city rising at 152m.a.g.l.
Stokenchurch BT Tower it’s a reinforced concrete object built at Chiltern Hills, which has 99m altitude above the ground. The object is situated next to the M40 motorway between London and Oxford.

B. COMPUTATION

h1b - the height of the Birmingham BT Tower
h2b - the height of the Stokenchurch BT Tower
Tvm - total margin of visibility

TaV = (h1b+h2b) - Tvm
TaV = (152+99) - 60
TaV = 251-60 = 191m.a.g.l.

This time I’ve used the shorter computation because I am not sure about the height of the ground, where the Birmingham BT Tower stands. As was covered above, we can use the “Meters above the ground” option in the Heywhatsthat.com service (Pic. 4).

C. RESULTS

These towers are invisible to each other, as per the estimations shown below (Pic. 9, 10).

Heywhatsthat.com visibility computation between two towers3

Pic. 10 Case II of visibility computations between Birmingham BT Tower and Stokenchurch BT Tower blocked by Cotswolds hills.

Birmingham BT Tower visibility computations

Pic. 11 Detailed views at Cotswolds hill, which breaks the line of sight between the Birmingham BT Tower and Stokenchurch BT Tower (Mapy.cz).

Let’s have a look also from the opposite direction…

Heywhatsthat.com visibility computation between two towers4

Pic. 12 The case II of visibility computations between Stokenchurch BT Tower and Birmingham BT Tower, which cannot see each other because of the Cotswolds hills on the way between them.

CASE III: SANDY HEATH TRANSMITTER – BELMONT TRANSMITTING STATION – 134KM

A. DESCRIPTION

Sandy Heath Transmitter is located near Sandy Town in Bedfordshire, UK. It rises 244m above the ground.
Belmont transmitting station stands in The Wolds – a hilly charming landscape lying next to the North Sea. This is the second tallest structure in the UK, rising 351m above the ground.

B. COMPUTATION

We use the same computation as in Case II, because the rough altitude above the sea level is not known.

h1b - the height of the Sandy Heath transmitter
h2b - the height of the Belmont transmitting station
Tvm - total margin of visibility 

TaV = (h1b+h2b) - Tvm 
TaV = (244+351) - 60 
TaV = 595-60 = 535m.a.g.l.

C. RESULTS

In this case, both constructions are intervisible. The line of sight nearly grazes the ground in places (Pic. 13), but if it happens for the circumstances including the margin of visibility, it means, that another 25m of the remaining tower should be visible.

Heywhatsthat.com visibility computation between two towers5

Pic. 13 The case III of visibility computations between the Sandy Heath transmitter and Belmont transmitter station.

4. USING HEYWHATSTHAT.COM FOR LINE OF SIGHT COMPUTATION BETWEEN TWO ARTIFICIAL OBJECTS – CASE STUDIES – METHOD II

The second method is based on the visibility cloak, which comes from the altitude of the given artificial object. By computation visibility cloaks for two artificial objects, we can next check the viewshed range for them. If these viewsheds overlap each other, then the tops of these structures are intervisible. Let’s check it through all cases discussed. You don’t need any formulas here, as the Heywhatsthat.com service does everything for you. On the other hand, you should take care a bit about the performance of these results. They were discussed already for Google Earth, but going a step further, you can always display them a bit smarter, without the satellite imagery. A quite good way to do it can be QGIS or Google MyMaps, where you can upload extracted .kml files (visibility cloak.kml) and display them on Google Maps or OpenStreetMap canvas. Furthermore, in QGIS you can convert them to polygons and extract roughly which part overlaps if it exists at all.

CASE I – SUCHA GÓRA TV TOWER – KRAL’OVA HOL’A TV TOWER – 155KM

As estimated in the first method, the primary hill, which breaks down the line of sight between these two towers is Jaworzynka in Low Beskids (Pic. 7, 14). It’s worth to mention, that the hills, which straddle between these two visibility cloaks advance of the Lewockie Hills (Pic.5, 14), which explains away the first situation (Pic. 5), where the line of sights terminates in that place.  Now, we have the proof of the inaccuracy of the very first profile (Pic. 5). It could be the result of parallax against the mountains across the line of sight. Even 200m in horizontal line can cause the differences such as this.

Heyhwatsthat visibility cloak QGIS

Pic. 14 The visibility cloaks of Sucha Góra TV Tower and Kral’ova Hol’a TV Tower.

In both cases the total altitudes of the tower tips have been cut down by 30m (60m in total) due to forests, and so on. Looking at the image above we can clearly see, that both visibility cloaks are quite separated from each other on the line of sight. It definitely excludes the visibility of these 2 objects from each other. Anyhow, if an observer will move just 100m northwest, towards the top of the Jaworzynka Hill, he will see both objects (at least their tips) in opposite directions! In fact, finally these two towers remain not intervisible!  The same applies to the Lewockie Hills, which were meant to be the reason of visibility failure between these two towers. They’re just about 500m from the line of sight. Looking in the opposite direction it’s just 40m! (Pic. 15) Now, you are convinced enough about the high accuracy required for analysis like these!

Lewickie Hills Heywatsthat.com viewshed

Pic. 15 The narrow part of viewshed along the line of sight between Kral’ova Hol’a TV Tower and Sucha Góra TV Tower proves, that the accuracy of defining the line of sight profile between two objects is in a high demand.

These two towers can be visible wjhen refraction coefficient will exceed 0.25.

CASE II BIRMINGHAM BT TOWER – STOKENCHURCH BT TOWER – 115KM

This method also proves that these 2 objects cannot see each other. Like it was computed previously, the northeasternmost part of Cotswolds hills interrupts the line of sight completely (Pic. 16). The refraction coefficient of 0.7 is required for making these 2 towers visible, but it’s rather unrealistic. Again, 30m was subtracted from both altitudes.

Heyhwatsthat visibility cloak QGIS2

Pic. 16 The visibility cloaks of Birmingham BT Tower and Stokenchurch BT Tower. They are separated from each other along the line of sight, which means that the objects cannot be intervisible.

Birmingham BT Tower from Queensway

Pic. 17 Birmingham BT Tower as seen from Queensway.

Stokenchurch BT Tower from Princes Rinsborough

Pic. 18 Stokenchurch BT Tower as seen from around Princes Rinsborough.

CASE III: SANDY HEATH TRANSMITTER – BELMONT TRANSMITTING STATION – 134KM
This is the only case, where two towers are visible from each other. Despite their altitudes reduced by 30m for known reasons, an observer sitting at the top of one of them could be theoretically able to see the top of the other one (Pic. 17), although even a 100m shift would exclude this possibility!

Heyhwatsthat visibility cloak QGIS3

Pic. 17 The visibility cloaks of the Sandy Heath transmitter and Belmont transmitter station, which overlap each other proving that these objects are intervisible.

By concluding this method I would also advise checking in addition the area where visibility cloaks overlap. Sometimes, when it happens roughly in some urban areas it might be, that there is some high-rise building located. In turn even for “positive” results of computation the line of sight will remain obstructed.

Belmont transmitter station

Pic. 22 Belmont transmitter station as seen from the Benniworth village.

Sandy Heath transmitter

Pic. 23 The close-up view at Sandy Heath transmitter.

5. EXAMPLES

I would like to show you some examples of objects visible from higher parts of another object. One of the best example is my visit to The Shard in London, where I could watch the horizon from about 270m above the local ground. There were some constructions visible, which would’t be possible to spot from the ground (Pic. 24, 25).

Didcot powerplant from The Shard

Pic. 24 The former view of the Didcot powerplant chimney rising above Chiltern Hills as seen from The Shard observation deck at a distance of about 80km. This chimney wouldn’t be visible from the ground at that location.

Dover Transmitter from The Shard

Pic. 25 The view at Dover transmitter from The Shard observation deck. This construction is visible only from an elevated position, which gives the observation deck.

6. SUMMARY

The Heywhatsthat.com service gives a couple of options for estimation the visual range between two artificial objects. By using these computations we don’t need to worry about the calculations of the Earth’s curvature, which this platform takes care about. However, if you wish to have more detailed results, additional calculations are required. For the time being, this article gives you a hint on how to estimate the potential visual range between two objects. The more precise continuation of this matter is planning for the future.
Both methods are different from each other because the first one is based on geometrical interpretation and the second one is focused more on graphic depiction. The case studies reflect three different kinds of topography from the mountainous regions across the highland areas and finally the lowlands with no serious obstruction. In all the cases the altitudes have been reduced by 30m, which correspond more or less to the height of the trees and forests in general. The output is valid strictly along the marked line of sight only.
This is the first approach for possible viewshed extension in terms of long-distance observations, where we are considering something appearing far away above the horizon instead of in the vicinity, as discussed in terms of the Visual Impact Size (VIS) method. I would like this subject to be developed in the future by expanding it to much more precise calculations and patterns.

Mariusz Krukar

 

References:

  1. Caha J., 2017, Representing buildings for visibility analyses in urban spaces, (in:) Dynamics in GIscience, Lecture Notes in Geoinformation
    and Cartography, Springer International Publishing
  2. Czynska K., 2018,  High precision visibility and dominance analysis of tall building in cityscape, (in:) City Modelling & GIS, vol. 1
  3. Fisher P.F., 1996, Extending the Applicability of Viewsheds in Landscape Planning, (in:) Photogrammetric Engineering and Remote Sensing, 62(11), pp. 1297-1302
  4. Pompa-Garcia M., et al., 2010, Viewshed Analysis for Improving the Effectiveness of Watchtowers, in the North of Mexico, (in:) The Open Forest Science Journal, vol.3, p.17-22.
  5. Popelka S., Vozenilek V., 2010, Landscape visibility analysis and their visualisation, (in:) Dept. of Geoinformatics, Palacky University, Olomouc, Czech Republic, conference paper
  6. Sander A.H., Manson S., 2007, Heights and locations of artificial structures in viewshed calculation: How close is close enough?, (in:) Landscape and Urban Planning 82(4), 257-270.

Links:

  1. https://notesfrompoland.com/2021/02/22/warsaw-skyscraper-becomes-eus-tallest-building/
  2. World’s top 100 tallest buildings
  3. The Visual Impact Size method explained
  4. https://landscapearchaeology.org/2019/visual-impact-analysis/
  5. Snellius vs Pitagoras 1:0 (Polish)
  6. https://earthcurvature.com/
  7. Earth curvature – calculation of the height of the obscured part of the structure

Forums:

  1. https://gis.stackexchange.com/questions/261933/viewshed-analysis-how-to-assess-the-amount-of-a-building-that-would-be-visible

Wiki:

  1. Horizon
  2. Parallax
  3. Viewshed_analysis

The post Manual estimation of the visual range between two artificial objects – case studies first appeared on MkrGeo.

]]>
http://www.mkrgeo-blog.com/manual-estimation-of-the-visual-range-between-two-artificial-objects-case-studies/feed/ 0 65166
Saving Openlayers custom drawings as the .geoJSON file http://www.mkrgeo-blog.com/saving-openlayers-custom-drawings-as-the-geojson-file/ http://www.mkrgeo-blog.com/saving-openlayers-custom-drawings-as-the-geojson-file/#respond Mon, 04 Oct 2021 18:25:40 +0000 http://www.mkrgeo-blog.com/?p=65017 Saving Openlayers custom drawings as the .geoJSON file MkrGeo

In this short post, I would like to demonstrate to you the programmatic method of saving the custom shapes in OpenLayers as the .geoJSON file. Drawing own features on the OpenLayers map canvas equipped with some existing layers, like it takes place in case of the map rendered by the QGIS2Web plugin can be a […]

The post Saving Openlayers custom drawings as the .geoJSON file first appeared on MkrGeo.

]]>
Saving Openlayers custom drawings as the .geoJSON file MkrGeo

In this short post, I would like to demonstrate to you the programmatic method of saving the custom shapes in OpenLayers as the .geoJSON file. Drawing own features on the OpenLayers map canvas equipped with some existing layers, like it takes place in case of the map rendered by the QGIS2Web plugin can be a really beneficial feature. We can use it for displaying some changes on the field against the moment when the layers were exported from QGIS. Moving away from the QGIS2Web example, a user is simply eligible to plot its own data onto a blank OpenLayers map. There is a lot of sources, where you can read about drawing your own features in OpenLayers maps and obviously get the ready, full working codes for adoption into your own map. Find them in the links below. The step of my explanation covers one of the ways of exporting these drawings into the .GeoJSON file, which can be imported i.e. to QGIS later.
Our process will include 2 steps only. The first step covers the export button equipped with the export function defined in the code. Another step is to download the result as the .geoJSON file.

Before we attend to writing or copying the code, we should remember about the jQuery link in our index.php document, where I am convinced, your map is stored. This JQuery link should be at the top of the other script sources (Pic. 1), otherwise, the console won’t recognize our jQuery selector.

JQuery link index.php

Pic. 1 The place of the JQuery link in the index.php section (it can be also in the section. The <button> has been also included just beneath the drawing selection.

In our index.php we should start from the <button> property defining the place, where we will export our drawings as the .geoJSON file.

<select id="draw">

            <option value="select">Select to draw…</option>

            <option value="point">Point</option>

            <option value="line">Line</option>

            <option value="polygon">Polygon</option>

            <option value="circle">Circle</option>

            <option value="rectangle">Rectangle</option>

            <option value="star">Star</option>

          </select>

          <button type="button" class="exportBtn"><span>geoJSON</span></button>

Next in our JavaScript code, we should allocate the function for this button, making it running.

$(".exportBtn").click(function(){

    var json = new ol.format.GeoJSON().writeFeatures(vectorLayer.getSource().getFeatures(), { 

      dataProjection: 'EPSG:4326', featureProjection: 'EPSG:3857'

    });

    console.log(json);
});

Having proper feature projection, we will receive the correct coordinates. It should match your task purpose. In my example, I used EPSG:3857 (Pseudo-Mercator).

Since the console returns proper .geoJSON content, we are on the right track to get our layer properly (Pic. 2).

OpenLayers drawing features GeoJSON export

Pic. 2 Export new features drew in OpenLayers as the .geoJSON file – the .geoJSON content in the Google Chrome console.

Our second step includes export this .geoJSON content to the local directory. For this purpose, we should expand our JavaScript bode by adding the function of exporting the content as the pure .txt file.

function download(content, fileName, contentType) {

      var a = document.createElement("a");

      var file = new Blob([content], {type: contentType});

      a.href = URL.createObjectURL(file);

      a.download = fileName;

      a.click();

  }

  download(json, 'json.txt', 'text/plain');

Important here is the last line highlighted, which defines both file name and its extension. Because the console shows us the content written in  .geoJSON format, we shouldn’t worry about losing it when saved as the .txt file. On the other hand, the text file seems to be universal enough to be saved in the different extensions. In this case, we should already define both file name and its extension by changing it straight to .geojson, like below:

download(json, 'your_layer.geojson', 'text/plain');

Finally, the full code will look as per below:

$(".exportBtn").click(function(){

    var json = new ol.format.GeoJSON().writeFeatures(vectorLayer.getSource().getFeatures(), { 

      dataProjection: 'EPSG:4326', featureProjection: 'EPSG:3857'

    });

    console.log(json);

    function download(content, fileName, contentType) {

      var a = document.createElement("a");

      var file = new Blob([content], {type: contentType});

      a.href = URL.createObjectURL(file);

      a.download = fileName;

      a.click();

  }

  download(json, 'your_layer.geojson', 'text/plain');

});

Now, by clicking our button we should be able both get the .geoJSON data displayed in the console as well as saved them under the your_layer.geoJSON file.

OpenLayers drawing features and export as GeoJSONQGIS Add vector layer (GeoJSON)

OpenLayers GeoJSON layer in QGIS

Pic. 3 – 5 Saving the OpenLayers drawing features as the .geoJSON layer and its import to QGIS.

When you save the .geoJSON file from your OpenLayers map, you can import it to QGIS or other GIS software. Remember, that this file will always come with separate layers, as we used various geometries during our drawing. Basically, our file will come as the layer group, from where we can extract all layers with varied geometry: Points – PointLayer; Line – LineString; Polygon – Polygon.
It’s a quick and quite easy way to export our own drawings from OpenLayers map and use it in various GIS platforms thereafter.

OpenLayers drawing features export as GeoJSON and import to QGIS

Mariusz Krukar

Links:

  1. https://openlayers.org/en/latest/examples/draw-freehand.html
  2. https://dolmenweb.it/viewers/openlayer/examples/draw-shapes.html
  3. OpenLayers – draw & edit tools
  4. OpenLayers – features to GeoJSON export
  5. OpenLayers – vector format examples

 

Forums:

  1. https://stackoverflow.com/questions/50449105/saving-layer-from-openlayer-3-map-created-by-user
  2. https://stackoverflow.com/questions/54313855/converting-openlayers-polygon-to-geojson-with-different-projection
  3. https://gis.stackexchange.com/questions/263787/taking-draw-features-as-geojson-after-completed-drawing
  4. https://stackoverflow.com/questions/18740345/how-to-save-features-layer-in-openlayers
  5. https://stackoverflow.com/questions/35917225/save-interaction-draw-openlayers
  6. https://gis.stackexchange.com/questions/179907/openlayers-3-geojson-save-and-load
  7. https://stackoverflow.com/questions/2075337/uncaught-referenceerror-is-not-defined
  8. https://stackoverflow.com/questions/34156282/how-do-i-save-json-to-local-text-file

 

The post Saving Openlayers custom drawings as the .geoJSON file first appeared on MkrGeo.

]]>
http://www.mkrgeo-blog.com/saving-openlayers-custom-drawings-as-the-geojson-file/feed/ 0 65017
Batch styling of KML files in Google Earth http://www.mkrgeo-blog.com/batch-styling-of-kml-files-in-google-earth/ http://www.mkrgeo-blog.com/batch-styling-of-kml-files-in-google-earth/#respond Wed, 22 Sep 2021 17:12:59 +0000 http://www.mkrgeo-blog.com/?p=64987 Batch styling of KML files in Google Earth MkrGeo

Probably you used Google Earth many times, watched at least a few tutorials, and tried to manipulate some files by yourself. On the Web, you can find many sources, where the process of creating some simple elements in Google Earth is explained. Besides the drawing features, Google Earth can be a place where a user […]

The post Batch styling of KML files in Google Earth first appeared on MkrGeo.

]]>
Batch styling of KML files in Google Earth MkrGeo

Probably you used Google Earth many times, watched at least a few tutorials, and tried to manipulate some files by yourself. On the Web, you can find many sources, where the process of creating some simple elements in Google Earth is explained. Besides the drawing features, Google Earth can be a place where a user can alter existing .kml files uploaded from external sources. Usually, they can be done one by one, although here I want to demonstrate the way, you probably didn’t know before.
For instance, by reading this article, you can realize, that changing the properties of each object (or circumstance) separately might take a while. There is completely no need to do it like shown in the link above unless you deal with the dynamic circumstances like changing cruising altitude. What is most important, the multiple-selection feature is possible just from the Google Earth Pro 7.3.2 version released in early 2019. Compressing our task to styling only, we can make the desired change only once for all the files. See the steps below how to do this:

1. Create a new folder in your “Places” panel located on the left (Pic. 1).

Google Earth Places new folder

Pic. 1 New folder in the “Places” section.

2. Move all your objects to the folder regardless of their total number. You can do it in pieces (Pic. 2).

Google Earth moving objects to the folder

Pic. 2 Moving objects to the folder, where: 1 – select all of the items and dragging them to our new folder; 2 – All the files in our new folder.

3. Every single object has its properties to change (Pic. 3). Look at all the options available there.

Google Earth KML file properties

Pic. 3 The properties of the single object in Google Earth.

Looking at the above screenshot, you have an example of a defined style for one element. This style can be different across the other files in your folder.

4. Now, right-click on your folder including all the files instead of one file like previously (Pic. 4) and select the “Properties” option again. In this case, you will see nothing apart from the message that  “The descendant(s) of this folder do not share the same style. Click the button below if you want to force all descendants to share the same style.”
By clicking the “share style” button, every single object located in your folder adopts the style visible in the “Properties” window. You can even notice, that all your elements become uniform regardless of their number in the folder.

Google Earth batch styling files

Pic. 4 Batch styling files in Google Earth: 1 – Right-clicking in the folder and selecting the “Properties” option; 2 – The information about not the same style features of the folder descendants, which requires clicking the “Share style” button; 3 – Styling properties.

5. At this step just change your options left. You can alter both styles and colors as well as the altitude and view of your items. What is the most convenient, every single change can be instantly visible in your Google Earth map beneath (Pic. 5).

Google Earth batch styling files 2

Pic. 5 Batch styling files in Google Earth can be monitored simultaneously with any alterations provided in the “Properties” window.

6. When you are happy with your styling, just click “OK” making your job done.

Google Earth batch styling files 3

Pic. 6 Batch styling of the files in Google Earth is complete.

I have done it for about 120 features. Everything took me about a minute! Imagine now how much time you can save for bigger amount of items. The prerequisite is their uniformity. The process cannot be applied when your job requires keeping the styling various. Every “Sharing style” will erase all other styles defined previously. This is basically the one and very huge disadvantage of this solution. Concluding, this process must be applied deliberately. If this explanation wasn’t clear enough for you, watch the video below.

Mariusz Krukar

Links:

  1. Notes of Google Earth releases

Forums:

  1. https://gis.stackexchange.com/questions/9662/select-more-than-one-place-at-a-time-in-google-earth
  2. How do I select multiple placemarks to move them all in the same folder?

Youtube:

The post Batch styling of KML files in Google Earth first appeared on MkrGeo.

]]>
http://www.mkrgeo-blog.com/batch-styling-of-kml-files-in-google-earth/feed/ 0 64987