texts: Updating min and max values with ArcPy on stretched raster symbology in ArcGIS Pro?

texts:
I have a map I am making where all I want to do is change the source layer for a raster to a new layer.  I would then like to apply the same symbology as the original layer, but change the min and max values used to stretch the raster.

So far I have done this:

import arcpy

#load in aprx
aprx = arcpy.mp.ArcGISProject("in_aprx")

#get the maps
one = aprx.listMaps()[0]

#update the current raster with a new raster, this new raster has different min and max values which is what I ultimately want to change

one.updateConnectionProperties(original_layer, new_layer)

#save a copy
aprx.saveACopy("new_map.aprx")

I can access the layers symbology like so:

one_layers = one.listLayers()

one_layers[0].symbology

but I am not sure how to change the min and max values from here.  As of now the minimum and maximum are being used from original_layer which are very different and results in poor stretching.


texts: Converting from Lat/Lon (WGS84) to Mercator (UTM)

texts:
i am trying to render a map with Mapnik via Python. Therefore I first created a style file (as XML) and my code looks so far:

m = mapnik.Map(400, 400)
style = 'osm.xml'
mapnik.load_map(m, style)

box = mapnik.Box2d(347950, 5207105, 425404, 5316784)
m.zoom_to_box(box)

mapnik.render_to_file(m, 'map.png')

The problem is that the map shows the wrong part of the world. I think somewhere in the conversion is an error.

I tried the following values:

Lat/Lon: 47/7 ==> X/Y: 32T 347950mE 5207105mN

Lat/Lon: 48/8 ==> X/Y: 32U 425404mE 5316784mN

As I enter these lat/lon values on google maps it shows the mid east part of france southwest part of germany. Calculating the map with the calculated values i get the coast of france, especialle the city named "Port Vendres" in the lower left corner.

What am i doing wrong here?

The values in the database seem to bee in mercator form and the data was imported using osm2pgsql with no special options.

Update:
I printed out m.srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over

and the scale_denominator(): -8.92857142857

Update 2:
I read the documentation of osm2pgsql and it says that it imports the data as spherical mercator by default.
So i assume that the values are stored in that format and the projection is correct.


texts: How is QT designer used to implement radio buttons for a QGIS field

texts:
I have a custom data form, created using QT Designer, for interacting with a particular layer on QGIS.

A simple line-edit widget on such a form (as with most other form widgets) requires that the widget has the exact same name as the field name in the GIS data. It is this which tells QGIS to populate the form field with the corresponding data.

How is the equivalent achieved for a set of radio buttons? Do they need to be in a group box with the corresponding data field name? Do the individual buttons need names matching the potential values? Or is it instead necessary to use Python to select the correct button and to respond to interaction with the buttons?


texts: while reading a tiff file filenotfoundexception

texts:
I am unable to create File object while instantiate a tiff file using TestData.file function it is giving file not found exception . But the tif file is exist on the same path

  file exists

  Exception in thread "main" java.io.FileNotFoundException: Can not
  locate test-data for "images/no_crs.tif"  at
  org.geotools.test.TestData.url(TestData.java:306)     at
  org.geotools.test.TestData.file(TestData.java:328)    at
  org.geotools.gce.geotiff.GeoTiffTest.main(GeoTiffTest.java:17)

here is my code

public class GeoTiffTest
{
    public static void main(String[] args) throws FileNotFoundException, IOException
    {
    File file = new File("images/no_crs.tif");
    if(file.exists())
            System.out.println("file exists");
    else
            System.out.println("file not exist");
        final File noCrs = TestData.file(GeoTiffTest.class, "images/no_crs.tif");
    }
}


texts: How to get a list of map scales programmatically in ArcMap?

texts:
I need to get all map scales, which are shown in the ArcMap scalebar.
I need list of value, something like:

1:1500
1:3000
1:6000
1:12000
1:24000
1:50000
1:100000

Does anyone know how to get it?


texts: Leaflet-pip - Display properties of overlays polygons

texts:
I'm using leaflet-pip to return overlays polygon in a clicked point. Results seems to be good, but I have an array with [object Object]. How can I display the name or specific properties of matched features ?

For example

var myLayer = L.geoJson(myData,{
}).addTo(map);

var match = leafletPip.pointInLayer([-0.993005, 49.069792], myLayer, false);

alert(match);

Data

var myData =
{"type": 'FeatureCollection", "features": [
{ "type": "Feature", "properties": { "name": "01", "type": "type01" ...
{ "type": "Feature", "properties": { "name": "02", "type": "type02" ...
]}


texts: Changing vector layer dynamically using OpenLayers 4?

texts:
I need dynamically change vector layer on map, which is represented by some route in geojson. This new geojson I get from my service, so I have function changeRoute, which I will call in ajax on success :

function changeRoute(newRouteInGeoJSON) {
    // change vector layer here and redraw it by new Geojson...
}

And here is my actual code :

var format = new ol.format.GeoJSON({
featureProjection:"EPSG:3857"
});
var vectorSource = new ol.source.Vector({
features:format.readFeatures(routeJSON)
});

var vectorLayer = new ol.layer.Vector({
    source: vectorSource,
    style: new ol.style.Style({
        stroke: new ol.style.Stroke({
            color: 'red',
            width: 4
        })
    })
});

var markersCooord = getMarkersCoordinates();

var sourceFeature = new ol.Feature({
  geometry: new ol.geom.Point(ol.proj.transform(markersCooord[0], 'EPSG:4326',
  'EPSG:3857'))
});

var targetFeature = new ol.Feature({
  geometry: new ol.geom.Point(ol.proj.transform(markersCooord[1], 'EPSG:4326',
  'EPSG:3857'))
});

var sourceSource = new ol.source.Vector({
  features: [sourceFeature] //add an array of features
});
var targetSource = new ol.source.Vector({
  features: [targetFeature] //add an array of features
});

var sourceStyle = new ol.style.Style({
  image: new ol.style.Icon(({
    anchor: [0.5, 1],
    src: 'data/source.png'
  }))
});
var targetStyle = new ol.style.Style({
  image: new ol.style.Icon(({
    anchor: [0.5, 1],
    src: 'data/target.png'
  }))
});

var sourceLayer = new ol.layer.Vector({
  source: sourceSource,
  style: sourceStyle
});
var targetLayer = new ol.layer.Vector({
  source: targetSource,
  style: targetStyle
});

var map = new ol.Map({
    target: 'map',
    layers: [
        new ol.layer.Tile({
            source: new ol.source.XYZ({
                url: 'http://10.0.2.2:8080/geoserver/gwc/service/tms/1.0.0/Bachelor%3Av_slovensko_group@EPSG%3A3857@png/{z}/{x}/{-y}.png'
            })
        }),
        vectorLayer,
        sourceLayer,
        targetLayer
    ],
    view: new ol.View({
        center: ol.proj.fromLonLat([22.00, 48.82]),
        minZoom: 10,
        maxZoom: 18,
        zoom: 10,
    }),
    controls: []
});
//var extent = source.getExtent();
//map.getView().fit(extent, map.getSize());

function getMarkersCoordinates() {
    var start, end;
    var isFirst = true;

    for (var i = 0; i < routeJSON.features.length; i++) {
        if (isFirst) {
            if (routeJSON.features[i].geometry != null) {
            start = routeJSON.features[i].geometry.coordinates[0];
            isFirst = false;
        }
        } else {
            if (routeJSON.features[i].geometry != null) {
                for (var j = 0; j < routeJSON.features[i].geometry.coordinates.length; j++)
                    end = routeJSON.features[i].geometry.coordinates[j];
                }
            }
        }
        return [start, end];
}

My current scripts using geojson to draw route, and calculate first and last coordinates to create geopoints for pins.

How do I use the function changeRoute to change my vector layer to new geojson?


texts:
I'm working with QGIS 3.4.3 and have a list of addresses (1500ish) that I need to map into lines. I have a CSV file having a start and end of each street and also have the same list separated in two CSVs, one for start and the other for ending. What I need is to put those addresses as lines into my map.
I also used MMQGIS to geolocate the starting and ending points in order to join them with lines. So, I'm working with 2 options now.
My questions are:

How can I geolocate lines with a start and end address?
How can I join multiple points with a line?


texts: How to create pattern fill via geomtry generator in QGIS3?

texts:
I would like to style polygon layer using geometry generator to create point patterns but using just generated points geometry. Is it possible? How can I achieve that?

I know that I can use just use polygon geometry and choose points pattern fill but I don't want to use that option. I'm looking for workaround to create points pattern fill which remain vector when exported. In QGIS3 is a bug which prevent standard pattern fill to be exported as vector.

I genereted some lines or points inside polygon via geometry generator and they was exported as vector. So it should work but I lack experience to create regular pattern fill in geometry generator.


texts: How to generally determine if a Point is inside a Polygon/Region?

texts:
I have a region (i.e. closed polygon) like this given in cartesian coordiantes:

1: 628497 / 239586
2: 642383 / 249881
3: 657705 / 241262
4: 652677 / 230489
5: 631370 / 231446
6: 628497 / 239586

I like to know whether point 631849 / 238868 is inside this region or outside?
It would be trivial for a rectangle region, however my regions have an arbitrary shape and a lot of points.

I know, there are several working tools available to do this, for example MapInfo. However, I like to get a mathematical approach to code my own function in a common program language. A .NET assembly would help as well.


texts: Getting regions with neighboring borders?

texts:
I am currently working with some shapefiles of congressional precincts of the US.

One of my objectives is to get a list of the "Neighboring" precincts for each of the precincts. For example, if precinct X shares a border with YZ then I know that X has neighbors Y and Z.

I saw that ArcMap is a very powerful tool for working with shapefiles and analyzing data.

What tool can I use to get this done?

This is how my map looks like:


texts: Heatmap of events, I can't get the right resolution

texts:
With QGIS 3.2.3., I'm trying to create a heatmap of a set of events (ie: bikes passing on a road). This is the original vector.

What I'm trying to get is a heatmap with darker colour where a lot of bikes have passed, and light colour where a few have.

I've tried two approaces:

1) Gdal > Vector Conversion > Rasterize

2) Interpolation > Heatmap (Kernel Density)

I've tried with several parameters, but I always get, a result which is not satisfactory:

1) I get a single pixel where I had an event (so just 0/1 resolution)

2) I get very large circles, going out of my scope

(I attach here two examples).
Can anybody help me to set the right parameters?


texts: Using .osm.pbf file as an offline map resource for QT OpenStreetMap plugin

texts:
I implemented the example in the link below,

https://www.qt.io/blog/2017/05/24/qtlocation-using-offline-map-tiles-openstreetmap-plugin

Works well, however I need much more map data then the provided file in the example. To satisfy this absent I exported necessary map area in the format of .osm.pbf.

But I am not able to use this format in the QT plugin.


texts: ArcPy publish large map throws ERROR 001269: Compressing the service definition failed

texts:
I have a .mxd file with more than 1.3 million features that I would like to publish as ArcGIS map service using Python.

When I publish the map manually from ArcMap, it works fine and it appears in ArcCatalog. However, I have to use arcpy since this process needs to be invoked regularly every few days.

I use the arcpy functions arcpy.StageService_server() and arcpy.UploadServiceDefinition_server().

This raises the following error:

File "D:\Program Files (x86)\ArcGIS\Desktop10.7\ArcPy\arcpy\server.py", line 1405, in StageService
    raise e
arcgisscripting.ExecuteError: ERROR 001269: Compressing the service definition failed.
Failed to execute (StageService).

When I run the same code with a smaller mxd file on the same system, it works fine. Also, some people mention that this might appear when using 64 bit Python. I checked this, it is running in 32 bit mode. So my guess is that the error is raised because of the amount of features (>1.3 million).

How could I avoid this error? Or is there a possibility to split up the mxd file programmatically and then merge the published map services?


texts: heatmaps with local maxima, weight, api functionalities

texts:
I am looking for a heatmap vizualization on a map, which shows:

local maxima: that means that you always see some "red spots" regardless the zoom. See the picture below.

enables to set a weight to the points.
provides an API.

Ideally I would like to also display a legend for the heatmap.

UPDATE
Based on my research and a comment of @IvanSanchez I found that:

Leaflet with leaflet.heat plugin and heatmap.js turned out to cover all three requirements. However, a problem with heatmap.js was that points being plotted are very close to each other and the outcome was a red overlay rather than a heatmap. See the picture below. This problem was overcome in leaflet by setting radius and a blur parameters. Leaflet turned out to be the best option.


texts: Creating tile packages (.tpk files) in ArcGIS for Desktop using multiple cores?

texts:
It takes hours or days to create tile package files on my workstation, which has 4 cores, 32G ram and a SSD drive. I noticed only one core is in active use while it is working.

Is there a way to tell ArcGIS 10.2 for Desktop to use multiple cores?

Also, it would be nice to see what's going on - a preview panel would be nice? Is there any way to keep an eye on what is going on?


texts: Georeferencing CAD drawing against point data and/or raster image?

texts:
I am working on a project to identify households within certain buffer areas of a proposed water pipeline. I have raster imagery of the area of interest, point data for the households, and a CAD drawing of the proposed pipeline and buffer areas. My understanding of what needs to be done is as follows:

upload CAD .dwg to ArcGIS and georeference .dwg
Digitize the pipeline
add the raster image (for reference, mostly)
add data of households
add buffers
select households by location

I'm stuck on step 1. Information about the CAD drawing:

The Coordinate System is unknown and the source can't provide the information
I do not have access to AutoCAD
There are features listed in the properties and visible in the data frame when loaded into ArcMap

I have tried every method out there to georeference the CAD drawing, including:

identifying a Coordinate Systems through the properties window based on known UTM
using Georeference tool to add control points - the issue here was that I couldn't get the projected raster image or the project point data to 'show up' to connect the control points from the drawing to the projected data
using the Measure tool to measure distance between what would be the control points and manually adding/subtracting the X and Y to manually move the drawing (this was the closest I came to a solution but it was a bad one)
converting the CAD features to shapefiles and trying to project those

Meanwhile, my dataframe properties and projected data were all on the same coordinate system.


texts: Getting system locale settings error creating GRASS location from Python?

texts:
I am trying to use GRASS 7 from Python without explicitly creating a location. I am starting with the script provided at the GRASS-Wiki. This script tries to create a new location in the /tmp/ folder with the following lines:

p = subprocess.Popen(startcmd, shell=True,
                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if p.returncode != 0:
    print >>sys.stderr, 'ERROR: %s' % err
    print >>sys.stderr, 'ERROR: Cannot generate location (%s)' % startcmd
    sys.exit(-1)
else:
    print 'Created location %s' % location_path

But this code bit is failing with these cryptic messages:

grass70 -c epsg:3044 -e /tmp/grassdata/35ba41efc124ae1c791f5c538713d948
Created location /tmp/grassdata/35ba41efc124ae1c791f5c538713d948
grass70 -c epsg:3044 -e /tmp/grassdata/8e9e4baf21ef6831d4f7b1c4096259e7
ERROR: Fix system locale settings and then try again.

ERROR: Cannot generate location (grass70 -c epsg:3044 -e /tmp/grassdata/8e9e4baf21ef6831d4f7b1c4096259e7)

How can this script be fixed?


texts: Running zonal statistics and not all zones represented?

texts:
I have been working on a Python script to automate the steps illustrated by whuber here:Create points around the edge of viewshed results

I am trying to create a horizon graph illustrating the maximum viewing angles from a single observer point in all directions. Here is the script:

import arcpy
from arcpy import env
from arcpy.sa import *

env.Workspace = "C:/Temp/Python"
env.overwriteOutput = True

inDEM = "C:/Temp/multiDEM.tif"
env.extent = inDEM

inPoints = "C:/Temp/Points_ALL.shp"
outPoints = "C:/Temp/Python/output/pts.shp"
outPath = "C:/Temp/Python/output/observers"
outputPath = "C:/Temp/Python/output"
outEuclidean = "C:/Temp/Python/output/euclidean"
fieldFID = 'FID'
Elevations = 'RASTERVALU'
arcpy.CheckOutExtension("Spatial")

ExtractValuesToPoints(inPoints, inDEM, outPoints)

arcpy.MakeFeatureLayer_management (outPoints, "pts")

with arcpy.da.SearchCursor('pts',[fieldFID, Elevations]) as cursor:
    for row in cursor:
        fid = str(row[0])
        print fid
        ### Select and export each feature
        arcpy.SelectLayerByAttribute_management ("pts", "NEW_SELECTION", '"FID" = {}'.format(fid))
        arcpy.FeatureClassToFeatureClass_conversion("pts", outPath, fid+".shp")
        ### Create Viewsheds
        outViewshed = Viewshed(inDEM,"pts",1,"CURVED_EARTH",0.15)
        outViewshed.save("C:/Temp/Python/output/viewsheds/"+fid)
        ### Euclidean Distance
        outEucDistance = EucDistance(outPath+"/"+fid+".shp")
        outEucDistance.save(outEuclidean+"/"+fid)
        Euclid = outEuclidean+"/"+fid
        ### Subtraction for Relative Elevations
        elevation = row[1]
        outMinus = Minus(inDEM, elevation)
        ### Division for "viewing angle"
        outDivide = Divide(outMinus, outEucDistance)
        ### Tangent Angles
        outTimes = Times(outViewshed, outDivide)
        outSetNull = SetNull(outTimes, outTimes, "Value = 0")
        tangentAngle = Tan(outSetNull)
        tangentAngle.save(outputPath+"/angles/"+fid)
        ### Aspect of Euclidean Distance
        outAspect = Aspect(Euclid)
        outInt = Int(outAspect)
        outInt.save("C:/Temp/Python/output/int/"+fid)
        ### Zonal Statistics
        ZonalStatisticsAsTable(outInt, "VALUE", tangentAngle, outputPath+"/tables/"+fid, "DATA", "MAXIMUM")

So this script does the following:

Iterate through Points_ALL.shp to select one row at a time
Export each row to a feature class
Create a viewshed of each using inDEM
Find the Euclidean Distance
Find relative elevation through Subtraction
Find Viewing angle - Dividing relative elevation by the Euclidean Distance and taking its TANgent to find the viewing angle
Deriving the aspect of the Observer (then discretizing it using INT)
Running ZONAL Statistics on the Integer Zones and finding the MAXIMUM angles from step 6 in each aspect "zone."

So what's the problem? Well...

After investigating each table, I noticed that I receive two errors:

The maximum viewing angles in some areas are greater than 90 degrees (some as high as 600) so I think I am missing something in my calculations.
Not all zones end up in the resulting table. I'll have missing aspect values even though I check the data and there are obviously results in the directions that are missing.

Can someone help me find what I am missing? Did I skip a step or misinterpret a step from the previous question?


texts: Substracting attributes of different layers

texts:
Can I subtract two attributes belonging  to two different layers? In this case these would be two polygons holding DEPTH attribute (Depth1 - Depth2).

Is this possible and if so how?


texts: Unable to start modules in QGIS GRASS plugin (GNU/Linux Debian)

texts:
Recently, the Toolbox of QGIS GRASS plugin can't find modules in my GNU/Linux Debian. When I click on any module, the toolbox reports the message: Cannot find module x.xxx and, after, I have the dialog window options totally empty (see image below).

My system worked nicely until yesterday.

To solve this problem (in my system recently actualized; with QGIS v. 2.8), I uninstall and install QGIS-GRASS system, including configuration files, erase my .qgis2 home and .grassrc6 (I modified my .bashrc too for adapting these changes) files. Nothing took effect.

I found out that the GRASS-QGIS modules are in /usr/share/qgis/grass/modules. My question is: How can I get my bindings to this path again?

Note: GRASS Console and GRASS commands of Processing Toolbox work well; apparently. However, I would like using the Toolbox of QGIS GRASS plugin again for saving time and it can use my already created work spaces.


texts:
I have seen that QGIS upgraded its MacOS packaging in 2019.  I am trying to setup an environment for QGIS plugin development and haven't seen any resources since then (and very little since QGIS 3 was released).
Specifically I am wondering how to access the QGIS specific widgets in QtDesigner.
Is there anything similar to OSGeo4w that includes scripts to set up system paths etc and includes binaries for QtDesigner with the QGIS custom widgets?
The following blogpost seems to indicate that I would need to compile from scratch but that seems to be oriented to developing QGIS itself not Python plugins. https://www.lutraconsulting.co.uk/blog/2020/04/22/qgis-macos-development/
Working on MacOS Catalina and QGIS 3.10 LTR.
Is there anyone out there who develops QGIS python plug-ins on MacOS or am I stuck with Windows?


texts: Plotting polygon with hole as two separate polygons using Leaflet


texts: After r.sun processing pixels in [0,:] row and [:,0] column of output contain NaN/nodata values

texts:
I am using r.sun to calculate the daily insolation values for a region of a GeoTIFF.

I noticed that the resulting output has a 1-pixel wide artefact along the [0,:] row and the [:,0] column (assuming numpy axis conventions) - all the values in this region are unexpectedly NaN

I went back to look at some code from which my code is derived and noticed that this artefact also exists in that outputs generated by that code. Furthermore, that code sums across multiple r.sun runs (with r.mapcalc), and in that case, the artefact is 2 pixels wide (e.g. in the [0:2,:] rows and [:,0:2] columns).

It looks to me that the actual problem isn't r.sun but r.gdal.out (or perhaps r.gdal.in) since these are the only components that are used twice in the summed scenario.

It seems unlikely that r.gdal.in and r.gdal.out would introduce artefacts of this kind. What am I missing? Why is there this 1 pixel artefact in the single use case, and a 2 pixel artefact in the summed case?


texts: Read an ArcGIS Feature dataset using GDAL

texts:
I am new to GDAL in Python and would like to use it to create a list of populated layers in a ArcGIS mdb Feature datasets.  I have the code below that provides a list of all the populated layers but it returns a list for all the datasets in the database.  The database has Feature datasets for municipal water systems, sewer systems, transportation systems, etc.  How can I return only the layer counts for one of these Feature datasets and all of its layers; i.e Feaure dataset = water_systems and returns layers of Water_lines, Fire_Hydrants, Water_Valves, etc.?

Thanks in advance.

import osgeo.ogr as ogr
driver = ogr.GetDriverByName('PGeo')
ds = driver.Open(database)
numLayers = ds.GetLayerCount()
for layerNum in range(numLayers):
    layer = ds.GetLayer(layerNum)
    if layer.GetFeatureCount() > 0:
        print '%s features: %s' % (layer.GetName(), layer.GetFeatureCount())

[Edit: Additional Info]

When running OGRINFO -al on the data base I get a lot of information but was able to pull out the following:

OGRFeature(GDB_Items):70
    ObjectID (Integer) = 70
    UUID (String) = DB50B2B0-9DC6-4492-9CAD-4162580231B6
    Type (String) = 70737809-852C-4A03-9E22-2CECEA5B9BFA
    Name (String) = WaterV
    PhysicalName (String) = WATERV
    Path (String) = \Water_Sys\WaterV
    DatasetSubtype1 (Integer) = 1
    DatasetInfo1 (String) = SHAPE
    ...

Further down the massive list was:

OGRFeature(GDB_Items):827
    ObjectID (Integer) = 827
    UUID (String) = 22CAD8B9-DBBE-44A6-9D8C-86896CC23B72
    Type (String) = 70737809-852C-4A03-9E22-2CECEA5B9BFA
    Name (String) = Signal_3
    PhysicalName (String) = SIGNAL_3
    Path (String) = \Trans\Signal_3
    DatasetSubtype1 (Integer) = 1
    DatasetInfo1 (String) = Shape
    ...

Note the Path parameter contains the ArcGIS Feature Dataset Name!!!

How can I read this using GDAL in Python?


texts: Getting ArcMap to display rasters properly first time

texts:
This is a very basic question, but as I've self-taught most of my GIS skills this is still a gap in my knowledge.

When I load a .tif raster into ArcMap, most of the time it requires re-exporting to get it to display the correct values on the colour ramp. Rather than the actual values, I get 255->0 for most .tif files. Why does it default to this scale? And is there any way to get ArcMap to display the actual pixel values first time?

Thanks in advance,


texts: Python TypeError while using ClassifyPixelsUsingDeepLearning from ArcPy API

texts:
I am attempting to use a pretrained Keras Unet nueral network to perform pixelwise classification in ArcPro. I've written two Raster Function scripts to intregrate the model into the Arc backend. I can load the model and perform classification witht the raster functions outside of Arc. However when I use the Arc function ClassifyPixelsUsingDeepLearning, a consistent error is propogating.

Unable to initialize python raster function with scalar arguments. [dl_arcgis_tutorial\ImageClassifierTemplate.py]
TypeError: initialize() got an unexpected keyword argument 'pythonmodule'
Unable to initialize python raster function with scalar arguments.
Failed to execute (ClassifyPixelsUsingDeepLearning).

I've debugged into the source code for the function and can never actually see the error, just the result.
My question is, has anyone used a pre trained dnn and custom raster functions/.emd files in arc pro?
Thanks for any help.


texts: Why do comparisons in QGIS 2.4.0 Raster Calculator return -3.40282e+38 aka no_data?

texts:
I tried to use comparisons as conditional statements in QGIS 2.4.0 raster calculator.

My statement is:

(a < 230) * 230 + (a >= 230) * a

The expected result is raster a with all values lower than 230 replaced by 230.

What I get instead is a raster with nan and 3.40282e+38.

Upon further investigation I found that the comparison returns either 1 or nan / -3.40282e+38. Why is it not returning 1 or 0? What am I doing wrong? How can I build conditional statements with the raster calculator?


texts: Basemap not showing up when saving Shapefile

texts:
I am very much a beginner here.
I am trying to create a Shapefile to send to an agency to indicate where I will be conducting field work. I am using OCM Landscape Basemap, and I just have a few points added as Shapefile layers to indicate where my field sites are. However, when I save and try to open the Shapefile, there is no Basemap, and all I see are my little dots. How do I save a map with my field sites (as my little dots) and the Basemap in the Shapefile format?


texts: Read only part of an ESRI shapefile into R

texts:
I have a very large ESRI shapefile (>8000 polygons, .shp file is >32MB), which I want to read into R on Windows 7.

I am familiar with rgdal and readOGR(). However, with this size of shapefile, reading the entire shapefile into memory is a very slow process. Furthermore, I am only interested in a few clustered polygons (<100) of the 8,000 that are contained in the shapefile. The process for which I need to do this is highly repetitive, i.e. the shapefile needs to be loaded many times, so it is currently very slow.

Hence, I am wondering if it is possible to only read in a part of the shapefile in order to accelerate the process. It seems unpractical to load such a massive amount of data and then discard most of it.


texts: Dynamically Change Annotation Font Size According To Parcel Area using ArcGIS Desktop?

texts: I'm looking for an ArcGIS 9.3.1 solution to change annotation font size in an automated/dynamic way. The annotation data represents civic addresses and are displayed over a parcel fabric. What we would like to do is have the font size change in proportion to the area of the parcel. The current dataset has several classes and this kind of lets us do what we want, but still, it doesn't cut it. In the past we have done this manually, but our quickly growing municipality makes this task rather arduous and cumbersome.  I can't foresee a simple solution to this problem, but I'm willing to try anything.


texts: ArcGIS WGS84 Web Mercator Vs. WGS84 UTM zone 15N: Very different distance dimensions

texts:
I am working in ArgGIS 10.1 with a field (raster layer in tif format) in which I have placed two points (.shp layer).

I have two versions of both layers, resulting four layers: one tif+shp set in CRS WGS84 Web Mercator and the other tif+shp set in CRS WGS84 UTM zone 15N.

If I establish the CRS of the Data Frame to WGS84 Web Mercator, the distance between the two points is 138 meters, but if I establish the CRS of the Data Frame to WGS84 UTM zone 15N the distance is 99 meters, which is a huge difference. However, the point layers are displayed absolutely one above the other, I mean: the two points in one CRS haven’t any displacement in relation to the other two points; and the same for the rasters.

Why don’t I see both pairs of points misplaced? Is that “on the fly” projection by ArcGIS? If it’s so, does it mean that ArcGIS projects “on the fly” even between data with CRSs of different geographic coordinate system? (as far as I am concerned, ArcGIS only projects “on the fly” between data with CRSs with the same geographic coordinate system but different projection).

NOTE: Both projected CRSs (WGS84 Web Mercator & WGS84 UTM zone 15N) correspond to these two different geographic coordinate systems: in ArcGIS, Geographic Coordinate System > Spheroid-based > WGS 1984 Major Auxiliary Sphere & Geographic Coordinate System > World > WGS 1984, respectively.

Another major doubt is which of the two CRSs is then better for working in the south of Minnesota State (US)?


texts: duplicate labels in the result of ArcGIS Export Web Map server tool

texts:
Recently I encountered a problem on creating print service with "Export Web Map" server tool. I am unable to ask it on GeoNet so I decided to ask here instead.

When Export Web Map shared as Geoprocessing Service, it accept a JSON to understand what it is going to export, here, I passed in a map service with labeled layer.
    .
    .
    .
    {
        "id": "LayerWithLabel",
        "url": {{url}},
        "title": "{{title}}",
        "opacity": 0.5,
        "visibility": true,
        "minScale": null,
        "maxScale": null,
        "visibleLayers": [
          0
        ],
        "layers": [
          {
              "id": 0,
              "layerDefinition": {
                  "definitionExpression": {{definition string}},
              }
          }
        ]
    }
    .
    .
    .

While this layer display as expected in our system with ArcGIS javascript api, It always got tiled-like duplicate labels in the Export Web Map result.

Are there any extra options in Export Web Map specification needed to remove the duplicate labels? Or is it a bug? I need something to reply to our clients.


texts: ArcPy exporting maps to PNG problem - raster DEM does not show up in exported map file

texts:
I sm using ArcGIS Desktop (ArcMap) 10.8.1 and PyCharm 2020.3.3.
I'm trying to use a simple script to loop through a folder and export a PNG file for each MXD in the folder. The script works fine, and a file is successfully created for each MXD, but the elevation raster I have in each file is not shown in the exported PNG. I do not have this problem if I manually open the MXD and export the file to a PNG.
import arcpy
import os
arcpy.CheckOutExtension("Spatial")

inpath = r"D:\\Processing\\VermillionRiver\\"
outfolder = r"D:\\Processing\\Maps\\"
dirList = os.listdir(inpath)
print dirList

for item in dirList:
    mxd = arcpy.mapping.MapDocument(inpath + item)
    arcpy.mapping.ExportToPNG(mxd, outfolder + item[:-4], resolution = 200)
    del mxd

Here are the two different PNGs I get if I export manually from the MXD in ArcMap vs using the script above in PyCharm

The raster in the map is a 32 bit floating .tiff, is clipped to the dataframe, and is symbolized at 70% transparency.


texts: Efficient computation of nearest distance for each point to closest polygon

texts:
I'm looking for a more efficient way to compute the nearest distance between features from 2 layers, in this example for each point the nearest distance to the closest polygon.  Is there a more efficient way compared to below where I compute all polygon distances for each point? (Python 2.7.2, GDAL/OGR 1.9.1)

nPts = pointsLayer.GetFeatureCount()
nPolys = polysLayer.GetFeatureCount()

for pt in range(0,nPts):
      minDist = 1000000
      pointFeature = pointsLayer.GetFeature(pt)
      for poly in range(0,nPolys):
        polyFeature = polysLayer.GetFeature(poly)
        Dist = pointFeature.GetGeometryRef().Distance( polyFeature.GetGeometryRef() )
        if (Dist < minDist):
              minDist = Dist
 print (pt,minDist)


texts: Displaying Height of Multipatch (ArcScene)

texts:
I have converted a polygon shapefile of a forest to a multipatch, and now would like to have the multipatch appear 25m tall. I've added a column 'Height' to the attribute table with the number 25 in each cell.

I was able to view the 25m-high woodland easily when it was just a polygon (through using the extrude function), but am unable to achieve the same now that it has been converted. It only shows the footprint of the woodland, not the entire 3-dimensional mass. Is there a simple solution to this which I am missing?

Also, if using tools such as Skyline or Visibility, does it matter that forest isn't being rendered in 3D?

Additional info:
The ultimate aim is to determine how much of the surrounding view will be obstructed by the forest once it has grown to 25m high, through using tools in the Visibility toolbox. The multipatch in question and the initial polygon are floating on a TIN.


texts:
I'm new to ArcGIS, and I'm trying to find the percentage of the overlapped area between two class feature.

For this I'm using the tool Tabulate intersection. However, my values seem to be inaccurate after the tabulation process is completed.

The percentage nor the area match what I'm inputting into the tool. Also the percentages don't add up to a 100 when I have more than one item in the zone.

My units are in acres, and I don't know what might be causing this issue.

ArcMap V. 10.4.1

These are the class features that I'm trying to intersect. The colorful one is the zone feature and the purple is the class feature.

The purple layer has its area values on its attribute table and I thought that once I do the intersection and place these area values onto the class field I was going to get a percentage of these areas divided by the intersected zones, but I didn't getting that. What I got is shown on the first picture and it doesn't matter if I use the zone feature as the input class feature and vice versa. The area values don't match.


texts: Reading GeoPackage file bigger than RAM size with GeoPandas?

texts:
I have a gpkg file that's around 10GB, and 8GB of RAM. So, if I were to read my file:

import geopandas as gpd
fp = "/path/to/my/file.gpkg"
data = gpd.read_file(fp)
print(data.shape)

My computer would crash. Now, in Pandas, you can read a file by chunks (https://stackoverflow.com/questions/25962114/how-to-read-a-6-gb-csv-file-with-pandas). I haven't seen anything related to such capabilities in the geopandas (or fiona, used to read the files) documentation.

What would be my options here?

I tested converting my gpkg file to csv file in QGIS. I could then read it using Pandas and work my way up from there. While this could be a solution, I'd rather avoid this if possible.
I could technically manually "tile" my data in QGIS, and get say 4 gpkg files of 2.5GB, but I don't want to do this.
I could (and will) upgrade my RAM, but the problem is still there if I have 16GB of RAM and a 20GB gpkg file, etc.


texts: Generate regular point grid in a polygon layer in QGIS or PyQGIS

texts:
Is it possible to merge two functionalities in QGIS, I mean the tools "random points inside polygons" and "regular points", both in vector > research tool, to select regular grid points inside polygons?

Either a python code is well accepted. Generally I use to create a vector regular point net then I select only the points inside the vector polygons. Regular points creation can be demanding for wide areas and I would like to do everything in one step.


texts:
EDIT: I was able to add the layer in the example below by using the GeoService url, removing 'rest/', after much trial and error. Is there documentation regarding this 'trick', or can someone explain why this works?

Original question:

Is there any way to consume the data from either a GeoJSON or GeoService API url from an ArcGIS Open Data Portal page, into ArcMap (using v. 10.4.1)?

An example would be: BC OGC Pipelines

The API section looks like:

I have seen other ArcGIS Open Data pages that also include a url in the API section for OGC WMS (example), so it may be a conscious decision to not serve data in a format consumable by ArcMap, but I'm not familiar enough with web service protocols to be certain.

Things I have tried:

adding the GeoService url (full and many shortened versions) through both 'Add ArcGIS Server' and 'Add WMS Server' in 'Add Data'
adding the layer through 'Add Data from ArcGIS Online'. The dialog finds the layer, I click 'Add', the layer appears in the table of contents, although there appear to be no features (e.g. should be lots of pipelines at 651871E, 6197336N, UTM10).


texts:
I need to add a bearing compass to ArcMap 10.3.1. I can't seem to find the steps or process to do so.

I am trying to add a compass with a 360° bearing, centring on top of a lookout in ArcMap. I can't seem to find the steps or process to do so.
There will be multiple compasses that will be used to cross reference bearings from each lookout.


texts: OpenLayers export map control not working

texts:
I'm trying to save the map as an image and I edited my code according to this example.  When I test my site on Chrome the map does not render at all. Chrome's console says:

"Uncaught TypeError: undefined is not a function" for this line of code
exportMapControl = new OpenLayers.Control.ExportMap();

and

"Uncaught ReferenceError: exportMap is not defined" for this line
 <input type="button" value="Export Map" onClick="exportMap()" /> <br />

I use OpenLayers 2.12, GeoServer, PostGIS. The system is on my laptop. I don't use a proxy, I just edited the Apache's conf file (works fine).

I checked this and there is nowhere an export map control.

If you want to see my code, please let me know.

Also, another question, how to edit the above example to make it work with WMS, WFS, and Google layer?


texts: Legend color scale problem with tmap for island

texts:
Bornholm_data <- geo_RH %>%
  filter(KOMNAVN=="Bornholm")

tm_shape(geo_RH) +
  tm_fill(col="Befolkning") +
  tm_borders()

mainland <-  tm_shape(mainland_data, projection = 0) +
  tm_fill(col="AREAL") +
  tm_polygons() +
  tm_layout(frame = FALSE)

Bornholm_map   <-  tm_shape(Bornholm_data) +
  tm_fill(col="AREAL") +
  tm_polygons() +
  tm_layout(title = "Bornholm", frame = TRUE, bg.color = NA,
            title.position = c("RIGHT", "TOP"))

mainland
print(Bornholm_map, vp = viewport(x = 0.8, y = 0.5, width = 0.3, height = 0.2))

I know that the color on the map is not correct because a simple plot produces this which is the reality


texts: Combining attribute table of polygon and point shapefiles using ArcGIS Desktop?

texts:
I am fairly new to using ArcGIS Desktop.

I am working with two different types of data. The first is a large shapefile that contains small polygons that distinguish different types of vegetation. The second shapefile contains randomized points with coordinates attached and one or two other attributes like "Y" or "N". I'm trying to create some type of attribute table that will add the attributes of the polygon layer to the points that fall within the specific vegetation types. In practical terms, I want to know what veg type the points are sitting in.

I feel like this should be straight forward but I'm having a hard time getting joins and relates to work and I'm wondering if there is another option.


texts: Disable Panels at Startup from Custom Config Location

texts:
I'm trying to start QGIS 2.8 with the minimal GUI possible so I can reskin QGIS for a custom plugin. Unfortunately I'm not able to get rid of the Layers and Overview panels when saving the configuration into a custom location when starting QGIS with the options --configpath  --optionspath. Everything else is customizable, I'm able to hide all the menus, but even though all the panels are marked as false in the QGISCUSTOMIZATION2.ini they still show up as displayed in the picture.

The funny thing is that if I let the application store the values in the registry all the panels are disabled fine, but because this has to be shipped to approximately 40 - 50 clients I'd rather accomplish this with the QGISCUSTOMIZATION2.ini and the QGIS2.ini files rather than using the registry.

Any ideas?


texts: Find overlay between polygons excluding boundary

texts:
I want to find which polygons in a spatialpolygonsdataframe overlay each polygon in another spatialpolygonsdataframe. I have tried to use the function over from the package sp and it works fine... except that (from the help page):

  points on a polygon boundary and points corresponding to a polygon
  vertex are considered to be inside the polygon

This is a problem for me because I end up including all neighbouring polygons as well as ones that effectively intersect. Is there any way to get around this? If possible, I'd rather avoid 'hacky' solutions like shrinking the polygons in one of the dataframes.

EDIT: the argument minDimension = 2 should do what I need:

  minDimension: minimal dimension for an intersection to be counted; -1
  takes any intersection, and does not order; 0 takes any intersection
  but will order according to dimensionality of the intersections (if
  returnList is TRUE, 1 (2) selects intersections with dimension 1,
  meaning lines (2, meaning areas)

Unfortunately, it does not seem to work with my data... (I am intersecting level 1 administrative areas for GADM and ethnic homelands from Geo-EPR - if everything works fine, I should only get matches from homelands in the same country as the administrative area, but I get ones in neighbouring countries as well).


texts: Getting X,Y coordinate with mouse click on vertex of line feature using PyQGIS

texts:
How do I get X,Y coordinate with mouse click with enabling snapping so that only line's vertex point coordinates will be selected?
By using following code I can get latitude longitude of clicked position in map canvas of QGIS but cannot enable the snapping option .
from qgis.gui import QgsMapToolEmitPoint
class PrintClickedPoint(QgsMapToolEmitPoint):
    def __init__(self, canvas):
        self.canvas = canvas
        QgsMapToolEmitPoint.__init__(self, self.canvas)

    def canvasPressEvent( self, e ):
        point = self.toMapCoordinates(self.canvas.mouseLastXY())
        point = list(point)
        iface.mapCanvas().snappingUtils().toggleEnabled()
        print(point)

canvas_clicked = PrintClickedPoint( iface.mapCanvas() )
iface.mapCanvas().setMapTool( canvas_clicked )


texts: Adding QGIS-specific Python interpreter to Eclipse?

texts:
I was following the steps from QGIS Python Programming CookBook to add qgis interpreter to eclipse, however I went into the following error in step 8:

"See error log for details.
No output was in the standard output when
trying to create the interpreter info for: C:\Program Files\QGIS Essen\bin\python.exe
The error output contains:>>ImportError: No module named site
<<"

Steps from the book:

Open Eclipse.
From the Window menu, select Preferences. On OS X, you must click on the
Eclipse menu to find the preferences menu.
In the pane on the left-hand side of the Preferences window, click on the plus sign
next to PyDev.
From the list of PyDev preferences, select Interpreter Python.
In the pane labelled Python Interpreters, click on the New button.
In the Select interpreter dialog, name the interpreter PyQGIS.
Browse to the location of the QGIS Python interpreter called python.exe within the bin folder of the QGIS program folder.

8. When you click on the OK button, Eclipse will attempt to automatically add every Python library it finds to the Python path for this interpreter configuration. We need to control which libraries are added to prevent conflicts. Click on the Deselect All button and then click on OK:

When i click OK button it gives that error.

I going try do detail even futher, since no answer was given. I think that the objective of this feature is to facilitate the coding of python into QGIS program, because the author says:

"The Eclipse IDE with the PyDev plugin is cross-platform, has advanced debugging tools, and is free. This tool makes an excellent PyQGIS IDE. Eclipse allows you to have multiple Python interpreters configured for different Python environments. When you install PyDev, it automatically finds the installed system Python installations. On Windows, you must also add the Python interpreter installed with PyQGIS. On all platforms, you must tell PyDev where the PyQGIS libraries are"

That part of bold is exactly what I a having being try to do. I don't know what more I can do, can I post again to get more visibility?


texts: How to stack points based on their latitude and longitude value on a raster image in QGIS

texts: I have a Sentinel2 image. I have a CSV file that contains latitude, longitude and precipitation data over the location where the sentinel2 image was taken. Now I want to stack the precipitation data over the image. So that I will be able to find out the locations where precipitation data were not available. In fact, I will be able to visualize my data clearly. Will I able to apply this on QGIS?


texts: Populating attribute table from interpolation (grid)?

texts:
I am a novice ArcGIS Desktop 10 user, with a question on how to add data from a grid file to a shapefile based on an attribute and position.  I have a shapefile with fish positions (x,y) and their temperature.  I have created a grid from temperature observations collected from the surface of the lake to the bottom.  I need to add the depth from the interpolated surface to the fish position based on the fishes temperature.

So for each fish (circle) I know its position along the x axis and I also know its temperature.

How do I retrieve depth from the grid based on the fish temperature and its position along the x axis?


texts: Constructing contiguous regions with similar properties by graph partitioning

texts:
I have census data for census output areas. Each area is a geographical region. I would like to partition these areas into contiguous super-regions with similar properties.

For example, in each area I have employment broken down by industry, and I would like to find contiguous areas with similar industrial make-up.

These areas can be represented as a planar graph, which is easy to obtain from a topology of the output areas. Each edge in the graph can be weighted by some similarity score between the two adjoined nodes, (cosine similarity between proportions of employment by industry, for example).

Partitioning the areas into contiguous regions can be achieved by partitioning this graph, for example, by finding the minimum cut, and recursively finding the minimum cut of each subgraph until the desired level of granularity is achieved.

I've just come up with this procedure myself, but it's so basic that I can't believe it doesn't already exist under some other name.

I haven't been able to find any literature on it, but it's likely that I don't have the right terms to search for, and I'd like to avoid reinventing the wheel.

Does this category of geographical partitioning exist already?

If so, what's it called, and where is the relevant literature?
If it doesn't exist, are there any obvious reasons it would be a bad idea?

In the case of employment broken down by industry, cosine similarity seems like a sensible similarity score, because the proportions all sum to unity. Are there more suitable similarity scores or graph partitioning methods that I'm overlooking?

EDIT:

It has occurred to me that minimum-cut partitioning of the graph will probably not work, since the outlying areas will have a smaller degree than the innermost areas. As such, we'd expect this procedure to just eat away at the outskirts.


texts: Maximum number of record returned by the server. Why 1000?

texts:
Why in AGS "maximum number of record returned by the server" is set to default 1000?

What happens if I increase limit to 100000 or 1000000 in 100 services?


texts:
http://trafficscotland.org/rss/feeds/currentincidents.aspx
I'm looking to read this RSS feed, taking the entries, and publishing to an AGOL feature service. Using the GeoRSS reader I can see the attributes and the point locations are shown, however, I don't have a clue how to expose the attributes, form a table, create the vertex, then get this published.
I was expecting something like the Json reader where you take the element and use json schema scan.
I've read elements of the FME forum and HTML Extractor is suggested, but this doesn't seem to work.


texts:
I was wondering if it is possible to use the algorithm of Orfeo Toolbox in RStudio. I have been looking for some information but didn't find anything relevant. From the Orfeo toolbox I see that it can be access through command line so that may be an option?

I am working with Ubuntu Xenial 16.04


texts: Highlighting selected geojson feature and return to previous state when another one is selected using Leaflet?

texts:
I've a map with a geojson layer containing markers, polygons and lines.

I made a module so that when a feature is clicked, its properties are displayed in a frame and not in standard Leaflet popup. It works perfectly well and I'm quite happy with it.

Point is that I'd like to have the selected feature to highlight when clicked and return to unselected state when another one is clicked.

Do you have an idea on how I can achieve that ?


texts:
In QGIS 3.14 / QfieldSync there is now the functionality to configure photo naming. Yay!
I use a 1:n set-up for photos, i.e. I capture photos in the child table ('photo') of a one-to-many relationship. I would like to name my photos based on attributes ('type' and 'num') in the parent layer ('tree').
So far, my attempt at the expression is as follows:
'DCIM/'||attributes(get_feature('tree','uuid','fkid'))['type'||'num']||'_'||now()||'.jpg'

This isn't working.
Any ideas?


texts: ArcGIS key numbering labels for every feature in one layer

texts:
I would like to use key numbering when labeling specific layer. But the tricky thing is I want to label every feature in this way.
By default, key numbering is last option in Strategy order (source). And there's no possibility to change it.
Is there any workaround to force ArcMap to use key numbering for every feature?


texts: Making informative legend for Kernel Density Estimate in QGIS?

texts:
I have used heatmap (kernel density estimation) in QGIS 3.0.1 to make a heatmap of boat counts.
In my point data-each point is one boat.
Then, in my kernel, I have used a 500m radius, with 500m pixel size X and Y and uniform kernel shape. (I'm not sure if this is a great idea to have as pixel size...) I left the output as raw.
What I am wondering now, is how to make an informative legend?
The default legend looks like this:

I think that this means that in red there are 0-1 boats within 500m, in pinky orange: 1.1-9.5 in 500m, etc...
Is this the case?

When I try to change the values manually, the colours go out of order and the largest bracket is stuck in the middle of the key.
Further, how do I get this info out and use it as a legend in my plot?


texts: Adding x and y values while creating a label QGIS

texts:
I'm trying to create a label on a map in QGIS.

I can open the setting where there are an X and Y button and a few other properties, like opacity and distance.

I'm pretty sure the problem is that I need to enter the proper X and Y coordinate here, but I don't know how to get to where it lets you enter the coordinates.


texts:
I'm totally new to Mapserver and I've been banging my head trying to figure out how to mount a WMS server that will seed images of a small geographical area to a OpenLayers HTML page.

I already installed Mapserver on windows (MS4W) and "mapserver -v" shows: 'SUPPORTS=WMS_SERVER' so that's done.

Then I used JTileDownloader to get the tiles from the area I'm interested in. I ended up with folders "13" and "14" (guess that the zoom level) full of *.png file inside the folder c:\TMP\MyZone

The next steps seems to be to create an index file from the tiles with gdaltindex witch I manage to install, but I have no idea how to use.

While on the c:\TMP\MyZone folder I tried:

  gdaltindex PR1314.shp

  gdaltindex PR1314.shp *.png

  gdaltindex PR1314.shp 13\*.png

But none of them worked so I don't kwon what to do, I read a lot articles in Mapserver wiki how-to's, but the amount of info is overwhelming and I don't understand half of what I'm reading.

So to recap, I just need a WMS that will seed the tiles I already downloaded. What should I do next?

Thanks.-


texts: Adding CSV upload browse button to Ext.Action

texts:
I am trying to create a CSV File upload on GeoExt Map App.
I need to place the upload function within the Ext.Action, so that I can add it to the toolbar of the GeoExt Panel. I am trying to implement this example. Here is my code,

action = new Ext.Action({
        text: "Upload Excel",
        control: new Ext.create('Ext.form.Panel', {
                title: 'Upload a CSV File',
                width: 400,
                bodyPadding: 10,
                frame: true,
                renderTo: Ext.getBody(),
                items: [{
                    xtype: 'filefield',
                    name: 'csv',
                    fieldLabel: 'CSV Upload',
                    labelWidth: 50,
                    msgTarget: 'side',
                    allowBlank: false,
                    buttonText: 'Select CSV File'
                }],

                buttons: [{
                    text: 'Upload',
                    handler : function() {
                        var form = this.up('form').getForm();
                        if(form.isValid()){
                            form.submit({
                                url: 'file-upload.py',
                                waitMsg: 'Uploading the CSV File...',
                                success: function(fp, o) {
                                    Ext.Msg.alert('Success', 'Your csv file "' + o.result.file + '" has been uploaded.');
                                }
                            });
                        }
                    }
                }]
        }),
        map: map,
        // button options
        tooltip: "Upload CSV File",
        // check item options
        group: "newTool"
    });
    actions["upCSV"] = action;
    toolbarItems.push(action);

Firebug keeps giving me this error,

TypeError: b[d.xtype || e] is not a constructor

Am I declaring the function incorrectly within the Ext.Action?


texts:
when creating the postgis extension

CREATE EXTENSION postgis;

I have the next problem

  ERROR: Could not access the file «$libdir/postgis-2.2»: No such file
  or directory

I use Ubuntu 14.04.5 and PostgreSQL 9.3


texts: How to convert points to a raster in QGIS (rasterize does not show z field)?


texts:
I installed Qgis 2.2 this morning from the ubuntugis repository for ubuntu precise.  Qgis works great, except that all the common projections have been deleted.  So, I am a Little bit having a heart attack.

It Looks, from the install log, like what happened is this:

Synchronizing CRS database with GDAL/PROJ definitions.
Load srs db from: /usr/share/qgis/resources/srs.db
QFSFileEngine::open: No file name specified
QFSFileEngine::open: No file name specified
QFSFileEngine::open: No file name specified
QFSFileEngine::open: No file name specified
QFSFileEngine::open: No file name specified
Loading epsg.wkt
0 WKTs loaded
CRS update (inserted:0 updated:0 deleted:3631 errors:0)
No CRS updates were necessary.
qgis-common (2.2.0-1~precise1) wird eingerichtet.

This log is printed if I remove qgis and just install qgis-providers.

apt-get install --reinstall qgis doesn't fix it.
Even worse, I did an apt-get remove purge and went back to the qgis.org debian main, which installed dufour.  Projections were still wiped, and I got the same install log from qgis-provider-commons.  So, I can't get functional qgis back at all.

Is there any dependency I should be reinstalling to make this all go away, or a way I can explicitly update the CRS lists?

Thanks!


texts: Adding waypoints with certain connected data

texts:
Is it possible to import excel data to QGIS?

I have an 80,000 point database with city names (no coordinates) in a common country. There would possibly be minimal data to be viewed from each point.

How would I handle the import?

Here is a screenshot. It has been a few years since I last used QGIS, so I'm sure that I have forgotten some of the important basics.

If you can get me on the right track, I can take it from there. I have reduced my dataset to a single point, and I wish to add it to an existing country shapefile which I already have.


texts: Turning multiple vector layers into one raster in ArcGIS Desktop?

texts:
I want to make a raster out of the multitier view I have in ArcMap 9.3.1 .

The layers in my ArcMap come from several datasets.

I know there is a 'Feature to Raster'  tool, but it converts one layer at a time.

Is there a way to convert all of the layers to a raster ( asides from export as jpg, and georeferencing the jpg) ?


texts: Iterating through group to get layer names in PyQGIS?

texts:
Can somebody provide me some source code in PyQGIS 3.4 to iterate through groups and list out the layernames?

In the image you see several groups and single layers.

The purpose is to build a dialogbox with a list of layers but only those layers with a type of Point geometry.


texts: Show full layer name (including extension) in QGIS table of contents

texts:
Is there an option in QGIS to show the full name of a layer (including the extension) in the TOC?

I'll take a python solution as well, but it would need to trigger on layers being added.


texts: moving window regression on raster stack in R

texts:
I want to perform a moving window regression on every pixel of two raster stacks representing Band3 and Band4 of Landsat data. The result should be two additional stacks, one representing the Intercept and the other one representing the slope of the regression.
So layer 1 of stack "B3" and stack "B4" result in layer 1 of stack "intercept" and stack "slope". Layer 2 of stack B3 and stack B4 result in layer 2,.... and so on.

I already came along the gwrfunction, but want to stay in the raster package.
I somehow know that focal must be included in order to set my moving window (which should be 3x3 pixels) and somehow a linear model like: lm(as.matrix(b3)~as.matrix(b4)) although I don't think that this gets me the values pixelwise...

Instead of a rasterstack a layer by layer approach is also possible. (So it must not necessarily be a rasterstack of Band3.

Has anyone a glue how to program this in R?


texts:
Help me for processing my raster data on QGIS;

How to remove the outland on my image, so the image is following my shapefile border
why is my processing using "Clip With Mask" in QGIS for so long, about 30 minutes? But not on My ArcMap.


texts: How to achieve different Anchor Point based on N, W, E, S, NW, NE, SW, SE for point labels if max-displacement vendor option is used in geoserver sld?

texts:
How to achieve point label placement should be always as shown in the image.
GeoServer SLD code:
<PointSymbolizer>
    ...
</PointSymbolizer>

<TextSymbolizer>
    ...

    <LabelPlacement>
        <PointPlacement>
            <AnchorPoint>
                <AnchorPointX>0.0</AnchorPointX>
                <AnchorPointY>0.5</AnchorPointY>
            </AnchorPoint>
            <Displacement>
                <DisplacementX>10</DisplacementX>
                <DisplacementY>0</DisplacementY>
            </Displacement>
        </PointPlacement>
    </LabelPlacement>

    ...

    <VendorOption name="maxDisplacement">20</VendorOption>
</TextSymbolizer>

As given in above SLD file,
for East(E) AnchorPointXY = {0, 0.5} - as given in above SLD
need to change AnchorPointXY to {1, 0.5} at West(W), North-West(NW), South-West(SW) only & at remaining directions AnchorPointXY will be same as in SLD if "maxDisplacement" vendor option is used.


texts:
I clip 70 raster with polygon in postgresql, the result are: out of memory, Fatal on request size of 10872

I read some solution  about changing the postgresql.conf parameter but nothing work for me

Mine is ubuntuOS, 8GB RAM, the config is

#shared_buffers = 1024MB
#huge_pages = try
#temp_buffers = 512MB
#max_prepared_transactions = 0
#work_mem = 64MB
#maintenance_work_mem = 512MB
#autovacuum_work_mem = -1

Any soluton for this problem?


texts: Changing name of attribute field in shapefile using ArcPy?

texts:
I have two files:

a shapefile called: Habitat.shp
from the ZonalStatisticsAsATable-function a .dbf-file: ZonalStatisticsTable.dbf.

In the .dbf-file is a coloumn in which I am interested. It is the MEAN-coloumn. I want to join that field to the shapefile. Since I am forced to use the shapefile (there is no way a GDB is possible), I wanted basically to join the MEAN-coloumn to the shapefile and change then the name to Fox_Mean. Here is my code:

Habitat="C:\\Files\\Habitat.shp"
ZonalStatisticsOutputTable="C:\\Files\\ZonalStatisticsTable.dbf"
arcpy.JoinField_management(Habitat, "ZoneID", ZonalStatisticsOutputTable, "ZoneID", "MEAN")
arcpy.AlterField_management(Habitat, "MEAN", "Fox_Mean")

However since I am working on a shapefile the AlterField_management-tool does not work.

Is there any other way of renaming that MEAN-field without using GDB or any other additional library?

I thought maybe about simply renaming the MEAN-field in the .dbf-file, but then a new library is needed. An alternative would maybe be to just copy the content of the coloumn to a new field and delete the MEAN-field then. However I am unsure if that does not screw everything up.


texts: Can you apply Maximum Likelihood classification to NDVI?

texts:
Can the ML be applied to an NDWI image? Or is it a separate means of classifying that is only applied on 2 or more bands?
The problem I am actually facing is that without knowing that this could be a problem, I have already applied the NDWI and then the MLC on it. My question is now, how exactly does this change my results?


texts: Choosing which values to keep when merging rasters

texts:
I figured this would be a simple problem but I cannot seem to find the solution. I have two rasters as DEMs (digital elevation models). One is of the entire area of interest and represents the original topography. The other is of a smaller area within the area of interest, and represents the proposed landscape changes. I want to merge these two rasters. The final result would be a raster for the entire area of interest, with the values in the proposed area adjusted to match the proposed raster. I.e. it would use the proposed values in the areas they exist and the original values everywhere else.
I see this as burning the new raster into the existing raster, but perhaps this isn't the right terminology.
Is there a way to do this in QGIS or ArcGIS?


texts:
I have a lot of Real Estate related data in QGIS, and I would like the ability to display the logos of nearby businesses on my QGIS maps for presentation purposes.

Currently, I have business locations marked as points and symbol rules for each company set up to display the .svg of their logo.

My problem is that I cannot find a way to separate them so that they do not overlap. I would ideally like them to adjust and add an arrow pointing to the actual point. Is there a way to do this?


texts: How effective is os.unlink at deleting shapefiles?

texts:
I have a process where I use arcpy.FeatureClasstoShapefile() to re-create shapefiles.  Unfortunately, arcpy.env.overwriteOutput = True does NOT overwrite the previous ones.  I have tried using arcpy.Delete_management() on the original shapefiles, but sometimes it doesn't work either.

My question is: if I use os.unlink("asdf.shp") will that delete the whole shapefile (including all those subfiles that windows explorer sees) or just the single file with the .shp extension?  Also, does it matter? what will happen to the other files if I just delete the .shp file and then try to create a new shapefile that has the same name?


texts: mapsforge highway names disappear at lower zoom levels

texts:
I'm using mapsforge 0.5.1.  My App rendering the map displays certain highways at particular zoom levels.  For example, it displays k="highway" v="primary" at zoom=13 and above.  However it refuses to display the names of the highways until zoom=15.  My rendertheme-v4.xml is the same as github ...\mapsforge-0.5.1\Applications\Android\Samples\assets\renderthemes\rendertheme-v4.xml with a small change that should allow the names to display at zooms 13 and 14.  I replaced this rule in the original mapsforge-0.5.1 version of rendertheme-v4.xml:

<rule e="way" k="highway" v="secondary_link|primary_link|trunk_link|motorway_link|secondary|primary" zoom-min="15">
    <pathText k="name" display="always" priority="-6" font-style="bold" font-size="12" fill="#000000" stroke="#FFFFFF" stroke-width="2.0"/>
</rule>

With this rule in my rendertheme-v4.xml:

<rule e="way" k="highway" v="secondary_link|primary_link|trunk_link|motorway_link|secondary|primary" zoom-min="13">
    <pathText k="name" display="always" priority="-6" font-style="bold" font-size="12" fill="#000000" stroke="#FF0000" stroke-width="2.0"/>
</rule>

The name highway labels do not appear at zoom 13 or 14 (the stroke colour does change to red at zoom 15, proving my rendertheme-v4.xml is being used).

I also notice that if I reduce the font-size from 12 to 8 the label does appear at zoom 14 but not zoom 13.

Something is going on here that is unexpected and undocumented as far as I can tell.  Can someone explain this behaviour?  I'd like to be able to set up rules where I can display some highway labels at zooms 12 to 14 and use bigger fonts.  Can someone describe rules that allow this?


texts: Opening MapInfo .TAB file containing text objects in QGIS?

texts:
Whenever I try to open a MapInfo .TAB file that contains text objects in QGIS, the text objects are converted to point objects.

Any help, please?


texts: Edit an existing SQL view in GeoServer instead of creating a new one

texts:
There is a really solid guide to creating new views
https://docs.geoserver.org/latest/en/user/data/database/sqlview.html
But I can't find anything on changing the underlying SQL that populates an existing GeoServer view. We have a use case where we would like to change SQL that gets an existing data layer, potentially adding parameters and the like. Is that possible? Or should we build the layer from scratch?


texts: Finding Catchment Area for Dam using ArcGIS Spatial Analyst?

texts:
I have a DEM of my study area, and polyline shapefile of the Dams in that area.

I have run the standard Hydrology tools on it (Fill,  Flow Direction & Flow Accumulation).

I know that you can find the Watershed contributing to a pour point, but how do you use the Damlines, to get the catchment Area contributing water to the dam's reservoir?


texts: How to set the outline color of raster cell (pixel)?

texts:
Can somebody please show me how to set the outline color of a raster cell (pixel)?
This is what I have right now:

This is what I am trying to do:

I googled a bit, and looks like it is somewhere in the Layer->Properties->Style, but I can not find it:

?


texts: How to break apart a complex line segment into simple line segments between all points?

texts:
Take for instance a very complex line string.. which has WKT like this LINESTRING(1 1,2 2,3 3,4 4,5 5 ...)  I want to create two-point linestrings from many-point linestrings.

SELECT ST_MakeLine(ST_MakePoint(x,x)) AS l
FROM generate_series(1,10) AS x

To break down into simple linestrings between all points.

      linesegment
-----------------------
 LINESTRING(1 1,2 2)
 LINESTRING(2 2,3 3)
 LINESTRING(3 3,4 4)
 LINESTRING(4 4,5 5)
 LINESTRING(5 5,6 6)
 ...


texts:
I am trying to calculate an NDVI over time (say, the span of 30 years) for a certain area of the United States. I think it's possible with Landsat 5,7, and 8 together. The goal is to understand change in peak vegetation over time to evaluate the efficacy of natural parks policy in a certain locality.

Question: If I were to download images from 5,7, and 8 and calculate NDVI, would the results be comparable between satellites? If they are not, is it possible to make transformations to make them comparable?


texts: OpenLayers: Feature edit handles not appearing when addUniqueValueRules applied

texts:
I have been pulling my hair out over this issue and am now wondering if it is a bug rather than something I am doing wrong.

The Problem: I have a vector layer that users can edit. Each feature on the vector layer has an attribute called "Status" and I am using a unique values renderer to style the features. The layer can contain point, line, and polygon geometries. I have successfully set the layer styling and features are styled according to their status attribute. However, when a user selects a feature to modify the geometry the editing handles are not displayed which means the user is unable to modify the geometry, but the style clearly changes to the edit style. Here are the relevant parts of my code to create the layer:

// Capture the styles for the default render intents of a Vector layer
var defaultSymboliser = OpenLayers.Util.applyDefaults({}, OpenLayers.Feature.Vector.style["default"]);
var selectSymboliser = OpenLayers.Util.applyDefaults({ strokeColor: "red", fillColor: "blue" }, OpenLayers.Feature.Vector.style["select"]);
var temporarySymboliser = OpenLayers.Util.applyDefaults({ strokeColor: "red", fillColor: "blue" }, OpenLayers.Feature.Vector.style["temporary"]);

var editLayerStyleMap = new OpenLayers.StyleMap(
    {
        'default': defaultSymboliser,
        'select': selectSymboliser,
        'temporary': temporarySymboliser
    }
);

// Create a symboliser lookup that will be used to stye features in their default intent
var symbolisersLookup = {
    'Draft': { fillColor: '#0000ff', fillOpacity: 0.4, strokeColor: '#0000ff', pointRadius: 6 },
    'Submitted': { fillColor: '#00ff00', fillOpacity: 0.4, strokeColor: '#00ff00', pointRadius: 6 },
    'Review': { fillColor: '#ff0000', fillOpacity: 0.4, strokeColor: '#ff0000', pointRadius: 6 },
    'Processed': { fillColor: '#9900ff', fillOpacity: 0.4, strokeColor: '#9900ff', pointRadius: 6 }
};

// Add the symboliser and lookup rules to the StyleMap object, using the default intent
editLayerStyleMap.addUniqueValueRules('default', 'Status', symbolisersLookup);

editLayerRefreshStrategy = new OpenLayers.Strategy.Refresh({force: true});
editLayer = new OpenLayers.Layer.Vector("User Submitted Information", {
    strategies: [new OpenLayers.Strategy.BBOX(), editLayerRefreshStrategy],
    protocol: new OpenLayers.Protocol.HTTP({
        url: "Services/UserSubmittedInformationHandler.ashx",
        format: new OpenLayers.Format.GeoJSON()
    }),
    styleMap: editLayerStyleMap
});
mainMap.addLayer(editLayer);

If I comment out the line:

editLayerStyleMap.addUniqueValueRules('default', 'Status', symbolisersLookup);

Then the features are no longer styled according to their status value but the editing handles do now appear. So, is this an OpenLayers bug or have I not done something important that allows the select render intent to work correctly when a UniqueValueRules is applied?


texts:
GeoKettle (http://www.spatialytics.org/projects/geokettle/) is (or was?) a very promising approach to spatial ETL with an intuitive graphical process design, at least introduced an open source equivalent to FME from SafeSoftware. The last (and still actual) version 2.5 dates from Febr. 2013.

There is no contact form on the site, and the forum is under maintenance.

Does anyone know about the state of the project and if it is still under active development?


texts: Surface normal vector of a polygon in ArcGIS?

texts:
I have a dataset with 3D-Multipatch polygon features (roofs). My goal now is to determine different roof types, especially flat roofs. For this purpose I want to determine the surface normals for each polygon and store them in an attribute. Currently I determine this value by calculating the surface slope using a grid. Works well in principle, but I would like to avoid the detour via the grid calculation.
Is there a possibility in ArcGIS/ArcPy to perform the calculation directly?
For FME I have found a possibility in the FMEHub, but I would like to integrate the calculation directly into my script written in ArcPy.


texts: How to import erroneous geometry records into PostGIS for fixing?

texts:
New to PostGIS.  I have a few large multipolygon datasets with errors that PostGIS should be able to fix quite efficiently.  However, when in QGIS I try to import the layers into PostGIS, it will error out and stop importing when it reaches an invalid geometry.

The data currently is spread among a series of geopackages that load fine in QGIS, but the layers contain many errors.  My desire is to use PostGIS to fix the errors.  There are too many to manually fix.

How do I get invalid geometry into PostGIS so that I can use the various ST_ wrappers to fix it?


texts: Connecting to MSSQL 2008 R2 with QGIS 2.0.1

texts: There have been questions related to this, but some of them seem out of date or no one has asked.  I'm trying to connect to SQL Server 2008R2 using a MSSQL connection in QGIS.  I'm not exactly sure if I'm connecting to the correct site.  I'm able to connect through Autocad Civil 2014 so i'm using what I used to connect to that.  Any ideas?  The last posts I've seen are around 2011.


texts: Downloading multipolygons and indexing them

texts:
I'm trying to download Sentinel-2 data of my area of interest.

My shapefile contains two different polygons. So when I try to download the output images I get the error:

  Error creating or submitting task.
  A region must be a GeoJSON Polygon or LinearRing. Got: 'MultiPolygon'.

 Export.image.toDrive({
    image: collection_aoi,
    description: date + '_S2_BOA_cloudfree',
    maxPixels: 1000000000000,
   scale: 10,
   region: aoi,
    });

Is there any way to index polygons out of the "MultiPolygon" shapefile? I don't want to upload separate Polygons because in the future I will be using more polygons in the shapefile.


texts:
I export my map as an SVG from ArcMap but when I open it on adobe illustrator cc, the map looks so messed up, north arrow not in place and gaps between each letter, text not in the proper size, however when I open the SVG using InkScape it looks just as the MXD.
I have no idea what would cause such problem, I export in 300 DPI and Vectorize layer with Bitmap marker/fill, but I tried of changing the settings but same problem came up.


texts: Extracting list of layers in MXD using ArcGIS Desktop and Python?

texts:
I have been trying to extract a list of all the layers in my mxd (ArcGIS Desktop 9.3.1), using Python 2.5. If I could have the source of the layers too that would be even better... But as long as I can get a list of all the layers I have in my mxd that would be so handy!

I have seen several scripts but they are all "arcpy" , which as far as I understood only ArcGIS Desktop 10, unfortunately upgrading is not possible right now. there is very little on 9.3.1.

I am a somehow new to Python but I am confident we will find  a work around for that.


texts: How to add hyperlinks & embedded images to TileMill / Mapbox Tooltips?

texts:
I have a shapefile I am styling in TileMill; which will be imported later into a Mapbox webmap as MBTiles.

There is an attribute field for each feature in the shapefile that contains a link to an online image. Can I embed this image and add a clickable hyperlink within a tooltip?

The formatting I have now in the tooltip dialog is:

”Link: {{{hyperlink}}}“ where {{{hyperlink}}} is the unique url of an image for each feature. The link will display in the tooltip, but it isn’t clickable. I would also like to embed the image within the tooltip if that is possible as well. Thanks


texts:
If I'm reading a paper map how do I determine what projection was used to draw the map if such information is not explicitly labelled on the document?

Online it is easy to find resources (for example, Wikipedia or GIS Wiki) that describe and classify the various projections in use. However, as a non-expert map user I find it difficult to use the construction details in reverse, to determine what projection has been used to draw a particular map. I thought perhaps there might be a flow chart or other classification process that could help a map user determine the projection in use?

For example, at my local library and archives there is a copy of a map lithograph from the Dominion Lands Office (Canada) dated 1878. The map has curved parallels and meridians that are wider at the bottom than the top (the top being closer to the pole in this case). I think this makes the map a conical projection, but I'm not sure. And, if that is correct I am interested in learning if it is possible to classify the projection more precisely (e.g. Lambert conformal).

I have made a partial scan of this 1878 map (it is too large to scan the whole thing with the equipment I have available) in case that helps anyone answer my question.


texts: Why is my longitude conversion from NY State Plane Coordinate System to WGS84 consistently off by 3.665 degrees?

texts:
I'm trying to convert coordinates from the NY State Plane Coordinate System for Long Island (zone #3104) to WGS84 using the GeoTools Java API. The latitude value is correct, but the longitude is consistently 3.665 degrees off to the west:

public static void main(String[] args) throws FactoryException, TransformException {
        CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4456"); //http://www.geotoolkit.org/modules/referencing/supported-codes.html
        CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
        MathTransform tr = CRS.findMathTransform(sourceCRS, targetCRS);
        DirectPosition sourcePt = new GeneralDirectPosition(982394.0, 199298.0);
        DirectPosition targetPt = tr.transform(sourcePt, null);
        System.out.println("Source point: " + sourcePt);
        System.out.println("Target point: " + targetPt);
}

The code above, earthpoint.us, and Google all return similar values for latitude: ~40.714. For longitude, earthpoint.us and Google show values of ~-74.006, but the code above produces -77.671, putting the point in the middle of Pennsylvania.

Using different source NY SPCS values produces similar errors, with the difference in longitude always being 3.665 degrees to the west and latitude being correct. GeoToolkit produces the same results.

Am I doing something wrong? Is there a 3.665 constant I should know about?

EDIT: the source values are NAD27.


texts: how to take cell size from raster using python or GDAL or RASTERIO

texts:
How to take cell size per X,Y using simple python or GDAL or RASTERIO?
and hot to count how many pixels have my raster with some packages..

I have find some code but is pyqgis and I don't need this package :

ras  = QgsRasterLayer("C:/Users/myname/raster.tif")
pixelSizeX= ras.rasterUnitsPerPixelX()
pixelSizeY = ras.rasterUnitsPerPixelY()

print pixelSizeX
print pixelSizeY


texts: Leaflet features work on some browsers, but not all

texts:
So I'm having a strange issue with Leaflet plug-ins, certain features will fail on certain browsers. The site is is at-
https://samdotson1992.github.io/KY_beer/

It seems to work on:

IE11
Edge

But does not work on-

Chrome
Firefox

Note the basemap will map will appear regardless, but the points won't load from the CSV and my other features fail too. Everything is on GitHub at https://github.com/samdotson1992/KY_beer.

Any suggestions? Ideas?


texts: How to create a dock widget correctly in QGIS plugin?

texts:
I am building a QGIS plugin and would like to use a dock widget. I have used QT creator to design the UI, with the object type being a QDockWidget. When the plugin is enabled in QGIS the dockwidget appears to be inside of a normal dialog box. I am therefore unable to dock the plugin to the toolbar space etc. I have looked at other plugins using dock widgets but am unable to spot where I am going wrong. I used the plugin builder to generate my template code.

myplugindialog.py

from PyQt4 import QtCore, QtGui
from ui_Myplugin import Ui_MyPlugin

class MyPluginDialog(QtGui.QDockWidget, Ui_MyPlugin):
    def __init__(self):
        QtGui.QDockWidget.__init__(self)
        self.ui = Ui_MyPlugin()
        self.ui.setupUi(self)

part of myplugin.py

class myplugin:

def __init__(self, iface):
    # Save reference to the QGIS interface and map canvas
    self.iface = iface
    self.canvas = iface.mapCanvas()
    self.mapRenderer = self.canvas.mapRenderer()
    # initialize plugin directory
    self.plugin_dir = os.path.dirname(__file__)
    # initialize locale
    locale = QSettings().value("locale/userLocale")[0:2]
    localePath = os.path.join(self.plugin_dir, 'i18n', 'myplugin_{}.qm'.format(locale))

    if os.path.exists(localePath):
        self.translator = QTranslator()
        self.translator.load(localePath)

        if qVersion() > '4.3.3':
            QCoreApplication.installTranslator(self.translator)

    # Create the dialog (after translation) and keep reference
    self.dlg = mypluginDialog()

def initGui(self):
    # Create action that will start plugin configuration
    self.action = QAction(
        QIcon(":/plugins/myplugin/icon.png"),
        u"My Plugin", self.iface.mainWindow())
    # connect the action to the run method
    self.action.triggered.connect(self.run)
    QObject.connect(self.dlg.ui.searchButton, SIGNAL("clicked()"), self.searchFromDialog)
    QObject.connect(self.dlg.ui.zoomButton, SIGNAL("clicked()"), self.zoom)

    self.toolbar = self.iface.addToolBar("My Plugin")
    self.toolbar.setObjectName("PMy Plugin")
    self.toolbar.addAction(self.action)
    self.toolbarSearch = QLineEdit()
    self.toolbarSearch.setMaximumWidth(200)
    self.toolbarSearch.setAlignment(Qt.AlignLeft)
    self.toolbarSearch.setPlaceholderText("Type address and hit enter")
    self.toolbar.addWidget(self.toolbarSearch)
    self.toolbarSearch.returnPressed.connect(self.searchAddressFromToolbar)

    # Add toolbar button and menu item
    self.iface.addPluginToMenu(u"&My Plugin", self.action)


texts: Any standards for urban rainwater drainage network?

texts:
I am starting to work on a project related to urban drainage networks. Are there any standards out there to represent this kind of network? Relevant attributes would be things like pipe section, pipe length, pipe intake and outlet height.

I am awere the OGC has set up a work group developing InfraGML, but as far as I know it is not yet officially released.


texts:
I'm trying to add layer in group on QGIS using those code:

qgis_groups = QgsProject.instance().layerTreeRoot()
path =  QgsProject.instance().readPath("./")
operators_path = join(path, 'RSX')
operators_content = [item for item in os.listdir(operators_path) if isdir(join(operators_path, item))]
shp = qgis_groups.findGroup('SHP')
for item in operators_content:
    shp_path = join(operators_path, item, 'SHP')
    for shp_file in glob.glob(join(shp_path, '*.shp')):
        layer_name = basename(shp_file).replace(".shp", "")
        layer = QgsVectorLayer(shp_file, layer_name, "ogr")
        shp.addLayer(layer)

the layers loaded on QGIS become None only the last layer is worked, So I tried to call addLayer outside for It worked but the previous layer become None again.
Then I tried with inserLayer(i, layer) but same problem.

Anyone has an idea about that?


texts:
I am trying to apply spatial filter on a WFS layer, but owslib.fes has only BBox spatial filter. Other spatial filters such as Intersects, Disjoint, Contains etc. are missing and unable to find.
I want to apply intersect filter. I am able to do it in GeoServer.
Curl Request.
 curl -X POST -H "Content-Type:text/xml" --data @intersect.xml "https://demo.geo-solutions.it:443/geoserver/wfs"

@intersect.xml file.
       <wfs:GetFeature service="WFS" version="1.0.0"
             outputFormat="JSON"
          xmlns:topp="http://www.openplans.org/topp"
          xmlns:wfs="http://www.opengis.net/wfs"
          xmlns="http://www.opengis.net/ogc"
          xmlns:gml="http://www.opengis.net/gml"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.opengis.net/wfs
                              http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
         <wfs:Query typeName="geosolutions:Linee_in_america">
            <Filter>
              <Intersects>
                <PropertyName>the_geom</PropertyName>
                  <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
                    <gml:coordinates>-74.817265,40.5296504</gml:coordinates>
                  </gml:Point>
                </Intersects>
              </Filter>
          </wfs:Query>
        <wfs:Query typeName="topp:states">
            <Filter>
              <Intersects>
                <PropertyName>the_geom</PropertyName>
                  <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
                    <gml:coordinates>-74.817265,40.5296504</gml:coordinates>
                  </gml:Point>
                </Intersects>
              </Filter>
          </wfs:Query>
        </wfs:GetFeature>

Is it possible to implement this using OWSLib??


texts: Rule-based labeling using Atlas - QGIS.3.6.2

texts:
I'm working with two shapes, both of them have a common field called "ID". I need the atlas to filter, only the id that I need to use, in the two layers.

The point layer has an entry point and an exit point for the same id.

Try this option but it did not work, in the non-coverage layer,

"ID" = attribute (@atlas_feature, 'ID') (mentioned by Alexandre Neto)
Rule-based labeling using Atlas - QGIS.2.14.1

I HAVE TRIED THESE FORMS BUT I DO NOT HAVE RESULTS.


texts: Do daytime Road Traffic Accidents (RTAs) have same spatial pattern as those of night?

texts:
With the following set of recorded data:

Location of Road Traffic Accident (RTA) along 160km Expressway
Date of accident
Time of occurrence
Causes of the accident etc

What spatial analysis tool in ArcGIS 10.1 can be used to show whether the RTA occurred during the day and night have the same spatial pattern or not? i.e in terms of cluster or being dispersed.


texts: Create geometry in PostGIS with OGR and Python

texts:
I have issue with PostGIS, Excel spreadsheets and Python OGR bindings. I need to read many Excel spreadsheets (with same schema), parse latitude and longitude fields, create points, re-project them and then write final rows to PostGIS. Simple. I create following script to do this (only important part of script):

count = 0
for f in file_queue:
    input_ds = input_drv.Open(f)
    in_lyr = input_ds.GetLayerByName(input_layer)

    #first pass - create target table and fields...
    if count == 0:
        out_lyr = out_ds.CreateLayer(output_layer, output_sr, ogr.wkbPoint, ['OVERWRITE=YES'])
        for x in xrange(in_lyr.GetLayerDefn().GetFieldCount()):
            out_lyr.CreateField(in_lyr.GetLayerDefn().GetFieldDefn(x),1)

    out_lyr.StartTransaction()
        for x in xrange(in_lyr.GetFeatureCount()):
            tmp_feature = in_lyr.GetNextFeature()
            tmp_feature.SetFID(-1)
            x_coord = tmp_feature.GetField(in_lyr.GetLayerDefn().GetFieldIndex('X'))
            y_coord = tmp_feature.GetField(in_lyr.GetLayerDefn().GetFieldIndex('Y'))
            if x_coord and y_coord:
                x_coord = parse_dms(x_coord, input_dms_format_regex)
                y_coord = parse_dms(y_coord, input_dms_format_regex)
                source_geom = create_point(x_coord, y_coord)
                projected_geom = reproject_geometry(source_geom, input_sr, output_sr)
                tmp_feature.SetGeometry(projected_geom)
            out_lyr.CreateFeature(tmp_feature)

    out_lyr.CommitTransaction()
    count += 1

But... when i run this script, no geometry is written to PostGIS - geometry field is present in table but is always null. Although when in step thorough the code in debug mode, all variables are correctly initialized and filled. FIY reproject_geometry function returns Clone of passed source geometry.

There is create_point function:

def create_point(x, y):
    if x and y:
       geom = ogr.Geometry(ogr.wkbPoint)
       geom.AddPoint_2D(x, y)
    return  geom.Clone()

Any advice?


texts: Save a rasterPCA plot as a raster file in R

texts:
Looking to the tutorial in http://bleutner.github.io/RStoolbox/rstbx-docu/rasterPCA.html, in which they show how to do a Principal Component Analysis on raster data, I was wandering whether is it possible to convert the ggRGB plot in a raster file.

Do you have any suggestion?


texts: Rendering two shapes for point, and overlapping, using Mapnik?

texts:
I'm using Mapnik to render a list of points; for each of these points I want to render a plain round shape, and an icon inside the shape, using two different SVGs.
To that end, I wrote a CartoCSS stylesheet like this (simplified):

[marker="true"] {
    marker-file: url('marker.svg');
    marker-allow-overlap: true;
    marker-fill: purple;
    marker-line-color: white;
    marker-line-width: 2;
    marker-height: 40;
    marker-transform: translate(0, @marker-height/-2);
}
[marker="true"]::inner-icon {
    marker-file: url('tree.svg');
    marker-allow-overlap: true;
    marker-height: @marker-icon-height;
    marker-fill: white;
    marker-transform: translate(0, @marker-icon-offset);
}

As far as I understood how Mapnik rendering works, I was expecting each point to render the two shapes together at once (marker.svg then tree.svg, in the order of the stylesheet) before rendering the next point, which would make sure that if two points overlap a bit, then the round plan shape would be drawn OVER the two shapes of the previous point.

However, the end result seems to draw all the marker.svg shapes, and then all the tree.svg shapes:

I'm using Mapnik 3.0.0-pre.


texts: Legend in storymap show correct hexcode colours in editor but not in final display

texts:
I have used some html/css code from here: https://blogs.esri.com/esri/arcgis/2015/12/16/enhance-legend-story-map-journal/

to display legends in a journal style storymap. The hexcodes are correct and show the right colour in the editor like below:

and when I save the output to my storymap looks like this:

Does anyone know why the colours and text would change and move? I have other legends in the story map and they are fine. It seems to affect the blue and yellow colours only.


texts: Converting Double to Long Integer Value Using ArcGIS Field Calculator

texts: I need to convert double fields to long integers using the field calculator in ArcGIS. However, when I do this, I keep getting zero values rather than the actual values.


texts: Clipping with multiple overlapping polygons while maintaining unique IDs and overlap

texts: I’ve got a series of square overlapping polygons. I want to clip a layer based on these polygons and maintain the unique ID and overlap of the polys. As it is now, if I do a clip using overlapping polygons, the clip will automatically merge all the unique polygons (see attached) by basically assuming the square polygons are one big mask. You can see that many of the square polygons overlap significantly and will have nearly identical clip results-which is exactly what I want. Aside from clipping one polygon at a time (there are 3,000+ of them), I cannot figure out a solution. There don’t seem to be any options to tell ArcGIS to turn off the automatic merge.


texts:
I have processed the *.tif-file from https://astrogeology.usgs.gov/search/map/Mars/GlobalSurveyor/MOLA/Mars_MGS_MOLA_DEM_mosaic_global_463m
as gdalbuildvrt mars.vrt <filename>, and now gdalinfo mars.vrt gives

Driver: VRT/Virtual Raster
Files: mars.vrt
       Mars_MGS_MOLA_DEM_mosaic_global_463m.tif
Size is 46080, 23040
Coordinate System is:
PROJCS["Equirectangular Mars",
    GEOGCS["GCS_Mars",
        DATUM["D_Mars",
            SPHEROID["Mars_localRadius",3396190,0]],
        PRIMEM["Reference_Meridian",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Equirectangular"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",0],
    PARAMETER["standard_parallel_1",0],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-10669675.197320545092225,5334837.598660272546113)
Pixel Size = (463.093541550370901,-463.093541550370901)
Corner Coordinates:
Upper Left  (-10669675.197, 5334837.599)
Lower Left  (-10669675.197,-5334837.599)
Upper Right (10669675.197, 5334837.599)
Lower Right (10669675.197,-5334837.599)
Center      (   0.0000000,   0.0000000) (  0d 0' 0.01"E,  0d 0' 0.01"N)
Band 1 Block=128x128 Type=Int16, ColorInterp=Gray
  NoData Value=-32768

My questions (as I am a newbie in GIS) are the following:
1)does this all mean that the Mars surface have been projected to
a 2-dimensional plane, in particular to a rectangle
occupying the space between (-10669675.197,-5334837.599) and (10669675.197, 5334837.599)? In other words, does this mean I do not have to reproject it using e.g. gdalwarp?

I query the data with e.g. gdallocationinfo -geoloc mars.vrt x y to get the "height" of the point (x,y). Here x,y lie in the above rectangle. For example, when I type,
say, dallocationinfo mars.vrt -geoloc 10 10, I get

Report:
  Location: (23040P,11519L)
  Band 1:
    <LocationInfo><File>Mars_MGS_MOLA_DEM_mosaic_global_463m.tif</File></LocationInfo>
    Value: -1512

i.e. the numbers are different from the ones supplied.
Also, the "height" is negative, but I presume it is normal since what is measured is below the "sea-level".

I read the man-page of gdallocationinfo more carefully and I seel that P-and L-suffixes of the above numbers come from pixel/line space.


texts: How to list ActiveView SelectionChanged event delegates in ArcObjects .NET?

texts:
I currently have an issue in an ArcObjects ArcMap add-in where my event handlers are seemingly-randomly being unhooked from the event I'm trying to catch. I've spent some time looking for a way to list all delegates currently assigned for the event but I can't find a way to call Delegate.GetInvocationList() from the event interface.

When my add-in is created I execute the following to respond to the ActiveView SelectionChanged event:

IActiveViewEvents_Event activeViewEvent = (IActiveViewEvents_Event)ArcMap.Document.FocusMap;
activeViewEvent.SelectionChanged += new IActiveViewEvents_SelectionChangedEventHandler(this.onSelectionChanged);

Now I know that this event handler will be lost when the active view changes so I also have this:

IDocumentEvents_Event documentEvent = (IDocumentEvents_Event)ArcMap.Document;
documentEvent.ActiveViewChanged += new IDocumentEvents_ActiveViewChangedEventHandler(this.onActiveViewChanged);

which calls the previous code to re-add the SelectionChanged event handler.

At seemingly random intervals my application stops responding to the SelectionChanged event. I'm stopping on all CLR errors so I'm sure it's not a silent exception that's disabling my add-in.

What I'd really like is to be able to inspect the delegates assigned to the SelectionChanged event and see if mine needs re-adding, but so far no joy.

Any suggestions on what might be going wrong, or how to inspect the assigned event handlers would be VERY much appreciated!

EDIT:

I've since figured out a pattern to the madness. My tool will only run within an edit session if features are selected. One way I can replicate this behaviour is to
1) start an edit session
2) select some features
3) run my tool - copies selected features from one layer to another
4) stop editing (it doesn't matter whether I save my edits or not)
5) Now the selection changed event is no longer handled

Can anyone tell me why starting and then stopping editing would detach my selection changed event handlers?


texts: Checking third party extension license timeout date?

texts:
I have a few third party extensions for ArcMap installed. In Advanced Settings Utility I have the "Starting 15 days prior... show warning..." checked ON.

I do not currently see a warning message when I start ArcMap.

I would like to be able to find the timeout date before I get within 15 days of it.