Taking data from a csv file to create points on a shapefile Planned maintenance scheduled...
Does classifying an integer as a discrete log require it be part of a multiplicative group?
Is CEO the profession with the most psychopaths?
When the Haste spell ends on a creature, do attackers have advantage against that creature?
Can an alien society believe that their star system is the universe?
Do wooden building fires get hotter than 600°C?
What does "lightly crushed" mean for cardamon pods?
If a VARCHAR(MAX) column is included in an index, is the entire value always stored in the index page(s)?
Why aren't air breathing engines used as small first stages
Generate an RGB colour grid
Can you use the Shield Master feat to shove someone before you make an attack by using a Readied action?
Do square wave exist?
What are the out-of-universe reasons for the references to Toby Maguire-era Spider-Man in ITSV
Can a new player join a group only when a new campaign starts?
How to answer "Have you ever been terminated?"
8 Prisoners wearing hats
Why are there no cargo aircraft with "flying wing" design?
Is it a good idea to use CNN to classify 1D signal?
Why are both D and D# fitting into my E minor key?
How to tell that you are a giant?
For a new assistant professor in CS, how to build/manage a publication pipeline
Where are Serre’s lectures at Collège de France to be found?
How can I use the Python library networkx from Mathematica?
また usage in a dictionary
How does the math work when buying airline miles?
Taking data from a csv file to create points on a shapefile
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Drawing lines from two points in CSV using QGIS?How to compare values from a column in attribute table with values in Dictionary{}?Select points approx. 2000 metres from another point along a river?Cannot read CSV-file from ArcMapbuilding dictionary from feature class field values, how can I ensure there are no duplicate values per keyArcPy - error with updateRow() using UpdateCursorImporting/Plotting Lat/Long points from single column of *.csv using Python?Import csv value to an empty field in a point feature classHow to add a csv file into Whitebox GATImporting CSV file does not show points in QGIS?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am trying to import data from a csv file and write a script that will generate points on a new shapefile. I am running into issues for when I try to update the insert cursor. I get an error of "not enough quota is available to process this command". I am fairly new to python and appreciate if anyone has any suggestions of what is wrong with my code. I appreciate it.
#Import a csv file and take the coordinates of each ASOS and create a polypoint output
import csv
import arcpy
import os
from arcpy import env
#Lets you write over the shape file if needed
arcpy.env.overwriteOutput = True
targetFolder = "C:\GEOG485\FinalProject\OutPut"
env.workspace = targetFolder
#csv file that we are importing
asosFile = "C:\GEOG485\FinalProject\isd-history.csv"
targetState = 'NJ'
try:
#Create the featureclass ASOS shapefile, 4326 is the factory code for the required coordinate system of the file
asosStations = arcpy.CreateFeatureclass_management("C:\GEOG485\FinalProject\","ASOS","POINT",'','',"ENABLED",4326)
print ("success")
#add a new field called "Station Name", "CTRY", "STATE" and "END"
arcpy.AddField_management(asosStations,"STATION_NAME", "TEXT")
arcpy.AddField_management(asosStations,"CTRY","TEXT")
arcpy.AddField_management(asosStations,"STATE","TEXT")
arcpy.AddField_management(asosStations,"ICAO","TEXT")
arcpy.AddField_management(asosStations,"END","TEXT")
print ("success")
except:
print ("error")
#asos dictinary
asos = {}
try:
#Use the with statement to open the csv file and r to read mode
with open(asosFile, 'r') as csvv:
#Reading the csv file with DictReader which takes the first row of the file and uses them as keys
reader = csv.DictReader(csvv)
#Loops through the csv file
for row in reader:
#Dictionary to see what asos's have a key in the dictionary and append the asos location with the coordinates
if row['ICAO'] not in asos:
asos[row['ICAO']] = []
asos[row['ICAO']].append((row['LAT'],row['LON']))
print ("success2")
except:
print ("error2")
try:
#Takes the points that we just appended to each asos station and adds them to the shapefile
with arcpy.da.InsertCursor(asosStations, ["ICAO","SHAPE@XY"]) as cur:
#Loop checks for keys (file headers) and values (asos's inside the dictionary)
for key,value in asos.items():
print key,value
#creates a point with the points for each asos station in the shape file
for coords in value:
point = arcpy.Point(*coords)
#Takes all the keys with the same names and adds all the associated points to them
row2 = (key,point)
cur.insertRow(row2)
print ("success3")
except:
print ("error3")
arcpy point cursor
New contributor
add a comment |
I am trying to import data from a csv file and write a script that will generate points on a new shapefile. I am running into issues for when I try to update the insert cursor. I get an error of "not enough quota is available to process this command". I am fairly new to python and appreciate if anyone has any suggestions of what is wrong with my code. I appreciate it.
#Import a csv file and take the coordinates of each ASOS and create a polypoint output
import csv
import arcpy
import os
from arcpy import env
#Lets you write over the shape file if needed
arcpy.env.overwriteOutput = True
targetFolder = "C:\GEOG485\FinalProject\OutPut"
env.workspace = targetFolder
#csv file that we are importing
asosFile = "C:\GEOG485\FinalProject\isd-history.csv"
targetState = 'NJ'
try:
#Create the featureclass ASOS shapefile, 4326 is the factory code for the required coordinate system of the file
asosStations = arcpy.CreateFeatureclass_management("C:\GEOG485\FinalProject\","ASOS","POINT",'','',"ENABLED",4326)
print ("success")
#add a new field called "Station Name", "CTRY", "STATE" and "END"
arcpy.AddField_management(asosStations,"STATION_NAME", "TEXT")
arcpy.AddField_management(asosStations,"CTRY","TEXT")
arcpy.AddField_management(asosStations,"STATE","TEXT")
arcpy.AddField_management(asosStations,"ICAO","TEXT")
arcpy.AddField_management(asosStations,"END","TEXT")
print ("success")
except:
print ("error")
#asos dictinary
asos = {}
try:
#Use the with statement to open the csv file and r to read mode
with open(asosFile, 'r') as csvv:
#Reading the csv file with DictReader which takes the first row of the file and uses them as keys
reader = csv.DictReader(csvv)
#Loops through the csv file
for row in reader:
#Dictionary to see what asos's have a key in the dictionary and append the asos location with the coordinates
if row['ICAO'] not in asos:
asos[row['ICAO']] = []
asos[row['ICAO']].append((row['LAT'],row['LON']))
print ("success2")
except:
print ("error2")
try:
#Takes the points that we just appended to each asos station and adds them to the shapefile
with arcpy.da.InsertCursor(asosStations, ["ICAO","SHAPE@XY"]) as cur:
#Loop checks for keys (file headers) and values (asos's inside the dictionary)
for key,value in asos.items():
print key,value
#creates a point with the points for each asos station in the shape file
for coords in value:
point = arcpy.Point(*coords)
#Takes all the keys with the same names and adds all the associated points to them
row2 = (key,point)
cur.insertRow(row2)
print ("success3")
except:
print ("error3")
arcpy point cursor
New contributor
add a comment |
I am trying to import data from a csv file and write a script that will generate points on a new shapefile. I am running into issues for when I try to update the insert cursor. I get an error of "not enough quota is available to process this command". I am fairly new to python and appreciate if anyone has any suggestions of what is wrong with my code. I appreciate it.
#Import a csv file and take the coordinates of each ASOS and create a polypoint output
import csv
import arcpy
import os
from arcpy import env
#Lets you write over the shape file if needed
arcpy.env.overwriteOutput = True
targetFolder = "C:\GEOG485\FinalProject\OutPut"
env.workspace = targetFolder
#csv file that we are importing
asosFile = "C:\GEOG485\FinalProject\isd-history.csv"
targetState = 'NJ'
try:
#Create the featureclass ASOS shapefile, 4326 is the factory code for the required coordinate system of the file
asosStations = arcpy.CreateFeatureclass_management("C:\GEOG485\FinalProject\","ASOS","POINT",'','',"ENABLED",4326)
print ("success")
#add a new field called "Station Name", "CTRY", "STATE" and "END"
arcpy.AddField_management(asosStations,"STATION_NAME", "TEXT")
arcpy.AddField_management(asosStations,"CTRY","TEXT")
arcpy.AddField_management(asosStations,"STATE","TEXT")
arcpy.AddField_management(asosStations,"ICAO","TEXT")
arcpy.AddField_management(asosStations,"END","TEXT")
print ("success")
except:
print ("error")
#asos dictinary
asos = {}
try:
#Use the with statement to open the csv file and r to read mode
with open(asosFile, 'r') as csvv:
#Reading the csv file with DictReader which takes the first row of the file and uses them as keys
reader = csv.DictReader(csvv)
#Loops through the csv file
for row in reader:
#Dictionary to see what asos's have a key in the dictionary and append the asos location with the coordinates
if row['ICAO'] not in asos:
asos[row['ICAO']] = []
asos[row['ICAO']].append((row['LAT'],row['LON']))
print ("success2")
except:
print ("error2")
try:
#Takes the points that we just appended to each asos station and adds them to the shapefile
with arcpy.da.InsertCursor(asosStations, ["ICAO","SHAPE@XY"]) as cur:
#Loop checks for keys (file headers) and values (asos's inside the dictionary)
for key,value in asos.items():
print key,value
#creates a point with the points for each asos station in the shape file
for coords in value:
point = arcpy.Point(*coords)
#Takes all the keys with the same names and adds all the associated points to them
row2 = (key,point)
cur.insertRow(row2)
print ("success3")
except:
print ("error3")
arcpy point cursor
New contributor
I am trying to import data from a csv file and write a script that will generate points on a new shapefile. I am running into issues for when I try to update the insert cursor. I get an error of "not enough quota is available to process this command". I am fairly new to python and appreciate if anyone has any suggestions of what is wrong with my code. I appreciate it.
#Import a csv file and take the coordinates of each ASOS and create a polypoint output
import csv
import arcpy
import os
from arcpy import env
#Lets you write over the shape file if needed
arcpy.env.overwriteOutput = True
targetFolder = "C:\GEOG485\FinalProject\OutPut"
env.workspace = targetFolder
#csv file that we are importing
asosFile = "C:\GEOG485\FinalProject\isd-history.csv"
targetState = 'NJ'
try:
#Create the featureclass ASOS shapefile, 4326 is the factory code for the required coordinate system of the file
asosStations = arcpy.CreateFeatureclass_management("C:\GEOG485\FinalProject\","ASOS","POINT",'','',"ENABLED",4326)
print ("success")
#add a new field called "Station Name", "CTRY", "STATE" and "END"
arcpy.AddField_management(asosStations,"STATION_NAME", "TEXT")
arcpy.AddField_management(asosStations,"CTRY","TEXT")
arcpy.AddField_management(asosStations,"STATE","TEXT")
arcpy.AddField_management(asosStations,"ICAO","TEXT")
arcpy.AddField_management(asosStations,"END","TEXT")
print ("success")
except:
print ("error")
#asos dictinary
asos = {}
try:
#Use the with statement to open the csv file and r to read mode
with open(asosFile, 'r') as csvv:
#Reading the csv file with DictReader which takes the first row of the file and uses them as keys
reader = csv.DictReader(csvv)
#Loops through the csv file
for row in reader:
#Dictionary to see what asos's have a key in the dictionary and append the asos location with the coordinates
if row['ICAO'] not in asos:
asos[row['ICAO']] = []
asos[row['ICAO']].append((row['LAT'],row['LON']))
print ("success2")
except:
print ("error2")
try:
#Takes the points that we just appended to each asos station and adds them to the shapefile
with arcpy.da.InsertCursor(asosStations, ["ICAO","SHAPE@XY"]) as cur:
#Loop checks for keys (file headers) and values (asos's inside the dictionary)
for key,value in asos.items():
print key,value
#creates a point with the points for each asos station in the shape file
for coords in value:
point = arcpy.Point(*coords)
#Takes all the keys with the same names and adds all the associated points to them
row2 = (key,point)
cur.insertRow(row2)
print ("success3")
except:
print ("error3")
arcpy point cursor
arcpy point cursor
New contributor
New contributor
New contributor
asked 2 mins ago
WillWill
11
11
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Will is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f319184%2ftaking-data-from-a-csv-file-to-create-points-on-a-shapefile%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Will is a new contributor. Be nice, and check out our Code of Conduct.
Will is a new contributor. Be nice, and check out our Code of Conduct.
Will is a new contributor. Be nice, and check out our Code of Conduct.
Will is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f319184%2ftaking-data-from-a-csv-file-to-create-points-on-a-shapefile%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown