Error when loading a shapefile in a standalone PYQGIS script The 2019 Stack Overflow Developer...

How to reverse every other sublist of a list?

Does light intensity oscillate really fast since it is a wave?

Why isn't airport relocation done gradually?

Is flight data recorder erased after every flight?

Does duplicating a spell with Wish count as casting that spell?

Falsification in Math vs Science

Does a dangling wire really electrocute me if I'm standing in water?

How to deal with fear of taking dependencies

How can I fix this gap between bookcases I made?

Why could you hear an Amstrad CPC working?

Landlord wants to switch my lease to a "Land contract" to "get back at the city"

What is the steepest angle that a canal can be traversable without locks?

Carnot-Caratheodory metric

Could JWST stay at L2 "forever"?

What can other administrators access on my machine?

Does it makes sense to buy a new cycle to learn riding?

Are USB sockets on wall outlets live all the time, even when the switch is off?

Why is my p-value correlated to difference between means in two sample tests?

Why don't Unix/Linux systems traverse through directories until they find the required version of a linked library?

Geography at the pixel level

Why do I get badly formatted numerical results when I use StringForm?

How was Skylab's orbit inclination chosen?

Inflated grade on resume at previous job, might former employer tell new employer?

Access elements in std::string where positon of string is greater than its size



Error when loading a shapefile in a standalone PYQGIS script



The 2019 Stack Overflow Developer Survey Results Are InPyQGIS in standalone script, vector loading errorPyQGIS standalone gdal_ECW_JP2ECW.dll errorGetting shapefile extent from standalone PyQGIS script?Create a script to add delimited text layer in QGISPyQGIS Error using standalone script when loading a vector layerCall external plugin from PythonLoading Shapefile in a standalone PyQGis AppLoading a Shapefile in standalone PyQGIS scriptpostGIS views, qGIS, qGIS python consoleCreating shapefile in standalone script using PyQGIS?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I have a standalone pyqgis script that automatically visualizes 4 parameters (precip rate, temperature, pressure and wind). when I run just the precip rate and pressure part of the script there are no errors same as when I run temperature and wind together.



But when I run them all the error below appears. I have no idea what is that. The directory of my shapefile is correct. (The shapefile is a map of the philippines and I have all the files needed to load the file (.shp, .shx and .dbf) )



ERROR 4: Unable to open /home/francis/QGIS/shpfile/sample/Country.shx or /home/francis/QGIS/shpfile/sample/Country.SHX.
ERROR 4: VSIFOpenL(/home/francis/QGIS/epelwrf/temp/rpn-20180913/rpntemp-postwrf_d01_20180913_0300_f04600.asc) failed unexpectedly.


Here is the code snippet that I use to load the .shp file



#Loading of Shp file (vector) starts here
crsType = QSettings().value('/Projections/defaultBehaviour')
QSettings().setValue('/Projections/defaultBehaviour', ' ')
target_crs = QgsCoordinateReferenceSystem()
target_crs.createFromId(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
vLayer = QgsVectorLayer("/home/francis/QGIS/shpfile/sample/Country.shp", "Map", "ogr")
print vLayer.isValid()
vLayer.setCrs(target_crs)
#print vLayer.crs().authid()
vLayer.setLayerTransparency(50)
QgsMapLayerRegistry.instance().addMapLayers([vLayer])

if hasattr(vLayer, "setCacheImage"):
vLayer.setCacheImage(None)
vLayer.triggerRepaint()

QSettings().setValue('/Projections/defaultBehaviour', crsType)




This is the sample output of my script (Precip Rate)
while the temperature and wind produces blank images.



I am using qgis 2.18 and python 2.7. thank you










share|improve this question































    0















    I have a standalone pyqgis script that automatically visualizes 4 parameters (precip rate, temperature, pressure and wind). when I run just the precip rate and pressure part of the script there are no errors same as when I run temperature and wind together.



    But when I run them all the error below appears. I have no idea what is that. The directory of my shapefile is correct. (The shapefile is a map of the philippines and I have all the files needed to load the file (.shp, .shx and .dbf) )



    ERROR 4: Unable to open /home/francis/QGIS/shpfile/sample/Country.shx or /home/francis/QGIS/shpfile/sample/Country.SHX.
    ERROR 4: VSIFOpenL(/home/francis/QGIS/epelwrf/temp/rpn-20180913/rpntemp-postwrf_d01_20180913_0300_f04600.asc) failed unexpectedly.


    Here is the code snippet that I use to load the .shp file



    #Loading of Shp file (vector) starts here
    crsType = QSettings().value('/Projections/defaultBehaviour')
    QSettings().setValue('/Projections/defaultBehaviour', ' ')
    target_crs = QgsCoordinateReferenceSystem()
    target_crs.createFromId(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
    vLayer = QgsVectorLayer("/home/francis/QGIS/shpfile/sample/Country.shp", "Map", "ogr")
    print vLayer.isValid()
    vLayer.setCrs(target_crs)
    #print vLayer.crs().authid()
    vLayer.setLayerTransparency(50)
    QgsMapLayerRegistry.instance().addMapLayers([vLayer])

    if hasattr(vLayer, "setCacheImage"):
    vLayer.setCacheImage(None)
    vLayer.triggerRepaint()

    QSettings().setValue('/Projections/defaultBehaviour', crsType)




    This is the sample output of my script (Precip Rate)
    while the temperature and wind produces blank images.



    I am using qgis 2.18 and python 2.7. thank you










    share|improve this question



























      0












      0








      0








      I have a standalone pyqgis script that automatically visualizes 4 parameters (precip rate, temperature, pressure and wind). when I run just the precip rate and pressure part of the script there are no errors same as when I run temperature and wind together.



      But when I run them all the error below appears. I have no idea what is that. The directory of my shapefile is correct. (The shapefile is a map of the philippines and I have all the files needed to load the file (.shp, .shx and .dbf) )



      ERROR 4: Unable to open /home/francis/QGIS/shpfile/sample/Country.shx or /home/francis/QGIS/shpfile/sample/Country.SHX.
      ERROR 4: VSIFOpenL(/home/francis/QGIS/epelwrf/temp/rpn-20180913/rpntemp-postwrf_d01_20180913_0300_f04600.asc) failed unexpectedly.


      Here is the code snippet that I use to load the .shp file



      #Loading of Shp file (vector) starts here
      crsType = QSettings().value('/Projections/defaultBehaviour')
      QSettings().setValue('/Projections/defaultBehaviour', ' ')
      target_crs = QgsCoordinateReferenceSystem()
      target_crs.createFromId(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
      vLayer = QgsVectorLayer("/home/francis/QGIS/shpfile/sample/Country.shp", "Map", "ogr")
      print vLayer.isValid()
      vLayer.setCrs(target_crs)
      #print vLayer.crs().authid()
      vLayer.setLayerTransparency(50)
      QgsMapLayerRegistry.instance().addMapLayers([vLayer])

      if hasattr(vLayer, "setCacheImage"):
      vLayer.setCacheImage(None)
      vLayer.triggerRepaint()

      QSettings().setValue('/Projections/defaultBehaviour', crsType)




      This is the sample output of my script (Precip Rate)
      while the temperature and wind produces blank images.



      I am using qgis 2.18 and python 2.7. thank you










      share|improve this question
















      I have a standalone pyqgis script that automatically visualizes 4 parameters (precip rate, temperature, pressure and wind). when I run just the precip rate and pressure part of the script there are no errors same as when I run temperature and wind together.



      But when I run them all the error below appears. I have no idea what is that. The directory of my shapefile is correct. (The shapefile is a map of the philippines and I have all the files needed to load the file (.shp, .shx and .dbf) )



      ERROR 4: Unable to open /home/francis/QGIS/shpfile/sample/Country.shx or /home/francis/QGIS/shpfile/sample/Country.SHX.
      ERROR 4: VSIFOpenL(/home/francis/QGIS/epelwrf/temp/rpn-20180913/rpntemp-postwrf_d01_20180913_0300_f04600.asc) failed unexpectedly.


      Here is the code snippet that I use to load the .shp file



      #Loading of Shp file (vector) starts here
      crsType = QSettings().value('/Projections/defaultBehaviour')
      QSettings().setValue('/Projections/defaultBehaviour', ' ')
      target_crs = QgsCoordinateReferenceSystem()
      target_crs.createFromId(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
      vLayer = QgsVectorLayer("/home/francis/QGIS/shpfile/sample/Country.shp", "Map", "ogr")
      print vLayer.isValid()
      vLayer.setCrs(target_crs)
      #print vLayer.crs().authid()
      vLayer.setLayerTransparency(50)
      QgsMapLayerRegistry.instance().addMapLayers([vLayer])

      if hasattr(vLayer, "setCacheImage"):
      vLayer.setCacheImage(None)
      vLayer.triggerRepaint()

      QSettings().setValue('/Projections/defaultBehaviour', crsType)




      This is the sample output of my script (Precip Rate)
      while the temperature and wind produces blank images.



      I am using qgis 2.18 and python 2.7. thank you







      python pyqgis shapefile vector-layer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 10 mins ago







      Francis Kane

















      asked 17 mins ago









      Francis KaneFrancis Kane

      142




      142






















          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318321%2ferror-when-loading-a-shapefile-in-a-standalone-pyqgis-script%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
















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318321%2ferror-when-loading-a-shapefile-in-a-standalone-pyqgis-script%23new-answer', 'question_page');
          }
          );

          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







          Popular posts from this blog

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

          Meter-Bus Содержание Параметры шины | Стандартизация |...