Wednesday, December 14, 2011

An introduction to Opensource GIS and Geoserver

Be The First To Comment
Open Source software has come a long way in recent years for storing, manipulating and presenting spatial data. The Openstreetmap (www.openstreetmap.org) project is a great example of what can be achieved using open software and open data.

This presentation will look at using a combination of postgis, geoserver and openlayers to process, store and present vector and raster map data.

The presentation will also demonstrate OGC web mapping protocols, map projections, spatial toolkits (including uDig, gdal and ogr) and sources of free geospatial data.


Gavin Jackson is a software engineer working in the Spatial Team on the Atlas of Living Australia project (www.ala.org.au).

Bio: A software engineer with 10 years experience (BInfTech ANU, Msc UNSW), he has worked in a variety of environments, including Department of Defence (IT Security), CPT Global (Stress and Volume Testing), Les Mills (Software Engineer) and, currently, CSIRO (Spatial Software Engineer). 

He has long been an advocate for the use and implementation of Open Source technologies, and is a Redhat Certified Engineer (RHCE).

Monday, November 28, 2011

MODIS Data Products Naming Convention

Be The First To Comment
Are you wondering on MODIS products' naming convention? Don't worry !!. This is the time to dig out MODIS names. Let's say you have few MODIS products.


Nadir BRDF-Adjusted Reflectance (NBAR): MCD43B4.A2000185.h25v03.005.2006299173851.hdf


MODIS Land Surface Temperature Products: MOD11A2.A2002241.h12v02.005.2007222102136.hdf



MCD43B4 or MOD11A2- MODIS Product Short Name




A2000185 or A2002241 - Julian Date of Acquisition (A-YYYYDDD)




h25v03 or h12v02- Tile Identifier (Tile location- horizontalXXverticalYY)




005 - Collection Version




2006299173851 or 2007222102136- Julian Date of Production (YYYYDDDHHMMSS)


The YYYYDDD of above products equivalent to 2006299 and 2007222, which means Year:2006 Day of Year:299 (OCT 25, 2006) & Year:2007 Day of Year:222(AUG 09,2007)




hdf - Data Format (HDF-EOS)


Cheers !!

Wednesday, November 23, 2011

Instructions for Creating KMZ Image Overlays from ArcGIS in Google Earth and Google Map

1 Comment
Creating a kmz image overlay

 1. Make sure the dataset you are working with has a geographic coordinate system (unprojected) with WGS84 as the datum. If not, you will need to reproject your data. If the coordinate system of your datasets is defined you can change the projection “on-the-fly”. To reproject on-the-fly, go to Layers then Click Properties and specify geographic with WGS84 datum as the coordinate system. However, I recommend reprojecting the actual GIS datasets (shapefiles, grids, etc.) because project-on-the-fly is not always very precise, particularly when dealing with datum transformations.

2. Switch to the layout view. Select a layout that matches the dimensions of your map as closely as possible. To keep the file sizes of your images small, try to leave as little empty space around the edges as possible. Right-click on the layout and select Page and Print Setup to change the layout size.

3. Right-click on the map and select Properties. Go to the Size and Position tab. Under Size, set the Width and Height to exactly match the Width and Height of your layout. Under Position, set X and Y both to zero. Go to the Frame tab and make sure that Border is set to .

4. Zoom and pan in the layout so that you have as little empty space at the edges as possible.

5. Right-click on the layout and select Properties. Go to the Data Frame tab. Under Fixed Extent, you will see the latitudes for the top and bottom of the current layout, and the longitudes for the left and right sides of the current layout. Write these numbers down or cut and paste them into a file. Do not change them!

6. Go to File then Click Export Map. Export the tile as a PNG image. Select the Resolution (in pixels per inch). Depending on the amount of detail in your map and the size of your layout, you may need to experiment with a variety of resolutions to achieve a good balance between image quality and image size. 200 pixels per inch is often a good place to start. On the Format tab set Color Mode to 24-bit True Color, set the Background Color to white, and set the Transparent Color to white as well. If you have white in your map, you may need to choose a different shade (perhaps grey) for both the Background Color and Transparent Color. Do not check Clip Output to Graphics Extent. Click Save to export your file.
7. Open Google Earth

8. Select Add then Click Image Overlay

9. In the New Image Overlay box, type in a name for your overlay and use the Browse button to link to the image that you exported. You can use the Transparency slider to adjust the opacity of the overlay. Add a Description if you like.

10. Go to the Location tab and type or paste in the boundary coordinates of your layout that you saved in step 5. Be sure to include the negative sign for west latitudes. Click on OK.

11. You should see the name of your new image overlay under your Places in Google Earth. Right-click on it and select Save Place As… to save it as a kmz file. Once you have saved the kmz file, you can delete the temporary image overlay. You can double-click on your kmz file to open it in Google Earth,or use File then Click Open from the Google Earth menu.

Modifying a kmz image overlay

 1. You can use a program such as 7-zip to open the kmz archive. Inside you will find a KML file entitled doc.kml, and a subfolder that contains your image. You can open the KML file with a text editor. Note that there are just a few tags here that tell Google Earth what to do with your image. There is a tag. The tag has a code that specifies the amount of transparency in the overlay. The tag identifies the image to be overlaid. Thetab identified the bounding coordinates of the image.

2. You can create new kmz files by modifying this existing file. You can make a copy of the existing KMZ file, use 7-zip to remove the image1.png image and replace it with a image2.png image, and then use a text editor to modify the and tags in the kml file. Even if you have a new image has different bounding coordinates, you can edit them directly in the kmz file rather than using the New Image Overlay tool in Google Earth.

3. You can also add a legend or other graphics as screen overlays that are attached to a particular location on the screen (for example, the lower left corner) rather than a particular geographic location on the Earth’s surface.

4. There are various ways to export a legend from ArcGIS to a PNG file. One approach is to export the legend as part of a larger map graphic and then clip it out using a graphics program. Alternately, you can “trick” ArcGIS into letting you export the legend directly. Make sure your map symbology is set up the way that you want it displayed in the legend (it should match the map graphic that you have already exported). Set up your layout dimensions to match the size of your exported graphic (e.g., 1.5 x 1.5 inches). It can help to Insert then Click Legend into your layout first to get an idea of its dimensions. Your legend should fill up the layout and leave minimal whitespace at the edges. Right-click on the legend and choose Convert to Graphics. Then you can uncheck the map layers in the Table of Contents and you will only see the legend. You can now export the layout to a PNG file like you did with the map image. The only difference is that you should set the Background Color to white and the Transparent Color to No Color.

Friday, November 18, 2011

A 'mesmerizing' view of Earth from an orbiting space in HD

Be The First To Comment
Time lapse sequences of photographs taken with a special low-light 4K-camera (made in Japan) by the crew of expedition 28 & 29 onboard the International Space Station from August to October, 2011.

Shooting locations in order of appearance:
1. Aurora Borealis Pass over the United States at Night
2. Aurora Borealis and eastern United States at Night
3. Aurora Australis from Madagascar to southwest of Australia
4. Aurora Australis south of Australia
5. Northwest coast of United States to Central South America at Night
6. Aurora Australis from the Southern to the Northern Pacific Ocean
7. Halfway around the World
8. Night Pass over Central Africa and the Middle East
9. Evening Pass over the Sahara Desert and the Middle East
10. Pass over Canada and Central United States at Night
11. Pass over Southern California to Hudson Bay
12. Islands in the Philippine Sea at Night
13. Pass over Eastern Asia to Philippine Sea and Guam
14. Views of the Mideast at Night
15. Night Pass over Mediterranean Sea
16. Aurora Borealis and the United States at Night
17. Aurora Australis over Indian Ocean
18. Eastern Europe to Southeastern Asia at Night




Music: Carbon Based Lifeforms - Silent Running

Editing: Michael König | koenigm.com

Image Courtesy of the Image Science & Analysis Laboratory,
NASA Johnson Space Center, The Gateway to Astronaut Photography of Earth
eol.jsc.nasa.gov


Enjoy the Images :)

Thursday, November 17, 2011

How to retrieve WMS GetFeatureInfo from Openlayers & Geoserver

Be The First To Comment

map.events.register('click', map, function (e) {
//alert(map.getExtent().toBBOX());
x1=parseInt(e.xy.x);
y1=parseInt(e.xy.y);
    var url = layerhost
      + "?REQUEST=GetFeatureInfo"
      + "&EXCEPTIONS=application/vnd.ogc.se_xml"
      + "&BBOX=" + map.getExtent().toBBOX()
      + "&X=" + x1
      + "&Y=" + y1
      + "&INFO_FORMAT=text/html"
      + "&QUERY_LAYERS=" + layername
      + "&LAYERS="+layername
      + "&FEATURE_COUNT=50"
      + "&SRS=EPSG:900913"
      + "&STYLES="
      + "&WIDTH=" + map.size.w
      + "&HEIGHT=" + map.size.h;
    window.open(url,
      "getfeatureinfo",
      "location=10,status=10,scrollbars=1,width=600,height=150"
    );
  });

I got  X and Y points due to floating point error while retrieving GetFeatureInfo . In order to prevent those errors I parse e.xy.x and e.xy.y values into integer, and it works for me.

Thursday, October 13, 2011

DIVA GIS

Be The First To Comment
Today, I was working on Shapefiles from Australia and Nepal for my biodiversity research. I found DIVA GIS is useful for the scientist and students who can't afford ESRI's ArcGIS suite. DIVA-GIS is particularly useful for mapping and analyzing biodiversity data, such as the distribution of species, or other 'point-distributions'. It reads and write standard data formats such as ESRI shapefiles, so interoperability is not a problem. DIVA-GIS runs on Windows and (with minor effort) on Mac OSX.

Wednesday, July 13, 2011

Google Earth Engine API : An ambitious Project

Be The First To Comment
A highly ambitious project by Google, Google Earth Engine, will be launch by  the end of 2011. This project is using high resolution images from more than 30 earth observing satellites such as Landsat, MODIS, IKONOS, QuicBird etc to build global archive of atmospheric corrected data sets. According to Earth Engine team, these archives will be"available online with tools for scientists, independent researchers, and nations to mine this massive warehouse of data to detect changes, map trends and quantify differences on the earth's surface" in a cloud computing platform. 


Currently, this project is in testing phase with limited  access to few groups of partner including CLASlite and IMAZON.  Let us wait and see how far they can go !!!

Thursday, July 7, 2011

Cloud-based GIS application : ESRI Community Analyst

Be The First To Comment
Community Analyst includes demographic, health, economic, education, and business data variables to help users develop informed strategies for policy creation and critical resource allocation. Decisions such as matching health care clinics to areas with the greatest need or allocating infrastructure funding for maximum community impact can now be made and supported using customizable reports and maps more.

Sunday, June 12, 2011

Custom Google Maps Style

Be The First To Comment
From last couple of days I was busy on Google custom styling like http://maps-api-tt.appspot.com/apilite/styled/styled.html .

Fortunately, I found a good tutorial to share to carry out such custom styling. Check it out @bestfromgoogle  

Friday, June 3, 2011

875 Tornado hit USA in April 2011

Be The First To Comment
The U.S. experienced unprecedented tornado activity throughout the month of April 2011. The NOAA Storm Prediction Center received 875 tornado reports during that month alone; 625 have been confirmed as tornadoes, so far. Many of these storms were concentrated during 7 different major outbreaks, mostly in the Southern U.S. The largest of these outbreaks occurred during April 27-28, leaving over 300 people dead as over 180 storms were reported from Texas to Virginia.


This animation shows the GOES-East infrared imagery from April 1-30, along with the locations of each tornado that formed during the time (symbolized as red dots). Though tornadoes cannot actually be seen by GOES, these satellites are instrumental in being able to detect the conditions associated with their formation. As the resolution of GOES has increased with each successive satellite series, so have the warning times for tornadoes. The future GOES-R satellite will provide even higher resolution and storm prediction capability, especially with the use of the Geostationary Lightning Mapper sensor. The actual tornado locations are acquired from the Storm Prediction Center, which uses both NEXRAD radar and ground reports to generate a detailed database of tornadoes in the U.S.

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

Be The First To Comment
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.

Saturday, April 30, 2011

Mapping the Disease Trends

Be The First To Comment
West Nile Virus (WNV) is the most widespread arbovirus (viruses that are transmitted by arthropods) in theworld. . During the period of 1996 -1999, the WNV became prevalent insouthern Romania, the Volga delta in southern Russia, and the northeastern United States. The spread of WNV covered the United States from coast to coast in four years, and by then it had 7 infected about one million Americans, killing about eight hundred.

Here I mapped the spatial trends of WNV virus in the United States of America.

Check website - http://globalmonitoring.sdstate.edu/eastweb/maps/wnv1999_2011/

Thursday, April 21, 2011

Add and Remove DOM Elements..

Be The First To Comment
Snippets for adding DOM elements dynamically to the defined DOM element.
Here, "mydiv2" is added dynamically as "mydiv"1's child.

    //Dynamically generate Div
    var newdiv = document.createElement('div');
    var divIdName ='mydiv2';
    newdiv.setAttribute('id',divIdName);
    newdiv.style.width = "565px";
    newdiv.style.height = "480px";
    newdiv.style.left = "0px";
    newdiv.style.top = "0px";
    newdiv.style.position = "absolute";
   newdiv.style.border = "1px solid #000";
    document.getElementById('mydiv1').appendChild(newdiv);

A good example by Dustin Diaz to remove DOM elements Dynamically.

removeElement JavaScript Function

function removeElement(divNum) {

  var d = document.getElementById('myDiv');

  var olddiv = document.getElementById(divNum);

  d.removeChild(olddiv);

}

Sunday, April 3, 2011

Detect Browser Type Using Javascript and Pass it into PHP variable

Be The First To Comment
<html>
<head>
<script type="text/javascript" language="javascript">
function DetectBrowser(){
// Browser Detection Javascript
// copyright 1 February 2003, by Stephen Chapman, Felgall Pty Ltd
// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) return 'Opera';
if (agt.indexOf("staroffice") != -1) return 'Star Office';
if (agt.indexOf("webtv") != -1) return 'WebTV';
if (agt.indexOf("beonex") != -1) return 'Beonex';
if (agt.indexOf("chimera") != -1) return 'Chimera';
if (agt.indexOf("netpositive") != -1) return 'NetPositive';
if (agt.indexOf("chrome") != -1) return 'Chrome';
if (agt.indexOf("firefox") != -1) return 'Firefox';
if (agt.indexOf("safari") != -1) return 'Safari';
if (agt.indexOf("skipstone") != -1) return 'SkipStone';
if (agt.indexOf("msie") != -1) return 'Internet Explorer';
if (agt.indexOf("netscape") != -1) return 'Netscape';
if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}

</script>
</head>
<title>
</title>
<body>
<?php
$browser= "<scriptlanguage=javascript>document.write(DetectBrowser());</script>";
echo $browser;
?>
</body>
</html>
The php portion shows the example of "Passing Javascript variable into the PHP variable"

Sunday, March 27, 2011

A thought in the lazy day

Be The First To Comment
Being a geographer, I am so thrilled in my life. I got opportunities to feel nature from the bottom of my heart. I am also an engineer. I found geography is more interesting than engineering; however I love math, statistics, and scientific computing. I never afraid from math meantime, implementing math in geography is very fascinating job for me.
It’s a time to integrate technology with nature so don’t get late to be a geographer and experience ecstatic in your entire life.

Friday, March 18, 2011

How to get Color Brewer Ramp in ArcMap 10?

2 Comments

There are two ways to achieve this:

Method A steps:

1. Download Color Brewer Color Ramp Style Set from http://arcscripts.esri.com/details.asp?dbid=14403

2. Unzip it.

3. Open the Layer properties and click on ‘Symbology’ tab in ‘ArcMap 10’.

4. Double click on one of the color symbol beneath ‘Symbol’ that gives you a ‘Symbol Selector’ window.

5. Click “Style References..”

6. Click “Add Style to List..” and add ‘ColorBrewer.style’ that is obtained from setp 2.

7. If you made it correctly it should be listed in the ‘Style References’.

8. Select ‘ColorBrewer.style’ and make it default.

9. Close the layer properties once and open it again, you will see newly generated color ramp.


Method B steps:

1. You have to pick each color ramp value manually from http://colorbrewer2.org/ .

2. Open the Layer properties and click on ‘Symbology’ tab in ‘ArcMap 10’.

3. Double click on one of the color symbol beneath ‘Symbol’ that gives you a ‘Symbol Selector’ window.

4. Click on ‘Edit Symbol’.

5. Click on Color box inside ‘Simple Fill’ area.

6. Click on “More Colors” which gives you Color Selector.

7. Choose RGB from Drop down box located in the top right.

8. Then, update values that come from Colorbrewer.

Voila Cheers!!!!!

I would like to recommend ‘Method A, because it is faster than Method B. (Does the same work but time consuming)

The author of color brewer, Cynthiya Brewer also published a book Designing better Maps in ArcGIS.



Tuesday, February 22, 2011

Iframe busy inidcating spinning bar.

Be The First To Comment
I got one solution on delving the internet

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Iframe Loading Notice - Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#holder, #holder iframe {
position:relative;
width:500px;
height:400px
}
#loading {
height:50px;
width:125px;
padding:1ex;
position:absolute;
top:50%;
left:50%;
margin-top:-25px;
margin-left:-63px;
display:none;
border:2px groove gray;
background-color:#cccccc;
color:#333333;
}
</style>
<script type="text/javascript">
var loadit=function(){
var f=document.getElementById('myframe'), l=document.getElementById('loading').style;
l.display='block';
if(f.onload==null){
f.onload=function(){l.display='none'};
if(window.attachEvent)
f.attachEvent('onload', f.onload);
}
return true;
}

</script>
</head>
<body>
<div id="holder">
<iframe id="myframe" name="myframe" src="about:blank" scrolling="auto" frameborder="1"></iframe>
<div id="loading">Loading . . .</div>
</div>
<a href="http://www.google.com/" target="myframe" onclick="return loadit();">Google</a><br>
<a href="http://www.dynamicdrive.com/" target="myframe" onclick="return loadit();">Dynamic Drive</a>
</body>
</html>


Thank you for the original post(http://www.dynamicdrive.com/forums/showthread.php?t=22759).

And I modified this according to my need as below:

<style type="text/css">
#holder, #holder iframe {
position:relative;
width:500px;
height:400px
}
#loading {
<!--height:50px;
width:125px;
padding:1ex;
position:absolute;
top:50%;
left:50%;
margin-top:-25px;
margin-left:-63px; -->
display:none;
<!--border:2px groove gray;
background-color:#cccccc;
color:#333333; -->
}
</style>
<script type="text/javascript">
var loadit=function(){
var f=document.getElementById('iframemap'), l=document.getElementById('loading').style;
l.display='block';
if(f.onload==null){
f.onload=function(){l.display='none'};
if(window.attachEvent)
f.attachEvent('onload', f.onload);
}
return true;
}
</script>

And what you need is spinning.gif image.


<div id="holder">
          <iframe name="iframemap" id="iframemap" width="550" height="450"></iframe>
          <div id="loading"> <img src="images/busy.gif"></div>
          </div>


Cheers !!

Friday, February 18, 2011

Convert PHP array into Javascript array

Be The First To Comment
I got a chance to write a script that converts php array into javascript  array.
Here it is..
<?php
  $phparray= array(1,2,3,4,5);
?>

<script type="text/javascript" language="javascript">
    var mydata = new Array (
    <?php
      for ($i = 0; ($i < count($phparray)); $i++) {
        if ($i > 0) {
          echo ",\n";
        }
        echo "    \"";
        echo $phparray[$i];
        echo "\"";
      }
     
    ?>
    );
</script>
 

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

About Me