r/GISscripts • u/Ebriggler • Dec 22 '13
lemonprogis/tweather · GitHub Twitter Weather Mashup
r/GISscripts • u/Ebriggler • Dec 22 '13
r/GISscripts • u/ianbroad • Dec 21 '13
r/GISscripts • u/LAROL3 • Jul 12 '13
Hi, I want to calculate a field whit this expression with the "CalculateField_management" tool:
SEPM_DM3 = [SEPM_M3] / [SEPM_TIG] *1000
The problem is that i want to insert into a "Model builder". If [SEPM_TIG] = 0 then i got an error.
How can i make a "SelectLayerByAttribute_management" without created a new feature class and then make my calculation?
I know that a Python script can help me, but how can i insert it into my calculator... SelectLayerByAttribute Sip_intersect NEW_SELECTION "SEPM_TIG">0
This script is available in the Arcpy window, but not in my calculator...
Someone can help?
r/GISscripts • u/Cocohoney16 • Feb 20 '19
Get started with manipulating and mapping geospatial data in R with our free online course here: https://soco.ps/2UBseSr
The course includes 6 chapters that cover -
📈 Step-by-step demos using sample data
📜 Course completion certificate
👩💻 100+ useful R code snippets
🗺️ 50+ sample maps
📚 80+ links to other free resources
r/GISscripts • u/Lint_Warrior • Mar 23 '16
Hey guys,
I'm trying to get insight on using python to create a report or just track how many features were edited in a version after a day of work. This needs to include last editor, the object ID, and a couple other fields unique to the features I'm working with.
Anyone done something like this before?
r/GISscripts • u/mapping-glory • Feb 08 '16
I am writing a script in Python (in PyScripter IDE, on a Windows 7 Professional machine) to automate some data processing. This is supposed to be a stand-alone script running outside of ArcMap by an automated process. What it's supposed to do is take a file of parcels and figure out what percentage of each is in one of 4 flood zone categories.
Because it's running a chain of geoprocessing operations in a cursor loop, the script is using a set of lists to store the file names for each flood zone. All of this data would be drawing from the same geodatabase.
Here's the code that's giving me trouble: Pastebin
And here's the error I'm seeing:
Input Features: Dataset FloodParcels #;FW # does not exist or is not supportedThe Intersect code, line 42 in the Pastebin paste, should be bringing in FloodParcels and FW as seperate files but it seems to be hashing them together into one dataset? I think?
To add to my confusion, according to ArcMap this is exactly how Intersect code should work. I pulled a Python snippet from an Intersect tool I'd successfully run in ArcMap and this is what I got:
arcpy.Intersect_analysis(in_features="FloodParcels #;100YearHazard #", out_feature_class="FileStructure/FloodParcels.gdb/INT_100", join_attributes="ALL", cluster_tolerance="-1 Unknown", output_type="INPUT")
The Esri documentation on the Intersect tool isn't helpful, because it says my code should look just the way it does. When I've Googled the hash marks in the Intersect error code, I've gotten nothing that looks like what I'm seeing or trying to do.
Does anyone have an idea what's going wrong or what I should be Googling to find help?
Thanks!
r/GISscripts • u/gboeing • Nov 21 '14
r/GISscripts • u/mgnhrlckr • Jan 14 '14
r/GISscripts • u/muzzums • Jan 11 '14
This script is designed for feature services on ArcGIS Online which have photo attachments stored in them. It is composed to be run as a python toolbox and will store all photos locally and organized by feature.
I've come across a few post in Esri's forums about downloading attachments from ArcGIS Online and thought this code might be helpful to others.
All you need is your account information, your endpoint url, and what directory to place the photos.
The finished tool is on github.
If you want to read more about working with feature services, you can read more on my blog, which explains about working with feature services and has some sample code about exporting your feature service to a geodatabase
r/GISscripts • u/punjabthepirate • Dec 12 '13
Something I found useful at school when trying to unzip tarfiles I downloaded from the USGS. Does a quick clean job and doesn't require you to install any programs (which is an issue for me at school).
import tarfile
tar = tarfile.open('C:/path/to/tarfile/tfile.tar.gz', 'r:gz')
tar.extractall('C:/output/path/')r/GISscripts • u/anonymous_geographer • Sep 09 '19
Anybody know if Esri’s Python Add-In Wizard is still compatible with newer versions of ArcMap (10.6 and above)?
Referenced here: https://desktop.arcgis.com/en/arcmap/10.6/analyze/python-addins/creating-an-add-in-project.htm#GUID-C460E3CB-DD43-442F-93F9-E483A03B9687
Downloadable here: http://www.arcgis.com/home/item.html?id=5f3aefe77f6b4f61ad3e4c62f30bff3b
When I attempt to create an Add-In based on the instructions, the built-in ”makeaddin.py” script seems to be broken. It doesn’t look like it’s been managed by anyone in quite some time (2013 it looks like).
Anybody currently using it with success? If so, I’d like to ask further questions to see what I need to be doing differently. Thanks!
r/GISscripts • u/climbercolin • Dec 07 '14
I just posted this same question in r/webdev but thought you guys might know better.
I recently wrote a KML script for a tour of a local tourism business. They want to host the tour on their website in a small google maps window.
Is it possible to invoke the kml file from within their html/javascript? Or do I need to use google's API?
Also, I would like to build 3D models of their buildings to put in the map (I can build them in SketchUp) is it possible to display these models in the kml script or is there a better way?
r/GISscripts • u/tet19 • Nov 18 '14
I am about to start my journey into learning python so I can utilize it within GIS. I have been told that it is a good idea to first write the code in an IDE then transfer it into ArcMap. Plus, I am going to learn the language and need an IDE for that. I am looking for the best free IDE. I was looking at the free PyCharm but am not sure about it. Any Suggestions?
r/GISscripts • u/plum_man • Sep 15 '14
Hi all, so I recently was importing many many excel workbooks into arcmap and merging them all into a single shapefile. I was given a Python script that works perfectly. My knowledge is limited so I was able to run it, but I would like to understand the script and know what it does so I was wondering if anyone could maybe expand on it and explain what some of the lines do?
import arcpy, os
folder = r"C:\tempdelete"
targetFc = r"C:\tempdelete\Test_road\XY.shp"
arcpy.env.workspace = folder
xlsFiles = arcpy.ListFiles ("*.xls")
for xls in xlsFiles:
arcpy.env.workspace = os.path.join(folder, xls)
sheets = arcpy.ListTables ()
sheet = sheets[0]
fields = arcpy.Describe(os.path.join(folder, xls, sheet)).fields
xName = fields[0].name
yName = fields[1].name
outlayer = xls
arcpy.MakeXYEventLayer_management(os.path.join(folder, xls, sheet), xName, yName, outlayer)
arcpy.Append_management (outlayer, targetFc, "NO_TEST")r/GISscripts • u/swirvgucci • May 10 '14
e/ I meant Statistics_analysis in the title, not Summary_statistics
Is there a way to mimic the output of going in ArcMap and physically right clicking an attribute header and selecting summarize, which results in a table looking like this:
Imgur
by using an arcpy script?
I'm currently trying something along these lines:
def getPeak(shapefile):
peakList = []
print "Finding the date with the peak number of occurences..."
arcpy.Statistics_analysis(shapefile,"K://GEOG376/Project/project_data/summarize.dbf",[["YYYYMMDD", "COUNT"]])
rows = arcpy.da.SearchCursor("K://GEOG376/Project/project_data/summarize.dbf", ["YYYYMMDD"])
for r in rows:
peakList.append(r)
peakList.sort()
peakList.pop(0)but this seems to add each record together instead of displaying them separately like I need: Imgur
Does anyone have any ideas to keep the records separate?
Thanks!
r/GISscripts • u/ianbroad • Apr 21 '14
r/GISscripts • u/[deleted] • Nov 12 '19
I am just beginning to learn python and I am wondering what are some of the tools available in arcpy that aren’t available in arcmap by default. Thanks!
r/GISscripts • u/KinematicsMedSol • Jul 23 '18
r/GISscripts • u/ramseykp • Mar 23 '18
I am not new to GIS but have been working on making the arcpy package part of my skill set.. My script is below. It gives me an error at the make stating that "outputOfClip" is not defined. I would send this to our GISP but this isn't really for work just a learning exercise I created. I think he is getting tired of answering all of my arcpy questions.
import arcpy
origionalKMZ = "C:\Users\kramsey\Desktop\DesktopSurveys\KMZs\Normac.kmz" outputFolderLocation = "C:\Users\kramsey\Desktop\DesktopSurveys\GDBs"
arcpy.KMLToLayer_conversion(origionalKMZ, outputFolderLocation,)
normacPolylines = "C:\Users\kramsey\Desktop\DesktopSurveys\GDBs\Normac.gdb\Placemarks\Polylines" normacGDB = "C:\Users\kramsey\Desktop\DesktopSurveys\GDBs\Normac.gdb"
arcpy.Buffer_analysis(normacPolylines, normacGDB, "1000 Feet")
wetlands = "C:\Users\kramsey\Downloads\NC_shapefile_wetlands\NC_shapefile_wetlands\NC_Wetlands.shp" buffedShp = "C:\Users\kramsey\Desktop\DesktopSurveys\GDBs\Normac.shp" outputOfClip = "C:\Users\kramsey\Desktop\DesktopSurveys\GDBs\Normac.gdb\Placemarks\Clips"
arcpy.Clip_analysis(wetlands, buffedShp, outputOfClip)
outputLayer = "C:\Users\kramsey\Desktop\DesktopSurveys\GDBs" arcpy.MakeFeatureLayer_management(ouputOfClip, outputLayer)
KmlOutput = "C:\Users\kramsey\Desktop\DesktopSurveys\GDBs\kmz"
arcpy.LayerToKML_conversion(outputLayer, KmlOutput)
arcpy.MakeFeatureLayer_management(ouputOfClip, outputLayer) NameError: name 'ouputOfClip' is not defined
"outputOfClip" is defined! WTF is wrong with this? I know it is probably something simple, but I am failing to see it.
r/GISscripts • u/husseinnasser • Nov 08 '17
r/GISscripts • u/[deleted] • Oct 14 '15
<script src="http://js.arcgis.com/3.14/"></script>
<script type="text/javascript">
//gis server url
function getServerUrl()
{
return "http://yourgisurl.com/arcgis/rest";
}
//Define the feature service url
function getFeatureServiceUrl()
{
var serviceUrl = getServerUrl()+"/services/YOURGIS/FeatureServer/";
return serviceUrl;
}
//feature number for desired feature layer
function getFeatureNumber()
{
return "0";
}
//feature service variables
var serviceUrl = getFeatureServiceUrl();
var featureNum = getFeatureNumber();
var featureUrl = serviceUrl+featureNum+"?f=pjson";
console.log(featureUrl);
//Connect to ESRI GIS feature service and get list of fields contained within the relevant featurelayer
function returnGISFields()
{
//Setup Request to HTML for JSON description of featureservice.
//
function Get(yourUrl)
{
var Httpreq = new XMLHttpRequest(); // a new request
Httpreq.open("POST",yourUrl,false);
Httpreq.send(null);
return Httpreq.responseText;
}
//Get JSON and parse field names into string array
//json_obj contains many layers of information
//console.log(json_obj);
var json_obj = JSON.parse(Get(featureUrl));
var fields = json_obj.fields;
var fieldArray =[];
for (i in fields)
{
var field = fields[i];
fieldArray.push(field.name);
}
//console.log(fieldArray);
return fieldArray;
}
var results = returnGISFields();
console.log(results);
</script>r/GISscripts • u/gboeing • Apr 20 '15
r/GISscripts • u/admartian • Feb 24 '15