Friday, December 3, 2010
Thursday, October 28, 2010
Code sample below:
< dyn emptystr=" " property="PageNumber_E" type="page" >
Tuesday, October 26, 2010
# Warning: the toolbox toolbox.tbx DOES NOT have an alias.
# Please assign this toolbox an alias to avoid tool name collisions
# And replace arcpy.gp.toolname(...) with arcpy.toolname_ALIAS(...)
Basically, the system is asking for an Alias to provide an additional unique identifier because tools within the same toolbox cannot have the same name, but tools in other toolboxes can have the same name.
To define an alias, open ArcCatalog and right click on the tbx file. Select properties, you'll see this:
Enter in an alias and press ok.
Monday, October 11, 2010
Friday, October 8, 2010
- Go to Central Administration
- Click on the Operations Tab
- Click on Alternate Access Mappings under Global Configuration
- You should now see a list of your web applications, switch over to the one you want to map to the new URL by selecting it from the drop down on the right side.
- Click on Edit Public URLs and change the desired zone URL type to your new domain name. You can also change your internal URLs also by clicking Add Internal URLs.
- Now you’ll have to switch over to your DNS server.
- Within the DNS Management Console and Under Forward Look up Zones:
- Add a new Primary Zone with your new domain name.
- Add a new Host (A) to the records and point the IP Address to the SharePoint server.
- Launching Internet Information Services Manager from the Start -> Administration Tools menu
- Select the web site, right click and select Properties
- Click on the Directory Security tab
- Click on Edit in the Authentication and access control section
- First get to your portal. Then under “My Links” look for “Central Administration” and select it.
- In the Central Administration site select “Application Management” either in the Quick Launch or across the top tabs
- Select “Authentication Providers” in the “Application Security” section
- Click on the “Default” zone (or whatever zone you want to enable anonymous access for)
- Under “Anonymous Access” click the check box to enable it and click “Save”
You can confirm that anonymous access is enabled by going back into the IIS console and checking the Directory Security properties.
2). Enable anonymous access in the site.
- Return to your sites home page and navigate to the site settings page. In MOSS, this is under Site Actions – Site Settings – Modify All Site Settings. In WSS it’s under Site Actions – Site Settings.
- Under the “Users and Permissions” section click on “Advanced permissions”
- On the “Settings” drop down menu (on the toolbar) select “Anonymous Access”
- Select the option you want anonymous users to have (full access or documents and lists only)
A couple of notes about anonymous access:
- You will need to set up the 2nd part for all sites unless you have permission inheritance turned on
- If you don’t see the “Anonymous Access” menu option in the “Settings” menu, it might not be turned on in Central Admin/IIS. You can manually navigate to “_layouts/setanon.aspx” if you want, but the options will be grayed out if it hasn’t been enabled in IIS
- You must do both setups to enable anonymous access for users, one in IIS and the other in each site
Thursday, October 7, 2010
Let's say you need to search the .NET ArcObjects help, so to streamline the search process, you can utilize Google's search engine by doing the following:
- In order for google to work, you need the site. For this example, we will use http://help.arcgis.com/en/sdk/10.0/arcobjects_net/ao_home.html. You can to remove the http:// and the ao_home.html for your site reference.
- The result should be this: help.arcgis.com/en/sdk/10.0/arcobjects_net
- Go to: http://www.microsoft.com/windows/ie/searchguide/en-en/default.mspx
- Paste the resulting Google Search URL into the URL box
- Give it a descriptive name. Ex: Search .NET ArcObjects
- Click install
Tuesday, October 5, 2010
Of course I said use python. It's quick, easy, and reusable:
# Input Parameters #
inputTable = arcpy.GetParameterAsText(0)
CountFields = arcpy.GetParameterAsText(1)
VotedValues = arcpy.GetParameterAsText(2)
# Local Variables #
# Logic #
fields = arcpy.ListFields(inputTable)
for field in fields:
if field.name == ElectionCountFieldName:
arcpy.AddField_management(inputTable, ElectionCountFieldName, "TEXT")
rows = arcpy.UpdateCursor(inputTable)
splitVal = VotedValues.split(',')
for row in rows:
count = 0
for f in CountFields:
if str(row.getValue(f)) in splitVal:
count = count + 1
del row, rows
where the inputTable is the table which contains the data you wish to sum up, CountFields is a collection of field names (multi-value object), and VotedValues is a comma separated string (value1,value2, etc...) that represents the values of a voter voted.
Now that the script is created, you need to create the toolbox in ArcCatalog or ArcMap:
|1||Input Table/FC||Type: Feature Class or Table|
|2||Fields||Type: Field, |
Obtained From: Parameter 1,
|3||Voted Values||Type: String|
|4||Return Table/FC||Type: Table/FC, |
Enjoy and Happy GISing
Friday, September 10, 2010
Wednesday, September 8, 2010
Error 5 Entity references or sequences beginning with an ampersand ‘&’ must be terminated with a semicolon ‘;’.
Error 4 ‘"’ is an unexpected token. The expected token is ‘;’.
You can encode invalid characters for use in XAML by using the following encoding syntax:
(numeric character mappings)
(assuming UTF-8 encoding)
Thursday, August 19, 2010
Wednesday, August 11, 2010
One design pattern to follow is the singleton pattern, which can be found here.
Once you have started diving into the world of classes, name spaces, and methods, it's time to figure out how to make methods private. It's surprisingly simple to do this. To make something private in python, just put two underscores in front of your method. That's it, now only that class can access that method.
Here is a small example:
Thursday, July 29, 2010
Friday, July 23, 2010
To do this do the following:
1) Click on Project -> Properties
2) Select PyDev - Interpreter/ Grammar
3) Under the interpreter combo box, click on the text that says: "Click here to configure an interpreter not listed."
4) Press Apply -> It will take a couple of minutes to look through your PythonPaths -> Press Ok
5) Begin Coding
Check it out and Post you own links in the comments to help other with MVVM design patterns!
Wednesday, July 21, 2010
VBA Samples: http://technet.microsoft.com/en-us/library/ee692929.aspx
Tuesday, July 20, 2010
This is for excel:
Wednesday, July 7, 2010
Check it out here.
Wednesday, June 23, 2010
Thursday, June 10, 2010
Getting Started, Open Visual Studios 2010, and create an empty SharePoint Project and a Silverlight Application. For the Silverlight Application project ensure that the "Host the Silverlight Application in the new Web Site" is unchecked.
Now we are cooking with fire, and we can create our Silverlight application. For this example, I will just add a map and one layer to the project.
Save and compile the project. If you get any errors, it's most likely you need to reference the proper ESRI silverlight libaries.
The next step is to configure the SharePoint Project. Add a new item to the SharePoint project and select Module. Double click on the Elements.xml file.
Configure the elements file to match the above image, you need to change the path of the Url to "_layouts/clientsbin/ XAPFILENAME.XAP" and change the Path from the textfile name to the XAP file name.
Click on the module and select the Project Output Refer -> Add a member -> Choose the Silverlight Application name -> in the Deployment Type Select ElementFile -> press OK
Select Build From main toolbar -> Configuration Manager -> Uncheck all the builds except for the SharePoint Project Name and make sure the SharePoint Project has deploy checked.
Save the Project and deploy to SharePoint.
Open your SharePoint site -> Edit Page -> Add Silverlight Web Part -> enter in the text box the following "_layouts/clientbin/XAPFILENAME.XAP". You should now see your web part.
Tuesday, May 11, 2010
From the windows help: "Use the DataContractSerializer class to serialize and deserialize instances of a type into an XML stream or document. For example, you can create a type named Person with properties that contain essential data, such as a name and address. You can then create and manipulate an instance of the Person class and write all of its property values in an XML document for later retrieval, or in an XML stream for immediate transport."
Here is my code:
Here is a great "how to get started" article for from ArcUser magazine.
Thursday, April 29, 2010
First I decided that I wanted to use Windows 7 64-bit, which was a mistake. All the documents point to the fact that you can do an install on win7-64bit, but you can't. You need to alter the config.xml file.
So I alter everything, and now the setup likes it, yippee, and get the 300 prerequisites installed. (See: http://blogs.msdn.com/opal/archive/2009/10/25/sharepoint-2010-pre-requisites-download-links.aspx for pre-reqs) Now I'm ready to install SP 2010 and configure it. Oh wait, I'm not... error after error, and most of the answers are found here, www.google.com because Microsoft's help is crap.
Getting sick of the errors, and a glutton for punishment, I decided to format my HD and install Windows 2008, which is the desired OS for sharepoint.
Installation was long, but it went like a breeze, and I did have one funny moment when this appeared:
Now on to installing Silverlight and the MapIt Demo.
Tuesday, April 27, 2010
Here is a simple example:
To get this image, all you have to do is reference this url: http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World
You can simply couple this with python using the webbrowser library. To open the image in a web browser via python try this:
url = http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World
Thursday, April 15, 2010
Monday, April 12, 2010
ArcPy has some great new features, especially if you use eclipse to program in python. It is intellasense capable, which makes programming nice and easy. It is also a well organized set of functions with libraries, class, functions, etc... Basically it follows OOP patterns.
What I don't like, is the case sensitivity. This can get annoying, since I'm a lazy programmer. Really, who has time to be pushing that shift key and another letter on the key board?
I think the future looks bright for ArcPy, but only time will tell.
Thursday, March 25, 2010
Tuesday, March 23, 2010
The script I'm using is published to ArcGIS Server, and the kernel density if performed from the ArcToolbox, it returns the proper image, while the python call returns a black or blank tile, depending on how ArcGIS Server want to behave that minute.
It's very frustrating because no errors are returned, and both the script and arctoolbox function work in desktop.
Wednesday, March 10, 2010
If you've not installed ArcGIS Explorer before, you can run the system check utility or review the platform requirements before you install. If you are already using ArcGIS Explorer on the same machine as ArcGIS Desktop, please note that the uninstall may take a few minutes...
Find the Official Announcement Here.
Friday, March 5, 2010
You'll notice that method3() will not be called because our super() is passing in a variable gp, and it is expecting all classes to accept one parameter in the __init__().
A small change to your program can be done to fix this problem by using *args and **kwargs.
The *args is used to pass a variable-length argument list, and the **kwargs form is used to pass a dictionary object of variable length.
Thursday, March 4, 2010
1) Create your Singleton classHere there is a singleton class that will return the same instance of the object every time a specific class is called.
2) Create your class and have it inherit from Singleton
Now to use this, simply create a __main__ declaration, and create the object GeometryObject()
This gives you the output of:
Notice that GO and GO2 are the same exact object. This is what you want if you create a Singleton, only one instance of the object.
- Creational - patterns that can be used to create objects
- Structural - patterns that are used to combine object and classes in order to build structured objects
- Behavioral - patterns that can be used to build computation and control the flow of data
A Singleton is a way to ensure that you cannot create more than one instance of a class. A class attribute could be used to check the number of instantiations of the class.
The singleton patter requires a mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among class objects. The singleton pattern is implemented by creating a class with a method that creates a new instance of the class if one does not exist. If an instance already exists, it simply returns a reference to that object. To make sure that the object cannot be instantiated any other way, the constructor is made protected.
As a note: "The singleton pattern must be carefully constructed in multi-threaded applications. If two threads are to execute the creation method at the same time when a singleton does not yet exist, they both must check for an instance of the singleton and then only one should create the new one. If the programming language has concurrent processing capabilities the method should be constructed to execute as a mutually exclusive operation." ~From http://en.wikipedia.org/wiki/Singleton_pattern
Here are two examples of Singleton Patterns:
This will produce an output of:
Here is a second singleton implementation that returns the same instance of the singleton instead of throwing an error:
I would recommend starting to use Design Patterns in your ArcGIS Python code. With the coming of 10, it will be more important than ever to have code that conforms to standard coding practices.
The goal of any OO programming is the following:
- Genericity - is a technique to define parameters for a module exactly as you define parameters for a function thus making the module more general
- Flexibility - very difficult to achieve, but functions should be written as general as possible to allow for multiple data types
- Inheritance - is the ability in OO Programming to derive a class from another, either by extending it or specialize it
- Overloading - refers to the possibility for an operator or method to behave differently according to the actual data types of their arguments
- Polymorphism - is the possibility for something to have several forms.
Monday, February 22, 2010
1). Create a python class and create the following Enum Classes
def __init__(self, GP):
self.GP = GP
POLYGON = "POLYGON"
POLYLINE = "POLYLINE"
POINT = "POINT"
TEXT = "TEXT"
FLOAT = "FLOAT"
DOUBLE = "DOUBLE"
SHORT = "SHORT"
LONG = "LONG"
DATE = "DATE"
BLOB = "BLOB"
RASTER = "RASTER"
2). Add the following code below the class AddFieldTypesEnum
def CreateFeatureClass(self, workspace="in_memory", fileName="temp", FeatureType=FeatureType.POLYGON, SpatialReference="", Fields=,overwrite=True):
gp = self.GP
if gp.exists(workspace + os.sep + fileName) == True and overwrite == True:
if gp.overwriteoutput != 1:
gp.overwriteoutput = 1
#gp.delete(workspace + os.sep + fileName)
elif gp.exists(workspace + os.sep + fileName) == True and overwrite == False:
gp.adderror("Feature with name: " + fileName + " alread exists")
if SpatialReference == "":
desc = gp.describe(self.FC)
SpatialReference = desc.SpatialReference
gp.createfeatureclass(workspace, fileName, FeatureType, "","","",SpatialReference)
if len(Fields) > 0:
for field in Fields:
gp.addfield(workspace + os.sep + fileName, field, str(field))
return workspace + os.sep + fileName
The class is ready to use
Here is a simple example:
import Arcgisscripting as Arc
gp = Arc.create(9.3)
myClass = SomeClass(gp)
print 'dah da'
Tuesday, January 19, 2010
Before I continue, make sure you have the ESRI media just in case your geo-statistics fails because numpy 1.3.0 and above are not supported officially be ESRI.
You'll need 3 things:
Python - v2.5.4
numpy - v1.3.0
You can install each version over top the older versions, so there is no need to uninstall anything.
Once setup, you can now create graphs in python to compliment your geoprocessing data.
There are great examples of how to use Matplotlib on the website. For example, you can do histograms, box plots, etc.. Also, you can include graph items like legends.