Yukongis.ca says "Save me!"

In this present state I'm an embarrassment to my name's potential. This land is rich, full of unrealized potential.

Rescue me from the clutches of a distracted and absent land lord moldering in his castle. Hordes of demon goblins, orcs, trolls, thugs, and barbarians are massing on the borders

Quickly, before it's too late, get me out of here and raise me to the awesomeness you know I deserve! I know you can do it. C'mon, let's go!

Merging lakes split on YT border

Turned out to be quite involved, but now have an automated solution.

How to automatically merge polygons sharing a common boundary, keeping all attributes from class "A" features?

Interactively I would do this in an edit session by: 

Repeat for features of Name "Two", "Three", … 

Dissolve solution from How to combine adjacent polygons sharing similar trait into single polygon? doesn't work because we need to keep other attributes which differ. In other words:

  • Dissolve/merge touching polygons where geometry [Name] is identical
  • Keep attributes from polygon with [Class] A (if multiple Class A's, ok to just keep first one)
  • Discard attributes from other features

Dissolve does work, just not on it's own. Spatial Join as well, but it too is insufficient on it's own. I had explored and rejected both of these earlier because of of losing wanted attributes altogether (Dissolve) or resulting nulls in the attributes I need to keep (Spatial Join). With @Richard's answer we're reoriented properly. The solution:

  1. Dissolve on the common field, Name. We lose all other attributes but that's ok as it's only the geometry we'll keep from this step.
  1. Collect the attributes we want and make them portable with Make Feature Layer (or a Definition Query or interactive selection or ...) and Feature to Points. Make sure to select INSIDE so the points are always inside the polygons.
  1. Transfer the attributes from the points to the empty polygons with Spatial Join, use Match Option CLOSEST. One to one and One to Many don't seem to differ for the data I'm working with.

Expressed in arcpy:

# original feature class: border_lakes
# final feature class: dissolved_border_lakes_with_attributes
# all others can be discarded (tip: use "in_memory" workspace)

arcpy.Dissolve_management(in_features="border_lakes",
    out_feature_class="dissolved_border_lakes",
    dissolve_field="Name", statistics_fields="",
    multi_part="MULTI_PART",
    unsplit_lines="DISSOLVE_LINES")

arcpy.MakeFeatureLayer_management(in_features="border_lakes",
    out_layer="selected_border_lakes",
    where_clause="Class LIKE 'A'")

arcpy.FeatureToPoint_management(in_features="selected_border_lakes",
    out_feature_class="attribute_points",
    point_location="INSIDE")

arcpy.SpatialJoin_analysis(target_features="dissolved_border_lakes",
    join_features="attribute_points",
    out_feature_class="dissolved_border_lakes_with_attributes",
    join_operation="JOIN_ONE_TO_ONE",
    join_type="KEEP_ALL",
    field_mapping="",
    match_option="CLOSEST",
    search_radius="",
    distance_field_name="")


Notes

Spatial Join in step 3 is where I went wrong at first and ended up with null attributes or other unwanted combinations. I was choosing HAVE_THEIR_CENTER_IN and WITHIN. It was the interactive Spatial Join from the ArcMap table of contents, with it's different wording from the geoprocessing tool, that gave me the final clue.

I suspect it possible to use spatial join without using the point file intermediary, but wasn't successful with our data. Having something that works is good enough for now; I'll leave further optimization for others.

From <http://gis.stackexchange.com/questions/173417/combine-touching-polygons-keeping-all-attributes-from-class-a-feature/173563#173563>

 Matt

Rescuing data from OziExplorer

Should you ever find yourself needing to use data locked away in OziExplorer format: drop me a line I can convert them to shapefiles for you lickety split.

However, if I’ve been smushed under a bus or some other unpleasant scenario here’s how you can help yourself:

Use the free GPS Visualizer online service.

What I particularly like about gps-viz, aside from being available without installing and instant viewing gratification, is that it shows the command line used to use as templates in your own scripts.

The following GPSBabel command was executed:

gpsbabel -w -r -t -i ozi -f "2011 Auriol Moose.plt" -o gpx -F "2011 Auriol Moose.gpx"

Which is pretty good if GPX or KML is what you want. There’s some extra steps to get to shapefile for easy consumption in ArcMap though. For that we turn to the ogr2ogr command line tool: 

ogr2ogr output_folder "auriol ozi track file 008.plt"

Sources:


Matt

Where people ride

What if you could draw a map of where people ride their bikes or run? Based on actual usage data, not just looking at transit map or an aerial photo of where people might ride, could ride because "well, there's space for it there".

It's being done.

I hear "Yah, ummm ok".

This is the age of wizardry. Clouds live in your pocket, mapping with tweets or google cars or real time wind is so last year, so old. We all know New York, London, Shanghai, Tokyo, …  are crammed with millions and millions of people, so of course someone has built this map for them. They need it, they have resources, human power, they have it.

It's being done here.

"…?"

Here. In Canada, in the Yukon, in Whitehorse, population 22,000. Here.

A bicycle travel heat map, where colour intensity and thickness indicate traffic amount. Part of [and sells of course]total of 140 million rides and runs worldwide from Jan 2014 - May 2015. Users track their rides and runs on a smartphone or with a GPS device with Atrava app. Strava then removes personal information linked to the user and structures the data for compatibility with geographical information systems (GIS).

"!"

That's better. If you're alive in 2015 and not in a near constant state of awe there's something wrong. Wake up, pay attention. It's magic out there.

Found by way of Brian Timony's MapBrief, of which this story is but one tiny link from one sentence. Go forth and be amazed.

Matt

Yukon NTS tiles as tables

Yukon 1:250,000 National Topographic Series arranged in same order as they appear in the map index. For those times when you need plain text, but still want a graphic-like presentation.

Plain Text

117C  117D
117B  117A 
116NO 116P
116JK 116I 106L 106K
116FG 116H 106E 106F
116BC 116A 106D 106C 106B
115NO 115P 105M 105N 105O 105P
115JK 115I 105L 105K 105J 105I
115FG 115H 105E 105F 105G 105H 095E
115BC 115A 105D 105C 105B 105A 095D 095C

Ascii Table

+--------------+
| 117C |  117D |
+--------------+
| 117B |  117A |
+--------------+
| 116NO | 116P |
+----------------------------+
| 116JK | 116I | 106L | 106K |
+----------------------------+
| 116FG | 116H | 106E | 106F |
+-----------------------------------+
| 116BC | 116A | 106D | 106C | 106B |
+------------------------------------------+
| 115NO | 115P | 105M | 105N | 105O | 105P |
+------------------------------------------+
| 115JK | 115I | 105L | 105K | 105J | 105I |
+-------------------------------------------------+
| 115FG | 115H | 105E | 105F | 105G | 105H | 095E |
+--------------------------------------------------------+
| 115BC | 115A | 105D | 105C | 105B | 105A | 095D | 095C |
+--------------------------------------------------------+

Office Table

117C

117D

 

 

 

 

 

 

117B

117A

 

 

 

 

 

 

116NO

116P

 

 

 

 

 

 

116JK

116I

106L

106K

 

 

 

 

116FG

116H

106E

106F

 

 

 

 

116BC

116A

106D

106C

106B

 

 

 

115NO

115P

105M

105N

105O

105P

 

 

115JK

115I

105L

105K

105J

105I

 

 

115FG

115H

105E

105F

105G

105H

095E

 

115BC

115A

105D

105C

105B

105A

095D

095C

 

HTML table

Search and replace source code "xxx/" to desired link destination. Attached version has hover highlighting.

 

https://github.com/maphew/code/blob/master/gis/misc/nts-html-table.htm

https://github.com/maphew/code/blob/master/gis/misc/nts_map_as_html_table.py

'''Print Yukon NTS tile names as html table with links, arranged in same order as they appear in a map index.

2015-Aug-19, Matt.Wilkie@gov.yk.ca
License: X/MIT
'''

nts_txt_ordered = '''117C  117D
117B  117A
116NO 116P
116JK 116I 106L 106K
116FG 116H 106E 106F
116BC 116A 106D 106C 106B
115NO 115P 105M 105N 105O 105P
115JK 115I 105L 105K 105J 105I
115FG 115H 105E 105F 105G 105H 095E
115BC 115A 105D 105C 105B 105A 095D 095C
'''

style = '''<style type="text/css">
.ntsgrid {color:#333333;width:auto;border-width: 1px;border-color: #6D92A8;border-collapse: collapse;}
.ntsgrid tr {background-color:#f9fafb;}
.ntsgrid td {border-width: 1px;padding: 0.7em 0.5em;border-style: solid;
    border-color: #6D92A8;
    text-align:center;}
.ntsgrid td:hover {background-color:#FDECC5;}
.ntsgrid a {text-decoration:none}
</style>'''

def link(txt, prefix=None):
    return '<a href="{prefix}{txt}">{txt}</a>'.format(prefix=prefix, txt=txt)


if __name__ == '__main__':
    print style
    print '<table class="ntsgrid">'
    for row in nts_txt_ordered.splitlines():
        print '<tr>'
        for x in row.split():
##            prefix = '/maps/media/uploads/pdf-maps/Administrative_Boundaries_'
            prefix = 'xxx/'
            print '<td>',link(x, prefix),'</td>'
        print '</tr>'
    print '</table>