Welcome

I'm a student and this blogg has been created to keep information on a daily to weekly basis about my project that i am doing to get my Bachelor of Information Technology. This is based on my progress, and a place to put all of my information, not entirely a proper blogg. Though sometimes i feel like i'll be talking to myself... Any ways, enjoy and feel free to comment. If your wondering what this project is and dont want to read every single post, just go to the Proposal link, or any of the "posts worth looking at" below.

Saturday, March 29, 2008

29/3 End of Research

GAH not much work done today, but the bright side? I actually did something worth paying me for (actually helping people with stuff at work). This posting is just to go over what i achieved by the end of the milstone vs. what i was aiming to achieve, it wont be too in depth, but i will finish with a conclusion that will hopefully conclude well enough. I will also show examples (mainly code) of exactly what it was that has been learnt. First i'll just cover the milestone again :

  1. Have an overall idea on how to use Google maps API (Creating maps, Creating Routes – point to point, Google maps implementation in ASP.NET, Adding points to routes)
  2. Learn basics of JavaScript (Working with HTML, Arrays, General)
  3. Learn basics of C# (Basics of syntax, after this I should be fine as I’ve programmed VB.NET)

_________________________________________________

1 Google maps basics

So basically what i wanted to do here was know enough to be able to easily implement everything when it came to the implementation stage. Which will include things like actually knowing how to:

1.1 Showing a map and centering it
1.2 Adding polylines
1.3 Adding G G G markers
1.4 Listeners
1.5 Adding routes & geocoding
1.6 Google maps & ASP.NET

------------------------------------------
1.1 Showing a map and centering it

OK so this is easy basically all you have to do (besides adding the key to the javascript at the top) is add a few lines of code to show a map. This goes under function load().

map = new GMap2(document.getElementById("map"));
var startHere = new GLatLng(-41.28077355890163, 173.2734489440918);
map.setCenter(startHere, 13);


------------------------------------------
1.2 Adding polylines


This is a very simple example of adding a new line based on an array created by the user and added to an array. Every time a user clicks the map those coordinates will be added to an array, and if the array length is more than one, this polyline will be drawn on the map.

points.push(point);
if (points.length > 1) {
route = new GPolyline(points);
map.addOverlay(route);
}


------------------------------------------
1.3 Adding G G G markers

This is very simple, all you need is the point where you want the marker to go. Create a new marker, assign it a value and add the overlay.

marker = new GMarker(lcPoint);
map.addOverlay(marker);


------------------------------------------
1.4 Listeners


Using the GEvent.assListener funtion you can add listeners for things such as a map click, or map drag, a map error etc. This is declared in the funtion load() part at the start of the page.

GEvent.addListener(map, 'click', addMarkerPoint);
GEvent.addListener(gdir, "error", handleErrors);


------------------------------------------
1.5 Adding routes & geocoding

The following code assigns a place to put the information, then creates a new gdirections object, then a new geocoder is created, gets the locations, assigns the response to a variable, then gets the specific lat and long coordinates. This can then be added to an array and with the next code you can throw either addresses or coordinates at, and it will get the route for this.

//declare directions objects etc
directionsPanel = document.getElementById("route");
directions = new GDirections(map, directionsPanel);

//create geocoder and get locations, place those into an array.
geocoder = new GClientGeocoder();
geocoder.getLocations(address);
place = response.Placemark[0];


//get the geocoding data
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);

-------------
//load directions
directions.loadFromWaypoints([lcFromAddress, lcToAddress, lcEndAddress])

Another way of getting the coordinates is from the map point listener. Below listens for the use to click, then passes that point to a funtion which adds this point to an array. This can then be accessed and used for creating routes, polylines, g markers etc etc.

GEvent.addListener(map, 'click', addMarkerPoint);

function addMarkerPoint(marker, point) {
points.push(point);
setRoute();
}

------------------------------------------
1.6 Google maps & ASP.NET

AHHHHH now this i did not completely finish :( I got alot of looking at code etc done, but nothing practical. Only thing i missed in milestone. BUT as i have allocated 3 hours per week still on research and was going to use that time to carry on with more C#, i can just practise C# implementing google maps, make sense? Will talk about this more further on.

2 Basics of javascript

2.1 Basics
2.2 Variables
2.3
Loops and if statements
2.3 Arrays
2.4 Functions


------------------------------------------
2.1 Basics

I just wanted to put the real simple stuff here. Javacript usualy goes in the head part of the html document and is declared as shown below.

Inside the script area is where you add all of your functions and global variables. The best practise that i have seen for javascript is the same as other languages, such as where to put things, how to lay code out, and how to name variables.


------------------------------------------
2.2 Variables

The variables in javascript are loosely typed, which means we do not have to define what type they are. Below shows how to declare a variable and sign a value to this. If the variable is declared outside a function in the main script area this is a global variable and can be accessed from anywhere.

var lcCount;
lcCount = 0;

------------------------------------------
2.3 Loops and if statements

If statements are pretty simple, below is an example.

var meh;
meh = 5 + 5;

if (meh == 8) {
alert ("Nope");
}
else if (meh == 10){
alert("Yes!");
}



Loops: for, while, do while. I'll just go over one, basically these are used to execute one part of code a specified number of times.

for (var i=0;i<5;i++)>

------------------------------------------
2.4 Arrays

Arrays are easy, pretty much like a variable, but it holds many values. I did not go into multidimentional arrays so this is just basic arrays. Below is an example showing how to declare an array, how to add values, and how to read these out.

var points = [];

for (var i=0;i<5;i++)>

alert(points);

------------------------------------------
2.5 Functions


Functions hold seperate parts of code to do a specific task, below is an example of a function that is called to do a certain job.

points[];

function load(){
var valueOne = 12343;

addToArray(valueOne);
}


function addToArray(valueOne) {
points.push(valueOne);

}

3 C# basics

I'm still reading through my book on C#. So far i have looked at the basics of syntax and have gauged the idea that it is quite different from VB.NET. As mentioned earlier, because i have not done any implementation on C# i will put aside 3 hours a week to do this (maybe some other non project time also) of my specified research time. And because i did not complete the google maps in C# bit i will obviously combine this. I will make a seperate post for my progress on this specific task and link it from the side menu.


Conclusion

So how far did i get? I am going to say i reached 95% of my milestone and are going to have to catch up on that 5% in my specified research times. I think that i could have done much better in this part of the project, however i am having problems with time management, this i am going to try very hard to improve in the design faze which is starting on monday. Knowledge wise i have learnt enough to be able to design and know what i can do. Also i can start thinking about implementation.


Friday, March 28, 2008

28/3 Finish milestone

_________________________________________________________
Start 10.00 a.m.
_________________________________________________________


Today my purpose is to make a map using ASP.NET. I found a good tutorial, but its really pissing me off because its refers to code, such as: "Listing 2". BUT I CANT FIND THE LISTING. Looking at thousands of websites : so unmotivated today!!!!

hmmm cant even remember what i ended up doing yesterday.

_________________________________________________________
Finish ?? 4 hours
_________________________________________________________


LINKS

http://www.programmableweb.com/link/google-maps-ajax-and-asp.net
http://www.codeguru.com/csharp/.net/net_asp/controls/article.php/c10539/
http://www.codeproject.com/KB/custom-controls/LatLaysFlat-Part1.aspx
http://www.c-sharpcorner.com/UploadFile/shabdarghata/google-maps-user-control-for-ASP-Net-part103232008234414PM/google-maps-user-control-for-ASP-Net-part1.aspx
http://websphere.sys-con.com/read/171162.htm
http://www.dnzone.com/ShowDetail.asp?NewsId=1637
http://www.codeguru.com/csharp/.net/net_asp/controls/print.php/c10539__2/

Thursday, March 27, 2008

27/3 BAH

_________________________________________________________
Start 9.00 a.m.
_________________________________________________________


This morning i am going to be working on project management... have lots to catch up on and managed to some how score myseld the text book at the library! woot fun..

_________________________________________________________
12.30 p.m.
_________________________________________________________


Do some more project stuff, sorting out things for meeting today, then meeting.
OK so what i did for rest of day... bits and pieces of coding, for newer version of app click here, had project meeting, did more work after that, had class, then did project management for rest of time doing work. The new version of the app isnt so flash, i was just playing round with some case statements and i'm obviously doing something wrong, if i get spare time tomorow i shall carry on with that. So not too much project work today, i'll have to pull some long hours tomorow!

_________________________________________________________
Finish sometime... 3 hours.
_________________________________________________________

Wednesday, March 26, 2008

26/3 Finish Routing

_________________________________________________________
Start 9.00 a.m.
_________________________________________________________

Today i plan to finish all the main basics of using google maps. And also read a bit more of my C# book. So far i have made a new version of my simple routing. Basically what this new version does is works lol, in the sense that you can actually search the two addresses, it doesnt add ne waypoints but calculates the next point from the last point. Next i am going to start from scratch and figure out how to add multiple waypoints.

************************************************************************
Break 11.00 - 12.00 Lunch
************************************************************************

So after ages of looking at random stuff and random code, i came up with this. : took me so long to figure out how to work the loadFromWaypoints, my excuse? umm tired... I was doing something wrong haha. I shall now attempt to let the user add in there own addresses, then get the waypoints and make the route for them.

************************************************************************
Break 5.00 - 6.30 TEA FOOOOOD
************************************************************************


Blergh, time to end this night, i am not getting anywhere with code as my brain has decided not to work. this is what i did anyways, still trying to geocode three addresses the user inputs then make the map route from those. Heres version one.

_________________________________________________________
Finish 9.00 p.m. Estimated actual work time done? maybe 8 hours.
_________________________________________________________



LINKS

http://www.higheredblogcon.com/library/deweese/presentation.html
http://econym.googlepages.com/geomulti.htm
http://groups.google.com.au/group/Google-Maps-API/browse_thread/thread/548555bc7454fca/60bb87b9abbd280e?lnk=gst&q=loadFromWaypoints&rnum=5
http://groups.google.ms/group/Google-Maps-API/browse_thread/thread/dc1916563d343e83
http://esa.ilmari.googlepages.com/draggabledir.htm

Tuesday, March 25, 2008

25/3 More API shtuff

_________________________________________________________
Start 10.0o a.m.
_________________________________________________________


Carry on with trying to get the lat and long from google, yarg.

_________________________________________________________
Finish 12.0o p.m. - oops 2 hours.
_________________________________________________________

Monday, March 24, 2008

24/3 Stuff

_________________________________________________________
Start 10.0o a.m.
_________________________________________________________


So i spent the whole day playing round with code trying to come up with something, but ran into some problems with getting the lng and lat out of the response from the getLocations() function that you throw at google.

setLat = place.Point.coordinates[1];
setLon = place.Point.coordinates[0];

Ahhhh, well copying and pasting may not be the best thing to do. Shall look into more peoples code.

************************************************************************
Break 12.00 p.m. - 2.00 p.m. - Lunch
************************************************************************

_________________________________________________________
2.0o p.m.
_________________________________________________________

Carry on with stoopid problem, i'm doing something wrong!!!

_________________________________________________________
Finish 6.0o p.mish. Didnt really get too much done, maybe 4 hours of productive work.
_________________________________________________________

LINKS

http://www.geospatialtraining.com/Newsletter/Summer%202006/Google%20Geocoding.htm
http://www.gorissen.info/Pierre/maps/googleMapLocationv3.php