texts: Storing result from gdallocationinfo as variable in Python

texts:
I'm trying to find the cell value at various locations in a set of rasters so I can count the number of real values (aka not 'NoData') that occur at all the locations within each raster. The various locations are represented as points in a point shapefile. I exported the shapefile's attribute table (including lat/long) to a csv and am looping over each point to get the value. I have a script ready to go, but am having trouble storing the output of the 'gdallocationinfo' as a result.

How can I do this in python?

Here is my pseudo code:

for raster in rasters:
    count = 0
    for i in range(0, Npts):
        lat = points[i][10] # lat is 10th row of csv
        lon = points[i][9] # longitude is 9th row of csv

        result = os.system('gdallocationinfo -valonly -wgs84 %s %s %s' % (raster, lon, lat))
        print result

        if not result == 'nan': count+=1 # if result is no 'nan', add to the count

    row = [raster, str(count)]
    # write row to csv

When I run the actual code, the system call for 'gdallocationinfo' prints out the correct values (or 'nan'). But when it gets to 'print result', it just prints 0. So the command call is giving me the correct result, but this obviously is not the way to store the result as a variable so I can use it later. I'm calling the python code from the linux command line.


texts:
How can I save an IGeometry to disk as a Layer file?

ArcEngine 10, C#, VS2010

Edit 1: With Jason Scheirer 's suggestion I managed to convert a point into a shapefile - and I'll post the code here for the community.

string strFolder = @"C:\temp";
string strName = "NewShapeFile"; //don't include .shp extension
string strShapeFieldName = "Shape";
ShapefileWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
IFeatureWorkspace pFWS = pWorkspaceFactory.OpenFromFile(strFolder, 0) as IFeatureWorkspace;
IFields pFields = new FieldsClass();
IFieldsEdit pFieldsEdit = pFields as IFieldsEdit;
IField pField = new FieldClass();
IFieldEdit pFieldEdit = pField as IFieldEdit;
pFieldEdit.Name_2 = strShapeFieldName;  //Name is read-only Name_2 is writeable -- don't ask me why
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;
IGeometryDef pGeomDef = new GeometryDefClass();
IGeometryDefEdit pGeomDefEdit = pGeomDef as IGeometryDefEdit;
pGeomDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint;
pGeomDefEdit.SpatialReference_2 = CrowWingCoordinates;
pFieldEdit.GeometryDef_2 = pGeomDef;
pFieldsEdit.AddField(pField);
pField = new FieldClass();
pFieldEdit = pField as IFieldEdit;
pFieldEdit.Length_2 = 25;
pFieldEdit.Name_2 = "TextField";
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
pFieldsEdit.AddField(pField);
IFeatureClass pFeatClass = pFWS.CreateFeatureClass(strName, pFields, null, null, esriFeatureType.esriFTSimple, strShapeFieldName, "");
IFeatureBuffer fb = pFeatClass.CreateFeatureBuffer();
IFeature feature = pFeatClass.CreateFeature();
IFeatureCursor featureCursor = pFeatClass.Insert(true);
double x = -94.105797;
double y = 46.559214;
IPoint p = new PointClass();
p.SpatialReference = gcs;
p.PutCoords(x, y);
p.Project(myCoordinates);
IGeometry geometry = p as IGeometry;
fb.Shape = p;
featureCursor.InsertFeature(fb);
featureCursor.Flush();


texts: Results no error: Shapefile nowhere to be found/not in workspace

texts:
I'm trying to do the most basic stuff. I have 2 shapefiles. One is municipality polygons, and the other one is a polygon based on road network (20 min commute, using service area). Whenever I try to combine these datasets (spatial join, clip, union) it instantly pops up as finished, but I get no shapefile as a result. The Results tab says there is no problem.

I checked the coordinate system etc, it's the same in both.

It says: Level of comparison between projection files: NONE. I don't know if this might be the problem.

I am using ArcGIS 10.2


texts: Seeking Free Opensource Shapefile Writer for .NET

texts:
I am looking for a well documented, Open Source Library that can create and write to a shapefile from .NET. I need lower lever access i.e. I should be able to write feature by feature.

I have investigated and found the following:

SharpMap claims to write to shapefiles in v 2.0, but that version has not released.
NTS has absolutely no documentation.
Catfood shapefile reader provides read only access.

Is there a library that can be used to write a new shapefile?


texts: layer_styles table not available in QGIS 3.16, works in QGIS 3.10

texts:
Layer styles stored in a postgres database (postgres server version 9.5.22) are not available in QGIS 3.16 (Message from Database Styles Manager: No styles found in the database).
Everything works fine in my QGIS 3.10 Version. Are there other settings I need to take care of, or could it be the version difference in the PostgreSQL client of 12.3 for QGIS 3.16 and 11.3 for QGIS 3.10?
Here is a screenshot of the version info for QGIS 3.16:

Here is the screenshot of the version info for QGIS 3.10:


texts: How do I read the GPS data from a GPS device using Java

texts:
I want to read data from a GPS device connected to my laptop and find the latitude and longitude. I searched a lot about it but could only find Android related programs.
How do I read the GPS data using Java (and not Android)?


texts: QGIS: what is the difference between heatmaps and interpolation plugins?

texts:
I need to generate a raster looking like a « heatmap » based on a points layer. On this layer, each point represents a nest (bird population study). I need to produce a nest density map (raster) from this layer. I noticed that rasters produced from Heatmaps and Interpolation plugins were somewhat similar, so I'm wondering if there is one plugin specifically recommended for what I need to achieve.

I specifically would like a square-shaped extent (with X,Y mini and X,Y maxi), that Heatmaps plugin does not do (Interpolation does). I would like this extent to be colored for zero values. One more thing: I don't have any attribute to be taken into account in my nests layer (Interpolation plugin asks for such an attribute to rely upon).

Then, I don't really get the difference between the two plugins.


texts: Sharing properties for SQL server table in QGIS?

texts:
I have a project where most of the layers come from a SQL server. Most of the layers contain pointers to, and/or drop down list for, attributes so that there is consistency in data entry. This project accounts for 80% of my work

My PC was recently rebuilt in Windows 10 and I have a fresh install of QGIS 2.18. That means that I lost all recent history and connections to the database.

When I opened my project, I received the 'Handle Bad Layers' dialogue box for some of my layers. It turns out that the project had been created over time with different paths to the database. I was able to add the layers back to the project, but I have lost the pointers and drop down lists. I would like to get them back.

Luckily I have copies of the project that I can still open on a Windows 7 machine, so I can see what those pointers and lists looked like. I could go through one at a time and recreate what I need, but I would prefer something less manual and less prone to human error. There are 27 layer and each layer has 20-30 attributes.

I've been trying to research .qlr files, but I am not sure I am on the right track.

Can anyone help me, or direct me to some search terms that could help?


texts:
can't install qgis as per qgis download page.

at command line:

sudo apt-get install qgis python-qgis qgis-plugin-grass

getting unmet dependencies:

The following packages have unmet dependencies:
 python-qgis : Depends: python-qgis-common (= 1:2.18.14+13jessie) but 1:2.18.11+24xenial is to be installed
               Depends: libqgispython2.18.14 but it is not going to be installed
               Depends: libgdal1h (>= 1.8.0) but it is not installable
               Depends: libgeos-c1 (>= 3.4.2) but it is not installable
               Depends: libproj0 (>= 4.8.0) but it is not installable
               Depends: libqgis-analysis2.18.14 but it is not going to be installed
               Depends: libqgis-core2.18.14 but it is not going to be installed
               Depends: libqgis-gui2.18.14 but it is not going to be installed
               Depends: libqgis-networkanalysis2.18.14 but it is not going to be installed
               Depends: libqgis-server2.18.14 but it is not going to be installed
               Depends: libqwt6 but it is not installable
               Depends: libspatialindex3 (>= 1.8.1) but it is not installable
               Depends: libspatialite5 (>= 2.4.0) but it is not installable
               Depends: sip-api-11.1 but it is not installable
 qgis : Depends: libgdal1h (>= 1.9.0) but it is not installable
        Depends: libgeos-c1 (>= 3.4.2) but it is not installable
        Depends: libgsl0ldbl (>= 1.9) but it is not installable
        Depends: libproj0 (>= 4.8.0) but it is not installable
        Depends: libqgis-analysis2.18.14 but it is not going to be installed
        Depends: libqgis-app2.18.14 but it is not going to be installed
        Depends: libqgis-core2.18.14 but it is not going to be installed
        Depends: libqgis-gui2.18.14 but it is not going to be installed
        Depends: libqgis-networkanalysis2.18.14 but it is not going to be installed
        Depends: libqwt6 but it is not installable
        Depends: libspatialindex3 (>= 1.8.1) but it is not installable
        Depends: libspatialite5 (>= 2.4.0) but it is not installable
        Depends: qgis-providers (= 1:2.18.14+13jessie) but it is not going to be installed
        Recommends: qgis-provider-grass but it is not going to be installed
 qgis-plugin-grass : Depends: qgis-provider-grass (= 1:2.18.14+13jessie) but it is not going to be installed
                     Depends: libgdal1h (>= 1.8.0) but it is not installable
                     Depends: libgeos-c1 (>= 3.4.2) but it is not installable
                     Depends: libproj0 (>= 4.8.0) but it is not installable
                     Depends: libqgis-analysis2.18.14 but it is not going to be installed
                     Depends: libqgis-app2.18.14 but it is not going to be installed
                     Depends: libqgis-core2.18.14 but it is not going to be installed
                     Depends: libqgis-gui2.18.14 but it is not going to be installed
                     Depends: libqgisgrass6-2.18.14 but it is not going to be installed
                     Depends: libqwt6 but it is not installable
                     Depends: libspatialindex3 (>= 1.8.1) but it is not installable
                     Depends: libspatialite5 (>= 2.4.0) but it is not installable
                     Depends: grass644 but it is not installable
E: Unable to correct problems, you have held broken packages.

deb http://qgis.org/debian jessie main
deb-src http://qgis.org/debian jessie main

deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu jessie main

any ideas out there


texts:
i have a .shp file of gridded daily rainfall data for an entire state.

How do i calculate the sum of all 365 days (each day is a field, n recorded for 450 stations) and generate a raster?

I am using ArcGIS Desktop 10.5.


texts: Displaying points fetched from table as web map?

texts:
I have at hand a common GIS task:

The data: I posses 16,000 Excel rows. Each has latitude and longitude and some other attributes. I need to build a program that allows the user to type in a location and a radius and then the program will look up the data and fetch only those points that fall within the given radius.
The output should be a map with the fetched points displayed, but also a table listing the points that fall within the radius.

I am aiming for a web mapping solution.

Also, what programming language do you think would be suited for this?

Any particular web map API?

I am good at Python, but not so good at Javascript.


texts: How to create multiple external overviews for a geotiff with gdal?

texts:
I want to have mutiple overview files (one for each overview level) for a GeoTiff, so I'm able to edit this files in a raster editor. How can this be done?

Unfortunately, gdaladdo -ro creates only one .ovr file for a tiff, that contains all the overviews.

Maybe this can be done by using VRT format and specifying particular tiff files as overviews for a main one?


texts: gdal_merge Sum/Agregation files into single output band

texts:
I need to create a single tiff files from several others (each have the same extent and resolution) and the output file need to have a single band containing the aggregated/sum of the values in the separate files.

I was playing with gdal_merg, - in the the gdal_merge documentation the definition include "In areas of overlap, the last image will be copied over earlier ones." wich is not what I need. I got somewhat over that by using the -separate parameter that give me a single file with multiple bands, each representing one of the source files.

Is there a python/command line way how I can sum these multiple bands programmatically? (similar to the Raster Calculator GUI in QGIS)

Or even better do it in a single step?

Thanks in advance.
g


texts: How to detect(condition) if Query Layer Connection is failing?

texts: I have a job (arcpy script) which relies on a query layer but it fails sometimes. It has to do with the query layer connection (the point where job fails randomly)- which is totally under the control of ORACLE team. I want to capture this to discuss with ORACLE team. What should be the right layer property to capture this?


texts: In QGIS 3 Graphical Modeler can you add a check box to allow for different model path

texts:
In the Graphical Modeler in QGIS 3 is it possible to add a check box to the model GUI that if selected takes you down a different path of the tree so to speak.

Example:

Within a model I want to have two options for the geometric predicate in the select by location tool (intersect and within). Currently in the model interface you do not have an option to select multiple criteria. I would like the model to have a check box, which if selected will lead to another geometric predicate in the model.

Of course it would also be useful to apply this to many other scenarios too.


texts: I want to process Sentinel 2A images using another tool that is not SNAP. The later is very slow and crashes each time. I was recommended the Orfeo toolbox. I installed it on QGIS. I have 58 S2A images and I want to process them in a time-efficient way and not one by one. SNAP offers that through the graph builder and the batch processing. I want to know if there is such a thing with the Orfeo toolbox.


texts: I need to create a map with SRTM data but use contours instead of the grid data. I can use ESRI software to create contours but they aren't the nicest looking, mostly in flat areas. Does a good contour already exist for download somewhere? My Area of interest is North Vancouver, BC Canada and accross the border into the US (almost to Seattle).


texts: QGIS layers no longer overlay when Enable 'on the fly' CRS transformation is on

texts:
My QGIS project has two layers - one retrieved from GADM (administrative boundaries of Guinea Bissau) and another one of the villages collected in the field using GPS Decimal Degrees - D.ddddd.
If I have in Settings - Project Properties - CRS - Enable 'on the fly' CRS transformation clicked on, these layers no longer overlay. If it is off it is not possible to know distances in Km.
It would be great if someone has a clue about what is going on... Thanks!
Ila


texts: Why processing.runalg("gdalogr:rasterize"....) is not creating out files when running in the QGIS 2.6.0 console?

texts:
I want to use the QGIS python scripting functions to turn to rasterize a point vector using many different dimensions.

Right now my code looks like this:

import processing

RasterPixelSize = (10.0,20.0,30.0,40.0,50.0,60.0,70.0,80.0,90.0,100.0)

for rps in RasterPixelSize:
    processing.runalg("gdalogr:rasterize","/home/cparr/Documents/Inuvik   /West_Hourglass/spiral.shp","DEPTHCM_AL",None,0,[rps],[rps],0,"/home/cparr/Documents/Inuvik/SpiralToRaster/test.tif")

print "Done"

And in the console I get this message:

execfile(u'/home/cparr/Documents/Inuvik/QgisScripts/rasterize.py'.encode('UTF-8'))
Error: Wrong parameter value: [10.0]
Error: Wrong parameter value: [20.0]
Error: Wrong parameter value: [30.0]
Error: Wrong parameter value: [40.0]
Error: Wrong parameter value: [50.0]
Error: Wrong parameter value: [60.0]
Error: Wrong parameter value: [70.0]
Error: Wrong parameter value: [80.0]
Error: Wrong parameter value: [90.0]
Error: Wrong parameter value: [100.0]
Done

The help for rasterize shows:

processing.alghelp("gdalogr:rasterize")
ALGORITHM: Rasterize (vector to raster)
INPUT <parameters>
FIELD <parameters from INPUT>
WRITEOVER <parameters>
DIMENSIONS <parameters>
WIDTH <parameters>
HEIGHT <parameters>
RTYPE <parameters>
OUTPUT <OutputRaster>

DIMENSIONS(Set output raster size (ignored if above option is checked))
0 - Output size in pixels
1 - Output resolution in map units per pixel
RTYPE(Raster type)
0 - Byte
1 - Int16
2 - UInt16
3 - UInt32
4 - Int32
5 - Float32
6 - Float64
7 - CInt16
8 - CInt32
9 - CFloat32
10 - CFloat64

And I believe my parameters are correct. Does anyone have experience scripting the QGIS processing tools from the python console?


texts:
I want to develop a data provider for QGIS, but I cannot find any documentation on how to. I can see that Python plugins are popular, but from the repository it looks like data providers are written in C++ (which I am perfectly fine with) and that they're somewhat dynamically loaded in.

Can anyone point me to documentation on how to do this? Or is my only choice to join their mailing list and ask a "how to get started" question there?


texts: Use Python to change a print composer layout item's extent in QGIS 3

texts:
I have a QGIS project and in that project there is a print composer layout titled mainmap.  This print composer layout has my desired layout items like a title, scalebar, and legend.  mainmap also has a map with the default name Map 1.

I can use the Python code below in the Python Console to move the extent of the project canvas to the extent of the QgsRectangle just fine.

rect = QgsRectangle(1196381.0,655556.0,1204217.0,660632.0)
canvas = qgis.utils.iface.mapCanvas()
canvas.setExtent(rect)
canvas.refresh()

I would now like to use Python to also change the extent of mainmap/Map 1 in the print composer to the same QgsRectangle referenced in the code above.
I can see the Extent settings in the Item Properties (see the image below) and I can set them manually.  What Python code would I do to set the extents of Map 1 to match the map canvas?


texts:
I am getting the TIGER geocoding feature set up on my windows 7 64 bit box (PostGIS 2.1; Postgres 9.4).

I followed the steps outlined here to generate the batch scripts and ran them last night:
http://postgis.net/docs/postgis_installation.html#install_tiger_geocoder_extension

Upon inspecting the batch log, there are a bunch of what appears to be soft fails on importing the data.

NOTICE:  INSERT INTO tiger_data.ca_addr(tlid,fromhn,tohn,side,zip,plus4,fromtyp,totyp,arid,mtfcc) SELECT tlid,fromhn,tohn,side,zip,plus4,fromtyp,totyp
,arid,mtfcc FROM tiger_staging.ca_addr;
CONTEXT:  SQL function "loader_load_staged_data" statement 1
Unable to open C:\gisdata\temp\tl_2015_06105_addr.shp or C:\gisdata\temp\tl_2015_06105_addr.SHP.
C:\gisdata\temp\tl_2015_06105_addr.dbf: shape (.shp) or index files (.shx) can not be opened, will just import attribute data.

NOTICE:  INSERT INTO tiger_data.ca_addr(tlid,fromhn,tohn,side,zip,plus4,fromtyp,totyp,arid,mtfcc) SELECT tlid,fromhn,tohn,side,zip,plus4,fromtyp,totyp
,arid,mtfcc FROM tiger_staging.ca_addr;
CONTEXT:  SQL function "loader_load_staged_data" statement 1
Unable to open C:\gisdata\temp\tl_2015_06107_addr.shp or C:\gisdata\temp\tl_2015_06107_addr.SHP.
C:\gisdata\temp\tl_2015_06107_addr.dbf: shape (.shp) or index files (.shx) can not be opened, will just import attribute data.

Checking wget and unzip, however, they seem to both be fetched and unzipped properly:

C:\gisdata\ftp2.census.gov\geo\tiger\TIGER2015\ADDR>"C:\Program Files\7-Zip\7z.exe" e C:\gisdata\ftp2.census.gov\geo\tiger\TIGER2015\ADDR\tl_2015_06107_addr.zip  -o\gisdata\temp\

7-Zip [64] 15.14 : Copyright (c) 1999-2015 Igor Pavlov : 2015-12-31

Scanning the drive for archives:
1 file, 745422 bytes (728 KiB)

Extracting archive: C:\gisdata\ftp2.census.gov\geo\tiger\TIGER2015\ADDR\tl_2015_06107_addr.zip
--
Path = C:\gisdata\ftp2.census.gov\geo\tiger\TIGER2015\ADDR\tl_2015_06107_addr.zip
Type = zip
Physical Size = 745422

Everything is Ok

Files: 5
Size:       3706093
Compressed: 745422

What is more, there are actually plenty of rows in the tiger_data.ca_addr table: 2,940,520 (although surely way below the number of rows there should be for California.

I am not sure where to start looking for clues here, so pointers very welcome!

I found another mention of this issue--there is no tl_2015_06107_addr.shp (and similar) shp-files; only the dbfs are shipped from the census bureau, so the warning is generic. So the data seemingly loaded, I am just not getting results.

On Windows, I can geocode, but time is prohibitive: This request takes 136 seconds for one(!) address.

SELECT g.rating, ST_X(g.geomout) As lon, ST_Y(g.geomout) As lat,
    (addy).address As stno, (addy).streetname As street,
    (addy).streettypeabbrev As styp, (addy).location As city, (addy).stateabbrev As st,(addy).zip
    FROM geocode('1355 Market St #900, San Francisco, CA 94103') As g;


texts: How to get the legend of a Vector heatmap layer in QGIS 2.14.4?

texts:
I'm new on QGIS and PyQGIS. I'm trying to create a plugin which aims to apply a style on a vector layer (generated from a csv file) and then save the map as a png file.

The style I apply on the vector layer is a heatmap style. The problem is that I don't have a legend for the heatmap.. .
At least I would like to have the colors and the percentage of the different levels.

Do you have any idea of how I could do that? Or is it even possible?

I'm not using the heatmap plugin, only applying a heatmap style from a .qml file.

I searched a lot and I couldn't find anything helpful about that... any help would be great.


texts: Setting reference frame for shapefile with pyshp?

texts:
I'm using pyshp to create new shapefiles with Python 3. My code runs without errors, but when I open the resulting file in ArcMap I get this error:

  The following datasource you added is missing spatial reference information.

This is not surprising, since I never told my code that the coordinates in the shapefile are supposed to be in EPSG:3006. How do I set this property in pyshp?

Here's some short example code. I want to tell the writer shape that the coordinates in start and stop are in EPSG:3006.

import shapefile

start = [6400137, 321751]  # Coordinates in EPSG:3006
stop  = [6400095, 319357]  # Coordinates in EPSG:3006

with shapefile.Writer("my_shapefile") as shape:
    shape.fileType = 3 # Polyline
    shape.field("FOO", "C", size = 32)
    shape.field("BAR", "C", size = 32)
    shape.line([[start, stop]])
    shape.record("foo", "bar")


texts: Put png map image as a background to draw upon

texts:
I have an image of a fiber optics network map:

I want to turn this map image (without any actual GIS data) into a vector map where each point is defined by lat, long.

To do this, I'm trying to import it in QGIS. I'm using the OpenLayers plugin to have Google maps as a basemap layer. I have an empty vector layer with projection set to EPSG:3857 where I want to draw the points.

I can't import the image and position it correctly over the Google Maps basemap.

As suggested, I tried this tutorial, placing 5 points (4 at the edges and 1 at the center).

I import the map guessing the coordinate system to be `Any idea what projection was used to create that map?

I tried both pasting coordinates in this format 48.767479, -97.551781 (found on Bing Maps searching the name of the cities) and in this format 48 46 02.92, -097 33 06.41 found using this converter.

In both cases, I end up with a super small, distorted map off the coast of Gabon.

I also tried picking coordinates from this webpage instead, which gives me projected coordinates in EPSG:3857, and feeding them to the Georeferencer plugin worked. However, my image is now very distorted when shown on top of the Google Maps (or Bing Maps) layer.

I guess the projection is not Mercator. Any idea on how I can work on this map without the distortion?


texts: ArcGIS Server 10.1 Integrated Windows Authentication with Token based

texts:
In ArcGIS Server 10.1 on Windows 7 and IIS, if wanting to secure services within an Intranet with Active Directory is that Integrated Windows Authentication http://resources.arcgis.com/en/help/main/10.1/index.html#//015400000517000000 ?

If using Integrated Windows Authentication, does that dictate that web applications wanting to consume the services re-code their app if they do token based access?

I'm involved with setting up AGS 10.1 and configuring and will have numerous 3rd party web app/desktop apps wanting to consume services.  Base question is once configured are we setting the policy that any app that want gis services have to do it one way or the other?


texts:
Recently our company purchased Cartosat-2 Image from NRSC. Our Mining Lease area Boundary is not aligning with Image.It is around 100 meter offset.We are using QGIS 3.4.Spatial reference  of Cartosat-2 UTM Zone-45 and WGS-84 datum.Project spatial reference is GCS WGS-84.On the fly projection is there.
It aligned properly with LISS-4 Image.


texts: One of the new features in QGIS 2.16.1-Nødebo is "live hillshade". But I can't find it- Raster->Terrain Analysis->Hillshade just calls up the non- interactive version. Anyone know how to invoke the new feature?


texts: /workspaces/{workspaceName}, query param "quietOnNotFound" always throws an exception with 404 code

texts:
I am working with WebRequest Class in .NET and the url I have built is "workspaces/" + worspace_name + ".xml?quietOnNotFound=" + true"
This works well if the workspace exists but always throws an exception with error code 404 if the workspace does not exist.


texts:
I have made an update from a previous version of qgis, after that I could not switch a layer on and off. After that I deleted everything, incl. all folders in the path inside ./qgis2/ and reinstalled everything. nothing helped. how can I fix this strange bug?

screenshot from Layers Panel:

My System:
QGIS 2.18.9
OSX 10.11.6


texts: How to remove bounding box extents based on reflectance values of the image of Landsat8 by using R programming

texts:
I have taken the reflectance image from Landsat8 bands.

Now the extents of bounding box showing negative values , to proceed to my next level of the process i need to remove this negative values and make them as NULL.

Can you suggest the procedure to do that using R code?


texts:
I'm trying to reproduce the following jupyter notebook :

https://nbviewer.jupyter.org/github/jtbaker/folium/blob/geojsonmarker/examples/plugin-Search.ipynb

But once I'm trying to create the map I had to make a few changes to the search plugin because of the documentation:

citysearch = Search(layer=citygeo,
                geom_type='Point',
                placeholder="Search for a US City",
                collapsed=True,
                search_label='nameascii'
               ).add_to(m)

becomes, according to the folium documentation here :

citysearch = Search(data=citygeo,
                   geom_type='Point',
                   search_label='nameascii'
                   ).add_to(m)

The issue is that, at best the search plugin doesn't appear and at worse my folium map isn't displayed. Does anyone have this problem as well ? Or is there any dependecies I've forgot ?


texts: Data loads with preset symbology in ArcMap

texts: I have a set of points in a file gdb.  When I load them in ArcMap or ArcCatalog, the data displays with unique value symbology based on a field rather than "single symbol".  How do I get the data to load with single symbol by default?


texts: Using geodatabase feature dataset created in ArcPy script as output/input location later on in same script?

texts:
I am making a script which creates a  file geodatabase with a feature dataset named "Data". The user inputs the location of where the geodatabse should be created and the name of the geodatabase.

import os, arcpy, time ,sys
sr = arcpy.SpatialReference("WGS 1984 UTM Zone 37N")

#Create geodatabase
out_folder_path = raw_input('Enter location to create file geodatabase :')
out_name = raw_input('Enter name of file geodatabase :')
GDB = arcpy.CreateFileGDB_management(out_folder_path, out_name)

#Create feature datasets
out_dataset_path =  GDB
out_name0 = "Data"
fd0 = arcpy.CreateFeatureDataset_management(out_dataset_path, out_name0, sr)

How would one reference this feature dataset created above later on in a script, as an output/input location or to set the env.workspace?

I have tried for example:

arcpy.env.workspace = fd0
points = arcpy.ListFeatureClasses()
print points

This yields an error:

  RuntimeError: Object: Error in accessing environment

To use as an output location I have tried:

    arcpy.ASCII3DToFeatureClass_3d (file,"XYZ", fd0 + "test", "MULTIPOINT", 1,sr,5,"TXT")

This gives the error:

  TypeError: unsupported operand type(s) for +: 'Result' and 'str'


texts: 3D soil profile from borehole information

texts: I wonder what would be the best option if I want to build a 3D soil model in GIS from borehole information? Basically I want to generate several 3D soil layer surfaces. Can everything be done using the 3D Analyst extension of ArcGIS for Desktop, or am I better off using specific add-on programmes like GSI3D (Lithoframe Viewer) and Rockworks?


texts: Change Symbology of no value in ArcGIS Online

texts:
I created web map in ArcGIS Online with point data. I will update one field of attribute which doesn't have any value on it (empty) with random number or text. I just want when I am putting any number or text or both of them for pop up the point change to different color without going to ArcGIS Online and change style and ungroup them to different value with different color?

I think I need to write expression but I am not familiar with arcade expression.

Any hints?


texts: How can I assign multiple classes to a layer in TileMill?

texts: In my TileMill project, I have my-class that is assigned to most of my layers. I also have my-other-class that I want to assign to just a few of those layers. I tried assigning 2 classes using a comma, a semicolon, and a period, but all methods either gave me an error or failed silently. Is it possible to assign multiple classes to a layer?


texts: Plugins: Openlayers and OSM-Download QGIS 3

texts: Where are the Plugins for Downloading OSM-Data and the Openlayer-Plugin (with MORE than OSM). These are the most-importent plugins for me! Gone? Then I go back to QGIS 2 ;(


texts:
I use GWT-Openlayers and i want to add a WMS layer to my Map. Here is the code:

    ...
    MapOptions defaultMapOptions = new MapOptions();
    defaultMapOptions.setNumZoomLevels(7);

    //Create a MapWidget
    MapWidget mapWidget = new MapWidget("700px", "700px", defaultMapOptions);

    GoogleV3Options gSatelliteOptions = new GoogleV3Options();
    gSatelliteOptions.setIsBaseLayer(true);
    gSatelliteOptions.setType(GoogleV3MapType.G_SATELLITE_MAP);
    GoogleV3 gSatellite = new GoogleV3("Google Satellite", gSatelliteOptions);

    mapWidget.getMap().addLayer(gSatellite);

    //Create a WMS layer as base layer
    WMSParams wmsParams = new WMSParams();
    wmsParams.setFormat("image/png");
    wmsParams.setLayers("topp:tasmania_state_boundaries");
    wmsParams.setStyles("");
    wmsParams.setParameter("transparent", "true");

    //create a WMS layer
    WMSOptions wmsLayerParams = new WMSOptions();
    wmsLayerParams.setUntiled();
    wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);
    wmsLayerParams.setIsBaseLayer(false);

    String wmsUrl = "http://demo.opengeo.org/geoserver/wms";

    final WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams,
                                 wmsLayerParams);

    //Add the WMS to the map
    Map map = mapWidget.getMap();
    map.addLayer(wmsLayer);

    //Lets add some default controls to the map
    map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher
    map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap
    map.addControl(new ScaleLine()); //Display the scaleline
    map.addControl(new MousePosition());

    //Center and zoom to a location
    LonLat lonLat = new LonLat(146.7, -41.8);
    lonLat.transform(new Projection(ProjectionCode.LONGLAT.getEpsgCode()).getProjectionCode(),
            map.getProjection()); //transform lonlat to OSM coordinate system
    map.setCenter(lonLat, 6);
    ...

I used the example codes i found on this site:
http://demo.gwt-openlayers.org/gwt_ol_showcase/GwtOpenLayersShowcase.html

Anyone can try out because the wmsUrl points to the demo site.

The problem is that the WMS layer only appears when i zoom out to the outermost zoom level. Than if i try to zoom in, it disappears again. Any idea?


texts:
I am trying to add content to the middle of a string by using MyStr = Mid([MyField], 1, 1)  and I get an error.

I've tried MyStr = Mid([_smallx], 63, 6) and MyStr = Mid(["_smallx"], 63, 6)

The string is a file path totaling 76 characters and I need to add _small at 63 and keep the 13 characters at the end.


texts: Changing Coordinate System of Existing Table in GeoPackage

texts:
While writing some data to a GeoPackage, I set the wrong Coordinate System.
The Actual Coordinates are in a Particular UTM System, but the Table has been set as having data in EPSG:4326.
How do I now change the SRID of the data, without transforming the Coordinates?
I want to do the same thing as Changing SRID of existing data in PostGIS? but for a GeoPackage.


texts:
I am just running an application using OpenLayers. All data is transfered from my database in GEOJSON format. My current task is to review the implementation of the data format. Important characteristics are:

1) Transfered data size - the smallest possible file
2) Speed of drawing on the map - how quickly received file is drawn on a map
3) Possibility to store circles - possibility to define circle feature

Points 1) and 2) are quite obvious. As I am transfering geometries and feature attributes as well, I can event imagine transfering these in separate files if it is beneficial form size and / or speed point of view.

Point 3) is related to GEOJSON limitations - there is no "circle" shape. At first I defined circles as points with radius. The issue is, that "big" circles don't fire click event on the whole area until I increase render buffer attribute. But it significantly decreases peformance. Now I define circles as polygons with many points. Unfortunately it impacts size of the files and the application performance as well in case more circles are on a map.

Please, could anybody advice, from practical experience, which file format(s) is(are) the best from the 3 points listed above?


texts: How do I auto fill the Input Table records for batch processing the Delete Field Tool, in ArcMap?

texts: I have over 500 individual shapefiles that need to have a specific field removed from their tables. In theory I can use the batch option with the Delete Field tool, but adding the Input Table cell for 500+ records is extraordinarily tedious. Is there some way to automate or semi-automate that part of the process? It hardly makes the batch aspect worth it as it seems to work right now.


texts: One large vector layer or many small layers?

texts:
I have a GeoServer that displays some basic country data for Brazil at a course spatial scale (1:1 million). Now the geography institute (IBGE) is making available the topo sheets at 1:250,000 scale, one shapefile for each of the 548 tiles.

In order to store those data in PostGIS and serve via GeoServer, would I be better of merging all topo sheets into one, or is it better to have each sheet as a separate table in PostGIS?

This, of course, considering that there will be no topology issues with the sheets.


texts: No ST_* spatial functions are available in SQLite3

texts:
I'm struggling when using SQLite3 inside a docker container build on this (Ubuntu 20.04 based) GDAL image osgeo/gdal:ubuntu-small-3.2.1.
I have to install sqlite3 first by:
# apt-get install -q sqlite

it went fine:
# sqlite3 --version
3.31.1 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837balt1

But then, for whatever reason, I'm not able to use any spatial function, e.g.:
sqlite> SELECT ST_Buffer(ST_MakePoint(0, 0), 1, 1);
Error: no such function: ST_MakePoint

I also tried to install the spatialite-bin package, hopping they are hidden in there, but it didn't change anything, even if I entered the following into the SQLite3 command line:
sqlite> SELECT load_extension('mod_spatialite');

which results in an empty line. And still no ST_* functions.
Same thing after installing these in a last hope:
librttopo1 is already the newest version (1.1.0-2).
libspatialite-dev is already the newest version (5.0.0-1).
libspatialite7 is already the newest version (5.0.0-1).

How do we get the spatial functions in SQLite3?


texts: Extra conditions in composer controlled by atlas

texts:
I want to create a map series controlled by atlas, but some of my features have very different scales. I want to insert a condition to never use a scale lower than X (for instance: 1:5000). Any idea?

This is the result for one of the maps that zooms too much because it is shown just one point in the map.


texts: Importing attributes from Excel file into new Polygons

texts:
I have a constantly updated Excel file containing address information which I am currently copying into the attributes of new polygons which I am creating on a daily basis. I am currently doing this my manually by copying the address across from the Excel file each time a add a new polygon.

I am looking for a way of automating this process. After producing my polygon I would like a drop down box/ or search function of a unique ID which once selected will fillout the correct attributes by pulling them from the Excel file.

I am new to arcgis 10 and would have previously used the VBA editor to have a go at this (no expert). However, I see that unlike the previous versions there is not longer and VBA editor and has been replaced by python, which I am unfamiliar with. I have also spotted the model builder tool, not sure if this could be used to solve my problem? So really I'm just asking for a point in the right direction.

Is there any scripts available to solve a similar problem which I can modify?


texts: How to add point coordinates to a non geo-referenced csv file?

texts: I have a csv file with information but not georeferenced. I'd like to load it in QGIS and add points (with coordinates) in the same file and later save as a shapefile. Is there any way to doing that or just creating an independent layer with the points and then joining both layers? If that is the case  should I have a common ID to do that. I do not have one. Does the number ID could work on that?


texts: Is there a way to copy virtual fields from one project to another?

texts:
I have a project with several layers, each of which has several quite complex virtual fields in order to analyse a particular site. I'd like to perform a similar analysis of a new site in a new project. Normally, I would copy the old project, delete all the data and then add the new site's data, but on this occasion I've been given some of the first layers in an already existing project.

What I'd like to do, therefore, is copy some of the layers from my old project, including styles and virtual fields, to the new project. Ideally I would just copy the style and virtual fields, but if need be I could copy the whole layer and delete the old data.

Unfortunately, 'Save As...' converts virtual fields to fixed fields and '.qlr' and '.qml' files only save styles. Am I missing something?

I'm using Qgis 2.14.0


texts: ArcGIS, calculating new attribute fields

texts: How can I create a new attribute field which has results based on a simple combination of two other string fields, except when a third field gives a certain result, in which case I would like that result to be the output rather than the combination of the other two fields?


texts: Using CartoDB to detect user location and put dot on map?

texts:
I have a CartoDB question.

We have a project we are piloting in Rio das Pedras, Brazil, a favela near Rio.

We have sampling points, working on adding Fulcrum photo uploads and some pretty bad road linework from a university there, but the labels are helpful for our field team.
http://beh-gis.github.io/maps/rdp_loc.html

For this map, I’m trying to add a GPS dot, that shows where the user is. I grabbed some code from a CartoDB example (http://docs.cartodb.com/tutorials/query_by_distance.html) and it asks the user to use location but seems to Error out or something.

Here’s the html code:
https://github.com/beh-gis/beh-gis.github.com/blob/master/maps/rdp_loc.html


texts: QGis Making Column Value of Attribute table unique

texts:
For a shapefile, I have a field named id with the following contents in it:

1
1
2
2

I want to make these values unique such as:

1
2
3
4

Is there any way to achieve this in Quantum GIS (using any plugin or other means) ?


texts: How to create one shapefile between 2000-2010

texts: I have different deforestation shapefiles for Amazon region for each year 2000, 2001, 2002, 2003 etc. until 2010. I want to create a new shapefile that will show the data just between 2000-2010 in QGIS. Should I just use merge for this to get correct information?


texts: Using Data Driven Page Extents for 2 data frames in ArcPy?

texts:
I have an MXD with two data frames. I want to use Data Driven Pages (DDP) to export this to PDF but have the second of the data frames be one extent ahead. I have the following script to export the two frames with the same extent using DDP. I want to have frame2 be one ahead of the DDP page of the master frame.

Any ideas?

#set map document
mxd = arcpy.mapping.MapDocument("CURRENT")

#set master data frame - dataframe with DDP already applied
masterFrame = arcpy.mapping.ListDataFrames(mxd)

#set second data frame to copy master
frame2 = arcpy.mapping.ListDataFrames(mxd,"New Data Frame")

#for loop to process DDP using number of pages
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
   mxd.dataDrivenPages.currentPageID = pageNum

   #this sets the extent to be the same but I want frame2 to be one ahead, if that makes sense?
   frame2[0].extent = masterFrame[0].extent
   arcpy.mapping.ExportToPDF(mxd, r"C:\Users\user\Desktop\pdffolder\"+ str(pageNum) + '.pdf')


texts: How to share an ArcGIS Online Operations Dashboard with someone outside the organization?

texts:
I am attempting to share an operation dashboard publicly, but when other ArcGIS Online users attempt to view it, they receive an error message that they are not part of the organization.

Here is the organization security (anonymous access allowed):

And here is a screenshot of the Share Dialog when sharing the operations dashboard:

How does an ArcGIS Online user, who is not a member of an organization, authenticate with the organization in order to view the dashboard?


texts: QGIS, Populate field with self-updating formula (like spreadsheet)

texts:
Is there any way (plugin, or otherwise) to put a formula as the value of a field, which would then self-update as the other fields it is based on are adjusted? Exactly the way field-calculator updates the value of the field, but instead of having to go back to field-calculator every time, it could just work like a spreadsheet when the layers it depends on are updated.

For example, if I want to find the number of housing units inside a polygon, I can do something in field calculator like round("Density"*"Area"), but I have to redo it every time I adjust the polygon. When the calculations get more complicated it becomes a real hassle to manually go through and readjust manually.


texts: Spatialite union more than two layers / tables

texts:
Is there a way to union or collect any number of layer geometries with Spatialite (or another spatial database)? Two is simple enough, but more than that becomes convoluted. For example, if all I want is all the geometries of four layers, I need to do:

SELECT ST_Collect(ST_Collect(tbl1.geom, tbl2.geom), ST_Collect(tbl3.geom, tbl4.geom))
FROM tbl1, tbl2, tbl3, tbl4

Is there a function or approach which would allow for something like ST_Collect(tbl1, tbl2, tbl3, tbl4)?


texts: PyQgis: Extracting data using extractbyattribute or executesql: impact on memory usage and gui

texts:
I have written a QGIS (3.12) plugin that uses a loop to extract subsets from an input layer and create a series of new layers in memory (it is preparing species distribution maps). If I extract the data using the native:extractbyattribute algorithm, the loop works perfectly and gives user feedback via a progress bar in the dialog window. However, if I replace that algorithm with native:executesql, there seems to be an impact on memory usage (which doubles) and after a (predictable) number of  iterations round the loop the gui becomes unresponsive (with a 'not responding' tag in the window title), although processing continues correctly and control is returned to the user once the iterations have completed. I want to use an sql query so I can calculate a min() for one field.
Is this behaviour a consequence of the sql query using virtual layers? Is there a way of managing the memory usage of the virtual layers? Is there another way to do this?
I'm running this on Window 10 with 8GB of memory. If anyone is seriously interested, I can supply a copy of the plugin (experimental) and some test data to see if the problem can be reproduced.


texts: How much of a large collection of files is spatial data?

texts:
We need to determine how much of the 6.5 TB used space on a shared network drive is geographic or spatial data. It's a squirrels nest, built up over 3 decades from hundreds of people (though by volume mostly in past 3 years) across all walks of business using a variety of naming and filing standards -- including none and the dreaded "misc".

"Spatial" in this context is anything produced by ArcView 3, ArcInfo, ArcGIS, PCI, ER Mapper, Global Mapper, QGIS, DNR Garmin, Basecamp, MapInfo ...

My plan of the moment is a simple brute force itemization of file extensions, at least to get us some ballpark estimates.

Singular types like shapefiles and ArcInfo grids & coverages are easy as the extensions .shp, .shx, .adf, ... aren't used by anything else.

Shared types like DBase .dbf and images .tif, .jpg, offer complication, though ones larger than 300 MB are very likely spatial.

Before I hack together a personal and idiosyncratic solution. Has anyone solved this already?


texts: ExtJS 4.2 layout crush on latest chrome but not on old one in full screen

texts:
I've noticed that only in chrome my GeoExt app crush when I open many layers.
If I resize the window , the layout seems to look good , once I resize to bigger screen , it mess again.

The app code didn't change for long time , it doesn't happen on old laptop with chrome version 27 it only happens on 2 stronger desktops with latest chrome version.

UPDATE

I've found out that commenting the following CSS in openlayers resolve the problem , Any idea why ?

  /**
 * Animations
 */

      .olLayerGrid .olTileImage {
        /*-webkit-transition: opacity 0.2s linear;*/
        -moz-transition: opacity 0.2s linear;
        -o-transition: opacity 0.2s linear;
        /*transition: opacity 0.2s linear;*/
    }

    /* Turn on GPU support where available */
    .olTileImage {
        /*-webkit-transform: translateZ(0);*/
        -moz-transform: translateZ(0);
        -o-transform: translateZ(0);
        -ms-transform: translateZ(0);
        /*transform: translateZ(0);*/
        /*-webkit-backface-visibility: hidden;*/
        -moz-backface-visibility: hidden;
        -ms-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-perspective: 1000;
        -moz-perspective: 1000;
        -ms-perspective: 1000;
        perspective: 1000;
    }


texts: Why does QGIS convert 'NoData' values to 'Zero'?

texts: I'm trying to convert a clipped multi-spectral sentinel-2 image in QGIS to an 8-bit rendered image in a different CRS. I've clipped the image to the coastline and defined the other unwanted areas of the image as no data values. However, when I save the rendered image, all the no data values are converted to zero, which then causes a problem when I finally convert the image to a single band 8-bit image. All the no data values which have been converted to zero produce a black background around the image, which I don't want. I can't remove the zero values, because there are zero values elsewhere in the image which I require, values representing water, shadow etc... Is there any way to save a rendered image without converting the no data values to zero?


texts: Using zonal statistics in ArcGIS for Desktop?

texts:
I have a set of temporal images of a given State with 23 districts.

When I used ArcGIS for Desktop to generate zonal statistics using the vector file of the State, the pixel counts were tabulated for these 23 districts for different periods.

I am confused to note that the pixel counts were varying between different times.

Can anybody solve my problem?

I can do it in QGIS also if the method is suggested.


texts: How to solve Geoserver editing in QGIS returning read only error?

texts:
After creating a table in Postgis, making it available in Geoserver and then creating the necessary stores and layers, I loaded the resulting WFS file in QGIS.

When trying to populate the features with an edit, I get faced with the following error:

  Could not commit changes to layer teststore:test

  Errors: ERROR: 1 feature(s) not added.
       Provider errors:
        WFS service exception:
            {http://geoserver.org/teststore}test is read-only

I have admin privileges in Geoserver and Postgres, and I haven't found anything resembling a read only restriction.

How to get around this problem?


texts: Batch processing (offset of font marker) in QGIS

texts:
I have a group of layers with type linestring. Every line consists of simple line and marker line (font marker). I have a batch file(csv) with offsets of font markers.

Do you know if there is any function which makes this batch processing (offset of font markers) so I don't have to do it manually? Or it has to be done manually for every line separately? I have QGIS 2.6.1.


texts: PyQGIS export raster layer with resolution instead of size

texts:
file_writer = QgsRasterFileWriter(self.mypath + f'/{self.Name}_2x2DEM.tif')
                pipe = QgsRasterPipe()
                provider = DEMlayer.dataProvider()
                pipe.set(provider.clone())
                file_writer.writeRaster(pipe, 241, 213, DEMlayer.extent(), DEMlayer.crs(),)

For this code here, I hard coded it with 241 in Column, 213 in Rows in order to get 2x2 resolution.
Main problem:
When I try to reuse the code with another GeoTiff image with different size, the resolution is not correct.
Is there anyway to set the horizontal to 2 and vertical to 2 instead of using rows/column?


texts: Are you able to buffer labels to prevent other labels within the buffer area?

texts: I saw a post that talks about label offsets, but that was in 1.7. I did some internet research with no success. Is there a way to apply a buffer area so that labels from another layer are not placed in the buffer area? Otherwise the only option that I can think of is actually moving all labels that are in conflict manually.


texts: How can I stream a WMS/WMTS into Google Earth Engine?

texts: I have created a GEE app and would like to add a button that would allow users to turn on underlying imagery. The imagery is set up in a WMTS. Is there a way I can stream it in (as I do in ArcGIS)?


texts:
I have a problem to use correctly gdaltransform in a C# project to transform a set of coordinates from a crs to another.

If first try in console command and this line is working good

my inpufile contains

11,4110511566842 -16,3912563064512
11,4672071951958 -15,765159743537
10,9408189433189 -15,7659287774418
10,8827231060401 -16,3901294898696

and i get

1224514.39872601 -1804722.76625729 0
1224514.39872601 -1689200.13960789 0
1113194.90793273 -1689200.13960789 0
1113194.90793273 -1804722.76625729 0

This is the code i tryed

First Case process.StartInfo.FileName = "gdaltransform.exe"

System.Diagnostics.Process process = new System.Diagnostics.Process();

process.StartInfo.EnvironmentVariables["PATH"] = fwtoolsPath;
process.StartInfo.EnvironmentVariables["GDAL_DATA"] = ftwtoolsPath.Replace("bin", "data");
process.StartInfo.FileName = "gdaltransform.exe";
process.StartInfo.Arguments = string.Format("-s_srs EPSG:4326 -t_srs EPSG:{0} < {1} > D:/Temp/TempCoordinates/coordinates_output.txt", proj, inpuFileName);
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;

process.Start();
process.WaitForExit(processTimeOut);

In this case the outputfile is not created, no exception catched in code

Second Case process.StartInfo.FileName = "cmd.exe"

System.Diagnostics.Process process = new System.Diagnostics.Process();

process.StartInfo.EnvironmentVariables["PATH"] = fwtoolsPath;
process.StartInfo.EnvironmentVariables["GDAL_DATA"] =    fwtoolsPath.Replace("bin", "data");
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = string.Format("gdaltransform -s_srs EPSG:4326 -t_srs EPSG:{0} < {1} > D:/Temp/TempCoordinates/coordinates_output.txt", proj, inpuFileName);
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;

process.Start();
process.WaitForExit(processTimeOut);

In this case the output file is created but empty, no exception catched in code

Is someone already faced such a problem? do you have an idea about the problem?

I also try to use StandarInput.WriteLine and StandardOutPut.ReadLine() in the process but i didn't succeed. Problem with timeout in StandardOutPut.ReadLine()


texts: How to control polygon colour in hand-crafted Json for ArcGIS Desktop 10.3/10.4?

texts:
An app I'm developing needs to handcraft ESRI JSON to display simple polygons in ArcMap Desktop upon import. I want to specify color/transparency/outlining for the polygons in a layer and ideally different colors for different polygons. (The app does not have access to APIs for this, so it's all done the hard way.)

I've found no documentation for handcrafted JSON but got a few ideas from looking at JSON (Server) examples on the Net, for example drawingInfo/renderer, but haven't been able to get this working. (Maybe drawingInfo is supported by Server but not by Desktop?). I've tried a renderer of type "uniqueValue" without success and have fallen back to trying a renderer of type "simple".

Below, based largely on guesswork, is my attempt. On import into ArcCatalog/ArcMap 10.4, the polygon is displayed but the attempt to specify color and outline was ignored.

{"displayFieldName":"","fieldAliases":{"Name":"Name","Description":"Description","Latitude":"Latitude","Longitude":"Longitude","TriangAccu":"TriangAccu","SatHorWKID":"SatHorWKID","SatVerWKID":"SatVerWKID","GridWKID":"GridWKID"},"geometryType":"esriGeometryPolygon",
 "drawingInfo": {
  "renderer": {
   "type": "simple",
   "symbol": {
      "type": "esriSFS",
      "style": "esriSFSSolid",
      "color": [
       255,
       0,
       0,
       255
      ],
      "outline": {
       "type": "esriSLS",
       "style": "esriSLSSolid",
       "color": [
        0,
        0,
        255,
        255
       ],
       "width": 0.4
      }
     }
  }
  },
"hasZ":"false","spatialReference":{"wkid":"4326","latestWkid":"4326"},"fields":[{"name":"Name","type":"esriFieldTypeString","alias":"Name","length":"45"},{"name":"Description","type":"esriFieldTypeString","alias":"Description","length":"140"},{"name":"Latitude","type":"esriFieldTypeDouble","alias":"Latitude"},{"name":"Longitude","type":"esriFieldTypeDouble","alias":"Longitude"},{"name":"TriangAccu","type":"esriFieldTypeString","alias":"TriangAccu","length":"20"},{"name":"SatHorWKID","type":"esriFieldTypeString","alias":"SatHorWKID","length":"8"},{"name":"SatVerWKID","type":"esriFieldTypeString","alias":"SatVerWKID","length":"8"},{"name":"GridWKID","type":"esriFieldTypeString","alias":"GridWKID","length":"8"}],"features":[{"attributes":{"Name":"North","Description":"","Latitude":"-33.63610000","Longitude":"151.33165000","TriangAccu":"","SatHorWKID":"4326","SatVerWKID":"","GridWKID":""},
"geometry":{
"rings":[[
[151.31426667,-33.64595000],
[151.29100000,-33.64000000],
[151.33166667,-33.58195000],
[151.33365000,-33.64341667],
[151.31426667,-33.64595000]
]]
}}]}


texts: Debugging ERROR 000725 from loop using SearchCursor, SelectLayerByAttribute, and CopyFeatures?

texts:
I am fairly new to python scripting for ArcGIS. I am trying to create maps where each county is selected and then copied into a new layer with only that county's data. Then, I used ApplySymbologyFrom to copy the symbology format from a mock layer. It worked when I ran the code for an individual county, but it doesn't work when I try to use it in a loop statement.

Error details: The code seems to be working up until the loop step. The variables are stored, environment workspace is set, and the current map is being referenced. Cursor variable is stored. When I try to run the code block "for row in cursor" and press enter twice, the program does not have any response besides a new >>> line. There is no error code produced when I run that code block.

Error message from PythonWin run: ExecuteError: Failed to execute. Parameters are not valid. ERROR 000725: Output Feature Class: Dataset T:\HCI\Shapefiles\Inset_Maps\Alameda.shp already exists. Failed to execute (CopyFeatures).

UPDATE: I added the code to delete previous data. Now the new error message is "NameError: name 'row' is not defined"

Here's my code so far:

# Import system modules
import arcpy

# Set workspace
arcpy.env.workspace = r"T:\HCI\Shapefiles\Inset_Maps"
#mxd = arcpy.mapping.MapDocument("CURRENT")
mxd = arcpy.mapping.MapDocument("C:\Users\jchan1\Desktop\Inset_maps_test.mxd")

#background processing was disabled in geoprocessing options in order to access current map
#geoprocessing output overwrite enabled in geoprocessing options
# create local variables
field = "NAME_1"
counties = "Counties_layer"

#remove field delimiters, if needed
arcpy.AddFieldDelimiters(counties,field)

cursor = arcpy.SearchCursor(counties)

for row in cursor:
    whereClause = '"NAME_1" = \'' + row.getValue(field) + "'"
    if arcpy.Exists(row.getValue(field)):
        arcpy.Delete_management(row.getValue(field))
    # Select layer by county name
    arcpy.SelectLayerByAttribute_management(counties,"NEW_SELECTION",whereClause)
    # Write the selected features to a new featureclass
    arcpy.CopyFeatures_management(counties, row.getValue(field))
    # Copy county layer's symbology from sample layer
    arcpy.ApplySymbologyFromLayer_management(row.getValue(field), "dummy")

# export inset image to JPEG
# arcpy.mapping.ExporttoPJEG(mxd,r"file_path_name")

# delete local variables
del row, cursor, mxd

#Refresh screen
arcpy.RefreshTOC()
arcpy.RefreshActiveView()


texts: Update Eastings, Northings of linear feature

texts:
Using QGIS, need to update easting and Northing.

We have a number of rights of way across the National Park, we need them to be updated as far as the centroid of each one.  We also need to know how to update the start and finish of each line.

The co-ordinates of the centre point of each of the linear objects.  In British National Grid (BNG) if at all possible.


texts: Creating multi-colored raster image based on long,lat,color information?

texts:
I want to create a multi-colored raster layer to overlay on my map in OpenLayers

I have the following information in my DataBase:

D_Cell_ID          Long            Lat         ColorCode
055113             121.4698        40.8417     FF6600
057113             121.4698        40.8325     FF6600
.
.
.
063125             121.0344        40.4658     FFCC00
063127             121.0344        40.4567     FFCC00

I would like to have the output something similar like this:Example

Hence I need to write some code to create a raster image based on long,latt,color information.

Do anyone know how to do this or of any library tool which can import into Java environment to do this?

Method and direction is needed.


texts: How to open two projects at once in one QGIS window?

texts:
is it possible to have open two gis projects at once within QGIS? I want to compare the position of points between two different coordinate refercence systems.

nice regards,
jörn


texts: Is it possible to calculate area of polygons from GPS points without POSTGIS

texts:
I am new with GIS.

Assume we use the UTM30N coordinate system.

Is it possible to calculate an area (say a square box) by the 4 given points? (assume the points are in order, and the coordinates are very close to each other.)

Corollary, is it possible to calculate the area of a polygon?

Can this be done without the use of PostGIS?


texts:
I need get the label text for each feature in a points layer.
I can read feature attribute using:

layer = QgsProject.instance().mapLayersByName('layer_name')[0]
features = layer.getFeatures(QgsFeatureRequest())
for f in features:
    attribute=f.['field_name']

but I need the label text (result of a expresion), it's diferent from attribute.


texts: Interpolate values in QGIS attribute table

texts:
I've got a point shapefile of river sonar data. It got only two fields: id and depth. I want to interpolate depth of selected 40 points (arranged by id)  value from 1.49 to 1. Any idea how can I do it with QGIS Field Calculator?

I'm using QGIS 3.10

For now I've got only one lame solution:

1.5 - @row_number/100

I'm sure that more elegant and mathematical approach exists.


texts: Adding Street Names and Labels to QGIS Map as separate layer

texts:
I'm trying to add all the street, river, town (all words in fact) as a separate vector layer in QGIS.

I am looking to extract just the words from a London map as a PDF which I can then change to another font and size in Illustrator. As I have only used layers in QGIS I thought it might be a vector layer.


texts: Null values using Extract values to table with ArcGIS?

texts:
I have a shapefile with rectangular cells that i created with the function "create fishnet" and clipped it with a contour layer.

what i want to do is to add field to the attribute table that takes average values  from a raster based on the cells of my shapefiles.

I created a table with the function "extract values to table" and join it to the attribute table of my shapefile.

the problem is that i have some null values in some cells.


texts: Figure out which coordinate system being used

texts:
I'm working in a project that have no documentation and I'm trying to figure out which coordinate system is being used in their API.
What I know is that they have a coordinate like this:

latitude: -12168371
longitude: -27370165

And this maps to somewhere near this coordinate in the EPSG:4326 system:

latitude:-20.274378
longitude:-45.62233

Is there any service/clue/process that could help me find which coordinate system is being used?


texts: Loading Geoserver Group Layer as tiled map in SharpMap

texts:
I have geoserver and sharpmap and when I add one layer as tiled map it works perfect but when I want to add a group layer which contains several layers it shows nothing. this is my code:

        Mapbox1.Map.Layers.Clear()
    Dim Map As Map = New Map()
    Dim xmlDoc As New XmlDocument()
    xmlDoc.Load("http://192.168.21.29:8080/geoserver/finalCH/wms?SERVICE=WMS&VERSION=1.1.0&REQUEST=getcapabilities&TRANSPARENT=TRUE&TILED=true&srs=EPSG:4326&layer=finalCH:GroupLayer")
    Dim xDoc = Program.ConvertToXDocument(xmlDoc)
    Dim source As List(Of ITileSource)
    source = WmscTileSource.CreateFromWmscCapabilties((xDoc))
    Dim tileSource = source.FirstOrDefault(Function(x) x.Schema.Name = "GroupLayer")
    Dim TileLayer = New TileAsyncLayer(tileSource, "GroupLayer") With {.SRID = 4326}
    TileLayer.OnlyRedrawWhenComplete = True
    Mapbox1.Map.Layers.Add(TileLayer)
    Mapbox1.PanOnClick = True
    Mapbox1.Map.ZoomToExtents()
    Mapbox1.Refresh()

any suggestion?

Edit:
Above code works for a single layer fine, but in geoserver I have several layers which added to a group layer, "GroupLayer".
scale dependency is implemented in SLD files at Geoserver.
The group is in finalCH workspace.
As I know in sharpmap for tiled maps, you should download getcapabilities XML file and sharpmap will do the job with it.
I have no problem to show the GroupLayer as single tile. my code for a single tile layer is different. I'm using SharpMap.WMSLayer for that:

Try
        Mapbox1.Map.Layers.Clear()
        Dim wmsUrl As String = "http://192.168.21.29:8080/geoserver/finalCH/gwc/service/wms?version=1.1.0"
        'Adding Layers and Set Layers Properties
        Dim layWms As New WmsLayer("GroupLayer", wmsUrl)
        layWms.AddLayer("GroupLayer")
        layWms.SetImageFormat("image/png")
        layWms.ContinueOnError = True
        layWms.TimeOut = 50000
        'set projection format
        layWms.SRID = 4326
        'force wms version
        layWms.Version = "1.1.0"
        'add layer to map
        Mapbox1.Map.Layers.Add(layWms)
        Mapbox1.PanOnClick = True
        'set center of map to center of map box
        Dim env = New Envelope(44.0509701, 25.0652748, 63.3556599, 39.796795)
        Mapbox1.Map.ZoomToExtents()
        Mapbox1.Refresh()
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try


texts: Good place to get Country, State, City, and Zipcode information?

texts:
I'd like to populate a database with common location information.

I'm not entirely certain that addresses across the globe have similar or even the same entities as the Country, State, City, and Zipcode that we are so familiar with here in the United States.

Does anyone know of a web service or other method that would be useful for obtaining such data and populating a local database with its contents?

(or conversely just contacting the web service to obtain this information as needed)


texts:
I have an inherently flawed system where we are using old data points (point surveys) set in lat longs and another set (transect surveys for another sp.) whose data was recorded in UTMs.

Is there a quick conversion or easy work around? I mean my GPS obviously uses both but is there like conversion?

Our map provided is in lat long minute decimals so it's just bound to be a headache as we find our multiple sites unless there's an easy converter/conversion I'm missing!


texts: Is it possible that a good spatial index just cannot be made?

texts:
I have about 6 million rows with geography spatial features - they are all 1000 meter radius hexagons all over the US.   There are a couple hundred thousand that would have been NULL, which I updated to "the north pole" so they could be indexed but not show up in my queries (on recommendation from a blog).  I'm trying to find the closest polygons to a point.

I have tried many combos of spatial indexes to no avail.  I run the sp_help_spatial_geography_index and the primary_filter_efficiency is always really low, no more than 15% and usually 3% or less. The odd one is that when it's 15%, if I run it a second time it drops to around 3%.

I have literally been trying for months to index this dataset and I don't know what to do. I've basically just reverted to using all points and use 4-point Lat/Long boxes to search for data instead, but it's kinda slow (2 seconds) - I would have thought Spatial would be faster, but it's 50 times slower.

EDIT - Using SQL 2008 R2. More history: First my data was just all points, and I would make a single radius around the point I was searching to see what points intersected, but that was really slow. I figured spatial indexes on only points aren't very helpful.  So I had a revelation - what if I flipped the problem around - so then I put radius's around ALL the other points and indexed those instead. Then I ask the server to give me all the polygons that intersect the one point.  Unfortunately, that did not help, same performance.

EDIT2 - Show Query using hints:
For this 1 sample. the Policies date filter returns about 90,000 rows instantly. Including the Spatial filter takes anywhere from 500-1200 milliseconds depending on which type of index I use. I need to run this query on about 3,000 cases a day and no matter how much I've tweaked, the whole process still takes about 2 hours to run (All points do not query the same. Some other points take 10+ seconds).

DECLARE @g geography = geography::Point(40.731778, -73.77563, 4326)
DECLARE @DateDue DATETIME = '1/23/2014'
DECLARE @DateReceived DATETIME = '1/16/2014'

SELECT p.IdNumber, g.Radius1000Meters
FROM Policies p  WITH(INDEX(IX_Policies_DateReceived_DateDue))
JOIN GisTable g WITH(INDEX(SPATIAL_GisTable_HHHM16)) ON g.IdNumber = p.IdNumber
WHERE p.DateDue >= @DateReceived AND p.DateReceived <= @DateDue
    AND g.Radius1000Meters.STIntersects(@g) = 1


texts: how to use gdal command inside php exec() function

texts: I need to develop a webportal which will display the images generated by a GIS software package. I my development I need to run gdal command inside php exec() function. but I don't know how to do this.


texts: Print Composer pdf export: map as raster, just text as vector

texts:
Is it possible, to export a print composer map as PDF with all shapes as raster and just the text (embedded) as vector?

My maps use transparency and blending, so I'm forced to export them as raster. Thats okay, if the text would be vector and editable in scribus/inkscape.


texts: How to get next/previous layer in leaflet?

texts:
I want to create buttons to get next/previous layer but i don't know how to build code to make it possible.

var bounds = [[0,0], [2048,2048]];

var floor0 = L.imageOverlay('img/Floor-00-map.png', bounds),
    floor1 = L.imageOverlay('img/Floor-01-map.png', bounds),
    floor2 = L.imageOverlay('img/Floor-02-map.png', bounds),
    floor3 = L.imageOverlay('img/Floor-03-map.png', bounds),
    floor4 = L.imageOverlay('img/Floor-04-map.png', bounds),
    floor5 = L.imageOverlay('img/Floor-05-map.png', bounds),
    floor6 = L.imageOverlay('img/Floor-06-map.png', bounds),
    floor7 = L.imageOverlay('img/Floor-07-map.png', bounds),
    floor8 = L.imageOverlay('img/Floor-08-map.png', bounds),
    floor9 = L.imageOverlay('img/Floor-09-map.png', bounds),
    floor10 = L.imageOverlay('img/Floor-10-map.png', bounds),
    floor11 = L.imageOverlay('img/Floor-11-map.png', bounds),
    floor12 = L.imageOverlay('img/Floor-12-map.png', bounds),
    floor13 = L.imageOverlay('img/Floor-13-map.png', bounds),
    floor14 = L.imageOverlay('img/Floor-14-map.png', bounds),
    floor15 = L.imageOverlay('img/Floor-15-map.png', bounds);

var map = L.map('map', {
    crs: L.CRS.Simple,
    center: [39.73, -104.99],
    minZoom: -1,
    maxZoom: 4,
    layers: floor7,
    fullscreenControl: true,
    fullscreenControlOptions: {
        position: 'topleft'
    }
});

var baseLayers = {
    "Floor +7": floor0,
    "Floor +6": floor1,
    "Floor +5": floor2,
    "Floor +4": floor3,
    "Floor +3": floor4,
    "Floor +2": floor5,
    "Floor +1": floor6,
    "Ground Floor": floor7,
    "Floor -1": floor8,
    "Floor -2": floor9,
    "Floor -3": floor10,
    "Floor -4": floor11,
    "Floor -5": floor12,
    "Floor -6": floor13,
    "Floor -7": floor14,
    "Floor -8": floor15
};

L.control.layers(baseLayers).addTo(map);
map.fitBounds(bounds);


texts: Publishing map service with custom *.stylx symbology using ArcMap?

texts:
I am using custom symbology with ArcGIS map services.

There are some styles available from ESRI called Military Symbology Styles https://solutions.arcgis.com/defense/help/military-symbology-styles/ defined with *.stylx files.

If it is possible to publish a map service both from ArcMap and ArcGIS Pro using the symbology defined in those styles, or are there any specific restrictions?


texts: How to spatial join points attributes to layer with two (or more) overlapping buffers in QGIS?

texts:
I'm working with QGIS 1.8 and I've got 3 layers : 2 points layers, and 1 layer composed of the buffers of one of the points layer.

I'd like to retrieve the informations, for the point layer that isn't buffered, of the buffers.

The problem is that some buffers overlap, and some points of the layer I'd like to spatially join are contained within those overlaps.

How can I get the attributes, in my point layer, of those n buffers ?


texts: authentication error for accessing data product on scihub through wget

texts:
I am new to Sentinel(overall remote sensing domain) and currently trying to download the data products from Scihub using the wget utility on Windows10 machine. However I am getting the below error. I have verified that my credentials are correct by logging in to the Scihub portal separately.

Command:
wget --no-check-certificate --user={*MYUSERNAME*} --password={*MYPASSWORD*} --output-document=query_results.txt "https://scihub.copernicus.eu/dhus/search?q=ingestiondate:[NOW-1DAY TO NOW] AND producttype:SLC&rows=100&start=0&format=json"

Error:
--2018-07-27 14:47:26--  https://scihub.copernicus.eu/dhus/search?q=ingestiondate:[NOW-1DAY%20TO%20NOW]%20AND%20producttype:SLC&rows=100&start=0&format=json

Resolving scihub.copernicus.eu (scihub.copernicus.eu)... 131.176.236.28
Connecting to scihub.copernicus.eu (scihub.copernicus.eu)|131.176.236.28|:443... connected.

HTTP request sent, awaiting response... 401 Unauthorized Authentication selected: Basic realm="Sentinels Scientific Data Hub Search"
Reusing existing connection to scihub.copernicus.eu:443.

HTTP request sent, awaiting response... 401 Unauthorized

Username/Password Authentication Failed.

Can anyone suggest what am I missing here?


texts: How to extend a straight line in postgis?

texts: I have a postgis table of simple linestrings, each one is a straight line with just two points. I want to select every linestring, but extended from both sides by 1 meter. So i have lines, that are longer by 2 meters. How can this be done?


texts: Store an image in PostgreSQL and display it in an OpenLayers popup?

texts:
This is question regarding storing of image in PostgreSQL and display in OpenLayers popup through GeoServer (using WMS service).

PostgreSQL is installed in my virtual machine.

I tried to store image in my spatial table where I added new image column(bytea) then by using following query

update latlong set image = 'c:\\img.jpg' where gid = 1;

I could be able to store image but I think image not stored but its path.

Now when I click on my overlays map then I can see other attributes plus image attribute  also in popup but no image just some encrypted code which I did not be able to understand.

So my first question is that if that's the correct way to store image so that I can get image attribute with image using WMS service by OpenLayers.

and second question if this is not right way then please give me some information how to accomplish that. I want to display image in popup with other attribute by using database which is PostgreSQL. Please if anyone can help I am desperate here...


texts:
I have shapefile with 4000+ points and I would like to display only records that have values greater than zero in a specific column.

How do I stop ArcGIS from displaying all records including those that are null?

I've been trying to use the Display and Symbology options but can't seem to get rid of the points that are null, whatever I do they still show up, just without any color in them! I'm using ArcGIS 10.2.


texts: kde.points SpatialPixelsDataFrame to geojson

texts:
I have a multiple projected spatialpixelsdataframes produced from kde.points() and would like to use it in a leaflet map.
Basically the same as Brunsdon example with the New Haven crime data, except for Denver, CO.

I tried using writeOGR(), and geojson_write(), but both give me the error "Can't convert columns of class: array; column names: kde".

Also tried the From SpatialPixelsDataFrame method from the geojson_write example, but it give an error.

pixelsdf <- suppressWarnings(
    SpatialPixelsDataFrame(points = burg.2015[c("Var1", "Var2")], data = burg.2015))
Error in [.data.frame(x@data, i, j, ..., drop = FALSE) :
  undefined columns selected

Is there a way to export it as is, or would I have to convert the spdf to a different object?


texts: GDAL Creating color ramp gives "ERROR 1: TIFFSetField:Images/out.tif: Cannot modify tag "PhotometricInterpretation" while writing"

texts:
I am receiving a weird error when creating my color ramp using GDAL color options. Here is a working version of my code

import numpy as np
import os
from osgeo import osr, gdal

#Load in and format numpy array
data_array = np.load('concentrations.npy')
data_array = data_array[::-1]
data_array_scaled = np.interp(data_array, (data_array.min(), data_array.max()), (0, 255))
avg = np.float64(data_array_scaled[0,0])
data_array_scaled[data_array_scaled == avg] = 0 #Give no-data pixels value 0

r = data_array_scaled

RES    = 0.025
WIDTH  = data_array_scaled.shape[1]
HEIGHT = data_array_scaled.shape[0]

output_file = "Images/out.tif"

# Create GeoTIFF
driver = gdal.GetDriverByName("GTiff")
dst_ds = driver.Create(output_file, WIDTH, HEIGHT, 1, gdal.GDT_Byte)

# Upper Left x, East-West px resolution, rotation, Upper Left y, rotation, North-South px resolution
dst_ds.SetGeoTransform( [ -180, RES, 0, 90, 0, -RES ] )

# Set CRS
srs = osr.SpatialReference()
srs.SetWellKnownGeogCS("WGS84")
dst_ds.SetProjection( srs.ExportToWkt() )

# Write the band
dst_ds.GetRasterBand(1).SetNoDataValue(0) #optional if no-data transparent
dst_ds.GetRasterBand(1).WriteArray(r)

# Set colour map
band = dst_ds.GetRasterBand(1)
colors = gdal.ColorTable()

# Splits color ramp into 16 different colours (equal-interval)
colors.CreateColorRamp(  1, (253, 227,  30),  16, (212, 226,  27))
colors.CreateColorRamp( 16, (212, 226,  27),  32, (171, 219,  25))
colors.CreateColorRamp( 32, (171, 219,  25),  48, (133, 215,  46))
colors.CreateColorRamp( 48, (133, 215,  46),  64, ( 75, 189,  85))
colors.CreateColorRamp( 64, ( 75, 189,  85),  80, ( 61, 173, 101))
colors.CreateColorRamp( 80, ( 61, 173, 101),  96, ( 31, 168, 109))
colors.CreateColorRamp( 96, ( 31, 168, 109), 112, ( 30, 147, 112))
colors.CreateColorRamp(112, ( 30, 147, 112), 128, ( 28, 123, 125))
colors.CreateColorRamp(128, ( 28, 123, 125), 144, ( 39, 102, 124))
colors.CreateColorRamp(144, ( 39, 102, 124), 160, ( 34,  91, 117))
colors.CreateColorRamp(160, ( 34,  91, 117), 176, ( 46,  79, 121))
colors.CreateColorRamp(176, ( 46,  79, 121), 192, ( 45,  54, 114))
colors.CreateColorRamp(192, ( 45,  54, 114), 208, ( 54,  36, 110))
colors.CreateColorRamp(208, ( 54,  36, 110), 224, ( 54,  25, 100))
colors.CreateColorRamp(224, ( 54,  25, 100), 240, ( 51,   9,  86))
colors.CreateColorRamp(240, ( 51,   9,  86), 255, ( 52,   0,  67))

band.SetRasterColorTable(colors) # Using debugger, I found this is where the Error occurs
band.SetRasterColorInterpretation(gdal.GCI_PaletteIndex)
del band, dst_ds

The code still runs (error isn't fatal) but the resulting tiff is in greyscale. When using a numpy array filled with random values, this error doesn't occur and the resulting tiff is colored according to my colormap. Is there something in my data which could be causing this?

Data Info:

dtype = 'float32'
shape = (7200, 14400)
max = 2.8664365e-06
min = 1.2119261e-06
mean = 2.2154409e-06

Unfortunately I cannot share the actual data file. Any insight? It was working with another numpy array and it works with a randomly generated one but I can't figure out what broke the color ramp from this array.


texts: Problems with Reclassify and RemapRange in ArcPy?

texts:
I'm having a bit of trouble with a script that uses ArcPy. I keep getting the following error:

  ExecuteError: ERROR 000622: Failed to execute (Reclassify). Parameters are not valid.
  ERROR 000628: Cannot set input into parameter remap.

This would seem simple to fix, but I've reached the edge of my knowledge without making headway. The most frustrating thing is that RemapRange isn't throwing any errors at all, so I don't know why Reclassify seems to have a problem with the type of parameter I'm giving it. Relevant portion of my code is below.

# Set the output raster name
out = "MMRWFS__for" + str(forestValue) + "__gra" + str(grassValue) + "__agr" + str(agricultureValue)+ "__dev" + str(developedValue) + ".asc"
            outASCII = "Resistance Surfaces\\" + out

# Set the reclassify ranges
arcpy.CheckOutExtension("Spatial")
reclassifyValues = RemapRange([[11,12,"NODATA"], [21,24,developedValue],[41,43,forestValue],[71,81,grassValue],[82,82,agricultureValue],[90,95,wetlandValue]])

        # 11 Open Water
        # 12 Perennial Ice/Snow
        # 21 Developed, Open Space $
        # 22 Developed, Low Intensity $
        # 23 Developed, Medium Intensity $
        # 24 Developed, High Intensity $
        # 31 Barren Land
        # 41 Deciduous Forest *
        # 42 Evergreen Forest *
        # 43 Mixed Forest *
        # 52 Shrub/Scrub
        # 71 Grassland/Herbaceous **
        # 81 Pasture Hay **
        # 82 Cultivated Crops ***
        # 90 Woody Wetlands 000
        # 95 Emergent Herbaceous Wetlands 000

# PROCESS: Reclassify and Convert to ASCII
print "Creating " + out
arcpy.RasterToASCII_conversion(Reclassify(inRaster, reclassField, reclassifyValues, "NODATA"),env.workspace + "\\" + outASCII)

All the importing, etc. is correct. I'm sure there's something obvious here that I'm just missing as a novice.


texts: Detect one or more rows selected in an attribute table from an add-in

texts:
With ArcGIS Pro SDK 2.5, you can detect that the map selection has changed with the MapSelectionChangedEvent, which also includes selecting one or many rows in the attribute table of a geodatabase that is loaded in a MapView.  I know that I can wire it up like:

private SubscriptionToken eventToken = null;

private void SetupEvents()
{
  eventToken = MapSelectionChangedEvent.Subscribe(OnMapSelectionChangedEvent);
}

private void OnMapSelectionChangedEvent(MapSelectionChangedEventArgs obj)
{
  //do work on the selection
}

I would prefer to isolate the work in the handler to only happen when the geodatabase's attribute table row selection changes, not on all map selections. I haven't been able to find an event that fits this qualification in the sdk.  Does one exist?

EDIT 3/19/2020:  Since it may be unclear what I'm attempting to achieve, the below image has the MapView and the open attribute table.  I would like for the selection of a row in that table to trigger an event in my add-in.  The MapSelectionChangedEvent is far too broad for this purpose, so if there is a SelectionChanged event or the like on the attribute table that I can hook into, that would work.  I cannot seem to find one, though.  I can select something from the add-in and have it show on the map, but I wanted to know if something existed on this built in control.


texts: Filtering out labels surrounding active feature in Atlas

texts:
Let me put it this way, if I’ve tried data-defined rendering and the common  featureid expression and it’s still not working - and I think one or both options should - what basic thing could I be doing wrong?

I am using QGIS version 3.4 to create atlas maps utilizing a polygon coverage layer of 19 watersheds. Everything works fine in layout as I can jump/zoom to each desired watershed map. Furthermore, to filter out features surrounding the active watershed, I've applied symbology with inverted polygons and rule-based sub-renderer with the expression  $id  =  @atlas_featureid. This successfully removes outlying features, but not their labels. The labels are from both polygon and point shapefiles.

I've tried seemingly everything - different types of symbology, various other expressions (which I, admittedly, don't fully understand), old versions of QGIS, a new project using only two shapefiles (using counties to filter out surrounding cities) - but nothing gets rid of the outlying labels. I've got to believe it's something simple I'm doing wrong. What could that be?

BTW, I’ve tried using the mask plugin, but with the same result.


texts: Can you restrict the max bbox or tile size for WMS request in geoserver

texts:
I have a dataset that must contain a watermark that covers a percentage of a rendered image to meet a licensing issue and I'm struggling to ensure this.

Geoserver does not allow me to get it to scale the watermark appropriately (happy to be proven wrong), so the coverage of the watermark is dependant on the size of image requested.  As a work around I hoped I could get the WMS to reject requests that have a bbox larger than a max size suitable for the watermark image, does anyone know of a way to do this out of the box?

While I can set the tile size in our client to match there is nothing someone accessing the WMS directly.

While I'm a java developer by trade I'd much rather I could do this using an existing feature without having to resort to intercepting the requests or modifying geoserver, so if anyone has any suggestions I'd love to hear them.


texts: How to import coincide table of r.coin tool of QGIS in Excel

texts:
I am trying to do a crosstabulation analysis with QGIS. I have used the grass tool r.coin and I have got the coincide report in txt format. However, I want to work with that report in excel, but I don´t know how to import it in excel in a way it keeps the original columns and differentiates between pages, etc.

You can see in the following link how the output table of the tool looks like:
https://grass.osgeo.org/grass70/manuals/r.coin.html


texts: Splitting a Shapefile based off coordinates in Python using osgeo (ogr) or pyshp

texts:
I'm having trouble with splitting a shapefile of all the regions in Mongolia into a smaller shapefile based off some input coordinates.

The big shapefile I'm trying to split can be found here: https://marine.rutgers.edu/~cfree/gis-data/mongolia-gis-data/ under Administrative areas - soum boundaries.

I currently have input coordinates of upper left corner:

  uly, ulx = 47.82259512683848,108.3279267594774

and bottom right corner:

  lry, lrx = 46.85958308337844,109.81664846692111

I've tried importing the shapefile with pyshp and the ogr, and have been having the most success with pyshp, using:

import shapefile
sf = shapefile.Reader('file path')
sf.bbox()

The results of sf.bbox() return [-325212.4151875854, 4620806.467562388, 2096670.9522781507, 5777542.4030963285], and I've been trying to find out what projection this is in, I haven't found a clear way to do this with pyshp.

Once I've worked out the current projection of the shapefile and reprojected it into lat/long coordinates, I then need to split it to get rid of everything outside the lat/long coordinates described above.

I've tried to split it so far using the following code, but this produced a shapefile containing nothing.

w = shapefile.Writer(sf.shapeType)
for i in sf.iterShapeRecords():
    geom = i.shape
    rec = i.record
    sxmin, symin, sxmax, symax = geom.bbox
    if sxmin < ulx: continue
    elif sxmax > lrx: continue
    elif symin < uly: continue
    elif symax > lry: continue
    w._shapes.append(geom)
    w.records.append(rec)
w.save('Local File')

I can try to provide more details if required.


texts: Switch between raw field values and displayed values in the attribute table?

texts: When working with the attribute forms value map or value relation i have found no way to switch between raw field values and displayed values in the attribute table (neither in the project properties nor in the program options). Is there any?


texts: Is there a specific tool to globally manage visibility/theme in QGIS?

texts:
In short : I'm looking for a Visibility Manager (QGIS 2.18) ou Theme Manager (3.0).

I couldn't find it in the QGIS plugin list or in different methods on gis.stack. Maybe I missed it and maybe it hasn't been invented yet. I'm not looking for a dev to do it for me (altought you're welcome if you like the challenge ;) ), i'm just seeking information on the subject for the moment.

Explanation

I use a lot visibility settings. Some examples =

historical data atlas where geometry doesn't change but where i loop across multiple raster and shapefiles on the same area with a field in the coverage table where I put my visibility setting name (Historical_1950, Historical_1960, etc.)
polluted soils sample analysis point classification and combinaison (Parameter_1_From_0to1m, Parameter_1_From1to2m, etc.)
flooding atlas with multiples scenarios, areas, and flood levels.

Below a full example for flood maps settings (sorry it's in french but the example should be understandable), in the map window, in the composer windows and the source in Excel, where I keep all the settings:

Now, I'd like to go further and be ableto create an automated list of settings from an Excel sheet with visibility/theme names depending on a set of vector and shapefiles with data defined filters.

what I'm looking for

My dream tool would be a dialog with the list of layers associated with a Theme/visibility setting. It would be possible to modify a setting easier, import or export a set of configuration, maybe change it in Excel for example, instead of click/replacing themes when something changes.

Example : I have 600 A0 sheets set up in ~52 visibility settings and my client wants to see a new layer on all maps. I'll have to activate the setting, click on the new layer to activate it, then go into the visiblity menu and replace the current setting... for all of them. It's a very annoying task, and I might do some mistakes.

Does this exists ? If not where should I seek to automate those settings edition ?


texts: How to execute a GRASS module developed in Python?

texts:
I am following the FOSS4G-E 2015 tutorial on how to develop GRASS modules with Python. The minimum template given in this tutorial is this script:

%%file r.viewshed.points.py
#!/usr/bin/env python

#%module
#% description: Compute and analyze viewsheds
#% keyword: raster
#% keyword: viewshed
#%end

import grass.script as gscript

def main():
    gscript.parser()

if __name__ == '__main__':
    main()

Which at face value looks pretty ok. However, when I try to run it I get a strange message, and GRASS hangs up:

GRASS 7.2.0 (nc_spm_08_grass7):~/git/python-grass-addon > ./r.viewshed.points.py --help
./r.viewshed.points.py: line 1: fg: no job control

What is the exact way of executing this template module?


texts: How to create multiple QGIS layers from multiple text files?

texts:
I have a few hundred txt files (each representing a line of a river bed profile) that I need to load as (point-) layers in QGIS. Partial example:

4504764.8331;5374251.3024;397.8871;2
4504764.7761;5374250.8056;397.8555;2
4504764.7191;5374250.3089;397.8295;2
4504764.6621;5374249.8121;397.8149;2
4504764.6051;5374249.3154;397.7977;2
4504764.5481;5374248.8186;397.7725;2

It works manually (layer -> add delimited text layer, then renaming the columns after import) but given the volume I can't do it all by hand.

I found a similar two year old question here: How to import multiple textfiles in one step , but "create a plain text file called .vrt file for each of csv files" doesn't sound so peachy. The files are also missing the header line, but I know the format: "X; Y; Z; classification".

Is there any way to do this without having to code up a text generator for those vrt files and inserting header lines into all csvs?


texts: pdal tile to generate TIFFs without seams

texts:
I'm using a pdal tile command like the one below.  This works, and creates tiles of Z dimension in a TIFF.  However, the edges of each tile create a seam (seen below).
I tried setting the buffer to 1 but that had no effect.  It seems logical that the cause is because the points are clipped while streamed before determining the mean value vs. instead using a buffer into the neighboring tiles to get that mean before the clipping, just guessing.
The goal is to take about 8500 LAS files and tile them into TIFFs of various kinds.
4 las files
docker run --rm -v ~/:/data pdal/pdal pdal tile "/data/las-demo/*.las" "/data/las-demo/outfile_#.tif" --writers.gdal.resolution=1 --buffer=1


texts: How to use affine transform parameters in a PROJ or WKT2 string

texts:
Can anyone show me how I can construct a PROJ or WKT2 string with affine transformation parameters to create a custom CRS in QGIS?
I wish to use the following affine transformation parameters to convert UTM28N-WGS84 coordinates to a local coordinate system:
Translation x-axis: 592643.28732299805
Translation y-axis: -1507351.9635620117
Rotation around z-axis (degrees counter clockwise): 50.0636222
I have used these parameters to successfully transform a vector file using QGIS 'Vector geometry>Affine transformation' tool but I would like to define a custom CRS using these parameters.


texts: Selecting points/buffers by location according to vector area value?

texts:
I am trying to select buffers "touching" a vector layer with a specific value. This vector layer comes from a categorized raster with values of 0 to 6.

How can I select buffers that "touch" or intersect with this vector layer where the value is equal to x?

Here is an example of the vector layer with values of 4 (yellow), 5 (orange) and 6 (red). How can I select buffers contained only in 6 (red) for example?


texts: I am new to QGIS.  I have a map with known coordinate points.  How can I manually enter these points and then export this map as a .tfw??


texts: How can I write in really big font size using a QGIS html box?

texts:
I'm making a map that needs to combine different fonts and different types (italic, bold) in the same line.

The QGIS text box can let me style the box using more conventional cartographic properties, but I can't mix fonts and types.

Using the HTML box, I have complete control over font and types, but the size can't go beyond HTML size 7. Anything larger than 7 doesn't have any affect on the output.

my amazing text

How can this be achieved? I need a font size equivalent to 120 pt.


texts: Transforming zonal and meridional velocity from regular lat lon to rotated lat lon?

texts:
Like in Transforming regular lat/lon to rotated lat/lon? that was asked before, I am working with climate data and I need to transform zonal and meridional velocities (u and v) from regular  lat lon to rotated lat lon.

What more do I need to for transforming zonal and meridional velocities than what was done for position ?

As input I have been given velocities(zonal and meridional) in the geographical coordinate system, latitude and longitude of rotated lat lon grid and the latitude and longitude of a point in the geographical coordinate system.

Does the wind vector pair need to be transformed together?


texts: Erasing small polygon which is overlaid by bigger polygon?

texts:
There is a huge recreation area but inside this recreation area there is some other zoning.

I finished creating all polygons but this recreation area polygon overlaps with the small zoning polygons within the same area.

What tool can I use to cut out the small zoning polygons from this big polygon?

I cannot use the erase tool as I don't have the license.

I am using ArcGIS Pro as well, which is really confusing since I just started using it.


texts: Saving default layer name to spatialite/geopackage table?

texts:
I'm a huge fan of being able to save default symbology to spatialite/geopackage tables, however, I don't like that when I import a table as a layer it takes on the name "database name table_name".

Is there a way of giving tables a default display name so that instead of it being called "database name table_name" it would be called "Default Display Name" instead when it is added to QGIS?


texts: Why is a ST_Union within same table slow - shouldn't it be instant?

texts:
I'm working in Postgres 9.6. I have a table that looks like this:

 gid        | integer                     | not null default nextval('usgovt_gid_seq'::regclass)
 category   | character varying(12)       |
 geom       | geometry(MultiPolygon,5070) |
Indexes:
    "usgovt_pkey" PRIMARY KEY, btree (gid)
    "ix_usgovt_category" btree (category)
    "usgovt_geom_idx" gist (geom)

I want to retrieve the union of every polygon with a category of 1:

SELECT ST_Union(geom) AS geom
FROM usgovt
WHERE category='1'
GROUP BY category;

However this query is EXTREMELY slow (half an hour and hasn't finished yet), and this is on a reasonably powerful machine, and I've tweaked Postgres's memory settings etc.

Why is this slow? Shouldn't it be instant? Since this is a single table, presumably the polygons can't overlap, so it's pretty much just an additive operation. PostGIS just needs to add them together to make a single large MultiPolygon.

Or perhaps polygons can overlap within a table? If so, is there some way to tell PostGIS that these polygons don't overlap, so it can just add them together?


texts: Is there ArcGIS Symbol Library PDF for ArcGIS Desktop i.e. index for symbols/line weights?

texts: ESRI has an old set of PDFs from 2004 showing all the symbols available in ArcGIS at the time and their names. I don't need it often but if I'm searching for a certain symbol and don't know its name it's sometimes easier to look at a few sheets of paper than to use the Symbol Selector. It doesn't seem like it's been updated for ArcGIS 10, though. I was wondering if anyone is aware of a new version of this, or if anyone has created one on their own they might be willing to share.


texts: County-Level Ethnic Shapefile: United States

texts:
My professor usually provides the shapefiles that we deal with in our analyses of the United States--population, votes, etc., but I'd like to know how I can get these myself. I'd like, in particular, a shapefile with ethnic data listing the percent with respect to total population. I'm new to this, so keep that in mind.

I'd like to make an overlay of these data with the data in the above county-level population map of the United States to make an interesting comparison with another overlay of the 2012 presidential election results.