Wednesday, August 4, 2010

Some Updates

I talked to Ben about randomizing lots, and he introduced me to stochastic rules in CityEngine, which creates variation in lots using randomness. One example (take from the CE help page) would look like:

Lot -->
30% : Lot("residential")
20% : Lot("retail")
else : Lot("industrial")

Currently I'm using another method to randomly generate structures on a lot. It's "get" function that returns different file paths at different probabilities. See the following:

getBuilding =
20%: "assets/shack1.obj"
30%: "assets/shack2.obj"
20%: "assets/shack3.obj"
else: "assets/shack4.obj"

For now I find this easier than the previous method since it doesn't require me to define a new symbol for each possibility. I'll probably use it when I need a lot to develop into different types of procedurally generated buildings (Right now a majority of them are OBJ's...I cheated a little).

I also inserted vegetation into the city. It's funny how much of a differences trees make.


Trees added without wireframes (since they tend to make the leaf-clusters look black)






















Now with wireframes (just for comparison)





















City view. The shadows really slowed the computer down. They look nice, though.





















Also met with Joe, Norm, and Ben today. For now I'll be working mostly under Ben. For his city he wanted procedurally generated buildings (as opposed to OBJ's), since that method would allow us to identify doors on a building. We will be starting with roughly 5 types of buildings: Home, School, Inns, Food/Convenience Stores, and Restaurants. A high level of detail isn't required this time, so most of the architecture will be very basic.

Also working on the slides at the moment. Since I'm posting here already, I might as well include the pictures I'll show on the slides.

Street network generated in CityEngine via Open Street Map file (of Basra)























Lots generated from the street network
























Sidewalks and roads are added.

























By golly do I love blogger's editor. I feel like I'm being spoiled.

Monday, August 2, 2010

Back to work

SAAST just ended, so I'm back at the SIG Lab. Decided today would be a good day to start keeping track of what I do (should have really started earlier, oh well)

Recap so far:
Created a scalable shack that generates additional garage doors at different positions depending on how wide the shack is.


Maya model imported into CityEngine:




Planning out the city:
One of the problems I've been thinking about was how to specify which lot contained what building. One of the potential ideas that came up was to create a variable that generated a building number randomly, and grow the lot from that. Something like:

//ATTRIBUTES//
attr building_type = rand(1,10) //we have 10 building styles here

//RULES//
Lot -->
case building_type == 1: Shack1
case building_type == 2: Shack2
...
else: Generic_building

Unfortunately, nothing happened when I tried running the above code. The next idea I tried was to filter the type of structure generated by the scopes of the lot sizes. Currently, if the x-scope and z-scope differ no more than 1, then a shack-structure will be created from the Lot. If either scope is smaller than 20, then a generic building will be created from that Lot. Although this system isn't very sophisticated, it does do the job of partitioning different lots for different structures. More changes may be implemented in the future.

Saturday, May 1, 2010

Another Update

-Just figured out how to convert .csv files into .dbf format via ArcCatalogue

Python Script I have so far:
# Most of it referenced from this tutorial
# There are some functions in the tutorial that returned an error when I tried to run it. This might be a version issue.

import sys, string, os, arcgisscripting

gp = arcgisscripting.create(9.3)

gp.Overwriteoutput = 1



#Specify the location for the new shapefile.

#gp.CreateFeatureclass("C:/Users/Alice/Desktop/Testing", "test_line.shp", "POLYLINE")




#Define Coordinate System

gp.workspace = "C:/Users/Alice/Desktop/Testing"

gp.toolbox = "management"

coordsys = "Coordinate Systems/Geographic Coordinate Systems/World/WGS 1984.prj"

gp.defineprojection("test_line.shp", coordsys)



#Open a cursor to insert rows into the shapefile.

cur = gp.InsertCursor("C:/Users/Alice/Desktop/Testing/test_line.shp")



#Create an Array and Point object.

lineArray = gp.CreateObject("Array")

pnt = gp.CreateObject("Point")



#Open a cursor on the table of XY coordinates to read from.

rows = gp.SearchCursor("C:/Users/Alice/Desktop/Testing/pythonTest.dbf")



#Reset the cursor to the top.

row = rows.Next()



#Loop through each record in the XY table..



while row:



#Set the X and Y coordinates for origin vertex.

pnt.x = row.GetValue("Origin_x")

pnt.y = row.GetValue("Origin_y")



#Insert it into the line array

lineArray.add(pnt)



#Set the X and Y coordinates for destination vertex

pnt.x = row.GetValue("dest_x")

pnt.y = row.GetValue("dest_y")



#Insert it into the line array

lineArray.add(pnt)



#Go to next row in table.

row = rows.Next()



#Insert the new poly into the feature class.

feat = cur.NewRow()

feat.shape = lineArray

cur.InsertRow(feat)

lineArray.RemoveAll()



del cur, row, rows

Update May 1st

Right now the goal is to create a python script that plots the location on arcMap when given a longitude and latitude.

Tuesday, April 13, 2010

4/13 Update

I visited Ken today to help me with ArcGIS. Below are my notes for setting up a route between 2 points using ArcMap.

-Download files from PASDA->open in ArcCatalogue->drag the file into 'layers' in ArcMap

-Use the select tool to select part of the map (the whole map will take too long to process)

-In the layer window->selection tab:
Right click
Create layer from selected features
Clear selected features(this is a button on the right toolbar)
To save this, right-click -> data -> export data

-Create address Locator
A.L.Style: US Streets w/ zone
Ref. Data: teststreet
Role: Primary table ->press OK

-Geocode Addresses
Input table->we need to make one
New excel file: 2 columns, address + zip. Enter 2 rows, arbitrary values
Save as CSV (we called it adds.csv)
*Note: don't share data files between programs. ArcGIS doesn't like that
Refresh ArcCatalogue (right click)
Drag adds file to layers (under source tab)
Right click->open
Back to geocode address->input table = adds
Input Address Locator the one we made -> has 2 points from the 2 rows in adds.
Use the 'i' tool to identify

Note: you can use Tools->geocoding->rematch addresses if adds are out of date

Network Analyst
Toolbar(view->status bar->networkanalyst)
To turn on: tools->extensions->check the box next to 'network analyst'

For more info: click Help->network analyst->workflow description

In catalog: street test-> new network dataset
Impedance = length
Click OK->creates a streetstest_ND file
Move the 2 ND files from catalog to streetfile layer
New route->route->load locations->add ouradds
Finally click the solve button

Just plotting down 2 points and creating a route between them took over 40 minutes. This was without python scripting, or moving the dots at all.

Screenshot:

Sunday, April 11, 2010

Progress Report 4/12

-Received 2 documents from Ken about Agent Analyst. I have a pretty clear idea on what Agent Analyst does now, it's just the implementation part that I'm still a bit lost on. The tutorials I've worked on give a basic sense of how to create an agent, but I haven't found any that would help my figure out how to create agents that visibly move across a map. These are the ones I've been working through. The Schelling GIS tutorial seems close to what I am looking for, since it involves agents on a map, but they aren't displayed individually, and the tutorial provides a pre-made file to load rather than guide the user in creating the agents and their movements. So far I've only found 3 tutorials---it seems that support for AgentAnalyst is quite limited, which is a bit frustrating.

I was able to download a world street file from the esri website (here), so it seems that PASDA will not be needed for now.

If Agent Analyst does not work, I've compiled some other programs to consider:

1. Attempt to place object on a layer in ArcMap, and manipulate it along a street using Python script. I've emailed Ken about the probability of this alternative. Right now I'm waiting on a reply.

2. I found a version of Repast that integrates with eclipse (Repast Symphony). It seems like there is a lot more support for it than Agent Analyst. I'm already looking through tutorials. This is probably the best alternative if the above does not work.

Friday, April 9, 2010

4/9 Progress Report

-Got Agent Analyst/Repast to work with ArcMap by using the Legacy version.
-Worked through tutorials to familiarize with the program
-Currently I got Agent Analyst to run within ArcMap and modify its map contents (see below)



Simple vector model of Chicago in Schelling tutorial by Arika Ligmann-Zielinska, Ph.D. Associate, San Diego State University


-It is possible to create agents using RepastPy, but making them display on the map is still in question (most likely possible though)

Wednesday, April 7, 2010

selfnote: http://www.institute.redlands.edu/agentanalyst/tutorials.aspx

Sunday, April 4, 2010

4/2 Meeting Recap

-Simulation will be one which people exit building during a fire drill.
-Blockades will be place along routes in order to force agents to navigate detours.
-Possibility of redefining my part of the project if Python scripting for ArcGIS doesn't work out


Some updates:

-Emailed Ken about executable jar file error for Agent Analyst/Repast. Seems like
it is indeed an incompatibility issue. He might be able to find version 9.2 for ArcGIS (which should run with Repast/AA)

-Links to check out:
http://repast.sourceforge.net/
http://forums.esri.com/Thread.asp?c=93&f=983&t=288747

Happy Easter!!

Wednesday, March 31, 2010

Progress Report 4/2

-Installed PythonWin (along with python 2.6.5)

-Installed Repast 3/ Agent Analyst. There are still a few problems with it though--the jar executable won't run, and the batch file needed to add a toolbox into arcMap (agent_analyst.bat) generates a 'path not found' error. Not sure if this is due to installation issues, or incompatibility with the our version of ArcGIS (Most current version for Repast/AA is 9.2, we're running version 9.3)


Notes to self:
-So right now I have PythonWin running, and it is able to import arcgisscripting. I tried creating a geoprocessing object, gp = arcgisscripting.create(9.2), which works fine as well. Now I just need to figure out how to link these PythonWin and ArcMap together (shouldn't be hard...), and demo data to practice with.

Helpful Links:

Course-worth's of material:
http://www.gis.usu.edu/~jlowry/python/

http://blogs.esri.com/Support/blogs/esritrainingmatters/archive/2009/09/10/want-to-create-python-scripts-try-the-f-c-p-m-t-method.aspx

-Python ArcObjects
http://www.pierssen.com/arcgis/misc.htm
http://www.pierssen.com/arcgis/upload/misc/python_arcobjects.pdf

-Agent Analyst
http://www.institute.redlands.edu/AgentAnalyst/
Latest version of this supports ArcGIS 9.2, we have 9.3 so there might be compatibility issues.

-Repast
http://www.institute.redlands.edu/AgentAnalyst/repast.aspx

-PythonWin (for scripting in ArcGIS)
Download: http://sourceforge.net/projects/pywin32/
"Getting Started with Writing Geoprocessing Scripts"
"Installing PythonWin"

-Python 2.6.5
Download: http://www.python.org/download/releases/2.6.5/
Needed for PythonWin


3/26 Meeting Recap

-For arcGIS in javascript, fine a file that stores information such as street numbers. They are generally called LTADD, LFADD (can be found on the PASDA website; spatial data info)

-Look into ArcMap Network Analyst
-Look into ArcGIS Repast Agent Analyst

-Pythonwin from sourceforge( for arcGIS)

-Find icon on top of little red hammer ->tool utilities ->create script
look for help menu in arcMap for help with arcpy (Python API for arcGIS)

-ksteif@sp2.upenn.edu (email for help)

Friday, March 26, 2010

Progress Report 3/26

So it seems like it is possible to generate routes in the ArgGIS javascript API as well as locate points on the map based on an address input. The API links are below:

Routing overview
RouteTask
Working with RouteTask
Locator

Some difficulties:
-It's difficult to determine what type of map to import due to the variety of maps available and the fact that they can only be viewed in ArcGlobe.
(http://server.arcgisonline.com/ArcGIS/rest/services)

-Still trying to figure out the syntax for RouteTask. (Will most likely be working on this next week)


Locator for ArcGIS:
http://resources.esri.com/arcgisserver/apis/javascript/arcgis/index.cfm?fa=codeGalleryDetails&scriptID=16821

Thursday, March 25, 2010

3/19 Meeting Recap

-Try to connect the dots to actual geographical information on the map.
-See if additional data can be added to a map (ie. sidewalk)
-Check if ArcGIS has a route planner.

Thursday, March 4, 2010

3/5 Progress Report

Figured out how to animate the dot using a timer. Also, instead using a for-loop, I used setInterval:

function animate(){
var pt = oldLoc, i = 0, timer; // no global variables declared...

timer = setInterval(function () {
pt.y += 20;
pt.x += 20;
graphic.setGeometry(pt);
graphic.show();
//dojo.byId("info").innerHTML += "testingcheck";

if (i >= 1000) { // stop condition
clearInterval(timer);
}

i++;
}, 5);
}

And Happy Spring Break!

Friday, February 26, 2010

2/25 Update and Meeting Recap

Progress Report:
*Since ThinkMap is deeply integrated into GCAT, it would be extremely difficult to replace it with FreeMind. Currently we're waiting on a 30-day trial version of ThinkMap.

*ArcMap can only render animations over the entire map. ArcScene can animate object layers along a set path (seen here) but it requires environmental data which can be difficult to generate.

*Using the ArcGIS Javascript API seems to be the best solution now. The user is able to generate markers on a map and move it. Animation still needs some work.

*The PowerPoint presentation can be downloaded here.
*The dragPoint file can be downloaded here.



To Do:
*Figure out how to animate the markers using a timer in javascript.





Monday, February 22, 2010

2/19/2010 Meeting Recap

Notes:
*Since we're still in the process of getting a license of ThinkMap, Norm suggested looking into FreeMind, which is an entity-relation map and happens to be free.

*My idea of using coordinates on the ArcMap map display to display data didn't go through--Zooming in would cause the image to pixelate/degenerate, which is why we need an actual object/objects on the map.

*Random tidbits: Lockheed Martin has developed a software called CultureSim that we might use in place of GCAT should it prove to be insufficient.

To-Do:
*Figure out if ThinkMap can be replaced by FreeMind
*Which databases have we been given to pull all the components of GCAT together.
*Find out if it is possible to animate marker objects in ArcMap.

Edit/Update: Joe heard back from ThinkMap. Seems like they're not willing to give us a free license so that's most likely a no-go.


Friday, February 19, 2010

2/19/10 Progress Report

*Installed MySQL. Next step would be to look up tutorials/become familiar with the program.

*From the documentation Norm sent me it seems like GCAT needs an additional software, Thinkmap, to fuction. I emailed them about obtaining a limited license and Joe will be taking care of the rest of the process.

*It seems like ArcMap can support animation from this tutorial I found. From the introduction:

Animations can be created in ArcMap™, ArcScene™ or ArcGlobe™. With an animation, you can visualize changes to the properties of objects (such as layers, the camera, or the map extent). By altering layer properties, such as the time stamp that is displayed or layer visibility and transparency, you can create interesting animations that can be used to analyze data through time or to view information in various layers. By altering the extent (ArcMap) or the camera position (ArcScene or ArcGlobe), you can create an animation that moves around a map, scene or globe. Examples of applications that would benefit from being viewed as an animation include:

• The occurrence of events through time, such as hurricanes or precipitation, the spread of a disease, or population change
• The navigation of an object (such as a car) through a landscape (example here)
• A visualization of information in multiple layers by applying transparency

The second bullet seems close to what we're looking for, although I'm not sure what the effects would be if we had multiple objects (possible lag?). Also, judging from the videos, it seems that ArcMap is more suited for animating a spread rather than single points of data. If GCAT doesn't work, this may be a viable option.

More references:
Animation in ArcMap tutorial index
Animating data through time
Sample animation videos

Tuesday, February 16, 2010

2/12/10 Meeting Notes

*Try to see if it's possible to move dots from one latitude/longitude to another in GCAT using a simple or loop

*See if trail can be updated/erased. Some ideas for erasure was to put a street-colored on the old dot and masking it out, since redrawing the whole map would be expensive

*Next meeting will be at 2pm