Issue converting csv files to point shapefiles using pyqgis - Qgis 3Error adding a delimited text layerHow to...
What is the blue range indicating on this manifold pressure gauge?
Time-reversing a quantum computation: what does this mean for the future of physics and is it considered to be time travel?
A curious inequality concerning binomial coefficients
Why doesn't the EU now just force the UK to choose between referendum and no-deal?
Can't remove a file with file mode bits a+rw
What has been your most complicated TikZ drawing?
Block storage rewrites
Is all copper pipe pretty much the same?
What is the difference between "shut" and "close"?
Is this animal really missing?
Want to switch to tankless, but can I use my existing wiring?
How could our ancestors have domesticated a solitary predator?
When two POV characters meet
Making a sword in the stone, in a medieval world without magic
Running a subshell from the middle of the current command
Silly Sally's Movie
Best approach to update all entries in a list that is paginated?
Is it ok to include an epilogue dedicated to colleagues who passed away in the end of the manuscript?
How to deal with a cynical class?
Sword in the Stone story where the sword was held in place by electromagnets
The three point beverage
Time dilation for a moving electronic clock
When were linguistics departments first established
Does the Bracer of Flying Daggers benefit from the Dueling Fighting style?
Issue converting csv files to point shapefiles using pyqgis - Qgis 3
Error adding a delimited text layerHow to convert Point coordinates into CSV format?Unable to add features in QGIS 2.4.0Converting csv files into shapefiles using pythonConverting KML coordinates to LeafletHow do I address this error message in QGIS, “CSV file must be in UTF-8 encoding”?MMQGIS: delimiter error on CSV import for mergingHow to convert latitude and longitude to x y coordinates (in meters)Converting .dat files to shapefilesQGIS Joined Layer not displaying points visible on pre-join layer (No Extent)
I have hit a snag using pyqgis in Qgis 3. I want to convert a set of csv's (20 total) into point shapefiles but I am struggling with just the single csv case. My code is based on this blogpost (https://www.geodose.com/2018/07/python-qgis-tutorial-adding-csv-data.html). I keep getting the same error but the "reason" section of the error message is always empty.
Any help is greatly appreciated.
My code:
This is the full code, I have not imported any additional packages.
path = "C:/Users/.../Weather/CSVs/precip_1992.csv"
uri = path + "?encoding=%s&delimiter=%s&xField=%s&yField=%s&crs=%s" % ("UTF-8",",", "longitude", "latitude","epsg:4326")
vlayer = QgsVectorLayer(uri,'Points', 'delimitedtext')
print(vlayer.isValid())
iface.addVectorLayer(uri,'Points','delimitedtext')
The error message in the "messages" log:
2019-03-13T15:23:27 CRITICAL Layer is not valid : The layer
C:/Users/.../CSVs/precip_1992.csv?encoding=UTF-8&delimiter=,&xField=longitude&yField=latitude&crs=epsg:4326 is not a valid
layer and can not be added to the map. Reason:
The error message in the "delimited" log:
2019-03-13T15:27:59 WARNING
File cannot be opened or delimiter parameters are not valid
Sample of my csv file:
longitude,latitude,year,sum_precip,avg_precip
-179.75,71.25,1992,150.3,12.525001
-179.75,68.75,1992,189.5,15.791667
-179.75,68.25,1992,226.7,18.891666
-179.75,67.75,1992,287.10001,23.925001
pyqgis shapefile convert qgis-3 csv
New contributor
Dante Zago is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I have hit a snag using pyqgis in Qgis 3. I want to convert a set of csv's (20 total) into point shapefiles but I am struggling with just the single csv case. My code is based on this blogpost (https://www.geodose.com/2018/07/python-qgis-tutorial-adding-csv-data.html). I keep getting the same error but the "reason" section of the error message is always empty.
Any help is greatly appreciated.
My code:
This is the full code, I have not imported any additional packages.
path = "C:/Users/.../Weather/CSVs/precip_1992.csv"
uri = path + "?encoding=%s&delimiter=%s&xField=%s&yField=%s&crs=%s" % ("UTF-8",",", "longitude", "latitude","epsg:4326")
vlayer = QgsVectorLayer(uri,'Points', 'delimitedtext')
print(vlayer.isValid())
iface.addVectorLayer(uri,'Points','delimitedtext')
The error message in the "messages" log:
2019-03-13T15:23:27 CRITICAL Layer is not valid : The layer
C:/Users/.../CSVs/precip_1992.csv?encoding=UTF-8&delimiter=,&xField=longitude&yField=latitude&crs=epsg:4326 is not a valid
layer and can not be added to the map. Reason:
The error message in the "delimited" log:
2019-03-13T15:27:59 WARNING
File cannot be opened or delimiter parameters are not valid
Sample of my csv file:
longitude,latitude,year,sum_precip,avg_precip
-179.75,71.25,1992,150.3,12.525001
-179.75,68.75,1992,189.5,15.791667
-179.75,68.25,1992,226.7,18.891666
-179.75,67.75,1992,287.10001,23.925001
pyqgis shapefile convert qgis-3 csv
New contributor
Dante Zago is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I have hit a snag using pyqgis in Qgis 3. I want to convert a set of csv's (20 total) into point shapefiles but I am struggling with just the single csv case. My code is based on this blogpost (https://www.geodose.com/2018/07/python-qgis-tutorial-adding-csv-data.html). I keep getting the same error but the "reason" section of the error message is always empty.
Any help is greatly appreciated.
My code:
This is the full code, I have not imported any additional packages.
path = "C:/Users/.../Weather/CSVs/precip_1992.csv"
uri = path + "?encoding=%s&delimiter=%s&xField=%s&yField=%s&crs=%s" % ("UTF-8",",", "longitude", "latitude","epsg:4326")
vlayer = QgsVectorLayer(uri,'Points', 'delimitedtext')
print(vlayer.isValid())
iface.addVectorLayer(uri,'Points','delimitedtext')
The error message in the "messages" log:
2019-03-13T15:23:27 CRITICAL Layer is not valid : The layer
C:/Users/.../CSVs/precip_1992.csv?encoding=UTF-8&delimiter=,&xField=longitude&yField=latitude&crs=epsg:4326 is not a valid
layer and can not be added to the map. Reason:
The error message in the "delimited" log:
2019-03-13T15:27:59 WARNING
File cannot be opened or delimiter parameters are not valid
Sample of my csv file:
longitude,latitude,year,sum_precip,avg_precip
-179.75,71.25,1992,150.3,12.525001
-179.75,68.75,1992,189.5,15.791667
-179.75,68.25,1992,226.7,18.891666
-179.75,67.75,1992,287.10001,23.925001
pyqgis shapefile convert qgis-3 csv
New contributor
Dante Zago is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I have hit a snag using pyqgis in Qgis 3. I want to convert a set of csv's (20 total) into point shapefiles but I am struggling with just the single csv case. My code is based on this blogpost (https://www.geodose.com/2018/07/python-qgis-tutorial-adding-csv-data.html). I keep getting the same error but the "reason" section of the error message is always empty.
Any help is greatly appreciated.
My code:
This is the full code, I have not imported any additional packages.
path = "C:/Users/.../Weather/CSVs/precip_1992.csv"
uri = path + "?encoding=%s&delimiter=%s&xField=%s&yField=%s&crs=%s" % ("UTF-8",",", "longitude", "latitude","epsg:4326")
vlayer = QgsVectorLayer(uri,'Points', 'delimitedtext')
print(vlayer.isValid())
iface.addVectorLayer(uri,'Points','delimitedtext')
The error message in the "messages" log:
2019-03-13T15:23:27 CRITICAL Layer is not valid : The layer
C:/Users/.../CSVs/precip_1992.csv?encoding=UTF-8&delimiter=,&xField=longitude&yField=latitude&crs=epsg:4326 is not a valid
layer and can not be added to the map. Reason:
The error message in the "delimited" log:
2019-03-13T15:27:59 WARNING
File cannot be opened or delimiter parameters are not valid
Sample of my csv file:
longitude,latitude,year,sum_precip,avg_precip
-179.75,71.25,1992,150.3,12.525001
-179.75,68.75,1992,189.5,15.791667
-179.75,68.25,1992,226.7,18.891666
-179.75,67.75,1992,287.10001,23.925001
pyqgis shapefile convert qgis-3 csv
pyqgis shapefile convert qgis-3 csv
New contributor
Dante Zago is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Dante Zago is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Dante Zago is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 4 mins ago
Dante ZagoDante Zago
61
61
New contributor
Dante Zago is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Dante Zago is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Dante Zago is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
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
});
}
});
Dante Zago 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%2f315432%2fissue-converting-csv-files-to-point-shapefiles-using-pyqgis-qgis-3%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
Dante Zago is a new contributor. Be nice, and check out our Code of Conduct.
Dante Zago is a new contributor. Be nice, and check out our Code of Conduct.
Dante Zago is a new contributor. Be nice, and check out our Code of Conduct.
Dante Zago 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%2f315432%2fissue-converting-csv-files-to-point-shapefiles-using-pyqgis-qgis-3%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