Wednesday, May 25, 2011

Choropleth mapping techniques for Web2.0

Be The First To Comment
For my recent project, I have to display county wise time series data of disease pattern in web map for the conterminous United States for 20 years. In addition, I have to use Google maps as base layer and should overlay images on the top of it.  The concept sounds easy, and it was also similar with choropleth or thematic mapping. However, it should be in the Web 2.0.

I tried to figure out what are the possible ways to achieve this, I tried and few of them. Here I am going to share the pros and cons of these methods in a real quick and dirty style.

Choropleth with GFT
1) Google Fusion Tables

Pros:
Easy, No understanding of computer programming needed. Upload small or large data sets from spreadsheets or CSV files. Visualize your data on maps, timelines and charts. Pick who can access your data; hide parts of your data if needed. Merge data from multiple tables.

Cons:
Not much flexible and you can’t tweaks easily according to your needs. 

Choropleth with Cartographer.JS and Google API
2) Cartographer.js and Google API

Pros: It generates choropleth maps directly from database or other standard data handlers. Fast for small area mapping.

Cons:
Understanding of JavaScript is needed. It supports only US (County and State level data). I got performance is worst if we map entire 50 states. I recommend it to use to map few states only. Although cartographer.js's documentation claims browser friendly, it is horrible with IE, works so so with Firefox and chrome. 

Raster Misalignment with Base Data in ArcMap10

Be The First To Comment
In the early Friday morning of mid May, I got an email from one of my team member about raster misalignment problem in ArcGIS10. I also tried to overlay couples of previously working Tiff and Grid raster files in ArcMap9.3 and ArcMap10. The ArcMap9.3 overlay raster files perfectly aligned as we all desired, but ArcMap10 did not.
Unaligned

Aligned

From the ESRI website, I got to know that the issue of misalignment of Tiff in ArcMap10 is a bug in ArcGIS 10. The ESRI team announced two solutions to solve Tiff shift into wrong geographic locations:

Monday, May 16, 2011

Good Book for GIS Beginners: Book I

Be The First To Comment
Getting to know ArcGIS Desktop is one of the book kept in my collections ever. I started GIS from this book in 2009. It is easy, simple, and step by step tutorials with lots of real time beginner's project.

This book has very useful basics for using ArcGIS 10 , especially ArcMap 10 . It is primarily targeted for beginners with lots of hand on exercises, which are easy to follow with plenty of screen shots that made it easy to find the necessary buttons/menus/lists on my screen.

However, the major drawback of this book is the ArcGIS software comes with book has 180 days license.  

Most of the universities uses this book for GIS beginners. .In amazon.com this book is come up with special discount. Don't forget to catch the deal. I have lots of GIS books in my bookshelf,  I will write about them later. Hope this helps for you. Cheers !! Grab a coffee and enjoy your work..

Sunday, May 15, 2011

Malaria against malaria: Pre-existing malaria infection can prevent second infection

Be The First To Comment
Today, Nature published a good research about malaria prevention using Malaria against Malaria.  The research was successfully accomplished in  rats. Here is the abstract from www.medicalxpress.com  " A team of researchers have found that pre-existing malaria prevents secondary infection by another Plasmodium strain, the parasite responsible for malaria, by restricting iron availability in the liver of the host. This discovery will be published this Sunday, May 15, in Nature Medicine and has important implications for the management and prevention of malaria, a condition which affects millions of individuals worldwide." more

New way of Mapping : Crisis Mapping

Be The First To Comment

The above video about the uses of cell phone for mapping to help disaster victims world wide. This method was initially built for Haiti earthquake disaster, then used by Japan, and currently this technology is using in Alabama. Today, there are hundreds of volunteers in more than 50 countries creating maps of crises around the world via their cell phones
Watch the full episode. See more Need To Know.

Thursday, May 12, 2011

Nostalgic vibe at SDSU

Be The First To Comment
Faculty listing, Department of Geography, SDSU
As a quixotic geographer exploring and trying new things in everyday in life really matters to me.  However, I would not forget our great people who spent their lifes in geography and inspire me to be a good geographer. I got a chance to know about the history of old geographers and their geography practice then in "Geographic Evolution of Thought". I used to get boared in my history class, but I very much enjoyed the class geographic evolution of thought by Dr. George White at South Dakota Sate University.  To memorize all great people who contributed in the geography department so far, I made a visual list of them.

Sunday, May 8, 2011

River bank and Gorge as Highway

Be The First To Comment
Today morning, I saw couples of fascinating pictures; highway in the Kali Gandaki gorge, Nepal. This 93km long highway connects the Himalayan district Mustang's capital Jomsom with Lo Mangthang, Mustang. Typically a carrier takes 9 hours to accomplish the journey in this dangerous road.



Pictures are taken by Chandra S. Kari, the photo journalist of Nagariknews.com.

Friday, May 6, 2011

Rotate DIV by 90 degree

2 Comments
Here, I am going to share the styles found on internet to rotate Div. Unfortunately, it doesn't work in IE. Any ideas?

style="-webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);"

Geospatial Analysis to Find Bin Laden's Hideout

Be The First To Comment
Think, how powerful in geospatial technology? Finding Bin Laden using GIS?..........Are you kidding me? .......Take a look on this article from Good politics share the UCLA students' research on finding Bin Laden's possible hideouts using geographical theories and  GIS software.

The students were work under Prof. Thomas Gillespie and John Agnew, UCLA, were published their findings in MIT International Review(Pdf).

Wednesday, May 4, 2011

Fix the text length inside DIV

Be The First To Comment

Here are two divs for controlling characters length inside div.


    <div style="width:250px;border:solid 1px red; height:30px;word-wrap:break-word;overflow:hidden;text-overflow:ellipsis-word">
                 <div style="border:solid 1px green;padding:none; height:30px">
                 asdfasdfasdfasdfasdfasdfasdfa asdfasdfasdfasdfasdfasdfasdf asdfadf asdf asdf asdf asdfasdfasdfasdf asdf
asdfasdfafd                 
                  </div>
        </div>

Unified Search Engine

2 Comments
Quick and Dirty method to Combine MS Search Service, Indexing Service and SQL Server to provide a unified search engine for your ASP.NET website



Recently I was developing a site for a company and as usual they needed me to write a search engine. They had the contents in .aspx pages, not a problem, but they also had forums whose contents were collated in a database table, in a column to be precise. They wanted me to display the results from these two sources through a common search engine. Since I had little time to write a search engine of my own, I put the power of MS Search Service, Indexing Service and SQL Server together to do the task for me. There is a lot of scope for enhancement but here is how you can implement a very basic yet powerful search engine of your own.



STEP I: Create a Web Catalog in Indexing Service



By default, the indexing service has two catalogs, one for the file system (System) and one for the default web site (Web).



If Web catalog is not present, you can easily create one.



1. Open Control Panel --> Administrative Tools --> Computer Management



2. Scroll down to Computer Management--> Services and Applications --> Indexing Service in the MMC



3. Right click Indexing Service and choose New --> Catalog



4. In the name field give Web and choose C:\Inetpub as the location



5. Right click the newly created catalog, choose Properties. Click on the Tracking tab of the properties window. Select "Default Web Site" as the WWW server.



6. Restart Indexing Service



7. Go to Computer Management --> Services and Applications --> Services and configure Indexing Service as Automatic if it is Manual or Disabled.





STEP II: Optimize ASPX and ASCX files for full-text search





By default, the *.aspx and *.ascx file types are treated as text files which are not optimized for searching by the Indexing Service. To optimize searching for these two file types copy the following into a new .reg file and run it in your computer. The customary warning: Editing registry incorrectly may prohibit your computer to run properly. Edit the registry at your own risk. I may not be held responsible for the damage you do to your computer by incorrectly following the steps below.



   REGEDIT4



   [HKEY_CLASSES_ROOT\.aspx\PersistentHandler]



   @="{eec97550-47a9-11cf-b952-00aa0051fe20}"





   [HKEY_CLASSES_ROOT\.ascx\PersistentHandler]



   @="{eec97550-47a9-11cf-b952-00aa0051fe20}"





You must have Index files with Unknown Extensions enabled. To enable this, right click on Indexing Service, choose Properties and click on Generation tab on the window. Check Index files with Unknown Extensions checkbox. Restart the computer, stop Indexing Service, delete all the contents of the catalog.wci folder (not the folder itself) corresponding to your catalog (in this case C:\Inetpub\catalog.wci), start the Indexing Service and allow it to rebuild the catalog.





STEP III: Using Full-Text Searches directly in ASP.NET Applications



This is not actually a step but a side step where you can take a pause for a moment and test whether your newly created catalog is returning some results. If you don’t have a database to worry about, then this might be your last step unless you want to link the Indexing Service with SQL Server.



Indexing service exposes itself via the OLEDB provider MSIDXS. You can take the full advantage of the server in your ASP.NET application via ADO.NET. If  you have a TextBox (TextBox1), a Button (Button1) and a DataGrid (DataGrid1) on your web form and the Web catalog in place, this might as well be the content of your button click handler:





using System.Data;



using System.Data.OleDb;



…….



…….





private void Button1_Click(object sender, EventArgs e)



{



      string strCatalog = "Web";



      string strQuery = "Select Filename, Rank, VPath from SCOPE() where FREETEXT('" + TextBox1.Text + "')";



      string connString = "Provider=MSIDXS.1;Integrated Security .='';Data Source='" + strCatalog + "'";





      OleDbConnection Connection = new OleDbConnection(connString);



      Connection.Open();





      OleDbDataAdapter da = new OleDbDataAdapter(strQuery, Connection);



      DataSet ds = new DataSet();



      da.Fill(ds);



      Connection.Close();





      DataView source= new DataView(ds.Tables[0]);



      DataGrid1.DataSource = source;



      DataGrid1.DataBind();



}





STEP IV: Link Indexing Service with SQL Server





The next step is to link the Indexing Service with your SQL Server. Open Query Analyzer or your favourite SQL script editor. Run the following script.





EXEC



sp_addlinkedserver FTIndexWeb, 'Index Server', 'MSIDXS', 'Web'



GO





where FTIndexWeb is the chosen linked server name, and Web is the catalog name you created in STEP I.





STEP V: Querying Indexing Service via SQL Server





Let's modify the previous query and run it in SQL server. Run the following query in Query Analyzer.





SELECT Q.FileName, Q.Rank, Q.VPath



FROM OpenQuery(



FTIndexWeb,



'Select Filename, Rank, VPath



from SCOPE()



where FREETEXT(''Calcutta'')



ORDER BY Rank DESC'



              ) AS Q





Replace FTIndexWeb with whatever linked server name you chose in step IV and Calcutta with your search keyword(s).





STEP VI: Enabling a table/column in SQL Server for full-text searches





Open Enterprise Manager. Browse to Console Root-->; Microsoft SQL Servers --> Databases --> Tables. Check two things before you proceed.


1. The table where you want full-text searching enabled, must have some unique constraint. If a primary key or a unique constraint is not present, create an "ID" column and apply a unique constraint.

2. Microsoft Search Service (mssearch.exe) must have been enabled and running in your computer. If not, browse to Computer Management --> Services and Applications--> Services in Computer Management MMC and configure Microsoft Search Service as Automatic and start the service.


On the Enterprise Manager MMC, right click on your table and choose Full-Text Index Table --> Define Full-Text Indexing on a table. If the option is grayed out, check #2 above.


Click Next on the popped up wizard .Choose the unique index and click Next. Choose the columns where you want indexing enabled. Click Next. Give the catalog a name and specify a physical location to store the catalog. Click Next. If you want the control over how and when the catalog is filled (full or incremental) click on New Catalog Schedule. After configuring it, come back to Full-Text Indexing Wizard and click Next. Click Finish. The wizard takes a minute or two to setup the catalog.


STEP VII: Querying Full-Text Catalog in SQL Server


Let’s test the newly created catalog in SQL Server. Run the following query.


SELECT FT_TBL.subject, KEY_TBL.RANK, FT_TBL.topicid

FROM forums_topics AS FT_TBL,

CONTAINSTABLE ( forums_topics

                ,   message

                , '"Calcutta"' )

 AS KEY_TBL

WHERE FT_TBL.topicid = KEY_TBL.[KEY]

ORDER BY KEY_TBL.RANK DESC


Forums_Topics is the table name and Message is the column name on which full-text catalog is built. Replace Calcutta with your search keyword(s).


STEP VIII: Combining the results


The steps to combine the results would be to


1. Create a temporary table

2. Insert the results of the first query

3. Insert the results of the second query

4. Query the temp table

5. Drop the temp table


We need a stored procedure for this and here it is:


CREATE PROCEDURE sp_Accounts_SearchSite

@FreeText varchar (255)

AS


SET NOCOUNT ON


CREATE TABLE #tempresults(

ID int IDENTITY,

FileNames varchar (255),

Rank int,

VPath varchar(255))


DECLARE @sql nvarchar(1000)

SET @sql = N'INSERT INTO #tempresults(FileNames, Rank, VPath) ' + CHAR(13) +

N'SELECT Q.FileName As FileNames, Q.Rank As Rank, Q.VPath As VPath ' + CHAR(13) +

N'FROM OpenQuery(FTIndexWeb, ''Select Filename, Rank, VPath from SCOPE() where FREETEXT(''''' + @FreeText + ''''')'' ) AS Q'


EXECUTE sp_executesql @sql


SET @SQL = N'INSERT INTO #tempresults(FileNames, Rank, VPath) ' + CHAR(13) +

N'SELECT FT_TBL.subject As FileNames, KEY_TBL.RANK As Rank, FT_TBL.topicid As VPath ' + CHAR(13) +

N'FROM forums_topics AS FT_TBL, ' + CHAR(13) +

N'CONTAINSTABLE ( forums_topics ' + CHAR(13) +

N', message' + CHAR(13) +

N', ''"' + @FreeText + '"'' ) ' + CHAR(13) +

N'AS KEY_TBL' + CHAR(13) +

N'WHERE FT_TBL.topicid = KEY_TBL.[KEY] '


EXECUTE sp_executesql @sql


SELECT FileNames, Rank, VPath from #tempresults ORDER BY Rank DESC


DROP TABLE #tempresults


SET NOCOUNT OFF


GO


STEP IX: Modify your .NET Application


The rest is a piece of cake. Your Button click handler should now look like this:


using System.Data;

using System.Data.SqlClient; // Bye Bye OleDb

…….

…….


private void Button1_Click(object sender, EventArgs e)

{

      string connString = @"server=****;database=****;uid=****;pwd=****;";

      string storedProcName = "sp_Accounts_SearchSite";


      SqlConnection Connection = new SqlConnection(connString);

      Connection.Open();


      SqlCommand command = new SqlCommand( storedProcName, Connection );

      command.CommandType = CommandType.StoredProcedure;

      command.Parameters.Add("@FreeText", TextBox1.Text);


      SqlDataAdapter sqlDA = new SqlDataAdapter();

      sqlDA.SelectCommand = command;


      DataSet dataSet = new DataSet();

      sqlDA.Fill( dataSet, "mySearchResults" );

      Connection.Close();


      DataView source = new DataView(dataSet.Tables[0]);

      DataGrid1.DataSource = source;

      DataGrid1.DataBind();

}


The grid will show results from your file system as well as from your database tables. With everything indexed, the result is lightening fast for hundreds of results if not millions.


Many of you might think that there remains a lot to be told. But didn’t I say it was quick and dirty? No pun intended. To learn more about how to compose your own queries for full-text searches, visit the MSDN website at http://msdn.microsoft.com. With little logic of your own, you can have a nice search engine which would query different sources differently based on your own requirements. For example, you can redefine the scope (Deep Copy Traversal, Swallow Copy Traversal ring a bell?) and can do regular expression searches. You are the one to set your own limit.


A nice ASP.Net search engine article by Ram P Dash. I think it would be nice to share such cool things my blog. If anybody  is offended by this post write me back.



I implemented his work in my project too.



Author:

Ram Dash is a ASP.NET, C# developer and can be reached at “ram underscore dash at fastmail dot fm”. If you wish to reprint this article, a note with the link to the author would suffice.



Tuesday, May 3, 2011

Map re-projection in ArcMap or ArcGIS

Be The First To Comment
Here, I am trying to show how to project/re-project US shape file into AEA conic USGS projection using ArcMap.

Follow the following steps:

1. Right click on Layer -> click on Coordinate System

2. Unfold Predefined -> Unfold GCS -> Unfold North America

3. Select North American Datum 1983

4. Click Apply and Click OK

5. Add Feature Data (Points/Lines/Polygons)

6. A warning may appears but ignore it.

7. Find Data Management Tools -> Select Project (feature) Tool

8. Input Dataset or Feature Class (Enter the name of layer needed to be projected.)

9. Input Coordinate System -> Click on Hand icon -> Click Select -> Unfold GCS -> Unfold North America -> Select North American Datum 1983

10. Click Add

11. Click Apply and Click OK

12. Output Dataset or Feature Class (Enter the location of output file and location name: *.shp)

13. Output Coordinate Systemè Click on Hand icon -> Click Select -> Unfold PCS -> Unfold Continental -> Select North American -> Select USA Contiguous Albers Equal Area Conic USGS.prj

14. Click Apply and Click OK

15. New Projected map layer will be created. But  might not be able to see that projected layer in same data frame. Then what?

16. Trick: Add new data frame.. HOW?

17. Click Insert from Arc Map tool bar -> Click Data Frame

18. Drag projected map layer into it.

19. Cheers !!!  Your Map is projected.

20. If still problems persist; check on Environmental Variable Setting.

NOAA releases aerial imagery of Tuscaloosa - Before & After

Be The First To Comment
NOAA releases the "before" and "after" shots for the damage caused by last week's F5 tornado in McFarland Boulevard in Tuscaloosa. Those images are captured from 5,000 ft high using special remote sensing equipment.

 

© 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

About Me