texts: scale dependent rendering of base layers(gmap,ghyb) causes warping/flickering

texts:
Hey guys I am using geoserver to host my WMS layers and I am using gmaps base layers in Openlayers. Below I have attempted to use scale dependent rendering of the base layer without any luck.
 What I am trying to do is once the user zooms past a certain level, Google's hybrid map will turn off and Google's aerial will turn on.....With the code I have now it will turn on and off but it tends to warp the base map or flicker. Not sure whats going on.

            /*map.events.on({ "zoomend": function (e) {
            if (this.getZoom() > 16) {
              gmap.setVisibility(false);
              ghyb.setVisibility(true);
            }
            else {
              gmap.setVisibility(false);
              ghyb.setVisibility(true);
            }
          }
        });*/


texts: Raster analysis , Proximity (raster distance)

texts:
This is my first message here. I am trying to create a proximity map with the Raster analysis tool. My problem is that I only get two options for distance units , pixels coordinates and georeferenced coordinates while I want to get them in meters.

I also used the grass tool , r.grow.distance that provides in advanced parameters the option "Output distances in meters instead of map units" If i check this option i get the following error ERROR: Raster map or group not found.

Does any of you know any workaround for this?

I am using QGiS 3.8.1 with GRASS 7.6.1


texts: Fixing colors of LISA Cluster maps from Pysal?

texts:
I am using the LISA Cluster package from Pysal to create a LISA (Local Indicator of Spatial Autocorrelation) map.

As the example of the documentation shows, the color lightblue is used to identify regions classified as "Low-High"

The problem is that, when I generate a map, that does not have a region in  each of the 4 categories (HH, HL, LH, LL) the color attributed to the existent categories is changed, creating a problem to compare different maps:

In the Figure above, there is no regions classified as HL, so the color orange was atributed to LH, instead of lightblue.

How can I fix the colors, so LH will always be lightblue and so the others?


texts: Extract single datapoint from netCDF file in R using ndcf

texts:
I'm trying to extract a single variable from a 3-dimensional netCDF file.

[1] "file blah.nc has 3 dimensions:"
[1] "longitude   Size: 200"
[1] "latitude   Size: 100"
[1] "time   Size: 2000"
[1] "------------------------"
[1] "file blah.nc has 1 variables:"
[1] "short temp[longitude,latitude,time]  Longname:temperature Missval:-9999"

Time's units are "days". I just want to get a single day in the middle of the dataset at time=t1 say. The manual seems to indicate that I should temp1 = get.var.ncdf(blah.nc, "temp", start=c(long1, lat1, t1)), but this gets all temperatures for all longs and lats until the ends of the arrays. I don't want to read the entire variable and then extract the desired value in R, I want the ncdf library to do it. get.var.ncdf doesn't take a end=c(long1+1, lat1+1, t1+1) argument as far as I can tell? So, how can I do this using ncdf?


texts: Adding Polygon to shapefile of particular area from Excel?

texts:
I have Excel data in which polygon number is given, in correspondence to that there is particular Area given. I have 5000 to these entries.
Now in the shape file, we have to edit every polygon and add area to it by cuting the polygon in two, one of which can be added by dividing area from one of the length from polygon and drawing new one (Shown in green marking)and have to give new attributes to it from ecxel by copy pasting(Shown in red circle)
As it is a repetitive process. I was exploring if there is a way i can use this excel data with python code and all the attributes get edit in shape file at once.

Basically I want to automate this.


texts: classFactory error when using QGIS Plugin Reloader

texts:
I am developing a QGIS plugin that loads perfectly fine when I open QGIS. I installed the "plugin reloader" plugin to facilitate development. However, when I reload the plugin via the reloader I get the following error:

  Couldn't load plugin TDGAlgorithmProviderPlugin due to an error when calling its classFactory() method

The accompanying trace is:

  Traceback (most recent call last): File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 219, in startPlugin
      plugins[packageName] = package.classFactory(iface)
  AttributeError: 'module' object has no attribute 'classFactory'

Is this a bug in the plugin reloader, or a problem with my plugin? Since it's loading just fine when QGIS starts I can't think of what I would need to do to make it compatible with the plugin reloader.


texts:
I am writing Python Addins for ArcGIS. I call a Python Toolbox, the Addin tool only works once in ArcCatalog when picked. If you pick it again nothing happens.

import arcpy
import pythonaddins
import os

 class OreconDBtoArcGISTool(object):
     def __init__(self):
         self.enabled = True
         self.checked = False

     def onClick(self):

        toolboxName = "OreconDB_Toolbox"
        toolName = "OreconDBtoArcGISTool"
        relPath = os.path.dirname(__file__)
        pyt = relPath + os.sep + toolboxName + ".pyt"
        pythonaddins.GPToolDialog(pyt, toolName)

If I close and restart ArcCatalog the tool will work one more time again. Any Ideas on how to fix this would be appreciated.


texts: Can't download semi-automatic classifications plugin

texts:
In QGIS 3, tried to download emi-automatic classifications plugin but get the following error message:

Couldn't load plugin 'SemiAutomaticClassificationPlugin' due to an error when calling its classFactory() method

ModuleNotFoundError: No module named 'matplotlib'
Traceback (most recent call last):
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 335, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/Users/x/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/init.py", line 65, in classFactory
    from .semiautomaticclassificationplugin import SemiAutomaticClassificationPlugin
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 672, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/x/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/semiautomaticclassificationplugin.py", line 74, in
    from .ui.semiautomaticclassificationplugindialog import SemiAutomaticClassificationPluginDialog
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 672, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/x/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/ui/semiautomaticclassificationplugindialog.py", line 39, in
    from .ui_semiautomaticclassificationplugin_scatter_plot import Ui_ScatterPlot
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 672, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/x/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/ui/ui_semiautomaticclassificationplugin_scatter_plot.py", line 453, in
    from .scatterwidget2 import ScatterWidget2
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 672, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/x/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/ui/scatterwidget2.py", line 39, in
    import matplotlib
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 672, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'matplotlib'

Python version: 3.6.8 (v3.6.8:3c6b436a57, Dec 24 2018, 02:04:31) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
QGIS version: 3.4.5-Madeira Madeira, exported

Python Path:
* /Applications/QGIS3.app/Contents/MacOS/../Resources/python
* /Users/x/Library/Application Support/QGIS/QGIS3/profiles/default/python
* /Users/x/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
* /Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins
* /Library/Frameworks/SQLite3.framework/Versions/E/Python/3.6
* /Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip
* /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6
* /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload
* /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
* /Users/x/Library/Application Support/QGIS/QGIS3/profiles/default/python
* /Users/x/Documents/mac Geology/geol Argentina/QGIS projects

Then I tried again (perhaps after re-booting my mac, don't remember) and was able to download. Closed QGIS 3, re-opened it,  checked in the "manage and install plugins" section under " installed" that it is listed and ticked, indicating that it is installed. But can't find where to access it .

What's going on ?


texts: Hibernate spatial intersects() over antimeridian

texts:
I have a DB full of objects that contain a location (usually a polygon).  I have a query defined that uses Hibernate Spatial's intersects() method to find all the objects that are with a box that's passed in (using SRID 4326, so it has lat/long coordinates).

The problem I'm having is that if the box contains the antimeridian it returns the objects as though the box was wrapped around the world, not the antimeridian.

For example: if I have a box with the top left (long, lat) coordinate of (170, 50), and a bottom right coordinate of (-170, 30), it treats it as though the top left coordinate is (-170, 50) and the bottom right coordinate is (170, 30).

How can I tell it that it should wrap around the antimeridian so that it returns the correct objects?


texts: How to load postgis layer to map control with mapwingis?

texts:
I search over the internet but couldnt find out the resolution.
I create GIS app with MapWinGIS library, I have some spatial table in PostgreSQL (table with geometry column). I want to load these table as shapefile to map control. Is there any way to do that ?

Thank all.


texts: Map generation when it is already in JPEG format

texts: I got maps in JPEG format but I need some information to be added in it. I can't start editing in JPEG format. If there is any other procedure to add other features into it. Then please let me know.


texts:
Manually in the PythonConsole I can open or close panels but when is executed in code it won't find the dockwidget, this is the line I'm using in my code:

self.iface.mainWindow().findChild(QDockWidget,'PythonConsole').setVisible(True)

and this one works in the PythonConsole:

iface.mainWindow().findChild(QDockWidget,'PythonConsole').setVisible(True)

it is supposed to work but give the error "NoneType" object has no attribute "setVisible" when executed in the code...


texts:
The map in which i am building will be used by an Emergency backup 911 system. I am plotting addresses from a csv file and geocoding with google. To do a test I did 100 addresses in a town I am very familiar with (I grew up there). The addresses in which i plotted are way off from where they should be. For instance an address in the 600 block in this town is plotting on the map in the 1000 block. Again I am geocoding it from Google. Information I have looks like this of course with actual real addresses names ect.
Address      City        Zip          Name
600 Main       Anywhere    99999        Jane Doe

These addresses need to be almost spot on.


texts: Exporting map canvas to PNG file using custom plugin created by Plugin Builder

texts: I'm making a complement for QGIS3, how can I export the map I'm seeing in the window to .PNG using Plugin Builder. Without having to go through Print Composers.


texts: Qgis mapserver - Can it use plugins you use in qgis desktop?

texts: Im thinking about developing a small python plugin for qgis which would access postgis raster database and return data via ST_AsPNG() for example. But since i need this in my wms, would it be possible for mapserver executable to also use this plugin, because the plugin would be used in the project file to fetch the data?


texts: Fixing headings for QGIS custom widgets in Qt Designer

texts:
I use custom Qt widgets like QgsMapLayerComboBox for my QGIS plugin, laying the whole thing out in Qt Designer. Using those requires fixing headings in .ui file as described here. Unfortunately I have to fix headers every time I save my .ui file.

So the question is: is it possible to make Qt Designer reference qgis.gui headers by default?


texts:
I want to edit the shape of a line segment using the calculate field. This runs during an edit session, but don't run without.

How can I turn on edit inside a model and the turn it of after the calculate field operation?

The calculate field for the SHAPE@ turns and extends multiple line segments.


texts:
I've been developing a plugin for Qgis, but something weird happend while renaming a layer, now whenever i add a layer using a button in my plugin, the layer is renamed with the last name I gave it. I'll explain it using an example.

The plugin creates a buffer around some points and creates a temporary layer to store these buffers. I programmed the buffer_layer to have the name 'buffer_{}'.format(current user) (where current_user is a variable which I tested to be right).
When the layer is loaded however, it will have the name "Buffers". I remember changing the name once to Buffers, and it seems as if Qgis remembers this change and applies it to all layers created by the plugin.
I can change the name of the layer using right mouse click > rename and rename it to 'testname' and delete it afterwards. If I then add a new buffer layer using the plugin, the layer will have the name 'testname'.

This keeps happening.

I'm on OS X El Capitan, using Qgis 2.12 Lyon.

Added code

def calculateBuffer(self):

    proj = QgsProject.instance()
    cur_user = self.SelectUserGroupCombo.currentText()
    # The current user is selected using a drop down menu.
    radius = proj.readNumEntry("SpatialDecisionDockWidget", "radius")[0]
    transittypes = proj.readEntry("SpatialDecisionDockWidget", "transittypes")[0]

    uf.selectFeaturesByExpression(self.getSelectedLayer(),"network in {}".format(transittypes))
    origins = self.getSelectedLayer().selectedFeatures()
    layer = self.getSelectedLayer()

    if origins > 0:
        cutoff_distance = radius
        buffers = {}
        for point in origins:
            geom = point.geometry()
            buffers[point.id()] = geom.buffer(cutoff_distance,12)
        # store the buffer results in temporary layer called "Buffers_[cur_user]"
        buffer_layer = uf.getLegendLayerByName(self.iface, 'Buffers_{}'.format(cur_user))
        # create one if it doesn't exist
        if not buffer_layer:
            attribs = ['id', 'distance', 'network']
            types = [QtCore.QVariant.String, QtCore.QVariant.Double, QtCore.QVariant.String]
            buffer_layer = uf.createTempLayer('Buffers_{}'.format(cur_user),'POLYGON',layer.crs().postgisSrid(), attribs, types)

The layer is renamed here!

            buffer_layer.setLayerName('Buffers_{}'.format(cur_user))
            uf.loadTempLayer(buffer_layer)
        # insert buffer polygons
        geoms = [] # geometries in a list
        values = [] #list of lists, consisting of 3 items. E.g. [[0L, 1200, 1],[...

        fld_values = uf.getFieldValues(layer, 'network', True,"network in {}".format(transittypes))[0]
        cnt = 0

        for buffer in buffers.iteritems():
            # each buffer has an id and a geometry
            geoms.append(buffer[1])
            # in the case of values, it expects a list of multiple values in each item - list of lists
            values.append([buffer[0],cutoff_distance, fld_values[cnt]])
            cnt += 1

        uf.insertTempFeatures(buffer_layer, geoms, values)
        self.refreshCanvas(buffer_layer)
        layer.removeSelection()

I just thought of a better way to describe this, it is as if qgis overrides the layer name with the name I've given to another when I renamed it. It is as if it remembers the renaming and overwrites the layer name with the 'remembered name'.


texts: Label polygon at central position dynamically

texts:
Does GeoServer have a way to display polygon's labels, in a centralized way and moving it to the center of displayed polygon at that "screen moment", dynamically?

I'm trying to make labels visible, always in the polygon's centralized position, independent of the zoom level and the screen position related to the polygon's itself:

.

Here's the code:

   <TextSymbolizer>
      <Geometry>
        <ogc:Function name="centroid">
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        </ogc:Function>
      </Geometry>
     <Label>
       <ogc:PropertyName>Nome_V2</ogc:PropertyName>
     </Label>
     <Halo>
       <Radius>1.5</Radius>
       <Fill>
         <CssParameter name="fill">#ffffff</CssParameter>
       </Fill>
     </Halo>
     <Font>
       <CssParameter name="font-family">Arial</CssParameter>
       <CssParameter name="font-size">10</CssParameter>
       <CssParameter name="font-style">normal</CssParameter>
       <CssParameter name="font-weight">bold</CssParameter>
     </Font>
     <LabelPlacement>
       <PointPlacement>
         <AnchorPoint>
           <AnchorPointX>0.5</AnchorPointX>
           <AnchorPointY>0.5</AnchorPointY>
         </AnchorPoint>
       </PointPlacement>
     </LabelPlacement>
     <Fill>
       <CssParameter name="fill">#000000</CssParameter>
     </Fill>
     <VendorOption name="autoWrap">60</VendorOption>
     <VendorOption name="maxDisplacement">150</VendorOption>
   </TextSymbolizer>


texts: Is there an international standard with GIS symbols for power distribution objects?

texts: I'm wondering if there is a standard that points out symbols for power distribution objects, power plants etc...


texts: Transforming Lambert Conformal Conic to EPSG:3857

texts:
I have a map file in a tiff format that is not geo-referenced, but I know the following projection information: +proj=lcc +lon_0=10.856 +lat_0=51.322 +lat_1=42 +lat_2=57 +datum=WGS84. I would like to transform it into EPSG:3857.

In my first attempt I tried to fix four arbitrary points and perform warping

gdal_translate -a_srs "+proj=lcc +lon_0=10.856 +lat_0=51.322 +lat_1=42 +lat_2=57 +datum=WGS84" -of GTiff -gcp 19725 11865 1 56 -gcp 103755 12990 23 56 -gcp 112755 80400 23 46 -gcp 8925 78990 1 46 original.tif translated.tif

But the coordinates of the corners of the warped image where not as expected and the map was distorted.

Corner Coordinates:
Upper Left  ( 1208480.629, 6678543.890) ( 10d51'21.48"E, 51d19'21.08"N)
Lower Left  ( 1208480.629, 6678541.123) ( 10d51'21.48"E, 51d19'21.03"N)
Upper Right ( 1208486.180, 6678543.890) ( 10d51'21.66"E, 51d19'21.08"N)
Lower Right ( 1208486.180, 6678541.123) ( 10d51'21.66"E, 51d19'21.03"N)
Center      ( 1208483.404, 6678542.507) ( 10d51'21.57"E, 51d19'21.06"N)

After reading many posts, here and elsewhere, I came to this:

Converting the UL and LR corners to x and y

cs2cs +proj=latlong +lon_0=10.856 +lat_0=51.322 +lat_1=42 +lat_2=57 +datum=WGS84 +to +init=epsg:3857

-3.63 57.28 >   -404089.75 7817564.89
23.76 44.39 >   2644951.10 5525995.28

Geo-referencing the tiff

gdal_translate -a_srs "+proj=lcc +lon_0=10.856 +lat_0=51.322 +lat_1=42 +lat_2=57 +datum=WGS84" -a_ullr -404089.75 7817564.89 2644951.10 5525995.28 original.tif translated.tif

The result of gdalinfo translated.tif is as follows:

Size is 14735, 11333
Coordinate System is:
PROJCS["unnamed",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",42],
    PARAMETER["standard_parallel_2",57],
    PARAMETER["latitude_of_origin",51.322],
    PARAMETER["central_meridian",10.856],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-404089.750000000000000,7817564.889999999664724)
Pixel Size = (206.925066168985410,-202.203265684284787)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  TIFFTAG_XRESOLUTION=144
  TIFFTAG_YRESOLUTION=144
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  ( -404089.750, 7817564.890) (146d18'53.31"E, 73d27'53.56"N)
Lower Left  ( -404089.750, 5525995.280) (158d45'33.92"W, 88d 1'24.64"N)
Upper Right ( 2644951.100, 7817564.890) (172d26'19.88"W, 64d26'59.68"N)
Lower Right ( 2644951.100, 5525995.280) (138d13'57.20"E, 73d22'12.76"N)
Center      ( 1120430.675, 6671780.085) (161d52'17.63"W, 79d37'35.75"N)

However, the coordinates of the corners above are completely off. When I attempted to warp it, the image could become so huge that I had to stop the process after a couple of minutes.

gdalwarp -overwrite -t_srs EPSG:3857 -r near -co COMPRESS=LZW translated.tif warped.tif

The result of gdalinfo warped.tif is as follows:

Corner Coordinates:
Upper Left  (-20037508.339,29704755.766) (180d 0' 0.00"W, 88d54'44.28"N)
Lower Left  (-20037508.339, 9464937.842) (180d 0' 0.00"W, 64d26'59.58"N)
Upper Right (20037503.600,29704755.766) (179d59'59.85"E, 88d54'44.28"N)
Lower Right (20037503.600, 9464937.842) (179d59'59.85"E, 64d26'59.58"N)
Center      (      -2.370,19584846.804) (  0d 0' 0.08"W, 84d41'15.52"N)

What did I miss?


texts: Are there any city boundaries of UK cities in the Ordnance Survey?


texts: Raster stack different extent for same site?

texts:
I have rasters for the same area (same polygon) but I am not sure why they have different extent. I had an supervised classified layer of the initial DEM and secondary variables that do not match the extent of the source. I georeferenced one of the layers so the different extent makes sense but now I need to match the extent of 60+ rasters to the original raster. I saw online posts for Alignraster in R and read through multiple forums with their script in R but their issue is a bit different than mine since my layers are all the same area, same site, shape etc. but are slightly offset.
Theoretically, what approach would you recommend to batch process or loop through the stack?


texts: How to set different style and name for each feature individually OpenLayers

texts:
I am trying to style each feature with different style and set properties like name dynamically  like in
this but all features get the same style
the code
select.getFeatures().on(['add'], function (e) {
        var feature = e.element;
  let styleNew =

      new Style({
        stroke: new Stroke({
          color: color,
          width: 7,
        }),
      });

  let x=  feature.setStyle(styleNew);
  const newStyle = feature.getProperties();
    feature.setProperties({ name: name });
    })


texts: minidump error message With A lots of layer (shp file)

texts:
I'm newbie in GIS or QGIS. I want to create mapweb, Map has a lot of layers (shp files) about 40 layers. I used QGIS2web to create map web. When I add some layers, it was no problem, but when I tried to add all of my layers, I got error minidump error.

What should I do?


texts:
I'm trying to open (vector) layer properties in QGIS 2.2.0 and 2.4.0 (Windows 8.1) and nothing is happening. The application freezes and not responding at all (requires cntrl+alt+delete to close).
I have tried:

Reinstalling the app
Deleting .qgis2 folder
CLose (and open) the Layers panel
Removing all the plugins

...nothing helps.
Does anyone have a solution?


texts:
I'm trying to change the Leaflet default Icon; in my script I set
L.Icon.Default.prototype.options.iconUrl = 'Point.png';

The .png file is in the same folder than my script file but I get a broken image icon, the .png is not found.
How can I specify the right .png location ?


texts: Why slope tiff image produced with QGIS does not show properly in paint?

texts: So I have this slope tiff image that I created using a DEM reprojected in meters. When I view it in QGIS, it shows fine. If I try to edit the picture in paint or Gimp afterwards, I dont see the same as in QGIS. What the cause of this? I have also produced a Hillshade tiff image and it works fine both in QGIS and in paint or Gimp as a grayscale image. Pictures below explain it better. One thing that I am considering is the fact that the pixel values in the Slope image are float numbers whereas in the Hillshade image, they are integers. This might cause the issue but I would like to hear any solutions.


texts: What does Error 000885: Input Signature file does not have file extension indicate?

texts:
I can't run a Maximum Likelihood Classification because an Error 000885 says my input signature file does not have a file extension but it actually does as you can see in the picture.

What am I doing wrong?


texts: Simplify a geometry on the fly in OpenLayers

texts:
I'm using OpenLayers 4 to render river ways with labels. The ways can be very curvy, so I'm trying to simplify them on-the-fly in a style function for the labels to go smoothly along the ways.

var styles = {
    'lines': new ol.style.Style({
        stroke: new ol.style.Stroke({
            color: 'blue',
            width: 1.25
        })
    }),
    'labels': new ol.style.Style({
        text: new ol.style.Text({
            text: '',
            font: '15px sans-serif',
            fill: new ol.style.Fill({
                color: 'red'
            }),
            offsetY: -11,
            placement: 'line',
            maxAngle: 0.25,
            overflow: true
        })
    })
};

function style_rivers(feature, resolution) {
    var stylesArray = [];
    stylesArray.push(styles.lines);
    styles.labels.setGeometry(feature.getGeometry().simplify(0.9));
    styles.labels.getText().setText(feature.get('name'));
    stylesArray.push(styles.labels);
    return stylesArray;
}

But the "simplify" method won't work for some reason. Can anyone tell why please?

Here is a jsfiddle to play with https://jsfiddle.net/t8Lbjr7r/


texts:
I use ArcGIS 10.2.2 and I have a problem with some frames extracted from a video. I have the frames (more then 1000) georeferend and I have a track file with the corresponding points.

I wrote down information on the singel frames corresponding to the name of the frames (jpgs numbered from 0 upwards, like "C4_dolo1_3_conv_MOD.avi_0"). I would like an operation that extracts the NAMES of the frames to the points from the track file - or only the number of the frame to some georeferenced outline of the georeferenced frames.

The attribute data are written down per extracted and georeferenced Videoframe. So the attributes have no spatial information yet. That is why I want to create a shapefile with a field with the names of the rasters - so that I can then join the attributes to that field.

Does anyone have an idea what I need?


texts:
How to create the outlet border only  while using raster data in ArcMap? I am already using raster to vector converting format but it did not help.

Can you tell me or explain about other way?


texts: Carto (editor): how to disable hoverwindow -temporarily- on different layer

texts:
See example https://designink.carto.com/viz/e6b1b7c5-ebc9-4a1f-8b8d-d63f127983ca/public_map

I have an active infowindow on a specific layer (Spain) -with active url as text inside-, but this conflicts (overlaps) with the underlying hoverwindow of another specific layer (France). How can i disable the underlying hoverwindow -temporarily- when this infowindow is active?


texts: Openlayers displaying local pbf at wrong location

texts:
Need help for displaying of local pbf file, it does show tiles but at wrong location and when zoom-in the whole feature set split into 4 locations.

First Openlayers v 4.6.5 is not displaying local pbf file

Here is code i am trying

   new ol.layer.Tile({
     source:new ol.source.VectorTile({
       format: new ol.format.MVT(),
       url:"rectangle-1.0.0.pbf"
     })
   })

openlayers load file "rectangle-1.0.0.pbf" as i can see in "Network Tab" of Chrome Developer's tool.

try above code with this style code also but shows nothing on map

     style: function(feature, res) {
           return new ol.style.Style({
               stroke: new ol.style.Stroke({
                   width: 2,
                   color: 'rgba(0, 102, 204)'
               })
           })
       },

i also try latest openlayers version 5.3.0 but it gives me error "Cannot read property 'ol_uid' of undefined".

Using help from @Mike it now shows pbf tiles with this code

   new ol.layer.VectorTile({
     source:new ol.source.VectorTile({
       format: new ol.format.MVT(),
       url:"rectangle-1.0.0.pbf"
     })
   })

but at wrong location and when i zoom-in whole feature set split into 4 locations and so on.

Note: Openlayers projection must be 4326 otherwise it does not display pbf files.i am creating pbf files with the help of geojson-vt "https://github.com/mapbox/geojson-vt". (From GeoJSON to pbf).the geojson must be in 4326.

What needs to be done?


texts: Selecting contours which heights are integers?

texts:
I have a Contours Featureclass, with an interval of 0.2 meters. I wish to select only those Contours, which are at 1 m interval?

I have tried using the following syntax in the 'Select by Attribute' dialog (in ArcMap), but it selects all the contours:

Mod("ELEVATION", 1)=0

What query should I run?


texts: Is it possible to get one geometry per area/box in PostGIS?

texts:
I have millions of rows of geometry data. Some of them are close to each other (tens of meters apart), and some of them can be very far from each other. You can think of gas stations in real world where some gas stations are close to each other across the street, but some are not. The next closest one can be few hundreds meters or tens of kilometers apart.

I was curious if it is possible to write a query that can select one record per area. (either square area or in circle is fine)

For instance, a query that can do something like

"I want to select all gas stations in Germany but only interested in seeing at most one per 500m radius area. If there are multiple stations that are close to each other (fewer than 500m apart), only one of them must be selected."

=> In the result set of the query, I can safely assume that most of Germany's gas stations will be shown and none of them will be fewer than 500 meters apart.

One way that I thought of doing this is to calculate geohash for each geometry, and select one per certain geohash prefix. However, this approach is not very flexible because the query will be limited to geohash characters. I cannot supply arbitrary distance threshold in meters.

Would this be possible as PostGIS query? (e.g. using clustering approach perhaps?)

Edit 1

Below is an example incomplete query that I have tried using geohash. Results are sorted by geohash, so it is just matter of selecting one from each set with the same geohash value. However, I can only use area box determined by geohash prefix, and cannot provide custom radius (e.g. 5km, 2km, 1km, etc) value, which makes this query not so flexible.

select id, ST_GeoHash(way, 5), st_y(way) as lat, st_x(way) as lng
from points order by st_geohash(way, 5) limit 1000;

id          geohash lat         lng
115319221   "4uusx" -41.5740949 -74.0718146
679361789   "4uusx" -41.5759059 -74.0728299
591844292   "4uusz" -41.5711773 -74.0703186
796302025   "4uutp" -41.5086211 -74.1087041
672159089   "4uuu8" -41.5721128 -74.0665036
687629681   "4uuub" -41.57108   -74.069856
591843790   "4uuub" -41.5696367 -74.064995
596950189   "4uuub" -41.5700602 -74.0660787


texts: create neighborhood list in R with large dataset

texts:
I want to create a weight matrix based on distance. My code for the moment looks as follows and functions for a smaller sample of the data. However, with the large dataset (569424 individuals in 24077 locations) it doesn't go through. The problem arise at the nb2blocknb fuction. So my question would be: How can I optimize my code for large datasets?

# load all survey data
DHS <- read.csv("Daten/final.csv")
attach(DHS)

# define coordinates matrix
coormat <- cbind(DHS$location, DHS$lon_s, DHS$lat_s)
coorm <- cbind(DHS$lon_s, DHS$lat_s)
colnames(coormat) <- c("location", "lon_s", "lat_s")
coo <- cbind(unique(coormat))
c <-  as.data.frame(coo)
coor <- cbind(c$lon_s, c$lat_s)

# get a list with beneighbored locations thath are inbetween 50 km distance
neighbor <- dnearneigh(coor, d1 = 0, d2 = 50, row.names=c$location,  longlat=TRUE, bound=c("GE", "LE"))

# get neighborhood list on individual level
nb <- nb2blocknb(neighbor, as.character(DHS$location)))

# weight matrix in list format
nbweights.lw <- nb2listw(nb, style="B", zero.policy=TRUE)


texts: Using unicode characters (arabic) in Select By Attribute of ArcGIS for Desktop?

texts:
I'm new to Python scripting with ArcGIS for Desktop and I have unicode characters (arabic) in my attribute table.

I want to use these characters in my script but when I try to do that the script does not work.

How can I use unicode characters in my script?

import arcpy
arcpy.env.workspace = "c:/test"
mxd=arcpy.mapping.MapDocument("CURRENT")
listlyr = arcpy.mapping.ListLayers(mxd,"","")
# hatta agar chand dataframe ham dashte bashim baz ham select ra anjam mdahad
for a in listlyr:
    delim = arcpy.AddFieldDelimiters(a,"City")

    arcpy.SelectLayerByAttribute_management (a, "NEW_SELECTION", delim+"='u'\xd9\x86\xd9\x88\xd8\xb4\xd9\x87\xd8\xb1''")

u'\xd9\x86\xd9\x88\xd8\xb4\xd9\x87\xd8\xb1' means 'نوشهر'


texts: QGIS regular points tool won't let me select layer as an area

texts: In previous posts that I have read, QGIS regular points should be able to take a shapefile as a boundary layer to generate points within, but in 2.18 I am not seeing an 'area' section of the dialog box, and it instead wants max and min values for x and y (not useful for what I want--I want my points to be generated inside a specific polygon). Does anyone have any ideas or recommendations on how to fix this?


texts: I'm decoding NMEA GPRMC sentences from a GPS device. The date field format is ddmmyy. So 191194 is 19 November 1994. This makes it impossible to represent years greater than 1999. Has the spec been amended to get around this problem?


texts: Counting raster values in each polygon using ArcGIS Desktop?

texts:
I have a Watershed with ~100 smaller watersheds as a shapefile. I want to count the number of different land use values (they are in a 30x30m raster) in each of the small watersheds.

I tried combining them but nothing turns out they way I need it. Which tool or routine can I use to get this?


texts: Creating r.sunmask layers for every hour of the year

texts: I'm trying to create a r.sunmask raster for every hour of the year for a specific DEM, so 24 rasters per day for 365 days. I'm quite new to QGIS and would like to know if there was a way to automate the process and to create some sort of cycle in Python so that it will create all the output raster without me having to manually create each one of them.


texts: Using QGIS to fix invalid geometry without saying not allowed?

texts:
I have a shapefile, and it's got a self-intersecting geometry in it. I'd like to fix the self-intersection, but it will require a few moves. When I attempt to move a point using the QGIS edit tools, I am warned that the resulting geometry is invalid (I know this already) and that my last change has been reverted.

Is there a way to suppress these warnings in QGIS so I can make the change, and only have it enforce validity when I'm done?


texts: How to Keep Database and Server Connections active

texts:
It seems like everyday I go to publish a service or connect to my SDE I get messages that I can't connect. It is particularly annoying when trying to publish a service to ArcServer. The connections are made, but for some reason they are timing out or becoming temporarily disconnected for whatever reason (Red X over the connection icons).

The fix is simple: As soon as I open Catalog and then double click on the connection, it re establishes connection and then I can do what I need in ArcMap. However, ideally I would like to stop this behavior.

Any ideas why this is happening? Can't find much in the help and it has been mentioned by several users in my organization.


texts: Custom labels - aligned to rectangular objects, in a specific position and with multiple attributes using Mapinfo?

texts:
Can the following be done in Mapinfo? It should be formula based without manual formatting as performed by my predecessor to get the following output.

So

Grave_No on right parallel to the y axis of the grave.
Name on top center parallel to the x axis of the grave.
Date of Death on bottom center parallel to the x axis of the grave.

I expect that we will need to copy the layer three times to apply custom labels for each of these situations enter image description here

In MI -I can't find a way to autorotate the labels and place them on the left/make sure the angle is the same as the grave. I know it can be done manually per label but this is far to much work.

Note 1. The name sometimes does not show but the Date of Death does, in other cases this is reversed. Both should be shown.
Note 2. Some will have 2 or more people in the grave so the data will be there twice - so grave no will be E-062a and E-062b for example with 2 names and dates of death as well.

Details of what I tried in QGIS and ArcMap are in the following question Custom labeling with same angle as rectangular object and specific position using QGIS? ... but an MI solution will be best.

So can I do all the above in Mapinfo?


texts: Create a PL/PSQL function that performs as fast as a normal query?

texts:
I'm trying to create a PL/psql function that cuts one user-defined geometry to a predefined border geometry.
If the user-defined geometry does not intersect with the border geometry, it should return the user geometry, unmodified.
The pre-defined geometry consists of 47 polygons. and it has a geometry-index.
The issue isn't with creating the function, its with the speed of the function.
The function:
CREATE OR REPLACE FUNCTION public.clip_geometry(
   IN in_geom geometry,
   OUT out_geom geometry
   ) AS
-- function returns unmodified input-geometry if it does not intersect with the border-geometry.
-- if input-geometry intersects with the border-geometry, the input-geometry is cut according to the border-geometry
$BODY$
select
    st_multi(coalesce(
                st_difference(a.geom ,dk.geom),
                a.geom))
        from (select $1 as geom) a
        left JOIN LATERAL
        (select st_union(b.geom) geom from
        b.border b
        where st_intersects(a.geom, b.geom)
        ) dk on TRUE;

$BODY$
  LANGUAGE SQL STABLE;

I have tested this function (and a version that was written in PL/pgSQL), and it behaves as I want it to. However, the function is slow compared to a normal query.
When I create a table using the function, with a table of road-geometries (approximately 2.3 million rows, with a geometry-index) the runtime is around 1 to 1:30 minute, using this query:
create table b.mod_roads as
select clip_geometry(geom) from b.roads

If I wrote the functions content as a normal query, the runtime is around 15-25 seconds.
the query:
create table b.mod_roads as
select
    st_multi(coalesce(
                st_difference(a.geom ,dk.geom),
                a.geom))
        from b.roads a
        left JOIN LATERAL
        (select st_union(b.geom) geom from
        b.border b
        where st_intersects(a.geom, b.geom)
        ) dk on TRUE;

The normal query uses the border-geometries' index.
When I try to use EXPLAIN on the function-call, it doesn't show how it optimizes the query.
Is there a way to achieve the normal query's speed within the function?


texts: Missing 1.6% of expected area after buffering SpatialPoints from vector of widths

texts:
Goal: I am buffering a random set of points (i.e. centroids) with different widths from a vector of predefined areas to make a random null model of polygons in a given extent. I am iterating through a 1000 object list go generate the distribution, but have provided an example for only one object since my issue occurs at that level.

Issue: The total area of the buffered centroids is 32.19617 hectares less than the original total area.

Question: How is this area being cut? I feel like I am missing something about how gBuffer() works. I thought it might be a planar vs geodesic issue, but read that regeos will only handle projected spatial objects (which I have). It doesn't seem like a rounding issue because the difference is spread across 101 points (0.318774 hectares per point). Any suggestions for how else to troubleshoot?

The coordinate system used is NAD 1983 Albers. The PROJ.4 projection string is:
"+proj=aea +lat_1=34 +lat_2=40.5 +lat_0=0 +lon_0=-120 +x_0=0 +y_0=-4000000
+datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0

Example

library(rgdal)
library(rgeos)

#the predefined areas
areas <- c(21.92466, 0.13743, 22.4576, 3.10855, 13.33003, 19.6971, 8.65893,
           1.36051, 1.97611, 0.4128, 5.09534, 13.08232, 0.65519, 6.69976,
           1.31828, 61.96348, 2.55861, 98.36752, 17.00504, 35.09418, 63.48043,
           15.28773, 9.96236, 0.75299, 7.92188, 9.88541, 1.44117, 9.31345,
           0.83406, 113.84276, 4.55541, 4.61159, 4.3415, 0.78915, 11.73815,
           0.59766, 0.94186, 9.81746, 30.88698, 3.93619, 1.50583, 39.07577,
           33.18197, 39.31604, 29.86065, 6.17087, 66.89905, 4.66883, 64.63708,
           2.83463, 38.12346, 14.0179, 25.69435, 26.97518, 26.86608, 8.11912,
           32.90833, 47.68297, 7.36192, 0.8557, 1.35078, 33.75896, 4.10684,
           1.33971, 26.18847, 1.68767, 34.18756, 18.59203, 4.13611, 23.08783,
           27.20771, 0.63805, 16.71614, 10.73375, 15.9914, 61.96926, 8.12024,
           1.26379, 14.14531, 11.27807, 9.35613, 5.94766, 92.88387, 17.1014,
           4.05735, 15.91729, 10.92878, 3.23904, 4.15417, 59.53967, 0.41474,
           6.3664, 16.00491, 0.72044, 14.36096, 1.10064, 2.52104, 6.35359,
           33.68302, 176.33294, 12.89539)

#don't know how to code SpatialPolygonsDataFrame for reproduciblity, but it can be downloaded at link below
extent <- readOGR(dsn = "SanDiegoCounty.shp", layer = "SanDiegoCounty")

#sample points within the extent equal to the total number in 'areas'
centroids <- spsample(x = extent, n = length(areas), type = "random")

#buffer centroids with width derived from predefined areas vector
buffered.centroids <- gBuffer(spgeom = centroids, byid = TRUE, id = names(centroids), width = sqrt(areas/pi))

#the total predefined area: 1966.97647
sum(areas)

#the total area of buffered centroids: 1934.78029709348
buffered.centroid.area <- sum(sapply(X = buffered.centroids@polygons, FUN = function(z){sum(z@area)}))

#difference in total areas: 32.1961729065185
sum(areas)-buffered.centroid.area

Link to extent shapefile on Google Drive: extent.zip


texts: Avoid alpha summation in Line that overlap itself in Carto Mobile SDK

texts:
I need to draw a big line that can overlap itself. I am using this doc:

https://carto.com/docs/carto-engine/mobile-sdk/getting-started/#add-a-line

And I need the line to have a opacity of 0.3. So far so good; I have a line that is almost transparent. The problem is that when the line overlaps itself, the alpha in the overlapping area is 0.6 (because you see the line over itself)

Is it possible to keep the alpha consistent, even if the line cross with itself?

EDIT: As suggested, I tried to do it with a BufferOp using NTS and making a polygon with the result. Unfortunately, when I make a few lines and the geometry starts being complex this happens:

I tried making a complex polygon without BufferOp and sometimes the same thing happens. Any suggestions?

EDIT: I Opened an issue with the polygon malformation problem as I understand it is a different problem.


texts: Loading WMS layers from Geoserver into QGIS using env-parameter to style?

texts:
I have a layer with a SLD-style on my Geoserver that requires a date through the "env"-parameter, which works fine in the OpenLayers application where the style will finally be used. However, it'd be great to be able to inspect the style in QGIS, just by importing the WMS layer and passing an "env"-parameter with the WMS request to Geoserver.

Unfortunately, I can't find any such options to pass additional parameters in the QGIS add WMS-tool. Any ideas on how this can be accomplished?


texts: Retrieve point coordinates from map canvas using QGIS API

texts:
I'm trying to build a plugin that firstly captures the map coordinates.

I have tried to adapt the map tool explained in this post: How to programatically check for a mouse click in QGIS

The code I used for the main function is below:

def canvasReleaseEvent(self, event):
    #Get the click
    x = event.pos().x()
    y = event.pos().y()

    canvas = self.canvas
    canvas.mapRenderer().setProjectionsEnabled(True)
    canvas.mapRenderer().setDestinationCrs(QgsCoordinateReferenceSystem(27700))
    espg = canvas.mapRenderer().destinationCrs().authid()

    point = self.canvas.getCoordinateTransform().toMapCoordinates(x, y)

Unfortunately the when I print point it always returns as (0,0). I have tried various ways to set the crs of the points but none work.  What needs to be done to make it work?


texts: QGIS place labels next to the beggining or ending points of Linestrings but above the Linestring

texts:
I've got a Linestrings layer.

Each Linestring has among other fields, these ones:

  id  ENTRY EXIT
    1   S1  E2
    2   S1  E3
    3   S1  E3
    4   S1  E3
    5   S1  E3
    6   S1  E1
    7   S1  E3
    8   S1  E2
    9   S2  E5
    10  S2  E3
    11  S1  E1
    12  S1  E1
    13  S3  E4
    14  S1  E2
    15  S1  E1

I want to show for each Linestring, the ENTRY value as a label at the beginning of the Linestring and the EXIT value at the ending.

I am using the following solution suggested by @Spacedman here:

You can do this with two "Rule-based Labelling" labels, with no filters. This lets you put multiple labels on a feature. The first rule labels the feature with the attribute you want at the start, the second rule with the end attribute. Initially your labels will appear in the centre of the line, so we need to fix that.
Do that with "data defined" expressions for the position. Use the drop-down and hit "Edit...". For the label at the start, use x_at(0) and y_at(0) for the position expressions. For the end label, use x_at(-1) and y_at(-1).

The thing is that if I place each label exactly at the beginning and ending points of a Line, as @Spacedman suggets, some ENTRY and EXIT labels get overlapped (and can't be seen) because some Lines share start/end points.

So, the idea then would be to place each ENTRY/EXIT label a little bit displaced to the inside of the Line and not exactly on the end/beggining point?

Result should be something like:

Something like postgis' ST_Line_Interpolate_Point function would be great in this case, but in qgis...


texts: Tools/Script to reshape automaticaly topologic edges within a given distance in ArcGis 10?

texts:
I have a footprint feature class and a land use cluster feature class. I am looking for a method/tool/script that would allow me:

to reshape two edges into one (topologically)
to decide at which distance it can be set
and to run the process automatically.

The outcome will be used into an hydraulic model, so it has to have the minimum amount of vertex as possible and still keep the main orthogonal shape of the footprint.

I have looked around and found some very interesting tools , although requiring a lot of manual editing.

Has anyone already see or used something similar?

First image shows the original Data (2 layers, so no gap to fill)

The second image shows the first steps used toward the simplification of the footprint (red lines are original footprint): : Dissolve (No Multipart), Aggregate polygon (1 m distance and with option Keep orthogonal shape), simplify building.

The third image shows what I'd like to achieve although without the manual editing, I have here tried the Zipper tool: extension of one of side of a building'sfootprint to the next adjacent land use polygon (dark orange area show the extension).


texts: QGIS 2.18 Installation on a Mac OS Sierra. The plug-ins will not open, I cannot tick the boxes

texts:
Screenshot showing plugins trusted but boxes to not tick.

If it is a Python problem, why would it be as I have installed the latest version?


texts: Adding sequence value on attribute table when clicking point in QGIS?

texts:
I have a point shapefiles that has a specific column name "Record".

In QGIS I want to add a sequence value in this column from 1, 2, 3,... so on until the last when I click each point one by one (the values added automatically).

In QGIS when the common method was in Toogle Edit we select a point then open the Attribute Table and manually type the value in specific column but how could I do this automatically ?


texts: Select by location are within source layer

texts:
So I am trying to select all of the block groups inside a group of counties. So I am using the select by location tool and setting my target layer as the block group and my source layer as my counties. then I am using the are within the source layer feature.

I thought that was how you did that, but it seems that it is only selecting the ones that are completly within each county. Am i just wrong here?


texts: Making 3D choropleth map in QGIS 3 with native tools?

texts:
This is similar to this question Is it possible to draw a 3D Choropleth Map in ArcGIS?, but I just wanted to know if the same could be done with the new release of QGIS 3 without the use of the QGIS2threejs plugin.

I am hoping this is possible so I can have a little bit more flexibility by using the composer capabilities.


texts: Describing geographic characteristics by lat/long?

texts:
I'm not sure of the right terminology to use to google for a database of information.

The data in the database should list geographic characteristics of an arbitrary lat/long. Stuff like height relative to sea level, country name, mountainous, prairie, tundra, desert, ocean, ocean trench, etc...

I have tried looking for geographic data by lat/long and ended up with what looks to be map data (NaturalEarthData.com)

I've looked at Spatial data? Geodata? Geographic Data? Geospatial data? and it looks like I need to avoid Geographic Data and look for either Spatial data or Geospatial data, but I'd like to get some confirmation on the matter.

I've also seen the various comments on the site pointing to opendata.se, and will post a question about the actual dataset there. This question is specific to what kind of terminology should I be using when discussing the type of data that I'm looking for?


texts: Does anyone here know of a source from which 1990 Census Block polygons can be downloaded? For Illinois, specifically, if not for the entire country? The Census Bureau has "no plans to create Block level boundary files", and I know that NHGIS doesn't have the block-level data. I searched the old questions here and found nothing.


texts: Convert String to Integer in QGIS tables

texts: I want it to know how to convert string field values to integer values in QGIS Dufour... there are numbers and strings in the same field, when I use toreal(string) it stops and it won´t create the field.


texts: I use two screens and the QGIS version 3.4.8 LTR. Is there any parameter, for example in the QGIS3.ini or the qgis_global_settings.ini, in which is stored on which screen qgis is always started?


texts: Select points within a given distance from a selected point

texts:
What I want to do:

In ArcMap, let the user select a point (not a point pre-enter) and enter a range (like a Message BOX can enter range)
the point (pre-enter the data and XY) within range will be selected

The above is in GIS, the following is an SQL(?) problem:

I can get selected point's data (in a database) and make it in a table (for my Kriging)

Is there any function/tool/script in arctoolbox that can do the step 1 and 2?

@ujjwalesri
Pre-enter means I have a point.shp and in the shapefile I have enter point's xy that can display in the ArcMap.

The range that I am talking about is User can enter a range (Kilometers) and the point in the shapefile within the range will be selected (maybe use a Msgbox).

It's just like a buffer range.


texts: Symbols showing sex of a species in a label in MapInfo

texts:
I am trying to indicate the sex of a species using the symbols ♀ and ♂ in MapInfo. I would like the symbols to display in the label of each species point, but I cannot find out how to do this.

I had thought I could maybe use chr$(), but I can't find the code for these symbols.


texts: Trying to create an Arcpy Python Script to Compare rows in a point feature Dataset

texts:
I have a large group of gps points that was collected. I want to select all points that have a spar depth that is greater or less than 20% that of the point that came before it and the point after.

GISID      Spar Depth

2022         4.035

2023         4.066

2024         3.604

2025         3.576

2026         4.593

2027         2.690

2028         2.960

2029         4.59

Ex. compare the Spar Depth for Pt. 2025 to the Spar Depth for Pts 2024 & 2026

counter =0
with arcpy.da.SearchCursor('GPS Gas Main Pipe Point',[ 'GISID', 'SPAR_DEPTH']) as cursor:
     for row in cursor:
     MSDepth = row[1]
     if counter > 0:
         diff = abs(MSDepth-oldMSDepth)
         if diff > 20:
             print('GISID {}'.format(row[0]))
     oldMSDepth = row[1]
     oldGISID = row[0]
     counter+= 1

Edited Question and script:


texts: What is the SRID of census.gov shapefiles?

texts:
I downloaded the county files from:

http://www.census.gov/cgi-bin/geo/shapefiles2011/main

I cannot figure out what SRID to use with them. When I am trying to generate a class file from ./manage.py ogrinspect ..., I get an SRID of -1 in the polygon field. I don't think that this is right.

GDAL gave me the Proj4 of +proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs.

I know an SRID of -1 means unknown. Wouldn't that make my geometries useless? How can I figure out what SRID to use?

I am really new to GIS. I already miss the days when the Earth was flat.

This may also be useful:

SELECT PostGIS_full_version();
                                         postgis_full_version
-------------------------------------------------------------------------------------------------------
 POSTGIS="1.5.3" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.8" USE_STATS
(1 row)

>>> import django
>>> django.VERSION
(1, 4, 0, 'final', 0)


texts: Node-line minimum distance: draw the minimum distance point location

texts:
I am working with a layer of nodes and a layer of lines.

I would need a tool able to find and draw, for some couples node-line, the location of the closest point laying on the line to this node.

If possible, I would also like to create such a feature in another layer, or at get the point coordinates.

I have been looking for a similar geoprocessing tool in ArcToolbox -> Proximity, but I did not find anything that could suit my need, since the "Near" tool just provide me with distances values.

Is there a tool in ArcMap able to do it?


texts:
I have to mask all the cloudy pixels, and because the QA info is stored in bits I am trying to decode them using this code. However when I chart the masked timeseries, I get an error: Error generating chart: Data column(s) for axis #0 cannot be of type string. Is this code robust for masking modis cloudy pixels?

var M = ee.ImageCollection("MODIS/006/MOD09GA"),
geometry1 = /* color: #d63000 */ee.Geometry.Point([10.644168108701706, 64.4188479841206]),
single = ee.Image("MODIS/006/MOD09GA/2012_10_11");

 var getQABits = function(single, start, end, newName) {
// Compute the bits we need to extract.
var pattern = 0;
for (var i = start; i <= end; i++) {
   pattern += Math.pow(2, i);
}
return single.select([0], [newName])
              .bitwiseAnd(pattern)
              .rightShift(start);
 };

// Select the QA band
var QA = single.select('state_1km');

// Get the cloud_state bits and find cloudy areas.
var cloud = getQABits(QA, 0, 1, 'cloud_state')
                .expression("b(0) == 0 || b(0) == 2 ");

// Get the land_water_flag bits.
var landWaterFlag = getQABits(QA, 3, 5, 'land_water_flag');

// Create a mask that filters out deep ocean and cloudy areas.
//var mask = landWaterFlag.neq(7).and(cloud.not());

var filter = function(image){
var mask = landWaterFlag.neq(7).and(cloud.not())
return ee.Image(image).updateMask(mask)
};

var B1= M.filterDate('2010-04-01', '2014-10-31').select('sur_refl_b01')
var gooddata = B1.map(filter)

 // chart b1 all quality data
 var chartb1 = ui.Chart.image.seriesByRegion({
 imageCollection: B1,
 regions: geometry1,
 reducer: ee.Reducer.mean(),
  scale: 1000,
  band: 'sur_refl_b01',
 })
 print(chartb1,'chartb1')

// chart b1 masked quality data
var chartb1mask = ui.Chart.image.seriesByRegion({
imageCollection: gooddata,
regions: geometry1,
reducer: ee.Reducer.mean(),
scale: 1000,
band: 'sur_refl_b01',
})
print(chartb1mask,'chartb1mask')


texts: How to use gdal_contour in QGIS Python console?

texts: Is there a way to use the gdal_contour utility within the Python console of QGIS?


texts: Specify database schema in MapServer mapfile

texts:
I have my mapfile. I am able to connect to my PostGIS database when my table is under the public schema.

Here is my database structure.

Database

Ingham
\__Schemas (3)
    \__2016
        \__Parcels
        \__Parcel Dimensions
    \__2017
        \__Parcels
        \__Parcel Dimensions
    \__public
        \__Parcels

The Parcels table under the public schema is a copy from 2016. I can connect to it from my mapfile this way.

CONNECTIONTYPE POSTGIS
CONNECTION 'host=XXX.XXX.XXX.XXX dbname=Ingham user=ingham_mapserver'
DATA 'wkb_geometry from Parcels'

This works great. When I try to specify a schema, like I would in a postgresql query,

CONNECTIONTYPE POSTGIS
CONNECTION 'host=XXX.XXX.XXX.XXX dbname=Ingham user=ingham_mapserver'
DATA 'wkb_geometry from "2017"."Parcels"'

Has anyone been able to specify a database schema in the mapfile for MapServer?


texts: Valid input for ArcPy raster to polygon in 10.1?

texts:
I'm experiencing some strange problems with this code starting from files with *.tif.tif to what seems should be *.tif.tif.shp according to the code. The code is not working because of the arcpy.RasterToPolygon_conversion Error 010157: Unable to open feature class. File name snowdepthN0001.tif.tif. Though the code fails, I get a single file in my output folder called snowdepthn0001.tif.shp (not sure why it's making the n lower case).

This is not the extension that I was expecting, and why would only this file turn up when there are 90 files in the input folder?

I have everything set-up to preference according to http://resources.arcgis.com/en/help/main/10.1/index.html#//001200000008000000 but it seems there may be an extension problem.

I've tried both inside and outside of an ArcMap session.

import arcpy, os
from arcpy import env
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")

env.workspace = r"C:\VMshared\small_example_valley8\SDpartINTRaster"
outFolder = r"C:\VMshared\small_example_valley8\SDpartINTshapefile"

for rasterFile in arcpy.ListRasters("*.tif"):
    oName, oExt = os.path.splitext(rasterFile + ".tif")
    outShape = os.path.join(outFolder, oName + ".shp")
    arcpy.RasterToPolygon_conversion(rasterFile,outShape,"NO_SIMPLIFY","Value")

print "done"

#Executing: RasterToPolygon C:\VMshared\small_example_valley8\SDpartINTRaster\snowdepthN0001.tif.tif C:\VMshared\small_example_valley8\SDpartINTshapefile\snowdepthN0001.tif.tif.shp NO_SIMPLIFY Value
#Start Time: Sat May 16 15:12:54 2015
#ERROR 010157: Unable to open feature class C:\VMshared\small_example_valley8\SDpartINTshapefile\snowdepthN0001.tif.tif.
#Failed to execute (RasterToPolygon).


texts:
I developed a plugin for QGIS 3.x but I need to adjust it to work with QGIS 2.x too.

Here is code which is working nice with QGIS 3.x:

root = QgsProject.instance().layerTreeRoot() #QgsLayerTree
group_preview = root.findGroup("Preview")
if group_preview is not None:
     root.removeChildNode(group_preview)
group = root.insertGroup(0, "Group")
raster_layer = QgsRasterLayer(urlWithParams, "new_layer", "wms")

QgsProject.instance().addMapLayer(raster_layer, False)

group.insertLayer(0, raster_layer)

Someone knows what I should use instead of :

root = QgsProject.instance().layerTreeRoot() #QgsLayerTree

to get QgsLayerTree() in QGIS 2.x?


texts: Plotting CDF of the values in a raster (.tif) file, using Python or QGIS?

texts:
I have a tiff file with some values and I want to read those values and plot a CDF (Cumulative Distribution Function). So far I only know how to get the mean value

from osgeo import gdal
gtif = gdal.Open( "INPUT.tif" )
srcband = gtif.GetRasterBand(band)
stats = srcband.GetStatistics( True, True )
mean_value = stats[2]

I prefer using Python but if QGIS already has a CDF feature implemented I can also use it.


texts: Create and use index with GDAL/ogr on shapefile

texts:
I'm using OGR and VRT to create a new shapefile from two distinct sources (CSV file and shapefile).

It works well, but it is very slow. I want to make it more efficient, so I tried indexing my data before processing my query -as follow (my join is done on INSEE_COM attribute) and guided by the doc :

ogrinfo -sql "CREATE INDEX ON CHEF_LIEU USING INSEE_COM" ./IGN/ADMINEXPRESS/ADE-COG_1-1_SHP_LAMB93_FR/CHEF_LIEU.shp
ogrinfo -sql "CREATE SPATIAL INDEX ON CHEF_LIEU"  ./IGN/ADMINEXPRESS/ADE-COG_1-1_SHP_LAMB93_FR/CHEF_LIEU.shp

I only get "using driver 'ESRI Shapefile' successful." as instantaneous returned value, which sounds very suspect to me.

How can I be sure the indexing operation is working ? Is that the right way to do ?


texts: Merge Polylines by Field Attribute & Sum Other Attributes at the same time [QGIS]

texts:
I'm working with a dataset of road links, each link has a flow assigned to it. I have 3 separate shapefiles of these links based on their times - AM, Interpeak and PM peak. I have merged all these into one polyline layer to work with, as ultimately I will need all the time periods in one table.
Unfortunately the dataset has multiple lines for each link, resulting in say 10 different features for one road link. See here:

What I want to do is:

Merge all feature links with the same road name AND same time period (eg. AM, Road 1) into a single feature
Ensure that as I do the above, the sum of the traffic flows is output in the single feature.

EG. I have the following attribute table:

I need the following output:
[UNIQUE TIME PERIOD] [ROAD LINK AS SINGLE FEATURE] [SUM OF LINK FLOW]
I should end up with 3 time periods, each with the same links and summed traffic flows.
I am at a loose end, having tried various options and I really need some help now!


texts: Overpass API query: Get streets in city limited to a particular country

texts:
I am working with a self-installed version of the Overpass API.

I need to be able to query all street names in a particular city, Inverness in the United Kingdom (GB).  There is also a city called Inverness in Florida, United States.

Therefore I need a query which limits the results returned to Inverness in GB.

This is the query that I have tried but it returns an empty result set.

[out:json];
(area["ISO3166-1"="GB"][admin_level=2]; )->.country;
(area["name"="Inverness"])->.city;
(way(country)(city)[highway]; );
(._;>;);
out;

How can I reformulate the query to return the information that I need?


texts:
I am trying to select a polygon then it must automatically change (calculate) the status to "C". The tool seems to work in the background but nothing actually happens (the status is not updated). I have used the code from Select and copy features in ArcMap using Python add-in tool but nothing actually gets selected. If I have a feature in the layer selected already it does deselect it though.

Below is the code that i am using. Is there something that I have gotten wrong?

import arcpy
import pythonaddins

def getSearchDistanceInches(scale, selection_tolerance=3):
    """Returns the map distance in inches that corresponds to the input selection
    tolerance in pixels (default 3) at the specified map scale."""
    return scale * selection_tolerance / 96.0 # DPI used by ArcMap when reporting scale

class tlStatToC(object):
    """Implementation for PythonAddin_addin.tlMapCoods (Tool)"""
    def __init__(self):
        self.enabled = True
        self.shape = "NONE" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.
    def onMouseDownMap(self, x, y, button, shift):
        mxd = arcpy.mapping.MapDocument("CURRENT")
        pointGeom = arcpy.PointGeometry(arcpy.Point(x, y), mxd.activeDataFrame.spatialReference)
        searchdistance = getSearchDistanceInches(mxd.activeDataFrame.scale)
        lyr = arcpy.mapping.ListLayers(mxd)[0] # assumes you want to select features from 1st layer in TOC
        arcpy.SelectLayerByLocation_management(lyr, "INTERSECT", pointGeom)
        arcpy.RefreshActiveView()
        arcpy.CalculateField_management(lyr,"STATUS","C")


texts: Summarizing table into multiple fields using ArcGIS Pro?

texts:
I have a large table with 150000 features. Every feature has one key and a keyword that I want to use to make a new field with. Below is an example:

|Field A|Field b|Shape_area|
|key 1  |Type 1 |300       |
|key 1  |Type 2 |4500      |
|key 2  |Type 1 |100       |
|key 2  |Type 1 |300       |

I want to summarize it like this:

|KEY  |TYPE 1|TYPE 2|
|Key 1|300   |4500  |
|Key 2|400   |0     |

Is this possible in ArcGIS Pro?

I've tried the summarize statistics, but I only get the keys in a long table.


texts: How to open and analyze Chandrayaan 1 Hysi data?

texts: I have an archive of Chandrayaan 1 Hysi data that contains file formats .lbl, .qub data. What software should i use to visualize and analyze these data?


texts:
I would like to create a cascading select in QGIS using the value relations widget. I'm using QGIS 3.14 (pi) and all layers are stored in a geopackage. The geopackage shown in this example can be downloaded here for testing (project file is in the gpkg).
I am able to do this in terms of limiting available values based on the value of a previously set attribute. However, the attribute table does not honour my choice.
I have a "parent" table with a 'key' and a 'type':
parent
key|type
1  |A
2  |B
3  |C

I have a "child" table as follows:
child
keyChild|typeChild|subType
1       |A        |Yellow
1       |A        |White
1       |A        |Red
2       |B        |Pink
2       |B        |Orange
2       |B        |Green
3       |C        |Brown
3       |C        |Blue
3       |C        |Black

I create a point layer "test" with the attributes of 'testType' and 'testSubtype'.
In the properties > attribute form I set the widget for the 'type' attribute to "value relation" with the following settings:

I set the widget for the 'subtype' attribute to "value relation" with the following settings:

The filter expression is set to:
"typeChild" = current_value('testType')

This works to filter the options available when adding a new point feature:

However when I check the attribute table only the first option for that type shows:

I can alter the 'testSubtype' value in the attribute table by selecting 'order by value' in the Attributes Form setting:

The desired behaviour is for the attribute table to honour the user's selection and for that selection to persist. Other answers to similar questions on SE link to this post in the QGIS changelog. The workflow above mirrors the behaviour shown in the changelog but changes do not persist.
I'd like to know if this is reproducible behaviour. I've tested this on QGIS 3.2, 3.4 3.10 and 3.14. I get the same results in all versions.
The extra columns in the parent and child tables ('key' and 'keyChild') are for testing different options in the Attribute Form settings prompted by the answer to this issue on github.
Update
Gabriel's answer is accepted. I had failed to realise that the Filter Expression will still work regardless of what is set in the 'key' and 'value' settings of the widget. The key must be unique. Keeping everything the same as descirbed above just changing the key to 'subtype' worked as shown below:


texts: Conditional won't work on GrassGIS python script

texts:
I have a conditional in Python script from GRASS but I can not get it to work. No matter if I set m to 1 or 0 it always prints "m must be 1 or 0." like it won't enter the conditional.

Here's the script:

m=options['m']

if m==1:
    grass.mapcalc("up=$c+tan($phy)*(($gamma*$z*(cos(slope)^2))-($k*$gamma*$z*sin(slope)*cos(slope))-($z*$gammaw))",
                  z = options['z'],
                  c = options['c'],
                  gamma = options['gamma'],
                  phy = options['phy'],
                  k = options['k'],
                  gammaw = 9.81)
    print ('m is 1')
elif m==0:
    grass.mapcalc("up=$c+tan($phy)*(($gamma*$z*(cos(slope)^2))-($k*$gamma*$z*sin(slope)*cos(slope)))",
                  z = options['z'],
                  c = options['c'],
                  gamma = options['gamma'],
                  phy = options['phy'],
                  k = options['k'])
    print ('m is 0')
else:
    print("m must be 1 or 0.")


texts: Error in transforming SRID in PostGIS 9.3

texts:
I am tying to use ST_Transform to shift SRID from 4326 to 25832. However, the resulting coordinates are far from the correct positions.

select x, y, ST_AsText(ST_Transform(ST_SetSRID(ST_MakePoint(x, y), 4326), 25832))
from cmi.a_groenne_erhverv_temp;

produces

55.6654496;12.5983956;"POINT(6158850.74362098 1998380.95066514)"

The correct coordinates in SRID 25832 are 726304.755701 6174717.39191, which is nowhere close to the result of the transformation. If I leave out the ST_Transform, the result is

55.6654496;12.5983956;"POINT(55.6654496 12.5983956)"

Am I doing something wrong, or is it ST_Transform that fails?


texts: Landcover area for each class in multiple regions (GEE)

texts:
I was trying to use the ReduceRegions and grouped reducer functions to calculate landcover area for each class in a feature collection, and I end up getting output in forms of lists of objects that I'm not sure how to export as informative tables. Any suggestions?

var image = ee.Image("ESA/GLOBCOVER_L4_200901_200912_V2_3"),
    countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017");

// Subset African countries.
var Africa = countries.filter(ee.Filter.eq('wld_rgn', 'Africa'));

// Select the landcover band and clip region of interests.
var landcover_roi = image.select(['landcover']).clip(Africa);

//construct a composite image where the first band is the pixel's area
//and the second band has the class information
var class_areas = ee.Image.pixelArea().addBands(landcover_roi)
print(class_areas,'class_areas')

//apply a grouped reducer to the composite image,
//in order to sum all the pixel areas within each class:
var class_areas = class_areas.reduceRegions({
    reducer: ee.Reducer.sum().group({
      groupField: 1,
      groupName: 'code',
    }),
    collection: Africa,
    scale: 300,  // sample the geometry at 300m intervals
  })

print(class_areas,'class_areas_reduced')

https://code.earthengine.google.com/3d6cc935088b591b0d33e2868658cc03?noload=true

And here is a screenshot of the output that I'd like to collapse into a table:


texts: Calculating percent overlap of Raster Layers using QGIS?

texts:
I have two raster layers, a DEM and a land use layer. The DEM layer is divided into discrete intervals (e.g. 100-200 m). I am trying to figure out how to calculate the percentage of each elevation interval that is allocated to each type of land use.

For example, calculating the percentage of the area between 100m and 200m that is agricultural. It seems like this should be straight forward, but I have not found a good method. I am using QGIS 2.18, and would prefer to keep using the same program.


texts:
I am writing a Rendering Transformation and would like to pass a parameter that is an array. The geoserver documenation states that
"Lists of values can be accepted by defining an array-valued parameter". Great, but how the heck does one properly define an array-valued parameter in SLD XML? An example would be great.

Below is an example SLD. I would like to make the parameter computeArgs be an array-valued parameter. What is the syntax?

<StyledLayerDescriptor version="1.0.0"
 xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
 xmlns="http://www.opengis.net/sld"
 xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <NamedLayer>
  <Name>GeoHashGrid</Name>
  <UserStyle>
    <Title>GeoHashGrid</Title>
    <Abstract>GeoHashGrid aggregation</Abstract>
    <FeatureTypeStyle>
      <Transformation>
        <ogc:Function name="vec:GeoHashGrid">
          <ogc:Function name="parameter">
            <ogc:Literal>data</ogc:Literal>
          </ogc:Function>
          <ogc:Function name="parameter">
            <ogc:Literal>gridStrategy</ogc:Literal>
            <ogc:Literal>Metric</ogc:Literal>
          </ogc:Function>
          <ogc:Function name="parameter">
            <ogc:Literal>computeArgs</ogc:Literal>
            <ogc:Literal>Please make me a list!!!</ogc:Literal>
          </ogc:Function>
        </ogc:Function>
      </Transformation>
    </FeatureTypeStyle>
  </UserStyle>
 </NamedLayer>
</StyledLayerDescriptor>


texts: Leaflet routing machine - get route JSON response

texts:
I created a simple page based on Leaflet routing machine tutorial. I would like to process obtained route with my API.
How could I to get full JSON response with route?


texts: Clipping layer when using new projection in QGIS?

texts:
I'm having trouble clipping a shapefile in QGIS so I'll take you through my steps.

I've downloaded the land shapefile here http://www.naturalearthdata.com/downloads/10m-physical-vectors/

When I load it in QGIS I right click on the layer and save as EPSG 3357 UTM Zone 17N.

Then I click to allow on the fly projection so I can see my newly projected layer.

I load in the coordinates (600967.4, 2177300) about which I make a buffer of 15km.

Then I clip the map with this 15 km circle but this doesn't appear on the map nor can I see it if I load it into QGIS.

It seems like I'm missing something with the projections.


texts: Calculating number of pixels in polygon using Google Earthy Engine?

texts:
How to calculate the number of pixels in a polygon, especially, when an image contains null-value pixels? I tried the function ee.Reducer.countEvery(), but it does not work.

var geometry = /* color: #d63000 */ee.Geometry.Polygon(
    [[[-122.420654296875, 37.96148894979038],
      [-122.530517578125, 37.735934739135104],
      [-122.244873046875, 37.82276800453933],
      [-121.904296875, 37.87481898883636]]]);

// Load a Landsat 8 image.
var image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318');

var c=image.reduceRegion({
  reducer: ee.Reducer.countEvery(),
  geometry: geometry
  });

print(c);


texts: Digital Surface Model data for Switzerland?

texts:
I'd like to get Digital Surface Model data from Switzerland. I want to calculate building volume from it. Even I am searching for LIDAR data, but I did not find any free data.

Is there any free LiDAR or DSM data set available for this country?


texts: Installing an ArcGIS add-in on several PCs

texts:
I usually do my python scripts and add them to ArcMap in the form of add-ins.

First I launch the ArcGIS Python Add-In Wizard, create a project, a toolbar and the tool.

Then, every time I do an update I re-run the makeaddin.py and re-install the addin.esriaddin.

Now, I would like to install this tool in other PCs and I don't have experience with that.

Do I have to go one by one and do the same as above every time? what if I update the script, how do I update it in the other machines?

Any ideas?


texts: Exporting project with all files, properties and dependencies using QGIS

texts:
I need to share a project with some students but I would like to share it simply in a sort of package file which would include the project and all the files (Vector and Rasters) with they properties and dependencies.
Looking at old posts it seems like that a plugin that used to work in the past (QConsolidate) is no longer supported.
How do I zip everything and share it, or what could be the best compromise to avoid to export each file into a dedicated folder to the share?


texts:
I'm trying to install GDAL 2.x on my CentOS 7.4 server.

I looked at what is available, and it is still at v 1.11 of GDAL

Since I need GDAL v 2.x along with libKML support, looks like I'll have to build it from source.

I looked at the documentation for building from source, and I found the details unclear.

What options to give when configuring the make file?
How do I specify that I need the libKMl & PostGreSQL Drivers?

Is there a Page/documentation which shows how GDAL 2.x can be compiled from source on a CentOS 7.4 server?


texts:
I'm trying to print one wms layer with openstreetmap base map.
Although I get a pdf file, it is empty with following errors:

java.io.IOException: Permission denied (Bind failed)
java.io.IOException: Permission denied (Bind failed)
java.io.IOException: Permission denied (Bind failed)
java.io.IOException: Permission denied (Bind failed)
java.io.IOException: Error (status=302) while reading the image from https://****/geoserver/wms?BBOX=-2878582.495003635%2C932558.2924218667%2C-2257693.5923343645%2C1614124.9590885332&HEIGHT=503&WIDTH=458&TRANSPARENT=true&map_resolution=75&VERSION=1.1.1&FORMAT=image%2Fpng&TILED=true&SERVICE=WMS&format_options=dpi%3A75&LAYERS=ensad%3Ahydropower&REQUEST=GetMap&STYLES=&DPI=75&SRS=EPSG%3A900913: Found

Here is geoserver's log:

2017-02-23 03:10:43,681 ERROR [org.mapfish.print.PDFUtils] - Server returned an error for http://a.tile.openstreetmap.org/06/26/30.png: Permission denied (Bind failed)
2017-02-23 03:10:43,682 ERROR [org.mapfish.print.PDFUtils] - Server returned an error for http://a.tile.openstreetmap.org/06/27/30.png: Permission denied (Bind failed)
2017-02-23 03:10:43,682 ERROR [org.mapfish.print.PDFCustomBlocks] - Error while adding a PDF elementjava.io.IOException: Permission denied (Bind failed)
2017-02-23 03:10:43,682 ERROR [org.mapfish.print.PDFCustomBlocks] - Error while adding a PDF elementjava.io.IOException: Permission denied (Bind failed)
2017-02-23 03:10:43,683 ERROR [org.mapfish.print.PDFUtils] - Server returned an error for http://a.tile.openstreetmap.org/06/27/29.png: Permission denied (Bind failed)
2017-02-23 03:10:43,684 ERROR [org.mapfish.print.PDFUtils] - Server returned an error for http://a.tile.openstreetmap.org/06/26/29.png: Permission denied (Bind failed)
2017-02-23 03:10:43,685 ERROR [org.mapfish.print.PDFCustomBlocks] - Error while adding a PDF elementjava.io.IOException: Permission denied (Bind failed)
2017-02-23 03:10:43,685 ERROR [org.mapfish.print.PDFCustomBlocks] - Error while adding a PDF elementjava.io.IOException: Permission denied (Bind failed)
2017-02-23 03:10:43,685 ERROR [org.mapfish.print.PDFUtils] - Server returned an error for https://****/geoserver/wms?BBOX=-3583420.7430280354%2C868930.7117841667%2C-2962531.840358765%2C1550497.3784508333&HEIGHT=503&WIDTH=458&TRANSPARENT=true&map_resolution=75&VERSION=1.1.1&FORMAT=image%2Fpng&TILED=true&SERVICE=WMS&format_options=dpi%3A75&LAYERS=ensad%3hydropower&REQUEST=GetMap&STYLES=&DPI=75&SRS=EPSG%3A900913: Error (status=302) while reading the image from https://****/geoserver/wms?BBOX=-3583420.7430280354%2C868930.7117841667%2C-2962531.840358765%2C1550497.3784508333&HEIGHT=503&WIDTH=458&TRANSPARENT=true&map_resolution=75&VERSION=1.1.1&FORMAT=image%2Fpng&TILED=true&SERVICE=WMS&format_options=dpi%3A75&LAYERS=ensad%3hydropower&REQUEST=GetMap&STYLES=&DPI=75&SRS=EPSG%3A900913: Found
2017-02-23 03:10:43,685 ERROR [org.mapfish.print.PDFCustomBlocks] - Error while adding a PDF elementjava.io.IOException: Error (status=302) while reading the image from https://****/geoserver/wms?BBOX=-3583420.7430280354%2C868930.7117841667%2C-2962531.840358765%2C1550497.3784508333&HEIGHT=503&WIDTH=458&TRANSPARENT=true&map_resolution=75&VERSION=1.1.1&FORMAT=image%2Fpng&TILED=true&SERVICE=WMS&format_options=dpi%3A75&LAYERS=ensad%3Anatural_gas&REQUEST=GetMap&STYLES=&DPI=75&SRS=EPSG%3A900913: Found

I'm using SSL for both geoserver and app. and both geoserver and app. is in same server.


texts: Using ST_Extrude in PostgreSQL with PostGIS?

texts:
I'm trying to use the function ST_Extrude() in Postgres 9.2. I enabled the PostGIS 2.2.0 extension and the PostGIS_SFCGAL extension (which carries the ST_Extrude function).

I can see the function in my list of functions (see snapshot), but I cannot use it.

When I try following SQL code:

CREATE TABLE house AS
SELECT id, ST_Extrude(geog, 0, 0, 5) as geom
FROM houses
WHERE id = 1500;

I get an error that the function ST_Extrude does not exist:

Does someone know what is going wrong here?


texts: Alternative way of correctly classifying Landsat images

texts:
I am conducting a supervised classification of Landsat 8 image. I have 6 classes: river, forest, built-up, brush land, grassland, and agricultural land. I assessed the spectral separability of each class and found out that it is difficult to distinguish brush land from forest and grassland from agricultural land. The classified image also showed a lot of misclassified Built-up pixels. I tried using band ratios and incorporating DEM to enhance the classification, but it did not improve, for instance kappa value is just around 0.30. I have a validated basemap (shapefile) where I based whether the areas are correctly classified. My question is, is it acceptable to clip/subset 2 classes together (say forest and grassland; river and built-up; agri land and brush land), which I know have a relatively more distinguished spectral values, then classify each group containing 2 classes, and join all classes together via mosaic tool?
I got more accurate results this way, but I wonder if this is a scientifically valid method.


texts: Installed GRASS Addons not appearing under modules [windows 10, grass 7.4.0]

texts:
I have installed GRASS 7.4.0 and then use the console to install the addons, r.denoise and r.patch.smooth.

However, when I want to run these tools there is nothing under the addons section in the modules tab.


texts: How to merge shapefiles of two countries with QGIS

texts: I want to merge the shapefile of Nigeria and Cameroon admin level 1. I downloaded the files from gadm but I cannot merge the files with QGIS or find a shapefile of Africa having countries at states level. Could anybody help me with this?


texts: Using group by to set a PostGIS datasource using QGIS Python API

texts:
I am writing a QGIS Plugin and wish to obtain data from a PostGIS table using the Group By clause using something like the following code:

uri = QgsDataSourceURI()
uri.setConnection('localhost', '5432', 'postgis', 'postgres', 'xxx')
Query="select param_id, st_union(the_geom) as the_geom from myTable group by param_id"
uri.setDataSource('', '(%s)' % postGisQuery, "the_geom",'','gid')
vlayer1 = QgsVectorLayer(uri.uri(), 'testlayer1', "postgres")

This gives the error "No key field for query given." because it is looking for the gid key field. But if gid was put in the select statement of the Query, we won't get aggregated rows, just distinct rows. If I try an aggregation function on gid, I get the same error. If I try aliasing the aggregate, I get an "Erroneous query" error (even count(gid) as gid), same as if I put 'param_id' as the key field in setDataSource, because 'param_id' is not a primary key, I guess.

In this case, forcing the key field in the uri seems to make the group by clause useless. Is there another workaround I haven't thought of or is this the expected behaviour?

EDIT: in QGIS version 1.7.3 and my plugin code like below works, but not in my dev version (1.9.90):

Query="select param_id, st_union(the_geom) as the_geom from myTable group by param_id"
uri.setDataSource('', '(%s)' % postGisQuery, "the_geom",'','param_id')
vlayer1 = QgsVectorLayer(uri.uri(), 'testlayer1', "postgres")

So it allowed the use of param_id as a key, even though it isn't a primary key. Has something changed in recent versions that doesn't allow such code? In fact there doesn't seem to be an error message in the Log Messages, QgsVectorLayer just doesn't load the layer - using QgsMapLayerRegistry.instance().addMapLayer(vlayer1)

Does anyone know if such code should work in the latest dev version (maybe there is a more recent version that allows this or the feature has been deliberately discontinued?)

Ian


texts: Set geometry in geodataframe to another column fails : TypeError: Input must be valid geometry objects:


texts: Importing GPX files into ArcGIS 10.3 for Desktop Basic?

texts:
I want to import GPX files into ArcMap. There is a good answer
Adding GPX files into Arcmap? for version 10.1 using the GPX to Features tool but that is not available in 10.3. I think it has been superceded by Smart Mapping in 10.3, which is not in ArcGIS 10.3 for Desktop, Basic.

Currently I am using QGIS and the GPS plug-in
http://docs.qgis.org/2.0/en/docs/user_manual/working_with_gps/plugins_gps.html


texts: Understanding Analyse > Slope function of QGIS

texts:
Playing around with QGIS I discovered the tool 'Analyse > Slope' and I wondered what it actually tells me.
Is it an additional information to let's say contourlines, which already provide info on the slope to be expected?


texts: What's the difference between QgsPoint, QgsPointXY and QgsGeometry.fromPointXY(QgsPointXY()) in PyQGIS?

texts:
I am using PyQGIS. What is the difference between

QgsGeometry.fromPointXY(QgsPointXY(x,y)),
QgsPointXY(x,y) and
QgsPoint(x,y)?

When I print these 3 options, I get:
print( QgsGeometry.fromPointXY(QgsPointXY(x1,y1)))
<QgsGeometry: Point (59777 -266560)>
print( QgsPointXY(x1,y1))
<QgsPointXY: POINT(59777 -266560)>
print( QgsPoint(x1,y1))
<QgsPoint: Point (59777 -266560)>

(x1,y1) are specific coordinates that I used as a test.
I don't understand the difference between these objects, and I need to know because there are some methods that work only in one or two of them. For example, intersect method does not work for QgsPoint (at least it didn't work when I tried to check which feature did the point intersected with).


texts: Is it possible to thicken lines that share geometry with other lines proportionately to the number of lines above or below?

texts:
I have a number of bus routes, which for certain parts of their length share the exact same geometry and therefore appear as only a single line. Can I style those parts or segments of the lines that overlap exactly other lines?

Conceptually it is similar to the "rule-based" render for points that overlap. So, for example, a segment that shared its geometry with 3 others might have a lineweight of 3x, a segment overlapping with 2 a lineweight of 2x, a line by itself a lineweight of x.

NB: I don't want to actually offset the lines or use transparency. Nor can I fudge it — this is a city-wide dataset, so it cannot be done manually. I want to assign a variable stroke weight based on the geometry that overlaps.


texts: Converting address to coordinates using OpenLayers 3?

texts:
Is it possible to convert address to coordinate using OpenLayers 3?

I can to it a bad way by taking address and search it in the planet_osm_points table and get osm_id and after that search the osm_id in planet_osm_node table. But this is a bad way. I am pretty sure that OpenLyers3 have to do it, but can't find anything on web.


texts: Why is ArcGIS Feature Service layer incomplete once added to QGIS?

texts: I'm running QGIS3 and I'm trying to a add property cadastre layer from a publicly hosted ArcGIS Feature Service connection. The connection works ok, but when I add the cadastre layer, not all polygons are imported/showing? I've confirmed that the cadastre do exist by referencing a WMS version, so I'm not sure if it's timing out or if there's something else I should be aware of?


texts: Get coordinates of a building with geocoding

texts: I want to get the coordinates of a building with geocoding. At the moment I use the GeoCoder class for android to get from the selected address the coordinates, but these are not corresponding to the edge of the building. OSM is containing these information for each building, but I do not know how to get these information with the GeoCoder class. Is there a possibility to use OSM with the geocoder class for android to get this information?


texts: How to implement stopovers in pgrouting?

texts:
I used to use Dijkstra to find the shortest path between two points. Now I have a shortest route, which uses a street forbidden to use because of internal rules (too slow due to shopping mall).

Now I would like to add a stopover on an alternative road and use a two segments Dijkstra. Is this the best way or should I better work with a turn-restriction network? The latter allows to set the costs for the shortest path / the street in question higher as usual.

The TSP is currently only implemented with Euclidian distance - this is not accurate enough  for European street layouts.


texts: Importing raster data with known lat/lon to QGIS?

texts:
I have a number of raster files with known latitude/longitude of the picture edges.

What is the appropriate way to import such pictures in QGIS with correct coordinates?

All the options that I can find in QGIS raster transformation require me to input some other coordinates than lat/lon, and I am not sure how to calculate them; and the georeferencer plugin requires me to match points that I am unable to enter - the picture edges are transparent and not visible in the georeference tool, and the pictures don't contain obvious landmarks, I have to proceed from the lat/lon ranges supplied in metadata.


texts: I have a WFS-T layer on GeoServer based on a shapefile. I want to set a specific field as a readonly field so that WFS-T operations cannot update that field. Is this possible? I couldn't find any information about this, how can I do that?


texts: Examples of geovisualizations of global connectivity

texts:
I stumbled upon interesting visualization of global connectivity patterns:

  'Major road and rail networks in Africa, along with transmission line
  and underwater cable data.'

(Source, more pictures in the gallery. Original.)

Can you point me to other examples of visual representations of connectivity in global scale? Connectivity in this case applies to both transportation and communication. And geovisualizations might include static maps as well as interactive web applications.


texts: Are there any sources of UK building footprint data available?

texts:
I noticed that there's another question related to this topic, but the question was related to US data.

I'm looking at the possibility of producing an interactive map for a UK based city, which would benefit from an overlay describing the building footprints in the city centre.

Does anyone know of a good source for this information?  Ideally the source would be free, but commercial suppliers could also be considered.

Many thanks in advance.


texts: I have been trying to build spatialite for Android for a few days now without success. I have even tried the recent documentation from the Google project page here: https://code.google.com/p/spatialite-android/. Build documentation is is quite vague and there are not many resources on the interweb to help me out. Just wondering if this project has seen adoption or is simply dead. If its dead its too bad... it was a good initiative.


texts: QGIS cluster gdal Unknown option 'INTERPOL'

texts:
I am running cluster analysis from image analysis menu of saga provider in QGIS.  I use the qgis GUI from processing tool box, I call saga modules.
I got same error in many other algorithms. I can read this lines:

Log pannel shows this message

  io_gdal 0 -TRANSFORM 1 -INTERPOL 0 -GRIDS ....

  After other lines

  Unknown option 'INTERPOL'

It seems to be that I am running wrong version fo qgis, gdal or saga in my system.

I am runnig

Linux Mint 17.3 64 bits
qgis 2.14.3
saga gis 2.2.7
gdal 1.11.2+dfsg-1~exp2~trusty

I made udate and upgrade in my system and got no difference.


texts:
I have the portion of a map stored as a collection of .jpg tiles in tms set of folders. The problem is that this particular set seems to have a WGS84 (EPSG 4326) projection, while my desired projection is a Spherical Mercator (EPSG 3857) one. The only adequate solution I found is to use tiff format and do a reprojection using some GDAL tools. But can I do this conversion directly from tms to tms?
P.S. That's how those maps look in QGIS. EPSG:3857 on the left and EPSG:4326 on the right:


texts: What is the difference between CartesianObjectLen and ObjectLen in MapInfo?

texts: I'm a little unsure, which one is closer to calculating length using "Calculate Geometry" in ArcMap?


texts:
Im trying to run the query below in postgresql/postgis:

SELECT ST_AsText(pgr_pointsAsPolygon('SELECT id::int4, ST_X(geo)::float8 AS x, ST_Y(geo)::float8 as y FROM junction WHERE id IN ( 1050062040,.. ) UNION ALL SELECT 0::int4, 80.9475631713867::float8 as x, 26.8484115600586::float8 AS y  ')) ;

But getting following error:

ERROR:  function pgr_pointsaspolygon(unknown) does not exist
LINE 1: SELECT ST_AsText(pgr_pointsAsPolygon('SELECT id::int4, ST_X(...
                         ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Have installed postgis and have pgrouting extension also.
Any help ?


texts:
intento evaluar una interpolación IDW realizada en QGIS y desconozco la manera de validar o evaluar su ajuste (y con cuales herramientas).
Pero he descubierto WEKA como una alternativa para la validación cruzada.
¿Alguien puede orientarme o recomendar biliografía?

from Google Translate:

I try to evaluate an IDW interpolation performed in QGIS and I do not know how to validate or evaluate its fit (and with what tools). But I have discovered WEKA as an alternative for cross-validation. Can anyone advise or recommend biliography?


texts: How do I get a json list of REST SOE's supported by a Mapservice?

texts:
The html returned by a rest mapservice url includes "supported extensions" down at the bottom.  However the json returned does not list the extensions.  Is there a way to get this list of SOE's in a json format?

I'd include a sample url, but I can't find any rest SOE's when I search - does anyone know of a sample that has been published?

Update
Thanks to Bill, here's an ESRI sample that illustrates the issue:
The html page returns Supported Extensions, but when formatted as json, it doesn't.

Update 2
ESRI support filed it as an enhance request (NIM062551).


texts:
In the typical primary database in layers window, under more-> US Govt, there is a Postal Code Boundaries layer. I have been trying to find a way to save this, and ultimately add it to a folder of my own.

Another caveat: I want to save it in KML form, so that I may open it up in notepad and extract the coordinates making the boundaries to save in a database.


texts:
There is a lot of nested loops and wondering of ways I could speed up this code? Any ideas?

Note: This requires ArcMap 10.2

def cut_geometry(to_cut, cutter):
    """
    Cut a feature by a line, splitting it into two geometries.
    :param to_cut: The feature to cut.
    :param cutter: The polyline to cut the feature by.
    :return: The feature with the split geometry added to it.
    """
    arcpy.AddField_management(to_cut, "SOURCE_OID", "LONG")
    geometries = None
    with arcpy.da.SearchCursor(cutter, "SHAPE@") as lines:
        for line in lines:
            with arcpy.da.UpdateCursor(to_cut, ["SHAPE@", "OID@"]) as polygons:
                for polygon in polygons:
                    if line[0].disjoint(polygon[0]) == False:
                        geometries = polygon[0].cut(line[0])
                        polygons.deleteRow()
                with arcpy.da.InsertCursor(to_cut, ["SHAPE@", "SOURCE_OID"]) as insert_cursor:
                    for geometry in geometries:
                        if geometry.area > 0:
                            insert_cursor.insertRow([geometry, polygon[1]])

UPDATE as per @MichaelMiles-Stimson

I was able to move out the insert_cursor, by adding in code for an edit session. However can't figure out how to pull out the UpdateCursor without losing the functionality, since it's deleting and inserting rows back into the original feature it needs to get a new UpdateCursor each time.

def cut_geometry(to_cut, cutter):
    """
    Cut a feature by a line, splitting it into its separate geometries.
    :param to_cut: The feature to cut.
    :param cutter: The polylines to cut the feature by.
    :return: The feature with the split geometry added to it.
    """
    arcpy.AddField_management(to_cut, "SOURCE_OID", "LONG")
    geometries = None
    polygon = None

    edit = arcpy.da.Editor(os.path.dirname(to_cut))
    edit.startEditing(False, False)

    insert_cursor = arcpy.da.InsertCursor(to_cut, ["SHAPE@", "SOURCE_OID"])

    with arcpy.da.SearchCursor(cutter, "SHAPE@") as lines:
        for line in lines:
            with arcpy.da.UpdateCursor(to_cut, ["SHAPE@", "OID@"]) as polygons:
                for polygon in polygons:
                    if line[0].disjoint(polygon[0]) == False:
                        geometries = polygon[0].cut(line[0])
                        polygons.deleteRow()
                for geometry in geometries:
                    if geometry.area > 0:
                        insert_cursor.insertRow([geometry, polygon[1]])

    edit.stopEditing(True)