Advertisement · 728 × 90

Posts by Vanuatu GIS Feed

Preview
Get data from NetCDF to CSV I have a NetCDF file I want to get the data into the CSV file. I am using the following command. cdo outputtab,date,lon,lat,value era_temperature_2016.nc > test_2016.csv I am getting the following output # date lon lat value 2016-01-01 72.9313 33.6871 286.3865 2016-01-01 72.9313 33.6871 287.8337 2016-02-01 72.9313 33.6871 289.5742 2016-02-01 72.9313 33.6871 291.0781 2016-03-01 72.9313 33.6871 292.2905 2016-03-01 72.9313 33.6871 293.7372 2016-04-01 72.9313 33.6871 296.703 2016-04-01 72.9313 33.6871 298.181 2016-05-01 72.9313 33.6871 303.2804 2016-05-01 72.9313 33.6871 304.7249 2016-06-01 72.9313 33.6871 304.5008 2016-06-01 72.9313 33.6871 305.9426 2016-07-01 72.9313 33.6871 301.9163 2016-07-01 72.9313 33.6871 303.3689 2016-08-01 72.9313 33.6871 301.4589 2016-08-01 72.9313 33.6871 302.9072 2016-09-01 72.9313 33.6871 301.5118 2016-09-01 72.9313 33.6871 302.9666 2016-10-01 72.9313 33.6871 300.3135 2016-10-01 72.9313 33.6871 301.8115 2016-11-01 72.9313 33.6871 294.0796 2016-11-01 72.9313 33.6871 295.5635 2016-12-01 72.9313 33.6871 290.7698 2016-12-01 72.9313 33.6871 292.2829 cdo outputtab: Processed 24 values from 1 variable over 12 timesteps [0.01s 44MB]. when I run the following command cdo infon era_temperature_2016.nc I get the following output -1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name 1 : 2016-01-01 00:00:00 975 3795 0 : 279.24 288.05 294.10 : t 2 : 2016-01-01 00:00:00 1000 3795 0 : 281.57 289.20 294.85 : t 3 : 2016-02-01 00:00:00 975 3795 0 : 280.10 289.55 296.12 : t 4 : 2016-02-01 00:00:00 1000 3795 0 : 281.64 290.64 296.63 : t 5 : 2016-03-01 00:00:00 975 3795 0 : 285.34 293.21 299.40 : t 6 : 2016-03-01 00:00:00 1000 3795 0 : 286.83 294.51 300.75 : t 7 : 2016-04-01 00:00:00 975 3795 0 : 287.85 297.03 303.41 : t 8 : 2016-04-01 00:00:00 1000 3795 0 : 289.42 298.57 304.99 : t 9 : 2016-05-01 00:00:00 975 3795 0 : 292.71 301.67 309.10 : t 10 : 2016-05-01 00:00:00 1000 3795 0 : 294.11 303.24 310.79 : t 11 : 2016-06-01 00:00:00 975 3795 0 : 295.53 302.51 310.17 : t 12 : 2016-06-01 00:00:00 1000 3795 0 : 296.83 304.01 311.66 : t 13 : 2016-07-01 00:00:00 975 3795 0 : 296.17 302.09 312.87 : t 14 : 2016-07-01 00:00:00 1000 3795 0 : 297.26 303.51 314.38 : t 15 : 2016-08-01 00:00:00 975 3795 0 : 296.01 300.90 309.52 : t 16 : 2016-08-01 00:00:00 1000 3795 0 : 297.21 302.34 311.00 : t 17 : 2016-09-01 00:00:00 975 3795 0 : 295.40 300.27 308.99 : t 18 : 2016-09-01 00:00:00 1000 3795 0 : 296.71 301.79 310.48 : t 19 : 2016-10-01 00:00:00 975 3795 0 : 285.79 297.38 303.29 : t 20 : 2016-10-01 00:00:00 1000 3795 0 : 288.00 298.78 304.88 : t 21 : 2016-11-01 00:00:00 975 3795 0 : 280.24 292.93 298.61 : t 22 : 2016-11-01 00:00:00 1000 3795 0 : 282.15 294.09 299.74 : t 23 : 2016-12-01 00:00:00 975 3795 0 : 278.99 291.18 296.56 : t 24 : 2016-12-01 00:00:00 1000 3795 0 : 281.15 292.30 298.00 : t How I can get the level variable when using this command cdo outputtab,date,lon,lat,value era_temperature_2016.nc > test_2016.csv
45 minutes ago 0 0 0 0
Preview
OpenTripPlanner Server won't start I was following this tutorial to learn how to setup and run OpenTripPlanner : https://github.com/marcusyoung/otp-tutorial/blob/master/intro-otp.pdf Everything goes well, until I want to start the server with this command : java -Xmx2G -jar otp.jar --router current --graphs graphs --server I get this on loop : http://localhost:8080 shows nothing, tried the next command that selects different ports but the same thing happens. Any idea how to resolve this problem?
1 hour ago 0 0 0 0
Preview
Geometry errors when importing shapefile with shp2pgsql PostGIS I'm trying to import the Census State Boundaries from the census data site although I get errors in the geom data every time I import in the same rows. I've tried shp2pgsql and ogr2ogr shp2pgsql -I -d -e /Users/cj/Projects/geospacial_data/cb_2019_us_state_500k/cb_2019_us_state_500k.shp public.state | psql -h localhost -d my_db -U cj and this ogr2ogr -f "ESRI Shapefile" /Users/cj/Projects/geospacial_data/cb_2019_us_state_500k/cb_2019_us_state_500k.shp PG:"host=localhost user=cj dbname=mydb" "state" The errors show up here in the geom column (in the screenshot) showing the loaded size. Are these errors just part of the file? or am I doing something wrong? This seems to crop up when I do Counties and zip codes as well. I'm running * PostGIS 3.0.1 (homebrew) * PostgreSQL 12.3 (homebrew) * GDAL 2.4.4 (homebrew) * MacOS 10.14.6
2 hours ago 0 0 0 0
Preview
Creating Atlas with PDF form fields I have a layer with information that needs manual review from third parties. For this I have created an atlas print layout that shows different map overviews and an a table showing the relevant features and currently set values. Next to each value, I have a third column and a rectangle serving as a free text field, that are empty and shall be filled out by the third parties that get sent the PDF. I was hoping to create form fields inside the generated PDF so others can fill in information later, but I cannot find such option inside QGIS. Is this there? Or is there another approach other than manually adding form fields with a PDF editor program? This will be 70 single PDF with 15 different fields so I'd rather not click that together manually.
17 hours ago 0 0 0 0
Preview
Forcing left to right order of cross section lines of river using QGIS Based on "Generating a series of cross sections (profiles) along a line?" post, how can I force the cross-section lines to be created, thus collecting elevation data, from LEFT to RIGHT facing the downstream end of the river based on the example @StevenKay has provided? I see that it depends on the CRS, but is there a way to actually force them? I need to import the cross-sections of a river in HEC-RAS 2D and they need to be created specifically in such way from the beginning. I am using QGIS 3.6.
17 hours ago 0 0 0 0
Preview
Laptop crashed and had been saving to files but they weren't backed up My dissertation is due in two weeks and yesterday my laptop crashed and all my files I saved to my Mac aren't saved which includes all my QGIS layers etc... is there anyway it would be saved to QGIS somewhere, like surly I had to log in at the start or something or they save also somewhere else. HELP!
18 hours ago 0 0 0 0
Preview
Creating polygon from lines, using the lines' attributes? I'm trying to transform lines into polygons with the attributes. The lines are from a dwg file. I tried to use "feature to polygons" but doesn't preserve the attribute. I tries to transform lines to points and than use them in the "feature to polygons"... still doesn't preserve the attributes.
18 hours ago 0 0 0 0
Preview
Subscript labels in QGIS legends Is it possible to include subscript and superscript text in the title of a legend item in QGIS ? I have tried using some text but this just appears in the title with no change to the contents. I am looking to have layer titles such as Annual NO2 concentration (μg/m3) The superscript is not a big issue, as I can use the character map to get a 3, but I don't know how to get the subscript.
19 hours ago 0 0 0 0
Preview
Filter Features depending on User with GeoServer I now use viewparams to filter the features by using sql views in GeoServer which is connected to our postgis-db. This means the parameter comes from the request url. I want to use keycloak for authentication. And i wonder if its possible to set the filter by user attribute of keycloak. If it is not working with keycloak, is there some other authentification method for this requirement? Why? Now the request may filter anything. I want to define the filter for every user. For example: UserA have the right to request buildings where city='Berlin' and UserB have the right to request buildings where city='Paris'. The datasource should be the same and also the layer in GeoServer, because i don't want to have for every city a new layer. (As Endpoint we use wmts with vector tiles)
19 hours ago 0 0 0 0
Advertisement
Preview
Reclassifying raster in QGIS I'm modelling species distributions using Maxent. Maxent produced probability of occurrence/habitat suitability maps for my study species. These raster maps have values ranging from 0 to 1. I want to transform these maps in a binary map of suitable and unsuitable areas, by using a threshold. It would be something like this: From 0 to threshold (not included) = 0 ; From threshold (included) to 1 = 1 I thought about using the QGIS tool r.reclass, but I'm failing to understand how to provide the (included) or (not included) information to the reclassify rules. Can anyone help?
20 hours ago 0 0 0 0
Preview
Changing Font Size in QGIS2threejs display I did quite a bit of searching on this topic, including reviewing in detail the two topics StackExchange immediately suggested for me (How to change text style in qgis2threejs?, Changing font in QGIS2threejs) but have not found an answer. The second of those links states "In QGIS2threejs, I want to change the fonts in 3D presentation. I learned that I can do it by change it in the css file" but the screen shots s/he provided for editting QGIS2threejs.css don't match the current version of that file (the post is over 4 years old). I tried all sorts of edits to the CSS file but with no luck. The other post suggests editing the HTML file that QGIS2threejs generates once you have your model set up. For example, I added to the HTML file .label { font-size: xx-small; } But that didn't help anything. The problem I am trying to solve is making these labels smaller: I have selected "small" in the Label dialogue box setting up the model. Any Suggestions?
20 hours ago 0 0 0 0
Preview
Translating own OSM server tile to English (ubuntu 18.04) I have created a OSM tile server using the https://switch2osm.github.io/ tutorial for ubuntu 18.04 with great success but no matter what I cannot display the map labels in English only, I have tried many solutions from the OpenStreetMap help forum but none seem to work for me. I tried adding the line node,way name:en text linear to the default.style in osm2pgsql so the field name:en gets included in the postgres database, but the name:en field never appears on the tables even re-building osm2pgsql, dropping the current table and re loading the map data into db did not help(I am using https://download.geofabrik.de/asia/azerbaijan-latest.osm.pbf from the switch2osm guide). Can you guide me?
1 day ago 0 0 0 0
Preview
How can I support LERC using the flag GDAL_USE_LERC_INTERNAL for versions > 3.3.0? I am currently trying to build GDAL 3.8.3 using conan. The GDAL documentation states, LERC and LERC_DEFLATE are available only when using internal libtiff for GDAL < 3.3.0. Since GDAL 3.3.0, LERC compression is also available when building GDAL against external libtiff >= 4.3.0, built itself against https://github.com/esri/lerc I am interpreting the wording "also available" as it's still available to use the previous approach for versions > 3.3.0, as in, it's just an additional option. This is a requirement for me because I am using conan to configure my project. Unforunately, building libtiff with LERC is not supported at the moment. However, in the GDAL recipe I have set both tc.variables["GDAL_USE_LERC"] = self.options.with_lerc tc.variables["GDAL_USE_LERC_INTERNAL"] = True of the variables GDAL_USE_LERC and GDAL_USE_LERC_INTERNAL to True. It seems that it should be supported as the directory that the CMake imports in version 3.8.3. still exists. However, when trying to import a LERC formatted image I still receive the error, output_LERC_DEFLATE.tif: Cannot open TIFF file due to missing codec LERC. when attempting to import LERC or LERC_DEFLATE formatted file. Is their an additional step I could be missing?
1 day ago 0 0 0 0
Preview
GEE - Confused about error matrix parameters I tried to calculating the error matrix for my classifications map. I am confused about error matrix parameters. I split my samples into 2 categories, 70% for training and 30% for validation. Example code: var validation = validSample.errorMatrix('q1','q2') Which parameters do I need to use for q1? The feature collections (30% sample)? or classified image using 30% sample? I mean, do I have to make a new classification image using 30% sample? q2: classified image using training sample.
1 day ago 0 0 0 0
Preview
How to supply a weight matrix to focal_hpc in R I'm using the function focal_hpc from spatial.tools in R to compute for each cell of a raster the average value (mean function) around windows of a specific size (3 cells x 3 cells). I used to perform this analysis using the similar function focal, which is however slower than focal_hpc when using large raster files. The advantage of focal is that the user can specify a matrix of weights. However, focal_hpc does not seem to provide this option. I have been trying to use a custom function, such as: f_mean = function(x,weight_pix){ x[is.na(x)]
1 day ago 0 0 0 0
Preview
Is it possible to automatically export maps via grid/cadaster system in QGIS I am working in the Netherlands on a research project using the national "Kadaster" (Grid/cadaster) system. I would need to position each map for export manually in the layout manager for print and wondered if there are ways to utilise to the bespoke grid (cadaster) instead so that the precision is 100% given? In my example below I would like to export each map (ca 700) at a certain scale with the "black outline" of the tile marking the edges of the map. I have positioned the maps only manually so far for tests. Has anyone done similar before and knows a smarter efficient route? (I suspect it may entail coding...) Just to illustrate the comment below, that I have looked into Atlas too but it doesn't get me anywhere (it might be me?), I suspect it needs more than that possibly, so its "smart" enough to recognise each topnl tile as a new map
1 day ago 0 0 0 0
Advertisement
Preview
Coordinates from Google Maps don't match up with coordinates in QGIS 3.38.2 I had some points marked down in Google Maps, and now I'm trying to implement those locations into QGIS. I converted the latitude and longitude from degrees into decimals, and put them into a CSV file. The point show up, but they're shifted about 40 kilometers south-west. I'm new to QGIS so idk how to solve it. Any help would be appreciated.
1 day ago 0 0 0 0
Preview
Error in URL connection of PostGIS Raster community module plugin in GeoServer I have a raster named MODIS_All_India_NDVI_2001_01_01.tif in the database named agro_dss in PostGIS, in the public.modis_all_india_ndvi_2001_01_01 table. The import was done using: raster2pgsql -s 4326 -I -C -M D:\Advisory\Raster\MODIS_All_India_NDVI_2001_01_01.tif -F -t auto public.MODIS_All_India_NDVI_2001_01_01 | psql -U postgres -d agro_dss -h localhost -p 5432 as I am using GeoServer Version 2.18.1 Git Revision 95cf8a329b0b51b69e1ea8d833bcb8b2ccc9b2be Build Date 19-Nov-2020 15:33 GeoTools Version 24.1 (rev 7d309a25d2f0c857fd67c09b0d5392432d77fc4c) GeoWebCache Version 1.18.1 (rev 08dd9de02426482f542b003f3bf381497939eb04/08dd9de02426482f542b003f3bf381497939eb04) so I downloaded and installed the compatible version of GeoServer PGRaster community module (geoserver-2.18-SNAPSHOT-pgraster-plugin.zip) I unzipped the files named * gs-pgraster-2.18-SNAPSHOT.jar * gt-imagemosaic-jdbc-24-SNAPSHOT.jar in the directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\geoserver\WEB-INF\lib then added the path of raster2pgsql.exe in JAVA_OPTS of Tomcat configuration .exe as -DRASTER2PGSQL_PATH=C:\Program Files\PostgreSQL\13\bin I then restarted the Tomcat server, and it worked fine as I was able to see the ImageMosaicJDBC - Image mosaicking/pyramidal jdbc plugin in new Raster Data Sources to Configure ImageMosaicJDBC store, I added these 3 files in the directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\geoserver\data 1st file connect.pgraster.xml.inc 2nd file mapping.pgraster.xml.inc 3rd file mosaicpgraster.pgraster.xml ]> &mapping; &connect; after this 1 added an additional table in agro_dss database to store mosaic metadata. CREATE TABLE public.mosaic ( name character varying(254) COLLATE pg_catalog."default" NOT NULL, tiletable character varying(254) COLLATE pg_catalog."default" NOT NULL, minx double precision, miny double precision, maxx double precision, maxy double precision, resx double precision, resy double precision, CONSTRAINT mosaic_pkey PRIMARY KEY (name, tiletable) ); then added the raster to this mosaic metadata table, and assigned the name mosaicpgraster: insert into mosaic (name,tiletable) values ('mosaicpgraster','modis_all_india_ndvi_2001_01_01 table'); Finally, as I am creating new database in ImageMosaicJDBC store, I am getting the error while connecting the mosaicpgraster.pgraster.xml file in URL This file is located in C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\geoserver\data for which, I have tried to parse the URL as file:data/mosaicpgraster.pgraster.xml and further as http://localhost:8080/geoserver/data/mosaicpgraster.pgraster.xml but I am getting errors both ways, How to rectify it?
1 day ago 0 0 0 0
Preview
Creating new tile cache using ArcGIS Pro I'm struggling to understand how to create a tile cache using ArcGIS Pro. Every time I try, it creates an empty map service. I'm caching a small scale just to test it out (it takes about 3 minutes for the publishing tool to complete). In the service editor I have the options "Using tiles from a new cache" and "Cache automatically on the server" turned on. I also chose an area of interest. I have "auto-suggest" set for the tiling scheme, it notes "Using" and lists they layer's projection. I then view the job status and it says "Publish status: Succeeded. Cache status: Succeeded." When I go to ArcGIS Server Manager, I see the map service there, with the thumbnail showing the appropriate layer, but when I click on the thumbnail to view that layer, nothing is there. When I go to the arcgiscache folder, I see the cached scale and it's populated with an RC#### bundle file. In manager, the service is pointing at the correct cache folder so I don't see a reason why it's not pulling from there. When I click on the cache status (the little four squares next to the name of the map service), it says 100% of the tiles are available. When I go to my rest services page, I can click down into the map service and find the scale at which I tiled; I click on "Start tile" and it says 404 Not Found, so it's not finding the tiles. I've tried to create the cache manually too. It never works. What am I missing?
1 day ago 0 0 0 0
How to add thumbnails to ArcGIS Dashboard table elements Part 2
How to add thumbnails to ArcGIS Dashboard table elements Part 2 Do you want to take your ArcGIS Dashboards to the next level? In this video, we customize the table element by using Arcade to display the thumbnail images of your ArcGIS Online items. If you’ve ever wanted your dashboard to feel more polished and user-friendly, this video shows you exactly how to make it happen. If you’re curious about how we found the thumbnail URLs for our ArcGIS Online items in the first place, check out this GeoSnap: https://www.youtube.com/watch?v=XrrMV8TNBBI&amp;list=PLZ9TJcIeAUwe86jbM7X01nszkyUpGGOfl&amp;index=3 0:00 – Intro 0:27 – Data prep 0:50 – Select feature layer and fields 1:10 – Arcade expression 2:10 – Outro ----------------------------------------------------------------------------------------- About ArcGIS Dashboards    ► Product Page  https://www.esri.com/en-us/arcgis/products/arcgis-dashboards/overview  ► Blogs  https://www.esri.com/arcgis-blog/?s=#&amp;products=ops-dashboard ► Esri Community  https://community.esri.com/t5/arcgis-dashboards/ct-p/arcgis-dashboards ------------------------------------------------------------------------------- About GeoSnaps | Videos by Esri Canada      ► A collection of bite-sized technical videos about all things in the ArcGIS universe.      ► Have a suggestion for a GeoSnap?  Email us at geosnaps@esri.ca     ► Be sure to subscribe to our channel and hit the notification bell to stay up-to-date with the latest tutorials and technical inspiration: https://www.youtube.com/user/esricanadatv  ------------------------------------------------------------------------------  Want more from Esri Canada?    ► Sign up for our email and select ‘Getting Technical’ under Esri Canada Blog Digests to receive the latest in your inbox: https://pages.esri.ca/Esri-Canada-Preference-Centre.html To learn more, contact us: https://esri.ca/contactus
1 day ago 0 0 0 0
Preview
Sample training points from image collection using Google Earth Engine JavaScript API I am trying to train a classifier to distinguish between snow and not snow pixels on Landsat imagery. I got the layer prepared with manually vectorized snow extent for couple of images and now want to iterate over that layer, grab the image corresponding to it from a collection, sample my points and merge the result together so I can pass it to train the classifier. I have the code below and I am almost there - it's just not working for a collection. It works perfectly for a single image. Why does .map behave like this and what would be the workaround? //Prepare data var manualSnowCover = ee.FeatureCollection(trainingPolygons); var trainingSceneList = manualSnowCover.aggregate_array('layer'); //layer field contains product ids var trainingScenes = lall_orig.filter(ee.Filter.inList("LANDSAT_PRODUCT_ID", trainingSceneList)); var bands = ['blue', 'green', 'red', 'nir', 'swir1', 'swir2']; //Sample training points var sampleTrainingData = function (img) { var landsatProductID = img.get("LANDSAT_PRODUCT_ID"); //Create snow points var query = ee.String('layer == "productID"').replace('productID', landsatProductID); var manualSnowMask = manualSnowCover.filter(query); var snowPoints = ee.FeatureCollection.randomPoints(manualSnowMask, 1000) .map(function (feature) {return feature.set("class", 1);}); //Create other land cover points - basically take image geometry and subtract snow from it var nonSnowMask = ee.Feature(clip_geom).difference(manualSnowMask.first()); var nonSnowPoints = ee.FeatureCollection.randomPoints(nonSnowMask.geometry(), 1000) .map(function (feature) {return feature.set("class", 0);}); //Merge together and sample the raster var trainingPoints = snowPoints.merge(nonSnowPoints); var trainingData = img.select(bands).sampleRegions({ collection: trainingPoints, properties: ['class'], scale: 30}); return trainingData; }; // This works fine and returns a feature collection that is usable with ee.Classifier.smileCart().train var trainingData = sampleTrainingData(trainingScenes.first()); // This returns an empty feature collection with 12 elements and 0 columns var trainingData = trainingScenes.map(sampleTrainingData); print(trainingData);
1 day ago 0 0 0 0
Preview
Converting complex depth contours to polygons in sf and R I have a large dataset of depth contours downloaded from an open database. At the time of writing, these contours appear to contain the best available continuous depth model for my region of interest. The second-best continuous alternative is the 15-arc second GEBCO grid, which is not of high enough resolution for my application. I need non-overlapping valid polygons to use the depth data in my application which uses R and the sf package. I manage to do the raster data polygonization but cannot polygonize the depth contours despite multiple days of trying. I need to do the polygonization for all three files in the downloadable dataset combined but will demonstrate the problem using a subset of the dataset extracted from the main dataset with (for full documentation): dt % dplyr::select(DYBDE, geometry) %>% st_crop(., st_bbox(c(xmin = 17, ymin = 70, xmax = 17.1, ymax = 70.1), crs = 4326) %>% st_as_sfc() %>% st_transform(st_crs(tmp)) ) Packages: library(sf) #> Linking to GEOS 3.8.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE library(tidyverse) Example data: dt % mutate(n = mapview::npts(., by_feature = TRUE)) %>% dplyr::filter(n > 4) # because "polygons require at least 4 points" with a larger dataset dt2 %>% sf::st_cast(.,"POLYGON") %>% plot(max.plot = 1) Does not work with st_polygonize() either: dt %>% st_cast("LINESTRING") %>% st_polygonize() %>% plot() I should somehow make sf understand that I want to make the polygons to another polygon encompassing the contour lines: dt %>% st_boundary() %>% filter(!st_is_empty(.)) %>% st_combine() %>% st_convex_hull() %>% plot() plot(dt, add = TRUE) dt %>% st_boundary() %>% filter(!st_is_empty(.)) %>% st_combine() %>% st_convex_hull() %>% st_as_sf() %>% rename("geometry" = "x") %>% bind_rows(., dt2) %>% sf::st_cast(.,"POLYGON") %>% plot(max.plot = 1) Created on 2022-01-13 by the reprex package (v2.0.1) Still not better. Any suggestions how to create depth polygons out of these contours?
1 day ago 0 0 0 0
Preview
Updating Virtual Layer by PyQGIS I want to update a virtual layer using PyQGIS by modifying the layer name in the query. Although I have executed the following code, the virtual layer's query remains unchanged when I open the project in QGIS. I want to update the existing virtual layer without creating a new one. Will this be possible? Is there any example I can refer to? old_layer_name = "ZDS" new_layer_name = "QHS" prj = QgsProject() prj.read(file_path) for layer in prj.mapLayers().values(): if layer.providerType() == 'virtual': query = layer.source() query = query.replace(old_layer_name, new_layer_name) layer.setDataSource(query, layer.name(), 'virtual') prj.write()
1 day ago 0 0 0 0
Preview
Raster NA Error in R - Error in { : task 5 failed - "0 (non-NA) cases" I'm trying to conduct a landscape genetic analysis through the R Package ResistanceGA on some environmental rasters. However, I keep running into the error Error in { : task 5 failed - "0 (non-NA) cases" when my rasters are being passed through the algorithm. I've had no issues to date with any of the other datasets that I've used, however, this dataset was sourced externally. This leads me to believe that it is something to do with the raster itself, and not the package. All rasters are in .asc format and have been converted from GeoTIFFs. Data can be found here. The full code used: # Load Package library(ResistanceGA) library(rgdal) library(corpcor) library(pryr) ## Create Directory for Examples ## if("ResistanceGA_Examples"%in%dir("D:/ResistanceGA/Data/Model_Outputs/100m")==FALSE) dir.create(file.path("D:/ResistanceGA/Data/Model_Outputs/", "100m")) ## Create Directory Object for .asc Files and results write.dir
1 day ago 0 0 0 0
Preview
Optimising large spatial queries in SQL I'm sure similar answers have been given elsewhere but no matter what I have tried I am unable to optimise this query. Details: TableA has 3.5mill records TableB Had 57000 records but I have dissolved that down to 170 based off category of data. I need to return what features in tableB intersect each individual record in tableA in a single string. Update a Set a.[Zone_Codes] = (SELECT SUBSTRING((SELECT '; '+ b.[ZONE_CODE] FROM [TableB] AS b WHERE a.geometry.STIntersects(b.geometry.MakeValid()) = 1 ORDER BY b.[ZONE_CODE] FOR XML PATH ('')), 2, 1000)) FROM [TableA] AS a Any thoughts on how to optimize this? All tables have spatial indexes. SQL Management Studio 13 --- removed amended code, didnt optimise
1 day ago 0 0 0 0
Advertisement
Preview
Module Not Found Error: No module named 'gdal' when installing RS&GIS, a QGIS Plugin So I'm trying to create a Land Surface Temperature (LST) using the RS&GIS plugin in QGIS. When finished installing the RS&GIS plugin, I get an error massage says Couldn't load plugin 'NITK_RS-GIS_17' due to an error when calling its classFactory() method ModuleNotFoundError: No module named 'gdal' Traceback (most recent call last): File "D:\QGIS/apps/qgis/./python\qgis\utils.py", line 335, in _startPlugin plugins[packageName] = package.classFactory(iface) File "C:\Users/HP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\NITK_RS-GIS_17\__init__.py", line 34, in classFactory from .RSGIS_M import RSGIS File "D:\QGIS/apps/qgis/./python\qgis\utils.py", line 799, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/HP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\NITK_RS-GIS_17\RSGIS_M.py", line 57, in import gdal File "D:\QGIS/apps/qgis/./python\qgis\utils.py", line 799, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'gdal' Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] QGIS version: 3.20.3-Odense Odense, 495fbaec Python Path: D:/QGIS/apps/qgis/./python C:/Users/HP/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/HP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins D:/QGIS/apps/qgis/./python/plugins D:\QGIS\bin\python39.zip D:\QGIS\apps\Python39\DLLs D:\QGIS\apps\Python39\lib D:\QGIS\bin D:\QGIS\apps\Python39 D:\QGIS\apps\Python39\lib\site-packages D:\QGIS\apps\Python39\lib\site-packages\win32 D:\QGIS\apps\Python39\lib\site-packages\win32\lib D:\QGIS\apps\Python39\lib\site-packages\Pythonwin C:/Users/HP/AppData/Roaming/QGIS/QGIS3\profiles\default/python Has anyone had an experience like this before? I'm new to QGIS and I don't know how to solve this kind of error.
1 day ago 0 0 0 0
Preview
QGIS and the Raster Tracer Plugin I have been away from the Raster Tracer for a couple of years. It is a very effective plugin and I previously had got all the bugs out of it and used it extensively. Now I cannot get it to snap onto itself (when closing a line) nor onto any existing vector line. I've done the usual Projection matching and played around with the QGIS snapping magnet and Options to no avail and otherwise have it working well. I can halve my work if I can get it fixed.
1 day ago 0 0 0 0
Preview
How does the ISEA-projection work? Looking for a didactic algorithm description Is it a direct projection on 20 faces or on 32 faces? Can I use PostGIS (with ISEA) to calculate and obtain cell-identifiers? For hexagons (like Uber H3) or for diamonds (like DGGRID's ISEA4D). The online literature say nothing: * the Wikipedia short page about ISEA. No clues about algorithm. Citation into the article: Begin with a Snyder Equal Area projection to a regular icosahedron (...) inscribed in a sphere (...) Then project the hexagon back onto the sphere using the Inverse Snyder Icosahedral equal area projection. * the PROJ page for ISEA, used by PostGIS and many other, would be the best source, but it doesn't say much, on the contrary, it creates some confusion by saying "... map projections on polyhedral globes for the dodecahedron and truncated icosahedron". And not shows how to use each polyhedre. * This paper explains how to transform regular icosahedron faces into projection planes and, them, into a Truncated icosahedron of 32 faces... But I am not a good reader of mathematical formalism, nor of Chinese. --- NOTES Clues by illustrations: * ... * Step n+1: Lambert azimuthal equal-area projection over each 20 faces of the icosahedron. * Step n+2: "project back onto the sphere using the Inverse Snyder" each 5 faces to truncate, generating 12 new pentagonal faces. So, the algorithm has a reprojection step? * ...
1 day ago 0 0 0 0
Preview
Error of reprojecting ImageCollection in GEE "Too many pixels in the region." Due to the necessity that I have to process the model in specific CRS (EPSG:3006), I try to reproject the ImageCollection after calculating all the vegetation indices I need. I use the code below to reproject that whole imagecollection so that I can continue the further analysis. var res2L2017c_Veg = s2L2017c_Veg.reduceRegion({ reducer: ee.Reducer.median(), geometry: ROI, scale: 10, // meters crs: 'EPSG:3006', //sweref99 tm }); print(res2L2017c_Veg) However, it shows the error: Dictionary (Error) Image.reduceRegion: Too many pixels in the region. Found 41709676124, but maxPixels allows only 10000000. Ensure that you are not aggregating at a higher resolution than you intended; that is a frequent cause of this error. If not, then you may set the 'maxPixels' argument to a limit suitable for your computation; set 'bestEffort' to true to aggregate at whatever scale results in 'maxPixels' total pixels; or both. Does it mean that it exceeds the computation affordability of GEE? How should I correct this error? This is the link to my code: https://code.earthengine.google.com/6a40e656de80a79aa4308c97f313b756 This is the geometry "ROI": https://code.earthengine.google.com/?asset=projects/ee-sweden2023study/assets/ROI
1 day ago 0 0 0 0
Preview
Polygons not showing when added to Leaflet map, may or may not show when page is refreshed I am trying to create a map to which users can add layers from ArcGIS data. They click a button, which opens a modal. In the modal, they enter the URL of the ArcGIS layer, choose a colour for the layer, and enter any text as a name for the layer. Then they click a button in the modal to close the modal and add the layer to both the map and the legend. (The legend also represents the order of the layers, so the first layer in the legend is visually on top of the others in the map, while the bottom one is below all the others, etc.) I have run into a problem when adding an ArcGIS layer that contains polygons. When I add it to the map via the modal, sometimes nothing actually appears on the map. It seems to be that if I have a brand new empty map and add the layer, it will show up, but if, for example, I have just deleted another ArcGIS layer from the map and try to add this layer, it does not show up. However, when I reload the page using my web browser, it shows up. Also, if I use my program's UI controls to reload the map (for example, by loading a different map and then loading this one again), it shows up. Alas, it's worse for a client, who is reporting that the layer never shows up on the map, no matter what! Because of the client's issue, I have to assume that the issue isn't a matter of adding the layer versus loading a map that already has the layer: rather, it has to do with the timings of the layer getting its data versus actually being drawn on the map. My map page actually does many other things, so the code is a bit of a large, complex maze. I'll share what I think is relevant here, but if you need to see more, let me know. function ysisoftArcGISMap(map, url, color, layerID, order, isFromAdd, arcGisToken) { var arcLayer = L.esri.featureLayer({ url: url, pane: layerID, token: arcGisToken, pointToLayer: function (feature, latlng) { let marker; let markerOptions; markerOptions = { radius: 6, fillColor: color, color: '#000', weight: 5, opacity: 0.7, fillOpacity: 0.6 }; marker = L.circleMarker(latlng, markerOptions); return marker; }, style: function () { return { color: color, weight: 3 }; }, }); if (!arcGisLayerIDs.includes(layerID)) { addMapLayerToMap(arcLayer, layerID, false); arcGisLayerIDs.push(layerID); } arcLayer.bindPopup(function (e) { var props = ""; for (var propertyName in e.feature.properties) { props += propertyName + ":{" + propertyName + "} "; } return L.Util.template(props, e.feature.properties) }); arcLayer.once("load", function (evt) { arcLayer.query().bounds(function (error, latlngbounds) { if (layerID == lastLayerID) { map.fitBounds(latlngbounds); } }); }); arcLayer.getAttribution = function () { return layerID; }; return arcLayer; } function addMapLayerToMap(geoJsonLayer, layerID, isSearchable) { removeOldLayer(layerID); var orderedMapLayer = $.grep(OrderedMapLayers, function (layer) { return layer.ID == layerID; }); if (orderedMapLayer.length > 0) { layers.push(geoJsonLayer); if (orderedMapLayer[0].IsVisible) { map.addLayer(geoJsonLayer); // [omitted code for when isSearchable == true] } } if (orderedMapLayer[0].Order == OrderedMapLayers[OrderedMapLayers.length - 1].Order) { isInitialLoad = false; } } function removeOldLayer(layerID) { for (var i = layers.length - 1; i >= 0; --i) { var oldLayer = layers[i]; if (oldLayer.getAttribution) { if (oldLayer.getAttribution() === layerID) { map.eachLayer(function (layer) { if (layer.options.pane == layerID) { map.removeLayer(layer); } }); layers.splice(i, 1); } } } } Things I have tried that do not work: * manually trigger the 'load' of the layer >> does not fix problem; causes console error re: "arcLayer.triggerEvent() is not a function" (note: it also messes up the getAttribution() function so that it returns null, which breaks other code) * call arcLayer.refresh() >> does not fix problem * nest various things in setTimeout() >> does not fix problem * using event listener for "data:loaded" >> never triggers, so it does nothing * force the map to refresh using invalidateSize() >> does not fix problem I've noticed something weird about ArcGIS layers, which is that a listener for on('load') will not trigger until the layer has been added to the map. I'm not sure whether this has anything to do with the trouble I'm having. Also notable is the fact that the .query().bounds call returns unexpectedly enormous numbers (roughly 100,000 times larger than normal latitudes and longitudes). However, this seems to happen regardless of whether the polygons show on the map, so I'm not sure whether it's a clue to the underlying problem or just an unrelated issue.
1 day ago 0 0 0 0