Introduction to Geographic Information Systems by Mike Zielinski

18
Introduction to Geographic Information Systems by Mike Zielinski

description

Introduction to Geographic Information Systems by Mike Zielinski. Definition of GIS. Stores geographic locations and attributes about the location. Able to add information Edit information Examples terrain information, disease information, tree information. Examples of GIS. Google Earth - PowerPoint PPT Presentation

Transcript of Introduction to Geographic Information Systems by Mike Zielinski

Page 1: Introduction to Geographic Information Systems by Mike Zielinski

Introduction to Geographic Information Systems

byMike Zielinski

Page 2: Introduction to Geographic Information Systems by Mike Zielinski

Definition of GIS

• Stores geographic locations and attributes about the location.

• Able to add information• Edit information• Examples terrain information, disease

information, tree information

Page 3: Introduction to Geographic Information Systems by Mike Zielinski

Examples of GIS

• Google Earth• Google Maps• CGIS – First Computerized GIS• ArcGIS-Current commercial GIS• Wikimapia

Page 4: Introduction to Geographic Information Systems by Mike Zielinski

History of GIS

• First were cave paintings showing where animals where located

• First known analytic use was cholera outbreak in London in 1854 when Dr. John Snow used a map to figure out how to stop the outbreak

Page 5: Introduction to Geographic Information Systems by Mike Zielinski

Demos

• Google Maps

• Wikimapia

Page 6: Introduction to Geographic Information Systems by Mike Zielinski

Google code

• Need key and a domain to embed in web site

• Uses Javascript

Page 7: Introduction to Geographic Information Systems by Mike Zielinski

Sample Code• <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=key"

type="text/javascript"></script> • <script type="text/javascript"> • • var map = null;• var geocoder = null;• • function initialize() {• if (GBrowserIsCompatible()) {• map = new GMap2(document.getElementById("map_canvas"));• map.setCenter(new GLatLng(37.4419, -122.1419), 13);• }• }• • </script>

Page 8: Introduction to Geographic Information Systems by Mike Zielinski

More Code• <body onload="initialize()" onunload="GUnload()">• <form id="form1" runat="server">• <div>• <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>• <asp:Button ID="Button1"• runat="server" Text="Button"

• onclientclick="showAddress();return false" • UseSubmitBehavior="True" />• </div>• <br />• <div id="map_canvas" style="width:300px; height:500px"></div>• </form>• </body>

Page 9: Introduction to Geographic Information Systems by Mike Zielinski

Geolocating• function showAddress() {• geocoder = new GClientGeocoder();• var address=document.forms[0].TextBox1.value;• if (geocoder) {• geocoder.getLatLng(• address,• function(point) {• if (!point) {• alert(address + " not found");• } else {• map.setCenter(point, 13);• var marker = new GMarker(point);• map.addOverlay(marker);• marker.openInfoWindowHtml(address);• }• }

Page 10: Introduction to Geographic Information Systems by Mike Zielinski

Wikimapia

wikimapiaRequestStr = "http://api.wikimapia.org/?function=box&bbox=" + LonMin.Text + "," + LatMin.Text + "," + LonMax.Text + "," + LatMax.Text + "&key=key”

The key can be gotten at wikimapia.org/api

Returns XML with places in the boxCan return other formats like JSON, KML and also

gzip it.

Page 11: Introduction to Geographic Information Systems by Mike Zielinski

XML format<code class="xml"> <?xml version="1.0" encoding="utf-8"?> <?access-control

allow="*"?> <folder language="en" version="1.0"> <!-- places folder, language and version --> <place id="22139">

<name>Golden Gate National Recreation Area: Land's End</name> <url>http://wikimapia.org/22139/</url> <!-- original url --> <location> <lon>-122.4997044</lon> <lat>37.7887088</lat>

<north>37.788878</north> <south>37.78681</south> <east>-122.494082</east> <west>-122.508352</west> </location>

<polygon> <point x="-122.5077081" y="37.7867756"/> <!-- points of polygon x - longitude, y - latitude --> <point x="-122.494082" y="37.78681"/> <point x="-122.4945974" y="37.7880983"/> <point x="-122.496593" y="37.7874539"/> <point x="-122.4973226" y="37.7875896"/> <point x="-122.4997044" y="37.7887088"/> <point x="-122.5002408" y="37.7885053"/> <point x="-122.5024295" y="37.788234"/> <point x="-122.5035238" y="37.7880305"/> <point x="-122.5060344" y="37.7882001"/> <point x="-122.5071502" y="37.7875048"/> <point x="-122.5071502" y="37.7875048"/> <point x="-122.5077081" y="37.7867756"/> </polygon> </place>

Page 12: Introduction to Geographic Information Systems by Mike Zielinski

XML Parser in C#• XmlReader wikiReader = XmlReader.Create(wikimapiaStream);• while(wikiReader.Read()) {• if (wikiReader.IsStartElement()){• if (wikiReader.IsEmptyElement) {• name = wikiReader.Name;• }• else{• name = wikiReader.Name;• wikiReader.Read();• if (wikiReader.IsStartElement() {• name = wikiReader.Name;• }• content = wikiReader.ReadString();• if (name == "name"){• ListBox1.Items.Add(new ListItem(content));• }•

Page 13: Introduction to Geographic Information Systems by Mike Zielinski

Other Capabilities of Wikimapia

• Can Search • Can request URL for a place; need place id

gotten from Box

Page 14: Introduction to Geographic Information Systems by Mike Zielinski

Can be used with Google Maps and Google World

• THE KML format is used by Google Earth• The KMZ format which is KML zipped can be

used by Google Maps to add information about the area like Google Earth.

Page 15: Introduction to Geographic Information Systems by Mike Zielinski

Spatial Databases

• Can add points, lines, and polygons to the database in SQLServer and MySql

• I will talk about MySql but these are standards that have been implemented so should work for other databases.

Page 16: Introduction to Geographic Information Systems by Mike Zielinski

Spatial Types

Point- POINT(12.5 13.1)LineString- LINESTRING( 0 0, 0.5 0.4, 20.1 20.5)Polygon- POLYGON( ………………………..)MULTIPOINT holds many points MULTILINESTRING holds many line stringsGEOMETRY can hold any type

Page 17: Introduction to Geographic Information Systems by Mike Zielinski

Use of types

• Create Table PointsAndLines (pt POINT,Line LINESTRING);

• Insert Into PointsAndLines Values (GeomFromText(‘(POINT(1 1)’)),…);• Select AsText(pt) From PointsAndLines.

Page 18: Introduction to Geographic Information Systems by Mike Zielinski

References

• Wikipedia-GIS• Wikimapia.org/api• code.google.com/apis/maps• dev.mysql.com