texts: Double precision error on user defined type

texts:
There is user defined type which consist of double precision type and integer. It looks like it
CREATE TYPE ZOOM_LVL AS ( eps FLOAT8, minptrs INTEGER );

This function is used to set the value to user defined type
CREATE OR REPLACE FUNCTION zoom_level( lvl ZOOM_LVL )
RETURNS ZOOM_LVL AS $$
  SELECT current_setting( 'zoom_level.' || lvl )::ZOOM_LVL;
$$ LANGUAGE sql;

And the value is set through the call to function like this:
CREATE OR REPLACE FUNCTION set_zoom_level( zlvl TEXT )
RETURNS VOID AS $$
DECLARE
  zoom_lvl ZOOM_LVL;
BEGIN
   CASE zlvl::INTEGER
     WHEN 0 THEN
       zoom_lvl := (0.5::FLOAT8, 1::INTEGER);
     WHEN 1 THEN
       zoom_lvl := (0.7::FLOAT8, 1::INTEGER);
     WHEN 2 THEN
       zoom_lvl := (0.7::FLOAT8, 1::INTEGER);
     ELSE
       zoom_lvl := (0.7::FLOAT8, 1::INTEGER);
     END CASE;

EXECUTE format( 'SET zoom_level.lvl TO %I', zoom_lvl )
// I alose tried EXECUTE format( 'SET zoom_level.lvl TO %I', zoom_lvl )
USING zoom_lvl;
END;
$$ LANGUAGE plpgsql;

CREATE OR REPLACE FUNCTION calc_clusters_internal()
RETURNS TEXT AS $$
 DECLARE
   coordinates TEXT;
   srid INTEGER :=4326;
   zoom_lvl ZOOM_LVL;
 BEGIN

   EXECUTE format( 'SELECT zoom_level( ''lvl'' );' )
   INTO zoom_lvl;

   EXECUTE format( 'SELECT ST_AsText( St_Transform( geom, $1 ) ), cluster_id
                    FROM ( SELECT ST_Union( cluster.coords ) AS geom, cluster_id
                           FROM (  SELECT geom.name, geom.coord AS coords,
                                  ST_ClusterDBSCAN( geom.coord, eps := $2::FLOAT8, minPoints := $3::INTEGER )
                              OVER() AS cluster_id
                              FROM ( SELECT name, ghash AS coord
                                     FROM cluster_storage_ptr ) as geom ) AS cluster
                              WHERE cluster_id IS NOT NULL
                              GROUP BY cluster_id
                              ORDER BY cluster_id DESC ) AS clusters;
          ')
   INTO coordinates
   USING srid, zoom_lvl.eps, soom_lvl.minptrs;

   RETURN coordinates;

   END;
   $$ LANGUAGE plpgsql
   IMMUTABLE;

And when I call calc_clusters_internal() method I get error message like this
ERROR:  invalid input syntax for type double precision: "(0.5,1)"
CONTEXT:  PL/pgSQL function calc_clusters_internal() line 10 at EXECUTE

I read through some articles and question here at StackExchange (this, this and this), also I tried play with data types. I tried to use FLOAT instead of FLOAT8, also tried to find maybe there is a need to convert text to digit but did not figure if it real needed.
How can I figure out what is the problem?
Additional info:
It seems that the problem somewhere in soom_level(ZOOM_LVL) or set_zoom_level(text) methods.


texts:
I am trying to figure out what the expression is to find all the roads in a TIGER street layer for a county that are the same as roads in a small selection of roads. The small selection of roads are the result of finding roads close to certain points of interest. Often, the TIGER street layer has multiple segments for a road, for example, say a road is called "HWY 99". There can be multiple records in the attribute table that are called HWY 99. There can also be records called Highway 99 or US 99 or such. For the purposes of this question, I am not worried about the variations on the name, I just want to be able to select all the records that are the same name.

I don't know what the proper expression is to do this. The TIGER layer is called street100k_l_or39 and the layer with the names of the roads I am trying to is called coastalroads. From the street100k_l_or39 attributes table I open the Select by Expression window. I have FULLNAME in coastalroads, but that doesn't work. I don't know SQL well and I don't know Python either, but I am guessing that an SQL statement in the Expression would do the trick. Maybe I need to do something like "coastalroads.FULLNAME" on the right side?


texts: PostgreSQL databases have an extension called unaccent to remove accents from words. Is there some function on GeoServer to do the same?


texts: How to replace an ArcGIS elevation service with a GeoServer elevation service

texts:
I'm trying to remove a dependency on ArcGIS in our system and I'm trying to replace ArcGIS's ImageServer with a counterpart on GeoServer.

Here's what I did so far:

Downloaded a sample elevation raster (GeoTIFF) from USGS.
Reprojected it to WGS 84 using QGIS.
Uploaded the projected raster as ImageMosaic to GeoServer.
Seeded a cached layer on gwc.

Here's what I'm getting in the tile preview:

The tile cache seems to be PNG pictures while I need a cache tile that is comprised of heights like ArcGIS's LERC format
The height should be defined by this function:
height = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)

How do I configure this information on GeoServer?
I've been searching everywhere and am looking for possible solutions.

To conclude here is what I need:

A LERC equivalent replacement.
If we're forced to use PNG, then configure it correctly and not just by creating a picture.
Serve the tiles by WMTS.
Tiles should calculate height information according to given function instead of a regular picture.


texts: How to add a OneGeology Layer to a Leaflet Map

texts:
My question is a continuation of Combine Leaflet with Geoserver WMS map (asked by someone else. I also understand the JavaScript in that post - my Q is not about javascript or leaflet).

However I tried to include geological map layers .

What I envision is: A user "drills down" from a topographic world map to a specific location, and then, after a click, optionally gets a geological map of a ~ 10*10 km² area. (I do not need to display a geological map of the  entire world)

The codesample I've linked to gives a head start but I do not know how to

find a suitable description on how to get a list of WMS Services curated/aggregated by Onegeology.org, (and optionally -if there are API restrictions- how to write Leaaflet.js code for it)
or alternatively get a Link to a different website that offers similar datasets/endpoints but better curated than by Onegeology.org (it does not have to be Onegeology.org - but according to my knowledge this seems to be the largest coordinated effort to-date to provide free geology data)

I've searched the OneGeology website but I did not find anything useful except some screenshot-walkthroughs to embed UK-specific WMS links into GUI-based GIS Software.

If there are other providers of geology data who offer geological maps as Leaflet-embeddable layers for any point of the Earth, I'll happily take that datasource instead. For example, I like this way to showcase layers and overlays:  "Leaflet Provider demo"  for topographic maps. Is there something similar for geology layers?


texts: Does OnStopEditing always happen after OnSave

texts:
During debugging, I discovered that the OnSaveEdits event is always followed by OnStopEditing and then OnStartEditing. Is this always the case?

I don't see the logic in this. I could understand if OnSave was fired after OnStopEditing (if the user choses to save), but not the other way around.


texts: rasterio masking with GeoJSON from file issue

texts:
I'm trying to load GeoJSON from a file for use with rasterio mask on a GeoTIFF and I can't seem to get the GeoJSON to load properly. I get this error:

File "/Users/user/example.py", line 18, in clip
out_image, out_transform = mask(src, geoms, crop=True)

File "/usr/local/lib/python2.7/site-packages/rasterio/tools/mask.py", line 12, in mask
return rasterio.mask.mask(*args, **kwargs)

File "/usr/local/lib/python2.7/site-packages/rasterio/mask.py", line 57, in mask
all_bounds = [rasterio.features.bounds(shape) for shape in shapes]

File "/usr/local/lib/python2.7/site-packages/rasterio/features.py", line 325, in bounds
geom = geometry.get('geometry') or geometry
AttributeError: 'unicode' object has no attribute 'get'

Here is the code:

#!/usr/bin/env python

import json
import rasterio
from rasterio.tools.mask import mask

class example:
    def __init__(self, tile_dir):
        self.tile_dir = tile_dir

    def clip(self):
        with open(self.tile_dir + "/geo.json") as data_file:
            geoms= json.loads(data_file.read())
        print type(geoms)
        # load the raster, mask it by the polygon and crop it
        with rasterio.open(self.tile_dir + "/tile.tif") as src:
            out_image, out_transform = mask(src, geoms, crop=True)
        out_meta = src.meta.copy()

        # save the resulting raster
        out_meta.update({"driver": "GTiff",
            "height": out_image.shape[1],
            "width": out_image.shape[2],
            "transform": out_transform})

        with rasterio.open(self.tile_dir + "/clipped.tif", "w", **out_meta) as dest:
            dest.write(out_image)

Any ideas? I've also tried doing this instead, but it results in the same error...

geoms= json.load(data_file)


texts: How to perform repetitive tasks in QGIS?

texts:
I am trying to do a treatment on many feature files, so I would like to automate it.

In fact, I have one shapefile with the spatial distribution of some species, and one with vegetation type.

I would like to select (by attribute) one species in the Species Shapefile, then to select (by locality) all vegetation areas which intersect with their distribution area. Finally, I would like to have a shapefile with, as name, the species name, and with attributes and forms of the frequented vegetation types. And I would like to repeat this for all species (more than 100), and if possible do this in an easy manner (so it could be done by another person).

I have already tried this task using Sextante plugin, but I can't have the species name as a shapefile name at the end.

Can someone suggest a method for this?


texts: GeoTools 2.6.5: Cannot get JMapFrame to work because of problem with processStylers

texts:
I am trying to get JMapFrame to work to visualize some feature. Unfortunately I keep getting errors although this test app can be started. Toolbars etc. are shown.

18.02.2011 16:44:38 org.geotools.renderer.lite.StreamingRenderer paint

SEVERE: null

java.lang.NullPointerException
at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1771)
at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:722)

(full stack trace here)

My source code is here. (And pom.xml here)

I assume the problem must be anywhere in "myStyle". Is there maybe a default style?


texts: Deleting custom functions in QGIS Field Calculator

texts:
Is there a way to delete custom functions (e.g. extractZipCode in the screenshot below) from the QGIS Field Calculator without having to look into the expressions folder on disc?

I know I can simply delete the Python script in this folder:

C:\Users\admin\.qgis2\python\expressions

But is there a way to actually do it from within QGIS?


texts: Overpass Turbo query within visible area (without using OSM script style)

texts:
I'm trying to do really basic queries on the current visible area in the Overpass UI, and I'd like to know what is the equivalent of 'bbox' in the following format:

(
  way["waterway"](53.3,-3.1,53.5,-2.6);
);

out body;
>;
out skel qt;

I'd like to replace the (53.3,-3.1,53.5,-2.6) with the equivalent of bbox. Any ideas?


texts: PgRouting Obtain RoadNetwork data from osm file

texts:
I am trying to obtain road-network data from OSM file using pgrouting and for this I am following this tutorial:

http://workshop.pgrouting.org/

The format I am looking for is following(bidirectional)

OSM_ID_1 OSM_ID_2 legth
OSM_ID_2 OSM_ID_1 legth
OSM_ID_3 OSM_ID_2 legth
OSM_ID_2 OSM_ID_3 legth
OSM_ID_3 OSM_ID_4 legth
OSM_ID_4 OSM_ID_3 legth
OSM_ID_2 OSM_ID_4 legth
OSM_ID_2 OSM_ID_4 legth

and so on...

I find that they have missing steps. At the end of this chapter they download the data in form of OSM files.
http://workshop.pgrouting.org/chapters/installation.html

Next chapter, they are using data from the "workshop directory":
http://workshop.pgrouting.org/chapters/topology.html

I have no idea how the got from one step to another.

Can anyone help me with this?


texts: Saving settings for batch run in ArcGIS for Desktop?

texts:
I am running a merge and dissolve on a variety of combinations of 9 different shapefiles, 3 at a time.

I made a model in the model builder that takes 3 inputs and performs a merge and then a dissolve.

I had a go at trying to make the iterator work but really i'd need more than one to make it work so I'll need to use batch anyway.

Basically, is there a way to save the settings on a batch run so that it can be repeated another time? Later on I might need to change some of the decisions we made on the initial shapefiles (the ones that are being merged) and it would be great if there was a single click button to repeat the action.

Alternatively, is there any way to import batch settings from excel?


texts: How to create scattered points in polygon

texts: I have few polygons and I want to create few scattered well distributed point within the polygon. I am used to with ArcGIS and QGIS platform. How can I make it?


texts:
I have two polygon layers, one is from natural earth data (Administrative 1 division) and the other is a polygon layer with some historical regions in Europe. As you can see in the image attached there are some areas which still has the same boundary, but since these two layers come from different sources they don't match up, is there a way I can match this automatically in QGIS 3.10?
I tried the snap geometries to layer tool and it just didn't work. (either it caused QGIS to crash, or the output was just the same as the input).


texts: Saving centroid with attribute fields in PyQGIS?

texts:
I'm new in PyQGIS and wrote a script to read a polygon and get the centroid:

from qgis.PyQt.QtGui import *
from qgis.PyQt.QtCore import *

# insert the location of the shp
layer = iface.addVectorLayer("/media/path/Setor_Censit_Urb_Cast_2010.shp", "Setor", "ogr")
layer2 = QgsVectorLayer('Point?crs=epsg:4326', 'MyPoint' , 'memory')

pts = []

# save the centroid as vector
prov = layer2.dataProvider()
points = []
for feature in layer.getFeatures():
    geometry = feature.geometry()
    centroid = geometry.centroid().asPoint()
    pts = [centroid]
    name = feature.attribute("CD_GEOCODI") # select the attribute

# Insert the coordinates in the layer2 shapefile
    for x,y in pts:
            feat = QgsFeature()
            point = QgsPoint(x,y)
            feat.setGeometry(QgsGeometry.fromPoint(point))
            points.append(feat)
prov.addFeatures(points)

# update extent of the layer
layer2.updateExtents()

# add the layer to the layers panel
QgsMapLayerRegistry.instance().addMapLayers([layer2])

But I want the attributes too. How can I do it?


texts: Updating or uploading CSS format style to GeoServer through REST API

texts:
I have tried that:

curl -u admin:geoserver -XPUT -H "Content-type: text/css" -d @data_clone.css http://localhost:8080/geoserver/rest/workspaces/sde/styles/style_clone.css

It does not change anything.
The way is working well for SLD type-styles. But I can not find any tutorial for CSS type styles to upload or update syle.

There is no error. It responses nothing.


texts:
I am trying to export a raster image from a WMS using gdal_translate and have not had any success.  I have read http://www.gdal.org/frmt_wms.html but still no success.  In my XML file, what should the values for SizeX and SizeY represent?

Here is the command line parameters: gdal_translate -of JPEG -outsize 500 250 ac3.xml ac3.jpg.

Error Message:
Input file size is 2666666, 1333333
0ERROR 1: GDALWMS: The server returned unknown exception.
ERROR 1: ac3.xml, band 1: IReadBlock failed at X offset 0, Y offset 0

Here is my ac3.xml:

<GDAL_WMS>
<Service name="WMS">
<Version>1</Version>
<ServerUrl>http://data1.commons.psu.edu/arcgis/services/pasda/AlleghenyCountyImagery2010/MapServer/WMSServer?</ServerUrl>
<Layers>AlleghenyCountyImagery2010</Layers>
</Service>
<DataWindow>
<UpperLeftX>-80.413955</UpperLeftX>
<UpperLeftY>40.717648</UpperLeftY>
<LowerRightX>-79.641264</LowerRightX>
<LowerRightY>40.153982</LowerRightY>
<SizeX>2666666</SizeX>
<SizeY>1333333</SizeY>
</DataWindow>
<Projection>EPSG:4326</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
</GDAL_WMS>


texts: CSV formatting: multiple points per row in qgis

texts: I have a CSV file in which each row represents a person and includes a location for them, which I want to map in QGIS as point layer. However, I would like some people to appear as a point in multiple locations simultaneously. What would be the best way to format my spreadsheet in order to reflect that in QGIS?


texts: Adding Geometric Network Trace to Map Using ArcPy

texts:
I am able to run Geometric Network Trace by using following ArcPy script but I also need to add Trace result into the map. Can you please let me know how I can add the result(graphic/geometry) to the map.

import arcpy

arcpy.env.workspace = r"E:/Utility/Sample/Montgomery.gdb"
# Local variables:
G_N = "E:/Utility/Sample/Montgomery.gdb/Water/Water_Net"
Flag = "E:/Utility/Sample/Flag.shp"
traceOut = "traceOut_Net"

# Process: Trace Geometric Network
arcpy.TraceGeometricNetwork_management(G_N, traceOut, Flag, "TRACE_UPSTREAM", "", "", "", "", "", "NO_TRACE_ENDS", "", "", "", "AS_IS", "", "", "", "AS_IS")
print "Trace Done"


texts: Basemap AGOL without internet connection

texts:
I have develop a JS webapp that call a arcgis services by web adaptor.
The AGS is deploy into a back end server and web adaptor into a front end server and web app is deploy into a separate web server with local ArcGIS JS API.
Now i have some client that are into a VPN to see only these 3 server but this client not have a internet connection, so does not load arcgis basemap by AGOL.
It's possible to load the basemap using a proxy or reverse proxy if the client user not have internet connection?
There is some example?


texts:
I am adding a Feature Grid in the Map page using this tutorial and I am not sure where exactly I have to add,

autoLoadFeatures: true

The tutorial says that I need to edit the feature manager section of the app.js but despite making the changes, I am still getting an empty feature grid.

Here is my code of the app.js that I modified,

{
            ptype: "gxp_featuremanager",
            id: "states_manager",
            paging: false,
            /*layer: {
                source: "local",
                name: "usa:states"
            }*/
            autoSetLayer: true,
            autoLoadFeature: true
        }, {
            ptype: "gxp_featuregrid",
            featureManager: "states_manager",
            outputConfig: {
                loadMask: true
            },
            outputTarget: "south"
        }


texts: How can I find the missing data from the downloaded bulk TRMM data?

texts: I have downloaded TRMM daily precipitation estimates for Indian Sub-continent from 1988 to present. I see that there are a lot of missing data days. I was wondering how can I possibly detect the daily missing TRMM files automatically without manually skimming through the downloaded data? Is there any tool/function/code that I can use to do this? I need to use the complete time-series as an input to a hydrological model. And in order to fill the missing data I need to know the exact days when it is missing.


texts: QGIS3 difficulty drawing 150km distance buffer and showing this on the map

texts: I wanted to construct a 150km distance buffer around a city in North America.  I changed the project co-ordinate system of the point to WGS84 Mercator North America from WGS 84 Lat/long to enable the buffer to be constructed in metres/km.  The buffer was drawn on the map, but it doesn't show on top of local US neighbourhood census tract boundary files (which I changed to the same co-ordinate system).  When I zoom to the full extent of the buffer layer, it appears to be different co-ordinbates to the census tracts layer. Am I using the correct co-ordinate system?  I assume 'on the fly reprojection' is automatically turned on in QGIS3.


texts: Training Random Forest using more than 5,000 samples

texts: I'm estimating forest biomass using Random Forest regression at a large scale. I want to train the Random Forest model using as many samples as possible (~100,000 samples), but it seems the Google Earth Engine can only train RF using no more than 5,000 samples. I wonder if there's a solution for this rather than split the study area.


texts: artefact issue gdalogr:translate with python

texts:
I'm trying to merge one band rasters into one multiband raster using gdalogr:merge in python. The fact is that I get an artefact, a lots of my values are converted near 0, which does not appear when I'm doing it manually from QGIS GUI (Raster-> Merge).

This is the histogram I get with the script

and this one manually...

my syntax in python :

outputs_GDALOGRMERGE_1=processing.runalg('gdalogr:merge', {"INPUT" :[blue,green,red,rededge,nir], "PCT" : False, "SEPARATE": True,"NODATA":0, "OUTPUT":"output_path"})

I tried using the algorithm a more classical way with

outputs_GDALOGRMERGE_1=processing.runalg('gdalogr:merge', [blue,green,red,rededge,nir],False,True,0,5,None)

But the same issue was happening and I thought maybe it came from the Float32 conversion, apparently not...


texts: Duplicate entry in layer_styles table with PyQGIS

texts:
I would like to duplicate an entry in QGIS (2.18.21) layer_styles table (in a PostGIS database) by the following steps:

From a PostGIS connection with styles saved to database add layer_styles table to the project and select it in the layers panel.

Using the following code on the python console I try to duplicate one of the features in the table:

>>> l = iface.activeLayer()
>>> f = [f for f in l.getFeatures()]
>>> f
[<qgis._core.QgsFeature object at 0x0000000029F4C378>, <qgis._core.QgsFeature object at 0x0000000029F4A048>]
>>> l.addFeature(f[0])
False

Now why does addFeature() return False here and how can I duplicate an entry in layer_styles table with PyQGIS?


texts: Issue on Adding Feature to Open MXD in Real Time Using ArcPy

texts:
I am using this code to add a feature from GeoDatabase dataset to an open MXD file

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Temp\Streets.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
targetGroupLayer = arcpy.mapping.ListLayers(mxd, "Main", df)[0]
addLayer = arcpy.mapping.Layer(r"C:\Data\NetMap.gdb\Streets\OneWay")
arcpy.mapping.AddLayerToGroup(df, targetGroupLayer, addLayer, "BOTTOM")

This is somehow adding the OneWay feature class to the Main Group Layer at Streets.mxd but I have to close the map and reopen it to see the data there.

I tried to refresh the TOC and Active view like (As it work in IDE inside the Current Map)

arcpy.RefreshActiveView()
arcpy.RefreshTOC()

but it is not doing anything with stand-alone script and MXD. Can you please let me know if there is a way to do this?


texts: Calculating NDVI value per pixel using GEE and extracting to CSV

texts:
I'm new to GEE so sorry for the basic question.

I would like to calculate NDVI value per pixel for a set of S2_SR images and extract the values to a CSV file.

Pseudocode:
1. import S2_SR image collection(start date X, end date Y).
2. clip every image to a specific polygon that I have previously imported.
3. calculate NDVI value for every pixel in the clipped image.
4. output the calculated NDVI values to a CSV file.

(Let's say the clipped image is 100x100m size, which means we have 10x10 pixels. So the CSV file should be pixels 1-100 and their values).

My code so far is built like this:

//IMPORT SEN2 IMAGE
var S2 = ee.ImageCollection('COPERNICUS/S2_SR')
  .filterDate('2019-09-01','2019-09-30')
  .filterBounds(poly)

// Define an index function (return only NDVI).
var NDVI = function(image) {
  return image.expression(
    '(NIR - RED) / (NIR + RED)',
    {
      'NIR': image.select('B8'),
      'RED': image.select('B4'),
    }).rename('NDVI').copyProperties(image, image.propertyNames());
};

// Calculate NDVI for each image
var NDVIS2 = S2.map(NDVI)

// Empty Collection to fill
var ft = ee.FeatureCollection(ee.List([]))

var fill = function(img, ini) {
  // type cast
  var inift = ee.FeatureCollection(ini)

  // gets the values for the points in the current img
  var ft2 = img.reduceRegions(poly, ee.Reducer.first(),30)

  // gets the date of the img
  var date = img.date().format()

  // writes the date in each feature
  var ft3 = ft2.map(function(f){return f.set("date", date)})

  // merges the FeatureCollections
  return inift.merge(ft3)
}

// Iterates over the ImageCollection
var newft = ee.FeatureCollection(NDVIS2.iterate(fill, ft))

// Export
Export.table.toDrive(newft,
"anyDescription",
"anyFolder",
"anyNameYouWant")

But the result I get is a value for each image taken,
As you can see here:

(I have selected only one of my fields in the displayed CSV output but it is the same for all.

Any suggestions?

Thank you!


texts:
Why this raster (tiff) does not have any values?

Why I am unable to perform:

doubleclick -> onechannel pseudocolor -> clafify

Both rasters are downloaded from the same site: www.globalforestwatch.org
from their "data page" respectively.

Working (from picture below)
http://commondatastorage.googleapis.com/earthenginepartners-hansen/GFC2013/Hansen_GFC2013_lossyear_50N_130W.tif

Not-working (from picture below)
http://commondatastorage.googleapis.com/earthenginepartners-hansen/GFC2013/Hansen_GFC2013_lossyear_60N_140W.tif

What is the difference in these tiff's? I am using Qgis 2.2 on Ubuntu.


texts: extracting time information from arcpy.da.searchcursor and Tuples

texts:
So I have a feature class in a GDB that contains time data that I wish to carry out calculations through arcpy. This data was entered from a string to a datetime format into the featureclass through a script that handles a special type of ASCII file.

The output format of this tuple, when accessed using arcpy.da.SearchCursor() takes the form of the following:

(datetime.datetime(1899, 12, 30, 13, 59, 18),)

Where the type of value I need to carry out further calculation needs to take the following form:

datetime.datetime(1899, 12, 30, 0, 0)

I get to this problem when I try the following code:

fc = "C:\\scripting\\timetest.gdb\\test1\\"
rows = arcpy.da.SearchCursor(fc,["time"])
a = []
for row in rows:
    a.append(row)

And when I look at the type of the output, I receive a 'tuple', which is the normal data output of the arcpy.da.SearchCursor() class.

type(a[0])
<type 'tuple'>

But what I really want to do is break the information out of the tuple so that I can carry out normal python operations with the datetime.datetime objects.

The help pages haven't been terribly useful in finding a way to break the data out of the tuple format. I can't print the information inside the tuple, nor can I access like an array. What I seek to do is get at the datetime.datetime object inside the tuple so that I may carry out my analysis. Has anyone run into this problem before?

I've uploaded a shapefile with the problem that I'm running at http://brianbancroft.ca/docs/timetest.zip in case someone wants to try running it.


texts: Fill array with coordinates within geographical bounds in Leaflet

texts:
I want to create an array and fill it with geographical coordinates I get from a bounds variable. Basically, a for-loop shall create coordinate pairs within the specified bounds with a fixed distance between each coordinate pair. See example code:

var arr = [],
    bounds = [[ 59.37519, 18.04616],[ 59.3606, 18.08169]],

for (var latitude = bounds[0][0], longitude = bounds[0][1]; latitude > bounds[1][0] && longitude < bounds[1][1]; latitude=latitude-0.003, longitude=longitude+0.003 ){
                    var lat = latitude,
                    lon = longitude;
              arr.push(lat,lon);

                    console.log(lat);
                 }

The current result looks like this:

Q1: I would like to fill each row entirely until i reach the lower right corner.

Q2: It would be nice to fill the array in the format of the bounds variable as coordinate pairs. At the moment it looks like: [ 59.37519, 18.04616, 59.37489, 18.04646, 59.37459,...]


texts: How to delimit point distances in ArcGIS for Desktop per Thiessen polygon

texts: I have 2 shapefiles. The first set contains x,y coordinates for 1100 hospital locations. The second pair contains x,y coordinates of about 7000 villages that are served by the hospitals. This means each hospital serves villages defined by Thiessen polygons. I need to calculate distance from each hospital to the corresponding villages in a specific Thiessen polygon. I can calculate this from the point distance in ArcGIS, but how will I get the distances per Thiessen?


texts: Using altered property in ArcGIS Toolbox Validator Class

texts:
I am trying to script some behaviour into the ArcGIS Toolbox validator class. Specifically, I am creating a dropdown parameter so the user can choose a predefined option and then a second parameter will update a list of items. The issue I am having is, when I change the option in the first parameter, I can get the options to change in the second parameter, but when I toggle the 'Unselect All' button in the second parameter, the items will not uncheck (they remained checked). I have a feeling it has to do with my script in the Validator.
Here are the details (see image below as well):

First parameter is a string type. It is required, Input Direction, Has a default value. Multivalue = No and uses a value list so that I can have a dropdown with 3 options to choose from
Second parameter is a string type. It is required. Contains Default values. Multivalue = Yes and uses a value list so that the items populated in this parameter (a list of items) can be toggled on or off.

So, in the Validator, my script is as follows. Can anyone see something obvious I may be missing here to get the 'Select All' and 'Unselect All' buttons to work?
import arcpy
class ToolValidator(object):
  """Class for validating a tool's parameter values and controlling
  the behavior of the tool's dialog."""

  def __init__(self):
    """Setup arcpy and the list of tool parameters."""
    self.params = arcpy.GetParameterInfo()

  def initializeParameters(self):
    """Refine the properties of a tool's parameters.  This method is
    called when the tool is opened."""

    self.params[1].filter.list = [1,2,3,4]
    self.params[1].values = self.params[1].filter.list
    return

  def updateParameters(self):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a parameter
    has been changed."""
    if self.params[0].altered == True:
      if self.params[0].value == 'Option 1':
        self.params[1].filter.list = [1,2,3,4]
        self.params[1].values = self.params[1].filter.list

      elif self.params[0].value == 'Option 2':
        self.params[1].filter.list = ['a', 'b', 'c']
        self.params[1].values = self.params[1].filter.list

      elif self.params[0].value == 'Option 3':
        self.params[1].filter.list = ['dr', 'bht', 'cjjjyy']
        self.params[1].values = self.params[1].filter.list

    return

  def updateMessages(self):
    """Modify the messages created by internal validation for each tool
    parameter.  This method is called after internal validation."""
    return


texts:
I am using shapely and Python.

How should I go about creating a circle using shapely whose radius is in meters?

If i use

sampleCircle = Point(1,1).buffer(1)
print sampleCircle.area

This returns an area of 3.13654849055. How do I interpret the unit of this area? I read that this can be interpreted in square degrees but seek a little more explanation.

Also, how do I create a circle with a specified radius (in meters) around a point (defined using lat,long)?

The closest article I found was this [http://comments.gmane.org/gmane.comp.python.gis/1582] but it lacks any concrete solution


texts: How to get started webmapping with xyz-tiles and Geoserver?

texts:
I´m starting to explore the possibilities of web based map presentation. Therefor I have a basic question in understanding. After reading a bunch of tutorials, could a workflow work like this?

Style a map (osm-bright) with tilemill
export styled map in mbtiles format
convert mbtiles format with mbutil to xyz-tiles
use geoserver to create a wms with these generated tiles (is geoserver able to serve tiles or do I need another component like a tile server?)
create a viewer with openlayers which shows my styled map tiles


texts: Customize geocoding locator styles in an ArcGIS Server environment

texts:
Using ArcGIS Desktop, it is relatively straightforward to customize locator styles by editing the corresponding CLS files. We are struggling to do the same in a server environment.

We have created a locator in ArcSDE (9.3.1) for Oracle 11g and a corresponding Geocode Service in ArcGIS Server (9.3.1). How do we customize locator styles in this environment?


texts: Updating (or using) Arcgis 9 Extension to Arcgis 10.1

texts: i am a noob learning arcgis, I want to use the following extension Generating and Updating Ordinary and Multiplicatively Weighted Voronoi Diagrams for Points, Lines, and Polygons built for arcgis 9 in arcgis 10.1.  How do i do that?


texts: I try to find "go to home folder" button in QGIS 2.12, like in the ArcGIS. It returns the default folder to the home folder where the map located.


texts:
I have the following script which selects the row with the maximum value in a specified field, and then deletes that record. This works when specifying a single input fc. I am working with ArcGIS 10.5.

fc = # the input feature class
field = # the field in the fc to sort by

rows = arcpy.SearchCursor(fc, '', '', '', field + ' D') # sort "field" descending

for row in rows: # read the rows
    max = row.getValue(field) # get value in field
    expr = '"' + field + '" = ' + str(max) # make "Where" expression
    arcpy.SelectLayerByAttribute_management(fc, "NEW_SELECTION", expr) # make selection
    arcpy.DeleteRows_management(fc)
    break # exit loop after first time

What I am trying to do, is loop this workflow over a list of feature classes (using ListFeatureClasses). I tried the following solution, which ran but didn't appear to do anything. (I'm running in the Python window at the moment, but would like it to run as a standalone script eventually).

>>> def deleterows(fc):
...     rows = arcpy.SearchCursor(fc, '', '', '', field + ' D') # sort "field" descending
...
... for row in rows: # read the rows
...     max = row.getValue(field) # get value in field
...     expr = '"' + field + '" = ' + str(max) # make "Where" expression
...     arcpy.SelectLayerByAttribute_management(fc, "NEW_SELECTION", expr) # make selection
...     arcpy.DeleteRows_management(fc)
...     break # exit loop after first time
...
>>> for fc in fc_list:
...     deleterows(fc)

fc_list = arcpy.ListFeatureClasses() # this is already defined before the above code runs.

I'm sure the answer is quite simple, but I'm still getting to grips with Python loops.


texts: How to add the geometry to google maps from geojson(retrieved as json) for a specified condition using javascript

texts:
I have a array called place_names which holds some place names. I have a GeoJSON layer loaded in CartoDB, which has three columns id, name and the_geom (which is a geometry object) that can be queried and retrieved as JSON. What I need is I am comparing the names in place_names array to the GeoJSON name column, if the name in place_names array matches with that of the GeoJSON names, I want to retrieve the geometry of the matched names and add that to Google maps. How could this could be done? My code so far:

var place_names = [];
$.getJSON(json_link,
    function (data) {
            for (i=0; i<data.rows.length; i++) {
                            unique = data.rows[i].region_name;
                            place_names.push(unique);
                        }
/*geojson names field*/
var msa_place = [];
$.getJSON(msa_usa_json_link,
  function (data) {
            for (i=0; i<data.rows.length; i++) {
                            msa_name = data.rows[i].name;
                            msa_place.push(msa_name);
                        }
                    });

var places = [];
    for (i=0; i<place_names.length; i++) {
        for (j=0; j<msa_place.length; j++) {

            if (place_names[i] === msa_place[j]) {
                places.push(place_names[i]);
                console.log(places);
                for (e=0; e<places.length; e++) {
                    ....../*do something to get geometry of matched places */
                }
            }
            else {
                console.log("no matches found");
            }

         }
      }
   });
});


texts: Exporting a CSV of Mean EVI Landsat 8 Values using reduceRegion function from Google Earth Engine (GEE)

texts:
I am trying to export a CSV file from Google Earth Engine (GEE) that reflects the mean EVI value per census tract. I have script that does this exact thing for NDVI from Landsat 8 but cannot seem to get the code to work for EVI. I understand that in my NDVI script I have specific bands but being unfamiliar with Java I cannot seem to figure out how to edit it for EVI.
Script to Export mean NDVI per Census Tract:

var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1')
    .filterDate('2015-05-01', '2015-09-30')

var count = collection.size();
print('Number of images in collection:', count)

var composite = ee.Algorithms.Landsat.simpleComposite(collection)

var compBands = composite.bandNames()
print('Composite bands:', compBands)

var NDVIcomp = composite.normalizedDifference(['B5', 'B4']).rename('NDVI')

Map.addLayer(NDVIcomp, {min: -1, max: 1, palette: ['blue', 'white', 'green']}, 'NDVI_')
Map.addLayer(UStracts)

var bandNames = NDVIcomp.bandNames()
print('Band names:', bandNames)

//US Census Tracts
var meansCT = NDVIcomp.reduceRegions({
  collection: UStracts,
  reducer: ee.Reducer.mean(),
  scale: 30,
});

Export.table.toDrive({
    collection: meansCT,
    description: 'US Tracts',
    folder: 'Aim1',
    fileNamePrefix: 'UStracts',
    fileFormat: 'CSV'
})


texts: How merge osm files with same ID objects?

texts: How merge many OSM files with same ID(between files) to one OSM file? I trying OSMCONVERT but he not add object with same ID in other OSM file.


texts:
I can't use the gDistance function of rgeos without a R crash even when I used the example script:

pt1 = readWKT("POINT(0.5 0.5)")
pt2 = readWKT("POINT(2 2)")
gDistance(pt1,pt2,T)

 *** caught segfault ***
address (nil), cause 'unknown'

Traceback:
 1: .Call("rgeos_distance", .RGEOS_HANDLE, spgeom1, spgeom2,byid, PACKAGE = "rgeos")
 2: RGEOSDistanceFunc(spgeom1, spgeom2, byid, "rgeos_distance")
 3: gDistance(pt1, pt2, T)

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"

rgeos version: 0.3-19, (SVN revision 524)
 GEOS runtime version: 3.5.0-CAPI-1.9.0 r0
 Linking to sp version: 1.2-3

Anyone have an idea ?

Edit: sessionInfo() gives

R version 3.3.1 (2016-06-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Scientific Linux release 6.6 (Carbon)

I just tested gBuffer and it does not work as well

pt1 = readWKT("POINT(0.5 0.5)")
gBuffer(pt1)

 *** caught segfault ***
address (nil), cause 'unknown'

Traceback:
 1: .Call("rgeos_buffer", .RGEOS_HANDLE, spgeom, byid, id, width,     quadsegs, capStyle, joinStyle, mitreLimit, PACKAGE = "rgeos")
 2: gBuffer(pt1)

Edit2 : I did some additional tests : the problem occurs whatever the rgeos version I use. When I use geos version <3.4.2 gDistance produces this error:

GeometryComponentFilter.cpp:35: virtual void    geos::geom::GeometryComponentFilter::filter_ro(const geos::geom::Geometry*): Assertion `0' failed. Abandon

while gBuffer(pt1) works ! As rcs wrote, this error has been reported (and seems unsolved)  stat.ethz.ch/pipermail/r-sig-geo/2015-February/022311.html

For version >3.5.0 neither gDistance nor gBuffer work but no error mess is outputted (only the segfault, see above)

Edit 3: I tried to go through the C-code of rgeos and I noticed that the segfault appears in this function:

GEOSGeom rgeos_xy2Pt(SEXP env, double x, double y)

where

s = GEOSCoordSeq_create_r(GEOShandle, (unsigned int) 1, (unsigned int) 2);

return an empty pointer that causes the segfault in

GEOSCoordSeq_setX_r(GEOShandle, s, 0, x)


texts: What is functionality of ArcGIS for Personal (formerly called Home) Use compared to ArcGIS for Desktop?

texts:
I note that ESRI has available an ArcGIS for Home product (for non-commercial use) for US$100 per year. I assume that this is pretty much fully-featured as it seems to have 3D Analyst, Data Interoperability, Data Reviewer, Geostatistical Analyst, Network Analyst, Publisher, Schematics, Spatial Analyst, Tracking Analyst, Workflow .

Anybody used this and can comment on the functionality as compared to the usually expensive product? I never assume anything these days.


texts: Definition Query to find next date value in ArcSDE attribute table?

texts:
I have an ArcSDE feature class that contains a date field called "SALE_DATE".  This sale date represents the bid date for ALberta crown mineral rights sales. A sale occurs about twice per month (one date value approx every two weeks).  Eg. for January there would be values of 1/14/2015 and 1/28/2015.  There are only ever 4 sales dates release at a time (4 date values in the feature class) and they revolve as the current sale occurrs, another one is released.  I need to create 4 layers from this one feature class, each representing the next sale date.  The trick is I want to set them up with SQL def query syntax so that the dates automatically revolve and I dont have to manually adjust the sale date, it should just grab the next available date value that is available.

This is an example of the syntax I have for the first upcoming sale date:

PROVINCE = 'AB' AND SALE_DATE > SYSDATE AND TO_CHAR (SALE_DATE, 'MM') = TO_CHAR (SYSDATE, 'MM') AND TO_CHAR (SALE_DATE, 'DD') < (TO_CHAR (SYSDATE, 'DD') + 2)


texts: Mixed SRID's when using users Lat & Lon coordinates to perform KNN through PostGIS when building points to jsonp

texts:
I have managed to create a script that passes the users lat and lon to a postgres query that finds the nearest 5 pubs to a users location.
However, on execution I realised no matter what lat and long I used the closets 5 points would always be within the Isle of Scilly, realising this I realised that the SRID for the script was still 2700 for the British national grid. Upon changing this to 4326 though I received a mixed SRID error

Operation on mixed SRID geometries
The script for this is:

//knn query
$knn1 =
    "SELECT jsonb_build_object(
            'type',     'FeatureCollection',
            'features', jsonb_agg(feature))
    FROM (
        SELECT jsonb_build_object(
            'type',       'Feature',
            'geometry',   ST_AsGeoJSON(st_transform(geom,4326),4)::jsonb,
            'properties', to_jsonb(row) #omits#
        ) AS feature
        FROM (SELECT #fields# FROM #table# as K, st_geomfromtext('point(#location#)',4326) ORDER BY st_distance(K.geom, st_geomfromtext('point(#location#)',4326)) LIMIT 5) row) features;";

//27700
//4326
//geomfromtext
//pointfromtext

    //replace placeholders
    $knn2 = str_replace("#table#", $ktable, $knn1);
    $knn3 = str_replace("#fields#", $fields, $knn2);
    $knn4 = str_replace("#location#", $Loc, $knn3);
    $knn5 = str_replace("#omits#", $geom, $knn4);
    ChromePhp::log($knn5);

//execute query
if (!$response = pg_query($conn, $knn5)) {
    ChromePhp::error("*KNN script failed*");
    exit;
}

//return data
while ($row = pg_fetch_row($response)) {
    foreach ($row as $i => $attr){
        echo $attr;
    }
}

with #location# replaced with the $Loc variable which is the location passed through using ajax
Image shows ChromePHP logs showing that the lat and long are successfully passed to the script


texts: Dealing with two input arguments to ModelBuilder?

texts:
I have a set of points (several independent files of different regions) and I want to make a selection according to a set of polygons (multiple files that form pairs with the points files). I want to use them to select by location through modelbuilder.

I want to inform only once the arguments, as is done, for instance, on batch processing. I have two interdependent arguments: each point layer/file should be selected by it's corresponding polygon layer/file (mask).

Is there a feature in the modelbuilder for this purpose?
Any suggestions?


texts: Finding closest anticorrelated polygon or automate what is learned in semivariogram?

texts:
I am trying to do spatial autocorrelation of sorts based on a layer of polygons of mean rainfall data. I want to see how rainfall deviates from a certain point on the landscape. Essentially, I want to see how far someone would need to go in order to find another polygon of rainfall that is most different to the polygon they live in. I have found the interpretation I need from the semivariogram function in Geostatistical Analyst, but I want to be able to click on a polygon and see where the closest, yet most different (in terms of rainfall amounts) polygons are.

I want to try doing one of the methods of spatial autocorrelation, but it appears all of the methods I have tried calculates z-scores based on the mean of the ENTIRE area of polygons, not the single polygon that I want to calculate the correlation from.

Do you have any ideas on how to best do this? Is spatial autocorrelation not the best route and are there other spatial statistics that I may want to pursue? Or is there a way to fiddle with the settings on spatial autocorrelation to ensure it is calculate the Zscore from a single point?


texts: Is it possible to customize the Vector and Raster menus?

texts:
As you know QGIS offers the ability to customize all the menus, toolbar, statusbar,... thanks to the option Customization in the Settings menu.
Here is the problem: I'm not able to use that to customize the vector and the raster menu. If I un-select some entries, when I reboot QGIS in order to update the view, nothing changes.
For example, I have unchecked certain menu items:

But nothing changes after restarting, they still appear:

BTW: I also tried to save the configuration file and then load it, but the un-selected entries in the customization menu remain all active.
I'm running QGIS 2.0.1 on a Debian 7.2 machine.


texts:
I'd like to quantitatively measure the display performance of mosaic datasets, image service layers, raster layers, feature layers, etc. in ArcMap 10.

How can I measure the draw time of a particular layer (or the complete drawing process if that is the only option) in ArcMap? What are the interfaces, objects and events involved? Is the StopWatch class in .NET suitable for accurately measuring this type of operation?

Has anyone already created an ArcMap add-in or extension for this purpose?


texts:
I have loaded a table into CartoDB with a column for latitude, longitude, date/time and a number.

CartoDB says that the data is georeferenced by the designated columns but when I open the map, I see nothing but the base map. My data is not being displayed.

Can someone tell me some basic mistakes I might have made?


texts: The remote server returned an error: NotFound

texts:
Our Sliverlight application (using V2.4) make a call to custom GP Toool which executes huge process which last for more than 10 min (avg), but before that client gets timed out. After going through all forums. a) Increased executiontime out value b) Increased GP Tool client timeout values but nothing worked. Any best methods to find the root cause. In Fiddler we are getting timeout exception in stack trace.

Below is the exact message from fiddler tool

Server Error in '/ArcGIS/rest' Application.

Request timed out.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Request timed out.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): Request timed out.]

Note : URL is available and able to browse in REST.This is an post request.

Please help on this


texts:
How can I get (if it's possible) a GeoJSON from OpenStreetMap with bike routes of a city only?

I have to say that I'm pretty new with the all the map/geo language. But as a developer I'm experimenting with routes for a project and I wondering if this request it's possible.

I see that http://www.opencyclemap.org/ that exactly this but for the whole world, but I don't understand how are they doing it. Although I know that the offer tile services. But what I want to do if have the data so I can manipulate it.


texts: How to create input mask for data capture into File Geodatabase by ArcGIS for Desktop?

texts:
For example if I had a "date" field (d = day digit, m = month letter, y = year digit) I could restrict entries to dd-mmm-yyyy instead of any number of different entry types(e.g. dd-mmm-yy or mmm-dd-yy or etc.) a user might enter.

A real life example using above entry types: User "A" creates a new feature in a feature class and in the "date_created" field user A enters 01-JAN-2015.  User "B" creates a new feature in the same feature class and in the "date_created" field user B enters 01-JAN-15. User "C" creates a new feature in the same feature class and in the "date_created" field user C enters  JAN-01-15.  These are all valid entries for a "text" type field and 100% accurate for the date but it is incredibly frustrating to SQL. To prevent this I am hoping that ESRI file geodatabase or feature classes have input mask capabilities like Microsoft Access does. Below is an example of input mask for access database.

I am using ArcGIS 10.2 for Desktop.


texts:
I had QGIS version 2.18.14 installed on my ubuntu. Today I wanted to make an update, but some problems came up. So I deleted QGIS and wanted to reinstall it. But everytime I try to reinstall it, this comes up:

The following packages have unmet dependencies:
 python-qgis : Depends: libqgis-analysis2.18.15 but it is not going to be installed
               Depends: libqgis-server2.18.15 but it is not going to be installed
               Recommends: liblwgeom-dev but it is not going to be installed
 qgis : Depends: gdal-abi-2-2-2 but it is not installable
        Depends: libqgis-analysis2.18.15 but it is not going to be installed
        Depends: libqgis-app2.18.15 but it is not going to be installed
        Recommends: qgis-plugin-globe but it is not going to be installed
        Recommends: qgis-plugin-grass but it is not going to be installed
        Recommends: qgis-provider-grass but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

How can I fix this problem?


texts:
Everytime I open the software QGIS 3.10.0 A Coruña in Ubuntu 18.04 I get the "default" interface. I can customize/personalize/modify it but it only lasts until I close it.

Edit 1: I have opened it in Windows and it works OK. It must be something of Linux


texts: Map Offset, Design not in Line with Map when I load my workspace

texts:
We are facing an issue when using QGIS to plan and design FTTx networks. We create the design and it all looks great and print it via composer to be validated on site but when we go back into the design to make changes the map is offset by a few millimeters which means we have to redo the entire design to fit the map again....

How can I fix this so we don't have to redo all this work?

We are using map CRS - EPSG: 3857


texts: How to include a PDF for displaying or downloading in QField

texts:
What I am looking for:

In a point-layer I would like to add a PDF (stored in OneDrive) that can be opened in Qfield while doing fieldwork.

What I did so far:

I created two fields named 'attachment' (widget type: attachment) and 'url' (widget type: text) I transferred the URL via field calculator to the attachment, because i wasn't able to fill in the URL directly to the default path (my workaround, maybe there is a better solution for this)

What works so far:

In QGIS, when i open the attributetable it shows me the PDF and I can even click on the link and it opens the file in the browser - thats exactly what I want.

What doesn't work:

When I export the file to QField and I open the attribute table there, the PDF is not shown and neither is the path. In the field 'url' (widget type: text) the path is shown but cannot be selected and thus not be opened in the browser.

I couldn't find a related post until now. How can I make this work?.


texts:
I am trying to find out if an mxd contains any schematic diagram layer through a python script tool. I am looping through all the mxds those are added to the python script tool and in each mxd checking each layer whether it's a schematicdiagram layer or not.

My actual code in .py file looks like this:

import arcpy
mxdList = string.split(arcpy.GetParameterAsText(0), ";")
outXLSpath = arcpy.GetParameterAsText(1)

mxdCount = 0

for mxdpath in mxdList:
    if "'" in mxdpath:
        mxdpath = mxdpath[1:-1]
    else:
        mxdpath = mxdpath

    mxdCount = mxdCount + 1

    mxd = arcpy.mapping.MapDocument(mxdpath)
    (filepath,filename)= os.path.split(mxd.filePath)

    arcpy.SetProgressorLabel("Extracting Layers for " + str(mxdCount) + " of " + str(len(mxdList)) + " MXDs \"" + filename[:-4] + "\"... ")
    arcpy.AddMessage("Extracting Layers for " + filename + "..." )
    lyrList = arcpy.mapping.ListLayers(mxd)

    for lyr in lyrList:
        if not lyr.isGroupLayer:
            longNameList = lyr.longName.split("\\" or "//")
            if len(longNameList)>1:
                    descTemp = arcpy.Describe('\\'.join(longNameList[:-1]))
                    if (not descTemp.dataType == "GroupLayer") and descTemp.dataElementType == "DESchematicDiagram":
                        arcpy.AddMessage("Schematic Layer")

The above code is throwing error for group layer it encounters in the list of layers. Following is the error being encountered by the tool!!

Traceback (most recent call last):   File "C:\ANM\ArcGIS\Tools\MyTools\ExportLayerList3-1-Test.py", line 34, in <module>

descTemp = arcpy.Describe('\\'.join(longNameList[:-1]))
File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\__init__.py", line 1234, in Describe
return gp.describe(value)   File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 374, in describe
self._gp.Describe(*gp_fixargs(args, True)))
IOError: "Boundaries" does not exist Failed to execute (ExtractLayerList2)

.

surprisingly the same code is working fine if I test it in ArcMap's Python window.

Would someone highlight the issue and suggest the solution.


texts:
A basic QGIS 2.2.0-Valmiera, Select By Expression - Field Calculator question.

Introduction

I am a geologist searching through a geological database (see attached figure). I have a shapefile and associated attribute file of which I would like to select certain records within a field to make as new shapefile layer.

Task/method

I wish to search the 'GEOLHIST' and select Permian lithologies using the field calculator. Subsequently I shall Save Selection As. I have tried using the following script unsuccessfully.

"GEOLHIST"
  IS 'Early Carboniferous to Early Permian'
  OR 'Early Permian'
  OR 'Early Permian to Late Carboniferous'
  OR 'Early Permian to Late Permian'
  OR 'Late Carboniferous to Early Permian'
  OR 'Late Carboniferous to Permian'
  OR 'Late Permian'
  OR 'Late Permian to Permian' 'Permian'
  OR 'Permian to Early Permian'

Question

What script can I use to select the above records?

Discussion

'GEOLHIST' IS 'Permian'

This script works. I have looked at the other OPERATORS (AND OR IS LIKE) and CONDITIONALS and have not figured out how to achieve my task.

@Nathan provided a working script, see attached figure.

I was not aware of the SQL operator in or the method of bracketing. This technique will be most helpful in the future.

"GEOLHIST" IN
(
    'Carboniferous to Early Permian'
    , 'Early Permian'
    , 'Early Permian to Late Carboniferous'
    , 'Early Permian to Late Permian'
    , 'Late Carboniferous to Early Permian'
    , 'Permian'
    , 'Permian to Early Permian'
)


texts:
Is it possible to create buffer and get intersected features in Qgis using Python?

I did in ArcObjects.but i need the same in QGIS also.

Dim topo As ITopologicalOperator
topo = chkPoint
Dim sFc As ISpatialFilter = New SpatialFilter
With sFc
  .Geometry = topo.Buffer(1000)
  .GeometryField = "Shape"
  .SpatialRel = esriSpatialRelIntersects
  .WhereClause = "NAME = 'ROYAL'"
End With
pFcursor = pLayer.Search(sFc, False)
pFeature = pFcursor.NextFeature


texts: Handling bad layers and empty layers using QGIS

texts:
I'm a novice in GIS.

I'm using QGIS 2.0.1. (Dufour) with Mac OS X (10.6.8). I have couple of dozens(?) of vector layers added on a project. At some point, when I opened a project, application opened a window "Handle bad layers". As far as I know, this should pop up when the project cannot find the file due to its new location, for example. There were a few (ca. 5) layers listed. But in the columns "New file" and "New datasource" there were the same path and file name. When I tried to select a file from the list and relocate it, QGIS crashed. After that it crashes every time at the same point. If I close the window, it's possible to get ahead. QGIS removed those files (vector layers) from the project's "Layers" list. That's not too bad. But now all the other layers in the project are empty.

If I right-click one of them in the "Layers" list and choose "Show feature count", it shows the right number, for example [13176]. But the style definitions under it (I've made the categorized color style according to one attribute value of the data), it shows [0] as feature count value.
if I choose "Open attribute table", it's empty. When I checked size of the original file (added as vector layer), it has some data.

I have NOT changed the location of data files - some earlier QGIS backup project files still find them.
Am I having too many layers, perhaps?


texts: Iterating shapefiles using ModelBuilder?

texts:
What tool can I use to run many shapefiles to intersect with a shapefile as a output?

It looks like that Iterate tools is use for feature classes or datasets and I don't see any for the shapefile.

I can use the Batch but I want to use ModelBuilder because I might need to add more tools later.


texts: Calculating slope between 5 and 10 percent using raster calculator of QGIS?

texts:
I went to Raster --> Analysis --> DEM (Terrain Models) to compute slope.

The slope ranges from 0-39.2311.

Now I'm unsure of the correct way to calculate slope between 5-10% in the raster calculator.


texts: Locating SpatialPoints on SpatialPixels using R

texts:
I have met this frustrating problem while using R doing some GIS operation.
The problem is, I want to locate some spatial points (SpatialPointsDataFrame) on geographical grids (SpatialPixelsDataFrame). But it seems that it would take FOREVER for me to do this.
I put my code here for you. First I read my data:
conf <- readOGR(dsn = path.expand("C:/Users/Abel/Desktop/conflict/reduce_to_short"),
                    layer = "conflict_short")

proj.crs <- proj4string(CRS(
  "+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"))

conf.newproj <- spTransform(conf, proj.crs)

africa_grid <- readRDS(file =
  "C:/Users/Abel/Desktop/divide/grid_with_adminfo/africa_grid.rds")

The conf.newproj is conflict data saved in SpatialPointsDataFrame type, and have about 170,000 observations. And the africa_grid is saved in SpatialPixelsDataFrame, which has 5 million pixels. I wanted to know which grid/pixel does each conflict locate, so I first tried this command:
cc <- over(conf.newproj, africa_grid)

because I followed the intuition of over function that it would return the information from the later object to each point in the first object. But later I found out that for SpatialPixelDataFrame, I should, instead using:
cc <- over(africa_grid, conf.newprooj)

and this should, I quote, "returns grid values x at spatial point locations y; NA for NA grid cells or points outside the grid".
But the command ran so slow even when I tried on a small sample including 10 conflicts. It did not finish after 30 minutes. If only find grids for 10 conflicts would take more than half an hour, I have no idea how long would it take to complete my full sample which include 170 thousand conflicts.
At first I thought this is because I use a SpatialPointsDataFrame instead of SpatialPoints as the command requires. So I changed my sample into SpatialPoints. But it still runs so slow.
I want to know whether there are other function for me to do this operation, or way to accelerate this process.


texts: How to easily import aerial imagery into gvSIG?

texts: I have used ArcView GIS 3.x for years. I have decided to try some of the free GIS desktop software. I am now trying gvSIG. One feature I was hoping for was the importation of aerial imagery relatively easily. In the past I would download tiles of images from various repositories but now want to work like I am in Google Earth and simple have nice aerial images easily available for various regions that I am focusing on. In particular I am working with New York State and Google earth aerial images would be perfect. Can anyone help me out. Thanks


texts: Web map linked to database that shows one spatial location at a time

texts:
I have a simple database with a record for each research project that occured on a national forest. Each project area is associated with a polygon, and there are around 200 polygons that are piled within a relatively small area. I want to create a web map (using open source software) that has a very visible database/project description components where the user can select a project record and then I would like for the record to link to a map of the study location. I can't show all project locations at once because it's too confusing given how many are overlapping.

Any ideas on how to accomplish this?


texts: Non-standard WMS parameters not sent in GetMap requests via QGIS?

texts:
I am coding a python plugin to QGIS that connects to the UK National Biodiversity Network (NBN) Web Mapping Service (WMS). In general, I don't have any problems doing this with the QgsRasterLayer API when I want to access the WMS as a public user. The problem is when I want to access the WMS as a registered user (to get access to secured data).

The NBN WMS provides a method for doing this by supplying a username and an MD5 hashed password as additional parameters to the web service called username and userkey respectively (https://data.nbn.org.uk/Documentation/Web_Services/Web_Map_Services/).

The parameters work as advertised when requests are tested in a browser. However, they have no effect when used through QGIS and when I used Fiddler to examine the HTTP requests that QGIS is actually sending to the NBN WMS, I find that the username and userkey parameters are no sent by QGIS.

They are non-standard parameters, but the OGC standard says that non-standard parameters are allowed (and don't break the standard). Does anyone know why QGIS strips these non-standard parameters out of the HTTP request or how I can get around it?


texts: Feature Type Unknown exception in GeoServer WFS request

texts:
I recently upgraded GeoServer from 2.12 to 2.142 because of a GeoNode update. A WFS GetFeature link failed in the new version of GeoServer:

http://myhost/geoserver/wfs?service=wfs&version=2.0.0&request=GetFeature&typeName=geonode:fr_admin1&outputformat=SHAPE-ZIP

The error message I got was something like:

<ows:Exception exceptionCode="InvalidParameterValue" locator="typeName">
    ows:ExceptionText>Feature type geonode:fr_admin1 unknown</ows:ExceptionText>

There is an exception "Feature type unknown" returned. However, I never had this issue in GeoServer ver. 2.12. Is there any changes for the WFS GetFeature request in GeoServer ver. 2.14? How to solve this problem?


texts:
I tried to use the GRASS GIS tool r.neighbors from QGIS with the method "quart1" and "quart3". But it is not possible to select one of these methods. In GRASS GIS itself it worked well.

Any ideas for a workaround for this issue in QGIS?


texts: Loading layer and check for polygon WkbType in QGIS 3.0

texts:
I am trying to edit a plugin to work in QGIS 3.0 and want to check for layer is polygon.

for layer in layers:
    if layer.type() == QgsMapLayer.VectorLayer and layer.wkbType() == Qgis.Polygon:
        self.dlg.comboBox.addItem( layer.name(), layer )

Its throwing error

  "if layer.type() == QgsMapLayer.VectorLayer and layer.wkbType() == Qgis.Polygon :
  AttributeError: type object 'Qgis' has no attribute 'Polygon'"

How can I use WKBType in QGIS 3.0?


texts: gdalinfo returns PROJCS["unnamed"] but QGIS returns the correct projection

texts:
I'm trying to understand why my gdalinfo call to a specific file returns "unnamed" for the PROJCS node.
The call looks like this: ./gdalinfo /path/to/file/dem.tif.

Output (notice the "unnamed"):

Driver: GTiff/GeoTIFF
Files: /path/to/file/dem.tif
Size is 25000, 25000
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["Polar_Stereographic"],
    PARAMETER["latitude_of_origin",70],
    PARAMETER["central_meridian",-45],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-1600000.000000000000000,2350000.000000000000000)
Pixel Size = (2.000000000000000,-2.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND

I've tried to set both GDAL_DATA and PROJ_LIB environment variables but still, I don't get the right projection back.

Using QGIS 3.10 I get this:

PROJCS["WGS 84 / NSIDC Sea Ice Polar Stereographic North",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Polar_Stereographic"],
    PARAMETER["latitude_of_origin",70],
    PARAMETER["central_meridian",-45],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","3413"]]

Why my gdal installation doesn't recognise the projection?

If I run ./gdalsrsinfo "EPSG:3413" the output is correct, similar to what QGIS is printing.

listgeo output:

TIFFReadDirectory: Warning, Unknown field with tag 42113 (0xa481) encountered.
Geotiff_Information:
   Version: 1
   Key_Revision: 1.0
   Tagged_Information:
      ModelTiepointTag (2,3):
         0                 0                 0
         -1600000          2350000           0
      ModelPixelScaleTag (1,3):
         2                 2                 0
      End_Of_Tags.
   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeProjected
      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
      GTCitationGeoKey (Ascii,8): "unnamed"
      GeographicTypeGeoKey (Short,1): GCS_WGS_84
      GeogCitationGeoKey (Ascii,7): "WGS 84"
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      GeogSemiMajorAxisGeoKey (Double,1): 6378137
      GeogInvFlatteningGeoKey (Double,1): 298.257223563
      ProjectedCSTypeGeoKey (Short,1): User-Defined
      ProjectionGeoKey (Short,1): User-Defined
      ProjCoordTransGeoKey (Short,1): CT_PolarStereographic
      ProjLinearUnitsGeoKey (Short,1): Linear_Meter
      ProjNatOriginLatGeoKey (Double,1): 70
      ProjFalseEastingGeoKey (Double,1): 0
      ProjFalseNorthingGeoKey (Double,1): 0
      ProjScaleAtNatOriginGeoKey (Double,1): 1
      ProjStraightVertPoleLongGeoKey (Double,1): -45
      End_Of_Keys.
   End_Of_Geotiff.

Projection Method: CT_PolarStereographic
   ProjNatOriginLatGeoKey: 70.000000 ( 70d 0' 0.00"N)
   ProjStraightVertPoleLongGeoKey: -45.000000 ( 45d 0' 0.00"W)
   ProjScaleAtNatOriginGeoKey: 1.000000
   ProjFalseEastingGeoKey: 0.000000 m
   ProjFalseNorthingGeoKey: 0.000000 m
GCS: 4326/WGS 84
Datum: 6326/World Geodetic System 1984
Ellipsoid: 7030/WGS 84 (6378137.00,6356752.31)
Prime Meridian: 8901/Greenwich (0.000000/  0d 0' 0.00"E)
Projection Linear Units: 9001/metre (1.000000m)


texts: NAN values in raster map statistics after import in GRASS GIS, error in r.mcda.topsis add-on

texts:
I imported a raster file (tif) into the GRASS GIS program using r.import and later r.in.gdal (every time the same problem).

Raster map statistics showed:

(Wed May 20 20:11:59 2020)
r.univar map=rasterData
total null and non-null cells: 1
total null cells: 1
Of the non-null cells:
----------------------
n: 0
minimum: nan
maximum: nan
range: nan
mean: nan
mean of absolute values: nan
standard deviation: nan
variance: nan
variation coefficient: nan %
sum: nan
(Wed May 20 20:11:59 2020) Polecenie zakończone (0 sec)

Below is my tiff file

https://www.dropbox.com/s/og6vujxsh508zz2/data.tif?dl=0

There is no problem with importing the file to ArcGIS and performing operations on it, but I want to use GRASS because of the mcda plugins e.g r.mcda.topsis.
https://github.com/OSGeo/grass-addons/tree/master/grass7/raster/r.mcda.topsis

When I run plugins with such imported layers I get an error:

Niewłaściwa mapa nan
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc with expression: _rasterData=(rasterData/sqrt(nan))*0.6

I guess it's related to nan values in statistics. Error is connected with standardizedNormalizedMatrix method of plugin. Source code is in the link above.

After importing to GRASS GIS, the raster is displayed correctly. Has anyone encountered such or similar problem or could look what is wrong with these tif files? Maybe some additional transformations are needed?


texts: Just need a lo-res & 8-bit depth elevation map either real or fictional (BMP?)

texts:
I am a software developer working on a strategy game in my spare time as a hobby. I still have very little knowledge of and experience with Geographic Information Systems and the different file formats, so please bear with me.

I am interested in using real-world maps as the stage for my game and have been investigating several online map data services to see if I could download an elevation map and convert it to raw data for my game maps. For example it could be nice to have an elevation map of the southern part of Africa for instance (nice simple cone shape).

For my purposes, the map data only needs to live up to the following:

Depth of 8-bit, so between 0-255 values
Elevation below sea level is not needed (sea level = 0)
Low resolution, at best 1 kilometer, but 10 kilometer is fine too

I am ready to investigate many of the file formats offered to be able to do so. However, since I am just at the experimental stage, I am wondering whether there aren't already some files like that available, e.g. in *.BMP format.

P.S.: I am also open for fictional or procedurally generated maps to play around with.


texts:
Does QGIS - through one of its rich algorithms library - allow for reduction of raster DSM/DEM resolution?
I want to speed up the analyses and reduce effect of detailed raster on results readability.

The problem lies in the detail level of the raster. Input dsm was made based on the uav survey (output format: .tiff), so its size (area) is not large, but very, very detailed. This makes results of every analysis run on it difficult to view - i.e. QGIS calculates the aspect for every bump even 10 cm high, or streams for catchments for completely irrelevant areas.


texts: Is there any way of merging two sets of tiles with gdal2tiles?

texts:
I've executed gdal2tiles against 2 raster coverages:

One big raster coverage, composed by several TIFF files. Example of
tile: http://dl.dropbox.com/u/6599273/319.png
One single TIFF file, geographically placed inside the coverage
above, but that wasn't procesed in the previous step. Example of tile:
http://dl.dropbox.com/u/6599273/319_bis.png

So, I first executed gdal2tiles against a "puzzle" of TIFF files, with
a missing piece, and then I executed gdal2tiles against that single
missing piece. I want to merge both tiles set. Zoom levels were 4-14,
only Google Maps output. Only levels 4-12 have the problem (tiles with
the same coords).

Is there any way of merging tiles or should I execute gdal2tiles
against the whole "puzzle"?


texts: Error in export image from Google Earth Engine from Python API

texts:
I am trying to use the GEE Python API to export an image to Google Drive.
Everything works smooth, except the exporting stage.

boundary = ee.Feature(Countries.first()).geometry().bounds().getInfo()['coordinates']

task_config = {
    'fileNamePrefix': 'image',
    'crs': 'EPSG:4326',
    'scale': 500,
    'maxPixels': 10e15,
    'fileFormat': 'GeoTIFF',
    'skipEmptyTiles': True,
    'region': boundary ,
    'folder': 'myfolder'
    }

task = ee.batch.Export.image.toDrive(image, str('image'), task_config)
task.start()

Where I get the following error:

Traceback (most recent call last):
  File "<input>", line 19, in <module>
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\batch.py", line 81, in start
    result = data.exportImage(self._request_id, self.config)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\data.py", line 1126, in exportImage
    return startProcessing(request_id, params)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\deprecation.py", line 32, in Wrapper
    return func(*args, **kwargs)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\data.py", line 1100, in startProcessing
    return send_('/processingrequest', args)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\data.py", line 1669, in send_
    raise ee_exception.EEException(json_content['error']['message'])
ee.ee_exception.EEException: Invalid request: 'driveFolder': Must be at most 255 characters.

It's like the parameter 'folder' was not read correctly, because in my Google Drive I then find an emtpy (since the task fails) folder named not after 'myfolder', as I specified, but after the long, entire list of parameters I specified in task_config. Any clue?


texts: Creating lines from raw survey data in CSV-file

texts:
I work for a survey company and we convert our raw survey data into a GIS format our clients can use and have used MapInfo in the past to achieve basic shapes our clients can use.
I start with 2 CSV files which simply have the attribute data and X, Y values for "Pits"(Points) and "Pipes" (Lines).
The Pits geometry works fine and is just created from the X, Y values, it's when I try to create "Pipes" (line) geometry which has the attribute data attached that I'm having issues.
The Pipes CSV contains 4 Columns labelled US_X, DS_Y, US_X, US_Y these refer to the X & Y of the upstream and downstream. Previously in MapInfo we would use a "CreateLine" command that could reference these 4 Columns and create the linework which also had the attribute data attached.
My attempts to do this in QGIS have involved bringing the CSV in via Data Source Manager -> Delimited Text and then lots of variations to attempt to create the geometry start from here. My closest attempt has been to choose 1 pair of the X,Y co-ordinates for the geometry definition and then create geometry from symbology->geometry generator using an expression that uses "Make_Line" stating the initial points I chose and then referring to the remaining co-ordinates to give it the other end. This worked but has the attribute data attached to either the US or DS depending on which one I chose when I imported the CSV earlier.
The problem with this as well is the linework that does show up won't stay if I need to send the data to the client in .TAB as lots of people request, it will come through as just the initial points.
I have also tried bringing the CSV in with no geometry defined and then trying to use similar expressions to generate the linework to no avail. I have also tried using a plugin called "Shape Tools" that looked very promising as it asked me for 2 sets of co-ordinates but upon running and it seemingly working no linework is generated.
I've also checked my table structure throughout these steps to make sure my CRS is the same at all times GDA2020/PCG2020 so I'm hoping it doesn't have anything to do with this.


texts:
mapObject = L.mapbox.map('mapDiv')
     .setView(defaultLocation,defaultZoom)
      .addControl(L.mapbox.geocoderControl('mapbox.places'));

             L.mapbox.styleLayer('mapbox://styles/gauravcatstech/civ82vos7008f2is5x92cp     vye').addTo(mapObject);

          L.control.scale({maxWidth: 100,metric: true, imperial: false}).addTo(mapObject);

How would i set max zoom in mapbox map..i have try object.maxZoome but sitt not able to set maxzoom


texts: Is there a faster way to assess accuracy of image classification in ArcGIS?

texts:
I am trying to perform accuracy assessment on a raster RGB image after supervised classification. I know the normal workflow in ArcGIS would be to create accuracy assessment points, then evaluate each point with ground truth data and lastly to calculate the confusion matrix. But the visual evaluation of ~500 points to reference data is beyond time consuming.

Is there a faster way to do this?


texts: How to export a postgis table to a pbf file?

texts: I need a tool like osm2po or osm2pgsql but that does the opposite thing, convert a postgis table to a pbf file. I think qgis can do this but I can't find that option.


texts: Convert pixel x,y position on map to latitude and longitude

texts: My map takes up 100% width and height of the browser screen.. I have a draggable div that is super imposed over the map, I am am capturing this divs position using offset(); to get the pixel top and left values. I would like to convert these values to latitude and longitude. Is this possible?


texts: Loading labels from Python script in QGIS

texts:
Is there a way to add labels of the added layers using python. I've tried these lines of code but no label shows after execution in QGIS 3.0

for layer in QgsProject.instance().mapLayers().values():
    layer.setCustomProperty("labeling/fieldName", "Id" )
    layer.setCustomProperty("labeling/placement", QgsPalLayerSettings.Horizontal)
    layer.setCustomProperty("labeling/predefinedPointPosition", QgsPalLayerSettings.BottomRight)
    layer.setCustomProperty("labeling/fontSize","10" )
    layer.setCustomProperty("labeling/bufferDraw", True)
    layer.setCustomProperty("labeling/enabled","true" )
    layer.triggerRepaint()


texts: Export Print Layouts with QMS Map Layers

texts:
I would like to export my map from the print composer that has a background layer from the QMS Quick Map Services plugin. I get this warning and then can't export the background layer:

"Some WMS servers (e.g. UMN mapserver) have a limit for the WIDTH and
HEIGHT parameter. Printing layers from such servers may exceed this
limit. If this is the case, the WMS layer will not be printed"

Any suggestions or workarounds?


texts: How to split a geotiff into a standard tiling scheme with Geotools in Java

texts:
I would like to tile random geotiffs to a standard grid, with a standard size of 256X256 using Geotools in java. My use case is as follows: I receive a "stream" of raster data in the form of multiband geotiffs, most files are over a GB in size. I am then storing them in Hadoop HBase for both spectral analytics and retrieval. I need to break them into smaller pieces, but not arbitrarily; they need to be split on a standard geographic grid so when new images come in and overlap, the tiles line up across all images that overlap over time. I have googled and binged all I can, and can't figure out how to create tiles with Geotools at all.
All of my code for reading the tif, reprojecting etc, all work fine.
Someone please point me in the right direction.

I am using Geotools 11.1, java 7, on windows 7


texts: Working with temporary files in ArcObjects using Geodatabases?

texts: My current add-ons rely on shapefiles for working with temporary files. For example, if I run a spatial analyst tool, I create a new shapefile to store the output geometry. ArcGIS stores all temporary files in a default GDB. Can someone point me in the direction of some .NET code or resources that would help me to structure my temporary file handling in the same way? It would be nice to have everything in one GDB that could be cleared, rather than in a folder containing many shapefiles and rasters.


texts:
I am currently trying to use the OS MasterMap topography layer in QGIS, however having some issues achieving the correct styling in particular for the Cartographic Text. I was using different software previously (Trimble FastMap)for the import of GPS data and the creation of the final map which has worked fine, however I am switching to to QGIS as FastMap is no longer supported.

The problem I am having is that when importing the Cartographic Text in QGIS - either as a raw .gz file or a shapefile (converted from .gml) – the text is displayed at a constant angle and not as shown below (which is an image from FastMap) whereby the road names, for example, are displayed in the middle of the road.

However, in QGIS the text is displayed at the same angle and it often overlaps different land classes (below). Also, the other stylesheets don’t seem to work i.e. the layer disappears once the stylesheet has been applied - I have unchecked scale dependent visibility (downloaded from here https://github.com/OrdnanceSurvey/OSMM-Topography-Layer-stylesheets/tree/master/Schema%20version%207).

What is causing this, or is this the only way QGIS displays OS Data?


texts: Creating points along line based on line lengths

texts:
I have a road network network (polyline shape layer) with multiple line lsegments. Each line segment has different line length as shown in image 1.

I am trying to generate points along lines based on specific distance. For instance, If the length of lines is less than 80 meters generate one point along line else two points for higher lengths.
I tried to generate points along lines by using PyQGIS as the script is given below. The problem is, it generate only midpoints of lines by dividing the line.

I searched some of the existing answers: answer 1, answer 2, answer 3. But the problem is these solutions are only generating random points along line without considering length of line.
layer = iface.activeLayer()

temp = QgsVectorLayer("Point?crs=epsg:4283", "result", "memory")
temp.startEditing()

attrs = layer.dataProvider().fields().toList()
temp_prov = temp.dataProvider()
temp_prov.addAttributes(attrs)
temp.updateFields()

for elem in layer.getFeatures():
    feat = QgsFeature()
    geom = elem.geometry().interpolate(elem.geometry().length()/2)
    feat.setGeometry(geom)
    feat.setAttributes(elem.attributes())
    temp.addFeatures([feat])
    temp.updateExtents()

temp.commitChanges()
QgsProject.instance().addMapLayer(temp)


texts:
I would like to syncronize a Google spreadsheet in my account in the CartoDB.com service, but the sync options are not available. I have found this in the documentation of Cartodb, but I have no experience in programming, and I do not know how to run a rake task.

Is there any other thing that I should do to sync the tables?


texts: OpenLayers: Show a styled title similar to pop-up but always visible?

texts:
I need to basically create boxes with titles inside, set to different styles (different coloured box, different FontAwesome icon etc.) set to specific points on the map, ideally replacing the label titles for LinePoint features.

What would be the best/most ideal solution? I presume creating pop-ups that are always "popped up/visible" - but I don't want the little 'arrow' directly below (nor the white box outline) - I suppose those can be disabled by CSS ? Except I'm using the canvas rendererer (I can change to dom or webgl, I figured canvas looked nicer but unsure which works best for which situations)


texts:
I have a multipoint adress layer creating problems with set-returning function cannot be used.

I tried :
Converting multipoint layer to point using PostGIS?
Multipoint vs point PostGIS

I tried converting the layer with vector > geometry tools > multipart to signle part in QGIS and sending it back to the PostGis dB but I still get the error.
I tried as well by thicking the box "create single parts instead of multiparts" when sending the layer to postgis db with db manager in qgis but the error remains. And the type of my geometry is still MultiPoint:

I need this conversion to use ST_LineLocatePoint and get the following error.
    ERROR: line_locate_point: 2st arg isn't a point
    SQL state: XX000


texts: Select by Location (Between two layers) - ArcObjects C#

texts:
I have two Point Feature Classes - Say FC1 and FC2 - added in the current map

I want to Select Features from FC1 that intersect with Features of FC2

This can be easily done with ArcMap's Select By Location (Providing FC1 in target layer, and FC2 in source layer)

However, when I'm trying to do it in ArcObjects, using IFeatureClass.Search Method and following this example I have the following code

public ESRI.ArcGIS.Geodatabase.IFeatureCursor PerformSpatialQuery(ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass, ESRI.ArcGIS.Geometry.IGeometry searchGeometry, ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum spatialRelation, System.String whereClause)
{
  // create a spatial query filter
  ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilter=new ESRI.ArcGIS.Geodatabase.SpatialFilterClass();

  // specify the geometry to query with
  spatialFilter.Geometry=searchGeometry;

  // specify what the geometry field is called on the Feature Class that we will be querying against
  System.String nameOfShapeField=featureClass.ShapeFieldName;
  spatialFilter.GeometryField=nameOfShapeField;

  // specify the type of spatial operation to use
  spatialFilter.SpatialRel=spatialRelation;

  // create the where statement
  spatialFilter.WhereClause=whereClause;

  // perform the query and use a cursor to hold the results
  ESRI.ArcGIS.Geodatabase.IQueryFilter queryFilter=new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
  queryFilter=(ESRI.ArcGIS.Geodatabase.IQueryFilter)spatialFilter;
  ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor=featureClass.Search(queryFilter, false);

  return featureCursor;
}

In this function, I have to provide a feature class and a IGeometry as parameters, rather than two Feature Classes similar to Select By Location

Is there any other method, that simply takes two Feature Classes as whole and return the intersecting geometry from one Feature class? Or do I have to Iterate through the complete Feature Class and provide each point's geometry one by one?


texts: Why GeoServer is blocked during restarting when its GWC had seeded a large quantity of cahce file(PNG)

texts:
There are a large quantity of layers have been published in our GeoServer, considering the performance, we have seeded the cache PNG files for these layers using GWC, but right now we restart GeoServer, it is always blocked at the moment of code '[storage.DefaultStorageFinder] - * Found Java Environment GEOSERVER_DATA_DIR set to PATH , using it as the default profix'.

I am not sure if this is blocked or that It needs a long time to take to complete some tasks during restarting.


texts: Count points in polygon - sum is giving NULL results

texts: When doing the "count points in polygon" I set up a sum of one the parameter. The problem is that at the end I get "NULL" for this column. Everything else is working well. I tried with integer, whole or real numbers.


texts: Error when running distance matrix in QGIS 3.4.10

texts:
I just recieved this error when running the distance matrix in QGIS 3.4.10. I have been using this with success but am now receiving this error. I have checked the data and I cannot see anything different that would cause an error.

I was running the Standard (N x T) distance matrix.

Traceback (most recent call last):
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\PointDistance.py", line 145, in processAlgorithm
nPoints, feedback)
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\algs\qgis\PointDistance.py", line 270, in regularMatrix
fields, source.wkbType(), source.sourceCrs())
Exception: unknown


texts:
I have an raster file in my server space, which has the same projection as my webmap, and I would like to crop the image by passing the visible extent of a webmap. I think the cropping function is easily possible via a python script server side, but the process of converting the map envelope coordinates to a bounding box the script could use to cut the image to that exact extent is beyond me at the moment.  Any ideas, methods, or general roadmap would be helpful.

In a nutshell, I am trying to reproduce the "export" functionality of an ESRI map service without using ArcServer.

Like this:
http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/export?bbox=-9562211.80152863,4584479.44244939,-9519931.21541649,4626760.02856153&size=1024,1024&format=jpg&imageSR=102100&bboxSR=102100&f=image

Am I crazy or what?


texts: OpenLayers 5: add Interaction and style selected feature

texts:
based on this example addInteraction adds opacity, so I am setting a new style for each selected feature, however the clicked features remain red.

I only want to style with the red border only one feature at a time.

var style_simple = new ol.style.Style({
  fill: new ol.style.Fill({
    color: 'khaki'
  }),
   stroke: new ol.style.Stroke({
      color: '#880000',
      width: 2,
      opacity:1
    })
});

var style_noBG = new ol.style.Style({
    fill: new ol.style.Fill({
    color: '#5755d900'
  }),
   stroke: new ol.style.Stroke({
      color: 'yellow',
      width: 2,
      opacity:1
    })
});
    var style_selected = new ol.style.Style({ //style to be added on selected layer
        fill: new ol.style.Fill({
        color: '#5fba6a38'
      }),
       stroke: new ol.style.Stroke({
          color: 'red',
          width: 3,
          opacity:1
        })
    });

    var getStyle = style_simple;
    $("#layerbg").change(function () { //fires when checkbox is changed
      if ($(this).is(':checked')){
        getStyle = style_simple;
      }
      else{
        getStyle = style_noBG;
      }
    vector.setStyle(getStyle);
    });

    var vector = new ol.layer.Vector({
      style:style_simple,//set default style when page is loaded
      source: new ol.source.Vector({
        //url: 'https://openlayers.org/en/latest/examples/data/geojson/countries.geojson',
        url: 'JS/getjson.json',
        format: new ol.format.GeoJSON()
       //,serverType: 'geoserver'
      }),opacity: 1
    });

var selectClick =  new ol.interaction.Select({
    condition: ol.events.condition.click
  });

        if (select !== null) {
          map.addInteraction(select);
          select.on('select', function(e) {
          var extent = e.target.getFeatures().getArray()[0].getGeometry().getExtent();
          e.target.getFeatures().getArray()[0].setStyle(style_selected); //commenting out this line works but adds opacity to the layer
          map.getView().fit(extent,{duration: 590},map.getSize());
          });
        }


texts: QGIS 3.4 Madeira crashes when calling print()

texts:
I am using the PyQGIS template from @underdark for showing the crash. Her script is running like a charm, but as soon as I add a print("finished...") - call in her code, QGIS 3.4 Madeira crashes.
You can look up her code on this site:
@underdarks class template for python processing scripts
And in the following code snippet you can see the part where I added the print()-call:
    def processAlgorithm(self, parameters, context, feedback):
    source = self.parameterAsSource(parameters, self.INPUT, context)
    (sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
                                           source.fields(), source.wkbType(), source.sourceCrs())

    features = source.getFeatures(QgsFeatureRequest())
    for feat in features:
        out_feat = QgsFeature()
        out_feat.setGeometry(feat.geometry())
        out_feat.setAttributes(feat.attributes())
        sink.addFeature(out_feat, QgsFeatureSink.FastInsert)

    print("finished ...")  # QGIS3 crashes after this line
    return {self.OUTPUT: dest_id}

The crash looks like this (please note that the string "finished..." has been printed into the console before QGIS crashed):

Any suggestions?


texts: Zonal statistics for multiple rasters with overlapping polygons

texts:
I have a shapefile with 300 polygons that correspond to 300 rasters (the rasters have the exact same extent than their corresponding polygons).
What I'm trying to do is to run Zonal Statistics on this dataset but the problem is that many polygons overlap many rasters (the rasters can overlap each other as well).
Here is an example:

First I used this answer with the code below:
root = QgsProject.instance().layerTreeRoot()
for layer in root.children():
  if layer.name().startswith('RASTER_CODE'):
    prefix = layer.name()[-6:-4]
    params = {'INPUT_RASTER': layer.name(), 'RASTER_BAND': 1, 'INPUT_VECTOR': 'MY_SHAPEFILE', 'COLUMN_PREFIX': prefix+'_', 'STATS': 2}
    processing.run("qgis:zonalstatistics", params)

But since polygon 1 and polygon 2 overlap: the Zonal Statistic tool calculates 2 means for those polygons...
... and even if that part of the code:
if layer.name().startswith('RASTER_CODE'):
    prefix = layer.name()[-6:-4]

enables me to retrieve which "mean" is the correct one, it is far too time-consuming for 300 polygons...
Here what I would like to get:

So I could eventually sum up  mean_1  mean_2   mean_3 in a new field  mean gathering the mean of each of my polygons
EDIT: I found a workaround with Rstudio (see script below) but I would like to find a solution within pyQGIS
library(tidyverse)

data_with_row_names <- data.frame(data[,-1], row.names=data[,1])
means <- sapply(row.names(data_with_row_names), function(x) data_with_row_names[[x, x]])
means_final <- data.frame(t(sapply(means,c)))


texts: Sync tables option not available in local install of CartoDB

texts:
I've got a production version of CartoDB running locally, but when I try and create a table based on a spreadsheet hosted on Dropbox I don't get the option to keep the data in sync, instead I get upgrade your account.

What do I need to do to resolve this?


texts: Remove duplicated items in Arc attribute table?

texts: I have imported a set of points into ARCmap using a kml file created in google earth. During this process, a number of the points were duplicated (see below). Is there a way to get rid of the duplicated points in arc rather than recreating the kml file which will be hugely time consuming?


texts: QGIS How are data points of the same value classified for Equal Count (Quantile)?

texts:
For example, I have 100 data points and am classifying them using the Equal Count (Quantile) method.
I want to have 5 classes, and in the ideal situation I will have 100/5 = 20 values in each class. However, I have 35 data values which are 0.
Would QGIS classify all 35 zeros into one class, or split them into 2 classes at random?
I have tried for one dataset and I noticed that all the zeros are grouped together. Is that the case every time?
Couldn't find any documentation for how they split the data for Equal Count.
I tried to read the source code at https://github.com/qgis/QGIS/blob/master/src/core/classification/qgsclassificationmethod.cpp to gain some insights. However, I see how they generated the breaks but I can't find where they classify the values into the separate groups. Can someone tell me where and how the code works for this part?