<commit_before># QGIS Exercise 3
For this assignment, you’ll use a couple of different export options to create maps that you can publish on a website. 

For this assignment, you should use one of the maps you made previously or make a new map using guidelines and techniques covered earlier. I would advise working with a simpler map, perhaps just a base map and a set of points. You might want to pull some data from your working project code, and if you have a set of place names without geocoordinates, you could try looking up latitude and longitude coordinates or visiting a geomapping API service. 

## Geocoding Tip
Some of you have completed a “TimeMapper” assignment with Dr. B using a simpler mapping program running with Google Sheets. In that program, you can keep an column of place names, and then add a column that does an “API lookup”, of the first available geocoordinates associated with a location. Here is the formula we used in Google Sheets to do that lookup, which returns latitude and longitude coordinates:

```
=JOIN(",", ImportXML(CONCATENATE("http://nominatim.openstreetmap.org/search/?format=xml&q=",A2), "//place[1]/@lat | //place[1]/@lon"))
```

If you have a column of place names output in Column A, and paste this formula to fill in Column B (like we've done in QGIS 2), it will read the place name in the corresponding cell in Column A and look up and return the first set of geocoordinates it finds. Note the XPath in the formula, as Open Street Maps' data is stored in XML. If you wanted to return *all* the available sets of geocordinates, or data associated with them, you could remove the `[1]` predicates after `//place` and look at the content of the `//place` element.

To split this data so that you have latitude in one column, and longitude in the other, you can just split up that XPath so that one column (B) reports ONLY the `@lat` and the next column (C) reports ONLY the `@lon` associated with your place name in Column A.

It will be possible to pull this geodata in XQuery, too, by the way, working with Open Street Maps as an external database. Happy experimenting. You will be able to import a TSV or CSV into Google Sheets and export it. And there may be a working variation on this `JOIN()` function in Excel or other spreadsheet software. Please report on your experiences with pulling geodata and raise questions on the [DHClass-Hub](https://github.com/ebeshero/DHClass-Hub) and find us on Slack if you want some help. You will want to inspect your results to do a “sanity check” and make sure they are the correct locations, and make any corrections you need to make for your map. 


## Export to PNG 
From working on previous assignments, you’re probably already familiar with the process for exporting to PNG. From the Print Layout window, you can use the “Export to Image” icon, pictured below, in the top menu bar, and then select PNG as the file type. 

![](qgis_3/Screen%20Shot%202020-03-24%20at%202.21.23%20PM.png)

The “Export to Image” icon is the first of the three icons pictured above. 

## Export to SVG 
Scalable vector graphic, or SVG files, are composed of vectors, something you’ve learned about previously. Because of that, they’re able to be scaled without compromising the image appearance, clarity, or integrity. You can zoom in on these pictures without them becoming pixelated. <commit_msg>spot edits to Geocoding Tip in QGIS 3<commit_after># QGIS Exercise 3
For this assignment, you’ll use a couple of different export options to create maps that you can publish on a website. 

For this assignment, you should use one of the maps you made previously or make a new map using guidelines and techniques covered earlier. We advise working with a simpler map, perhaps just a base map and a set of points. You might want to pull some data from your working project code, and if you have a set of place names without geocoordinates, you could try looking up latitude and longitude coordinates or visiting a geomapping API service. 

## Geocoding Tip
This is for people who have place names but need to find out latitude and longitude coordinates. Some of you completed a “TimeMapper” assignment with Dr. B in other classes using a simpler mapping program running with Google Sheets. In that program, you can keep an column of place names, and then add a column that does an “API lookup” of the first available geocoordinates associated with a location. Here is the formula we used in Google Sheets to do that lookup, which returns latitude and longitude coordinates:

```
=JOIN(",", ImportXML(CONCATENATE("http://nominatim.openstreetmap.org/search/?format=xml&q=",A2), "//place[1]/@lat | //place[1]/@lon"))
```

(Be sure to scroll to the right to read the complete formula.) If you have a column of place names output in Column A, and paste this formula to fill in Column B (like we've done in QGIS 2), it will read the place name in the corresponding cell in Column A and look up and return the first set of geocoordinates it finds. Note the XPath in the formula, as Open Street Maps' data is stored in XML. If you wanted to return *all* the available sets of geocordinates, or data associated with them, you could remove the `[1]` predicates after `//place` and look at the content of the `//place` element.

To split this data so that you have latitude in one column, and longitude in the other, you can just split up that XPath so that one column (B) reports ONLY the `@lat` and the next column (C) reports ONLY the `@lon` associated with your place name in Column A.

It will be possible to pull this geodata in XQuery, too, by the way, working with Open Street Maps as an external database. Happy experimenting! You will be able to import a TSV or CSV into Google Sheets and export it from there as a TSV or CSV as well. There may be a working variation on this `JOIN()` function in Excel or other spreadsheet software, and this may require a little investigating. Please report on your experiences with pulling geodata and raise questions on the [DHClass-Hub](https://github.com/ebeshero/DHClass-Hub) and find us on Slack if you want some help! You will want to inspect your results to do a “sanity check” and make sure they are the correct locations, and make any corrections you need to make for your map. 


## Export to PNG 
From working on previous assignments, you’re probably already familiar with the process for exporting to PNG. From the Print Layout window, you can use the “Export to Image” icon, pictured below, in the top menu bar, and then select PNG as the file type. 

![](qgis_3/Screen%20Shot%202020-03-24%20at%202.21.23%20PM.png)

The “Export to Image” icon is the first of the three icons pictured above. 

## Export to SVG 
Scalable vector graphic, or SVG files, are composed of vectors, something you’ve learned about previously. Because of that, they’re able to be scaled without compromising the image appearance, clarity, or integrity. You can zoom in on these pictures without them becoming pixelated. 
{'fraction_non_alphanumeric': 0.05360707157114343, 'fraction_numerical': 0.008696891930424864, 'mean_word_length': 4.375478927203065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '632427', 'n_tokens_mistral': 1853, 'n_tokens_neox': 1722, 'n_words': 1152}