Sunday, 1 September 2019

Seeking all US 2010 Census Data at Tract Level



I'm trying to find where I can download all the data (summarized to the tract level).
By all data, I mean




  • population

  • race

  • Marital status

  • job

  • wage

  • age

  • sex

  • same sex couples

  • kids


  • education


I need this for every tract, in every county, in every state.


Every search I do shows someone asking for something like just population counts by block in 1 area. people are usually pointed to the American Fact Finder, but this is going to be too cumbersome for what I want.


I think I need the summary files, but haven't been able to find anything that shows, in clear detail, which ones I need.




angles - Estimating Landsat 7 azimuth (heading)?


I am trying to understand if the Landsat 7 satellite ETM+ orbit has any significant azimuth or if it could be assumed as 0° (as it is not a pointable sensor). I searched in the web but could not find any good answer so far. Zenith is supposed to be equal zero as Landsat images are always nadir.



What about the azimuth?


Would knowing the scene center coordinates (they're 46.036323 N and 10.456876 E) be of any help?


The image looks like a sort of isosceles trapezoid, with the major basis towards the North (as I would expect for the Northern Hemisphere). It is also tilted differently from south to North (as I also would expect).




One question arose while I was trying to solve my task. The metadata file of Landsat provides coordinates of the four image corners. Anyway they refer to the black background.


The azimuth is intended to be calculated through these corners or the corners of the "real"-non-background image?


And why do I have to use latitude rather than longitude?


Is it not better to use longitude?


I thought to use (for instance) the right corners, subctracting the longitudes of them (e.g. upper right long-lower right long) and obtain what I was looking for in terms of degrees, does it make sense for you?


Here is an image showing a part of Landsat paths in a Worldwide Reference System (descending orbit) and my Landsat scene. RS is geographic, WGS84. According to this what I should looking at is the non-background image.



Landsat in the WRS path




Editing PostGIS layer from ArcGIS Desktop without Enterprise Geodatabase (ArcSDE)?



I have been working with QGIS/PostGIS for a while now, without problems, but now I have to change QGIS for ArcGIS Desktop 10.1.


I am having trouble adding a layer from PostgreSQL and being able to edit that layer. I want to work directly with the database, and if I change something in the map it should be reflected on the database.


Can I do this without a Geodatabase?




arcgis 10.2 - Changing color of symbol in UniqueValuesSymbology object using ArcPy?


I have an template mxd I reference with several pre-defined layers. The only variable I need to modify is the color of certain symbols in the layer. I have tried to modify and dig around the Symbology Object but I cannot access the colors of each Unique Value Symbol.


This is how I am accessing the the Symbology of the individual layers. There doesn't seem to be and option to change the color a value.





  • I am using ArcGIS 10.2.1


    mxd_file = r"some\path\file.mxd"
    mxd = arcpy.mapping.MapDocument(mxd_file)

    # getting data frame
    df = arcpy.mapping.ListDataFrames(mxd)[0]

    # getting street layer

    street_layer = arcpy.mapping.ListLayers(mxd, 'Street', df)[0]

    if street_layer.symbologyType == 'UNIQUE_VALUES':
    # trying to access all possible properties of the symbology object
    street_symbology = street_layer.symbology
    desc = street_symbology.classDescription
    labels = street_symbology.classLabels
    values = street_symbology.classValues
    show_other_values = street_symbology.showOtherValues
    value_field = street_symbology.valueField

    del mxd, df

    layer_file = r"some\path\file.lyr"
    arcpy.SaveToLayerFile_management(path_layer, layer_file)



Answer



I agree with the comment by @Hornbydd:



The short answer is no. The only way I am aware using the standard geo-processing tools is to use the Apply Symbology From Layer tool. It may be possible to access the Symbology using python to drive ArcObjects, you would have to do some research on that.




Checking via ArcPy if ArcMap is in edit session?


I've created a Python add-in button that helps speed up my coworkers workflow by copying one feature class attribute to another. It uses the arcpy.UpdateCursor function to update a row in the target feature class. As it exists now, this button script can be run regardless of the editing mode. Obviously when its run in an edit session, the user can choose to stop editing and not save changes, but this is not the case when the script runs outside of an edit session.


How can I add a check to the script that will stop the script from running if ArcMap is not currently in an edit session?


This concerns ArcMap 10 & 10.1





I also want to check with other ArcMap users to verify that updates to tables is not normally allowed without being in an edit session.


So how is this script running outside of an edit session?


This script also brings up another question about the seemingly serendipitous selection order ArcMap performs that just happens to work for me when I update the 2nd feature class table from a list, but that's for another day.


Here's the script as it works now (without any 10.1 editor implementation):


How to add a check to ensure the user is in an edit session?


def onClick(self):
#Reference mxd
mxd = arcpy.mapping.MapDocument("CURRENT")
#Reference the main Data frame

mm = arcpy.mapping.ListDataFrames(mxd, "MainMap")[0]
#Reference the Water System Valve feature class
waterValves = arcpy.mapping.ListLayers(mxd, "Water System Valve", mm)[0]
#Reference the fire hydrant feature class
fireHydrants = arcpy.mapping.ListLayers(mxd, "Water Hydrant", mm)[0]

#Use the extent of the main DF to select all valves in the current view
dfAsFeature = arcpy.Polygon(arcpy.Array([mm.extent.lowerLeft, mm.extent.lowerRight, mm.extent.upperRight, mm.extent.upperLeft]), mm.spatialReference)
arcpy.SelectLayerByLocation_management(waterValves, "WITHIN", dfAsFeature,"", "NEW_SELECTION")


arcpy.SelectLayerByAttribute_management(waterValves, "SUBSET_SELECTION", "LOCATIONID IS NULL")

fields = ["LOCATIONID"]

row, rows = None, None
rows = arcpy.UpdateCursor(waterValves,fields)
row = rows.next()
valveList = []
append = valveList.append


#Loop through the valves table to update LocationID
while row:
builder = str(row.QSNO)+"-"+ str(row.VALVESEQNO)
row.setValue("LOCATIONID", builder)
append(builder)
rows.updateRow(row)
row = rows.next()

del row, rows


#New selection for fire hydrants
arcpy.SelectLayerByLocation_management(fireHydrants, "WITHIN", dfAsFeature,"", "NEW_SELECTION")
arcpy.SelectLayerByAttribute_management(fireHydrants, "SUBSET_SELECTION", "LOCATIONID IS NULL")

row, rows = None, None
rows = arcpy.UpdateCursor(fireHydrants,fields)
row = rows.next()

#Loop through fire hydrant table to update LocationID
while row:

for locID in valveList:
construct = str(locID) + "-FH"
#print construct
row.setValue("LOCATIONID", construct)
rows.updateRow(row)
row = rows.next()

del row, rows, valveList, mxd

Answer



So this is how I fixed my issue of not being able to control if someone using my tool was in an edit session or not:



#Reference to mxd and layers script here. Then...
try:
fields = ("OBJECTID")
upCursor = arcpy.da.UpdateCursor(waterValves, fields)
with upCursor as cursor:
for row in cursor:
pass
except:
pythonaddins.MessageBox('You are not in an edit session', 'Warning', 0)


else:
#Rest of script

The script works because it tries to create an UpdateCursor on a layer that has another UpdateCursor later in the script. This violates the behavior of the data access module. According to the ESRI Resources page on arcpy.da.UpdateCursor:


"Opening simultaneous insert and/or update operations on the same workspace using different cursors requires the start of an edit session."


I'm not happy with this solution because it's more of a hack than what I imagine is proper arcpy scripting. Better ideas anyone?


arcgis desktop - Converting .pcd LiDAR binary compressed file to .las format?


I have LiDAR data in the format of .pcd in a binary compressed file (version .7).


How can I convert it into .las format or any other that can be readable by LAStools in ArcGIS 9.3 version ownwards?


I have tried MATLAB 2013b and FUSION, but I don't know how to use these software as I am new to this topic.





distance - Toblers's Hiking Equation and Slope Dilemma


I'm trying to use Toblers's Hiking equation to determine economical backgrounds of some hillforts. The equation is anisotropic which means that the speed of movement that it calculates differs whether you are moving up or down the same slope. For exampe, moving downwards on 5° slope is faster than moving upwards the same slope or even moving on the flat terrain. And here is my dilemma: ArcMap's Slope only calculates positive values for the inclination so as I understand using Slope in the equation is useless.


I also tried the Path Distance Tool, without using any cost raster, only DEM as Surface Raster and Vertical Raster in the Vertical Factor Parameters, as Vertical Factor I used table downloaded here. This table apparently defines the vertical-factor graph but I really don't know (and would really like to know) how is the table used in this method. Is it possible that this method actually calculates also negative slopes as the tool requires starting point(s) for the calculation and therefore knows the direction of the slopes in relation to the starting point(s)? Or the tool calculates the "ordinary" Slope and then reclassifies it according to the table?


I hope someone knows the answer or can at least direct me to correct section of this forum.


Here is the image of how the result should look like: enter image description here




arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...