This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
# Variables | |
pointData = 'points' # Point dataset | |
distanceData = 'other_fc' # Distance to this dataset | |
arcpy.env.workspace = r'C:/Users/myUser/Documents/GIS/new_data.gdb' | |
# Create a new field name, and add it to pointData | |
distanceField = 'dis_' + distanceData[:4] # Gets first 4 letters of distanceData | |
arcpy.AddField_management(pointData, distanceField, 'FLOAT') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fromJSON = [ | |
{ | |
"displayFieldName": "LID", | |
"fieldAliases": { | |
"Beskrivelse": "Beskrivelse" | |
}, | |
"fields": [ | |
{ | |
"name": "Beskrivelse", | |
"type": "esriFieldTypeString", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
files = [f for f in os.listdir('.') if os.path.isfile(f)] | |
cwd = os.getcwd() | |
text_file = open("images.txt", "w") | |
print("Writing to text file") | |
for f in files: | |
if "jpg" in f: | |
text_file.write(cwd + "\\" + f + '\n') | |
#text_file.close() | |
print("Done writing") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from PIL import Image | |
from itertools import groupby, zip_longest, dropwhile | |
with open('result.txt') as fin: | |
stripped = (line.strip() for line in fin) | |
start_at = dropwhile(lambda L: not L.startswith('Enter'), stripped) | |
grouped = (list(g) for k, g in groupby(start_at, lambda L: L.startswith('Enter'))) | |
for name, rest in zip_longest(*iter([grouped] * 2), fillvalue=[]): | |
if rest: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
import exifread | |
from datetime import datetime | |
# Variables | |
fc = arcpy.GetParameterAsText(0) | |
folderLocation = arcpy.GetParameterAsText(1) + '/' | |
# Check if feature class is shapefile or in a geodatabase | |
dataset = arcpy.Describe(fc).extension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
left = 290 | |
up = 1852 | |
right = 357 | |
bottom = 1915 | |
image_list = [f for f in glob.glob("*.jpg")] | |
num = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
1. Install python 3.x from python.org | |
2. Install Python Imaging Library (PIL). Open CMD and type "pip install python3-imaging" | |
3. Install pytesseract. Open CMD and type "pip install pytesseract" | |
4. Install tesseract from https://github.com/UB-Mannheim/tesseract/wiki | |
5. Add tesseract install folder to path in windows | |
6. Add digits database from https://github.com/Shreeshrii/tessdata_shreetest to tesseract install folder !! NOT WORKING 100% !! | |
7. Do your own training http://pretius.com/how-to-prepare-training-files-for-tesseract-ocr-and-improve-characters-recognition/ | |
8. Install ExifRead Open CMD and type "pip install exifread" | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Framework":"Keras", | |
"InferenceFunction":"MaskRCNN.py", | |
"ModelConfiguration":"DeepLab", | |
"ModelFile":"mask_rcnn_coco.h5", | |
"ModelType":"ImageClassification", | |
"ExtractBands": [0,1,2,3], | |
"ImageWidth":256, | |
"ImageHeight":256, | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sc = arcpy.SearchCursor(selectFishnets) | |
# Create empty list for kmz names | |
kmzList = [] | |
# Download for each feature in selected fishnets feature | |
for row in sc: | |
# Get extent for each feature | |
geom = row.shape | |
extents = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Converting kmz to raster | |
for kmz in kmzList: | |
arcpy.AddMessage("Converting {0} of {1} .kmz files".format(firstCount,count)) | |
kmzFile = os.path.join(tempFolder, kmz + '.kmz') | |
arcpy.KMLToLayer_conversion(kmzFile, tempFolder, kmz, True) | |
firstCount += 1 | |
# Enable adding data to map again and arcpy.AddMessage status | |
arcpy.env.addOutputsToMap = 1 | |
arcpy.AddMessage("Creating raster mosaic dataset") |
OlderNewer