Wednesday, November 12, 2014

I'm very proud of this title, Building Web Applications with ArcGIS

Among the books I wrote, this one stands out. I have used a story based approach starting from the first chapter up until the very last appendix.

This book starts with a problem. A problem that you will be solving. A client hands your his requirements to build a web application with ArcGIS. With each chapter you will be implementing one functionality until you bring and complete the entire project and web site up and running in the last chapter.

All this is being done with the ArcGIS for Javascript API, not feeling like writing code? With each chapter I hand you the end result source code.




I believe that this book will benefit a lot of those who want to begin programming with ArcGIS for Javascript. It doesn't require you to have any prior knowledge of ArcGIS as well.

Click here to get your copy

Yours
Hussein Nasser





Tuesday, October 21, 2014

Welcome to IGeometry, My first educational Youtube channel to teaching GIS Programming





I wanted to do this for a long time, I finally had the energy and the will. I call it IGeometry. I choose this name because this is my favorite ArcObjects interface and it is the core of all ArcGIS development.

I have already uploaded the first episode of the Learning ArcObjects with .NET Programming playlist.

I will keep posting GIS educational videos enshalla.

This is the link


Cheers,
stay awesome.

Hussein Nasser

Thursday, October 16, 2014

Multi-Threading and ArcGIS

As our processors get stronger and stronger with multi cores, software steps up to fully utilize these cores in order to be more effective at processing. Thus born the multi threading concept where a software can spawn threads do extra work independently from the parent process.

Although ArcGIS for Desktop up until now, (10.2.2) is not fully Multi-threaded, i.e. not all its functionalities are delegated to threads for execution, you still can write your own full Multi-threaded customizations on top of it.

There is a catch though.

For instance, below is an ArcMap customization code with two command buttons, both draw  marker element on the map. However, one does it with threading, the other without threading.



 
       
    '--------------------- Threading Example ---------------------
    Public Overrides Sub OnClick()
        'TODO: Add CreateCircleThreading.OnClick implementation
        Dim pThread As New Threading.Thread(Sub() DrawCircle(RGB(255, 0, 0)))
        pThread.Start()
    End Sub



 '--------------------- No Threading Example ---------------------
    Public Overrides Sub OnClick()
        'TODO: Add CreateCircleNoThreading.OnClick implementation
        'draw a red circle in the center
        DrawCircle(RGB(0, 0, 255))

    End Sub
 


    Public Sub DrawCircle(lRGBColor As Long)
        Dim pMxdoc As IMxDocument = m_application.Document

        Dim pMarkerElement As IMarkerElement = New MarkerElement
        Dim pMarkerSymbol As IMarkerSymbol = New SimpleMarkerSymbol
        Dim pColor As IColor = New RgbColor()
        pColor.RGB = lRGBColor

        pMarkerSymbol.Color = pColor
        pMarkerSymbol.Size = 50

        pMarkerElement.Symbol = pMarkerSymbol

        Dim pElement As IElement = pMarkerElement

        pElement.Geometry = pMxdoc.ActiveView.Extent.UpperRight

        pMxdoc.ActiveView.GraphicsContainer.AddElement(pElement, 0)

        pMxdoc.ActiveView.Extent.Expand(100, 100, False)
        pMxdoc.ActiveView.Refresh()

    End Sub

 
 

Obviously both will give you the same result, however, the threading option is better if you want to free up your cpu to do more important things, and of course if your operation is much more heavier than drawing a simple element. You want to through the bulk work on a thread to do that.

There is however, something interesting. The threading code I just gave you? it doesn't work. Yes its broken. The reason is that ArcGIS and ArcObjects (especfiically ICommand interface the command button for ArcMap) do not support invoking threads that owns its controls. So you will call a new thread (which is isolated from ArcMap) and then that thread will tries to draws an element on ArcMap, which she (i don't know why I think its a woman) doesn't have access to throwing an error in the process. So this is a classic problem called cross-thread violation.

Solving this problem is easy, you need to force the class that implements ICommand to have an invoke capability, so you have to make your ArcMap button into a Windows Form which allows invoking into the same thread. At least this is how I solved it, if you guys have another method please do share. Below is the code


 

Public NotInheritable Class CreateCircleThreading
    Inherits Form
    Implements ICommand
...
...

    Public Sub OnCommandClick() Implements ICommand.OnClick
        'TODO: Add CreateCircleThreading.OnClick implementation

        Me.Invoke(Sub() DrawCircle(RGB(255, 0, 0)))

        'Dim pThread As New Threading.Thread(Sub() DrawCircle(RGB(255, 0, 0)))
        'pThread.Start()
    End Sub


    Public Sub DrawCircle(lRGBColor As Long)
        Dim pMxdoc As IMxDocument = m_application.Document

        Dim pMarkerElement As IMarkerElement = New MarkerElement
        Dim pMarkerSymbol As IMarkerSymbol = New SimpleMarkerSymbol
        Dim pColor As IColor = New RgbColor()
        pColor.RGB = lRGBColor

        pMarkerSymbol.Color = pColor
        pMarkerSymbol.Size = 50

        pMarkerElement.Symbol = pMarkerSymbol

        Dim pElement As IElement = pMarkerElement

        pElement.Geometry = pMxdoc.ActiveView.Extent.UpperRight

        pMxdoc.ActiveView.GraphicsContainer.AddElement(pElement, 0)

        pMxdoc.ActiveView.Extent.Expand(100, 100, True)
        pMxdoc.ActiveView.Refresh()

    End Sub




One more thing, our command is not exactly a form until you create a handle for it. So we have to add this line in the new constructor. Showing and hiding the form will take care of this.


            'force to create handle (VERY IMPORTANT)
            Me.Show()
            Me.Hide()


You can download source working code here



Monday, October 13, 2014

Night's Watch: the Software that allows you to watch your machines

As software get more complicated, better hardware is needed to support it. More servers are installed, and thus they all need to be maintained. This project is initiated as an attempt to capture the performance of multiple servers connected on the same network. The product captures the cpu utilization, RAM usage and availability and other information and allows the user to process and analyze this information. There is a live web interface which provides an active state of the servers and whether they are online and up and running. The solution is designed carefully to be scalable and portable, currently only supported for windows machines.
Today, I bring you the alpha version of a software that I have been working on for a while. The Nights Watch.

Night’s Watch is an easily configured application that allows you to monitor network connected Windows machines from a web interface and see their CPU and RAM usage, whether they are connected or not. The real power of the Night’s Watch is that you don’t require installing any client software in the machines that need to be monitored. Which makes the installation and scaling very easy to implement.




It is a matter of simply adding the machines that you want to monitor into a configuration file and the Night's Watch takes care of the rest. 


Try it out guys and let me know, here is me shipping it finally.

Wednesday, September 3, 2014

9223372036854775807 is a special number

The number 9223372036854775807 is a very special number in programming but why?

Take a look at this small program in .NET, I have declared a long integer and saved this number in it.




I will now increase this number by 1 and try to store it. I will try to store the 9223372036854775808 number Note the compile error I got in this code.



The reason it overflowed is because n is a signed long integer variable, which means it is a 64 bit number. This means it can hold up to 2^63 -1 only and the computer cannot store the extra number.


Avoid Overflows! Make sure your calculations doesn't exceed this number in your future code!

Want to learn programming and software engineering? Follow my YouTube Channel 

Saturday, August 30, 2014

Build something small that scales

If you are starting a new project, you don't want to build something large. Instead build something small that scales easily.
You might ask how can one build something small that scales into something large. Well, I always ask myself while designing a new software, "What if tomorrow a company wants to buy this software and run it on a multi million user environment? Will they be able to add more hardware, reboot and just play?"

If the answer is no, I redesign it and ask the same question again until I get a yes.

Only then I start coding. 

Monday, July 14, 2014

Learning ArcGIS Geodatabases, Published!

It took some time but it is there finally,

I really hope it will benefit my readers and the users of ArcGIS!

Click here to see the book

Learning ArcGIS Geodatabases

What you will learn from this book

  • Explore the benefits of geodatabases with practical illustrations
  • Work with geodatabase datasets covering feature classes, tables, relationship classes, coverage, and annotations
  • Model your geodatabase by creating a sturdy design that can sustain large edits and decrease maintenance
  • Discover various tools to optimize queries and response time, which will help you to fine-tune your geodatabase
  • Utilize Python scripting to author your geodatabase programmatically
  • Set up and configure a full-fledged networked enterprise geodatabase using ArcSDE technology
  • Add programming flavors to your geodatabase using Python

In Detail

ArcGIS is an industry standard for geospatial development and management. A geodatabase is the database used to store and manage the spatial data.
Learning ArcGIS Geodatabases offers a comprehensive working and practical experience for readers who are interested in knowing about ArcGIS. The initial chapters guide you through authoring geodatabases and creating a geodatabase schema and datasets. Then, the book focuses extensively on modeling and optimizing geodatabases.
Finally, you will be able to work comfortably with datasets, annotations, and relationship classes, making it easier to migrate from a legacy database to an ArcGIS geodatabase.

Approach

This is a solution-based book, showcasing the real power of ArcGIS Geodatabase by following a real-world, example-based approach

Who this book is for

This book is aimed at geospatial developers who want to work with ArcGIS geodatabases as well as manage them. Having knowledge of building a geodatabase from scratch isn't a must; Learning ArcGIS Geodatabases is ideal for those who want to use ArcGIS geodatabase for the first time, or for those who want to migrate from their existing legacy database to a geodatabase.

Sunday, May 25, 2014

Arc2Google is now Certified for ArcGIS for Desktop 10.2.1

Hey guys,

I get a lot of emails thanking me for Arc2Google, I'm really happy to see GIS users and students really benefiting from this tool and I'm glad that I wrote it!

One more thing, you have been asking me for a while to upgrade Arc2Google to support 10.2 and 10.2.1. It is finally up, and the good news is the new version 10.x.x.1 is supported and certified for all the 10.x versions, 10.0 SP5, 10.1 SP1, 10.2 and 10.2.1

Click here to download and see the instruction for installations.

Tuesday, May 6, 2014

My new title: Learning ArcGIS Geodatabase Book, Stay tuned!

Last year I have released my first GIS book to the public with the help of Packt, a great British Publisher. It took me around a year to write, and it was a wonderful journey.

Currently, I have been working again with Pact for few months on a new title on ArcGIS Geodatabses. I am tailoring this one specially for students as I have been received some feedback (thanks alot guys) that Adminstering ArcGIS for Server was a bit advanced for GIS students and doesn't include basic features. Learning ArcGIS Geodatabases will be designed for those who want to start using ArcGIS technology or have been using it and want to learn more about geodatabases.

By contract I cannot exactly release the outline to you guys, however I can assure you that the title will include Creating,  Modeling, Optimizing and even programming geodatabases. I will also include a dedicated chapter for enterprise geodatabases and how you can setup yours from scratch. All these are with complete workable examples, supporting files and exercises. It is going to be fun!

Stay tuned! I am hoping to release it before the end of 2014.



Monday, April 21, 2014

A blast from the past, Esri ArcGIS Server Code Challenge April, 2007

In 2007, I won the first place at the ArcGIS for Server Code Challenge, conducted at the Esri Developer Summit in Palm Springs, California, for using AJAX technology with ArcGIS for Server, which was not implemented back then.


I remember winning a Trimble device which until this day I keep it.


p.s. Mind the picture.