1 / 38

Graphs, grouping, pie charts and other ‘ stuff ’ .

Graphs, grouping, pie charts and other ‘ stuff ’. Peter Fox GIS for Science ERTH 4750 (98271) Week 10, Tuesday, April 3, 2012. Contents (eek!). Dispersing points Creating points for intersections of lines Extracting latitude and longitude from a geocoded table

amandla
Download Presentation

Graphs, grouping, pie charts and other ‘ stuff ’ .

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Graphs, grouping, pie charts and other ‘stuff’. Peter Fox GIS for Science ERTH 4750 (98271) Week 10, Tuesday, April 3, 2012

  2. Contents (eek!) • Dispersing points • Creating points for intersections of lines • Extracting latitude and longitude from a geocoded table • Selecting data that are not geocoded • Web links • Adding tools • Pie charts on thematic map • Graphs • Editing attributes in tables • Manipulating objects within MapInfo • Graduated symbol maps • Bivariate thematic maps

  3. Pie charts (sorry, but they survive)! • Pie chart of the ethnicity of the population for the New England States (table usa). • Open USA.TAB, select New England States with marquis select, save as new table (ne_states.tab). • Display NE states only, Create Thematic map, select Pie Charts > Next > Table = NE_states, select and Add from fields, pop_cauc, pop_black, pop_native, etc. > Next. • Click Styles > turn on Half Pies > OK > OK.

  4. Looks like this …

  5. More thematic maps • Bar charts to show the quarterly rainfall for the New England States. • Open ne_states and US_rain. • Select rain data points from NE states and write to separate table NE_rain. • NE_rain has monthly data so we need to put it into quarterly sums. • To do this add 4 columns to the table (Table > Maintenance > Table structure) and Update columns to hold quarterly sums.

  6. More thematic maps • Create Thematic map, select Bar Chart > Next > select columns to plot > Next > OK. • But … because some states have multiple measurement sites we have to group them. • Query > SQL select > Columns = State,sum(q1),sum(q2),sum(q3),sum(q4) > Tables = NE_rain > Group by = state > into Table = ne_q. • Create Thematic map, select Bar Chart > Next > select columns to plot > Next > OK.

  7. Looks like this

  8. Adding/ comparing • Using a table of friends zipcodes (earlier exercise), add their ages and add 5 new friends (or class members) to the table. • Plot them on a map that distinguishes new friends from old and their ages. • Open friends table (NB save copy as new_friends). • Open new_friends, Table > Maintenance > Structure > Add field old_new as character (3) and age as Integer. • Open the table in Browser window and add new information. You can also edit the data via the Info tool.

  9. and • To add or delete rows, go to Edit > New Row or Edit > Clear. • You’ll have to Geocode the data again. • To remove rows from the table Table > Maintenance > Pack Table > Save changes > read table in again.

  10. Creating attributes • Make CL editable > put objects on map with tools > Map > Save CL objects and name the new table • Open new Browser window • Table > Maintenance > Table structure > add fields (add "area" column) • Table > Update column > Column = "area" > Value > Assist > Function > Area • Save table

  11. Modify graphic objects • Make layer with objects editable (if you can’t do this, try saving table with a different name). • Select the object to be changed. Select Reshape icon or Edit > Reshape. • Click on the node to be moved. • Select multiple nodes in sequence with Shift-click (short-route) or Ctrl-click (long-route) and move them together. • Ctrl-click on same node twice will select all nodes.

  12. Modify graphic objects • If the object borders another and shares nodes, first go to Options > Preferences > Map window > click on Move duplicate nodes in the same layer. • If you don’t do this, you can open up gaps between objects or make them overlap. • Use add nodes icon to add nodes.

  13. Combining objects • Make table editable, Select objects to be combined, Objects > Combine, select how to combine object attributes.

  14. Splitting objects • Objects must be split with another object which can either exist or be made on the cosmetic layer. • First, make splitting object if necessary. • Make CL editable, create polygon to be the "splitter", save to cut.tab (Map > Save Cosmetic objects). • Make target file editable, select the object to be split then Object > Set target, select the "splitter" object, then Objects > Split > OK. • Remove cut.tab from display.

  15. Graduated symbol maps. • Graduated symbol maps use symbol sizes to represent different values. • To make a graduated map of Japanese earthquakes where the earthquake magnitude is represented by symbol size: read tables ‘world’ and ‘japan_quakes’ > Map > Create TM > Graduated > Next > choose table = japan_quakes and field = mb > Next > Modify settings > OK.

  16. Bivariate thematic maps • Bivariate maps are those that represent two attributes with a single symbol on the map. For example, we can represent earthquake depth with color and earthquake magnitude with symbol size. • To do this first create a TM of the earthquake depth using point ranges. Use 6 ranges and select equal count. • Then create a second TM using point ranges for the mb field.

  17. Bivariate thematic maps • Under step 3 of 3 click Styles > Options and under Autospread select Size. • Then under Apply choose size again. • The symbols should become hollow but of graduated size. • Click OK and the graduated size symbols draw over the color ranged symbols. • Deep Japan earthquakes.

  18. Voila, and uh-oh…

  19. Mapbasic - prelude • MapBasic is a programming language for MapInfo that encompasses many direct calls to mapping and database functions. • It is used in one of two ways: either through Options > Show MapBasic window in MapInfo or through the MapBasic interface and compiler. • MapBasic Window

  20. Mapbasic compiler • MapBasic is a standalone program to develop programs that interface with MapInfo. • One can manipulate data and maps from within MapBasic programs. • E.g. a MapBasic program that performs the same function as that given above for the MapBasic Window looks like this: declare sub main sub main open table "c:\mapinfo\data\world.tab" Interactive [replace with correct path] map from world select * from world where pop_1994> 10000000 into selection browse * from selection map from selection end sub

  21. The body of the program is identical to the MapBasic Window commands. • To run this program, start MapBasic, select File > New, paste the program into the editor window, select Project > Compile current file (or Ctrl-K), then select Project > Run (or Ctrl-U). • If MapInfo is not already running it will start and perform the tasks. • The result should be a map window showing only countries with > 10 million inhabitants.

  22. Mapbasic - prelude • One can perform many of the MapInfo functions via the MapBasic window by entering command lines. • For example to open the world table and make a map of countries with greater than 10 million people, type in the MapBasic window: open table "c:\mapinfo\data\world.tab" Interactive map from world select * from world where pop_1994> 10000000 into selection browse * from selection map from selection • There are several functions available for MapBasic. • To view MapBasic functions, open the MapBasic window as you perform tasks with MapInfo's interactive screen.

  23. Dispersing points • Sometimes when we geocode we get many points falling at the same coordinates. • This happens because the data are geocoded to the centroid of the entity, for example when we geocoded with zip codes. • For the purposes of the map, we can disperse the points to give the proper representation of the number of points. • To do this we can use the MapBasic window. Choose Options> Show MapBasic window to open the MapBasic window.

  24. Dispersing points (ctd) • Within the window type: randomize update selection set obj = createpoint(centroidx(obj) +.02*rnd(1), centroidy(obj)+.02*rnd(1)) • This will randomly redistribute the points to the northeast within 0.02 degrees (or whatever the distance units are). • To randomly redistribute them about the current point, use: update selection set obj = createpoint(centroidx(obj) +.02*(rnd(1)-.5), centroidy(obj)+.02*(rnd(1)-.5)) • The table will be automatically updated and the new points will appear on the map. Make sure you save a copy of your original data.

  25. Creating points for intersections of lines • In some cases we might be interested only in the intersections of lines, for example street intersections. We can create a new table of points containing only the intersections. • Open the street file nyrensd. Make 2 copies of the nyrensd file and give each a unique name (File > Save copy as) such as str1 and str2. Open the 2 new files you have created. • Choose Query > SQL select. In the dialog box enter: • Select columns = str1.streetname + "&&" + str2.streetname

  26. Then From Tables = str1, str2 Where Condition = str1.obj Intersects str2.obj and str1.streetname <> str2.streetname Into Table Named = Intersection • Save the Intersection table (File > save copy as).

  27. Lon/lat from geocoded table • You may want to see the latitude and longitude in your geocoded table. • There are 2 ways to do this depending on whether you want a new table or want to put the lat/lon in your original table. • To create a new table use Query > SQL select. • Under select columns, enter columns you want in the new table and then also put: • CentroidX(obj) "Longitude", CentroidY(obj) "Latitude"

  28. And • To add the lat/lon to an existing table, select Table > Maintenance > Table structure and add 2 new columns to your table. • Call the Lat and Lon and make them ‘float’ types. • Then choose Table > Update column. Enter your table name under Table to update and Get value from Table. • Column to update should be your lat or lon and Value shoud be CentroidY(obj) for latitude and CentroidX(obj) for longitude.

  29. Selecting data that are not geocoded • You may want to get a Browser list of points that did not geocode from a particular table. • Open the table and choose Query > Select. Under that Satisfy enter not obj. • This selects all the data records that are not objects, i.e., not geocoded. • Example: Geocode friends.xls with zip_codes and find those that do not geocode.

  30. Un-geocoding tables or data • Un-geocoding means removing the objects from a Table. • You may want to do this if you are going to re-geocode using a better method or have better data to geocode with. • To un-geocode an entire table: select Table > Maintenance > Table structure. • Clear the Table is Mappable check box > OK > OK. • This is irreversible.

  31. Un-geocoding tables or data • To un-geocode selected objects: Plot the data in a map window. • Select the points you want to un-geocode. • Choose Layer control and set the layer to be editable. • Choose Edit > Clear Map objects only. • This un-geocodes the data but does not remove them from the table. • To undo choose Edit > Undo Deletion.

  32. Creating web links for maps • WWW links can be incorporated into the maps using the HotLink button (the lightning bolt). • To create the links, add a column to your table through the Table > Maintenance > Structure option. • Make it a character string long enough to accommodate your longest URL. • Open the table in the Browser window and type in the URLs. • In Layer Control, click on the HotLink button.

  33. Creating web links for maps • Select the column containing the links in the FilenameExpression dropdown box and check the Save options to table metadata box to save URLs with table. • Don't forget File > Save table. • To activate the link on the map, click on the HotLink button (the lightning bolt) and then on the map object. • Example: Add http://www.states.AL.us to the states table for Alabama.

  34. Adding tools to MapInfo • Tools are external routines that can be called from the MapInfo interface. • They are accessed via the Tools menu. • A tool can be developed as a MapBasic program and its compiled form (.mbx file) is run from MapInfo. • To add a tool, select Tools > Tool Manager > Add Tool and fill out the location of the tool (the .mbx file) and a description. • The tool will run. • To run it later, select Tools, then find the tool and check Loaded. • Checking Autoload will cause it to run on Startup of MapInfo. • Example: Add the Xcel_2_tab tool.

  35. Summary • Topics for GIS (for Science) • Extras! • For learning purposes remember: • Demonstrate proficiency in using geospatial applications and tools (commercial and open-source). • Present verbally relational analysis and interpretation of a variety of spatial data on maps. • Demonstrate skill in applying database concepts to build and manipulate a spatial database, SQL, spatial queries, and integration of graphic and tabular data. • Demonstrate intermediate knowledge of geospatial analysis methods and their applications.

  36. Reading for this week • MapInfo (10.8) User Guide • Chapter 5 Graphing your data • Chapter 7 Graphing and editing objects • Chapter 9 Pie charts, graduated symbols, etc. • Review the mini-exercises in these slides and work through them in MapInfo – if you have questions, ask on Friday

  37. Next classes • Friday, April 6, Lab: … • Tuesday, April 10, Editing attributes, manipulating objects in MapInfo • Friday, April 13, Lab: geostatistics and some more maps • No class April 17 (Grand Marshall week)

More Related