texts: How to wait for mapCanvas render before taking screenshot?

texts:
i am trying to iterate over a large list of features and making a screenshot of the selected feature. My problem is that it seems to be a delay between the refreshing of the canvas and the taking of the screenshot. In other words, the screenshot taken does not correspond to feature i but to feature i-1, sometimes i have several identical screenshots. Is it possible to explicitely wait until the rendering is done by the mapCanvas before calling the saveAsImage method?

This is globally the code that i am using to do this task.

 for i in range(n):
  layer.select(i)
  iface.actionZoomToSelected().trigger()
  qgis.utils.iface.mapCanvas().zoomScale(1000)
  iface.mapCanvas().refresh()
  imgname = '_'.join(['','object',str(i)])
  imgname = ''.join([imgname,'.png'])
  iface.mapCanvas().saveAsImage(imgname)


texts: Projecting small area lon and lat to Cartesian coordinates

texts:
Let suppose you have two points A and B that define a relatively small area on Earth. You know the longitude and the latitude of these points.
The situation is like in this drawing:

Let C be a point that is in the area defined by A and B.
If I know the Cartesian coordinates of A and B (which, in my case, represent pixels on a screen) how can I know the coordinates of C ?
In fact, I would like to draw all the roads of a specific area to my screen but I have no idea how can I compute coordinates that are inside the area.
Does anyone have an idea?


texts: How do you turn coordinates vertical in Map composer?

texts:
When using map composer in QGIS, there is the option to `Draw coordinates'. once selected, the coordinates are situated in the horizontal position (as seen below).

Does anyone know how to align the coordinates so they are situated in a vertical position?


texts: OpenLayers: Autoselect feature for modifying on page load

texts:
I'd like to create a map displaying a feature ready to modify. The map should already be selected and show the draggable vertices when you load the page (without needing to click on the feature first).

With this code, you first need to click the feature before you can edit:

    layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
    vectorLayer = new OpenLayers.Layer.Vector("Foo");
    map = new OpenLayers.Map('map');
    var wkt = "POLYGON((0 1, -1 0, 1 0))";
    var polygonFeature = new OpenLayers.Format.WKT().read(wkt);
    vectorLayer.addFeatures([polygonFeature]);
    map.addLayers([layer, vectorLayer]);
    map.zoomToExtent(vectorLayer.getDataExtent());
    modifyControl = new OpenLayers.Control.ModifyFeature(vectorLayer);
    map.addControls([modifyControl]);
    modifyControl.activate();

I already tried OpenLayers.Control.SelectFeature. It selects the feature (blue line) but it doesn't show the draggable vertices:

    selectFeature = new OpenLayers.Control.SelectFeature(vectorLayer);
    selectFeature.select(vectorLayer.features[0]);
    selectFeature.activate();

Any ideas? Thanks!


texts: Grass GIS animation tool: zoom in to area of interest

texts: The Grass GIS animation tool is great, but I'm struggling to be able to zoom into an area of the original rasters. Do I have to clip the rasters to achieve this, or can I use the advanced section of the 'edit animation' menu? If I can use the advanced menu, please explain how this works - it would need a start region and a zoom value I suppose but I can't select a start region. Setting a mask keeps the same level of zoom, but masks the animated rasters to the desired area. Screen shot attached.


texts: what is the output coordinate system when I use Near3D tool in ArcScene?

texts: I added a 3D rectangular surface (rectangle formed by 3D points) and a 3D point as two different shapefiles and then I tried to use Near3D tool. Then it gives an error "Datum conflict between input and output". I checked my coordinate systems and all the three (Scene, point and polygon) are in same geographic coordinate system which is "WGS_1984". What am I missing?


texts:
I am looking for a way to implement conditional value mapping in QGIS. This means that the values available in attribute number 2 depend on the value provided in attribute 1.

Example:

If the user enters "agriculture" in attribute 1, for attribute 2 only "corn" or "wheat" will be available.

Instead, if the user enters "forest" in attribute 1, for attribute 2 only "pines" or "olives" will be available.

And so on...

Apparently this is not doable just using the QGIS widget expression builder, but I am not sure. Here's a screencast to help visualize. The problem is that if for "class" I pick other than "Agri_Field", for the "color_aggri" attribute the same possible values appear.


texts: Calculating the surface area to calculate built-up area in GEE?

texts:
I have made a project to find the builtup area particular city.
Here is the source code:

var cloud_masks = require('users/fitoprincipe/geetools:cloud_masks');
var maskClouds = cloud_masks.landsatTOA();

//Loading India image, the extracting data for Haryana (a state in India) and then subsequently Ambala (a district in Haryana)
var bands = ['B1','B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B10', 'B11'];
var india = ee.FeatureCollection('ft:1UDdgOCf8DoRJ9bVm-UVbR6CqxtkJToLQjTFd0r0Z','geometry')
.filter(ee.Filter.eq('Name','India'))
.geometry();
var india_image = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterBounds(india)
.filterDate('2014-02-01','2014-09-01')
.sort('CLOUD_COVER')
.map(maskClouds)
.median();
var district = ee.FeatureCollection('ft:1PA2zwArj8EsplrX9eMxJ2H_TICyyx855KPnbJhC1','geometry')
.filter(ee.Filter.eq('name','Jodhpur'));
var haryana_image = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterBounds(district)
.filterDate('2014-02-01','2014-04-01')
.sort('CLOUD_COVER')
.map(maskClouds)
.median();
var input = haryana_image;
input = addBands(input.select(bands));
india_image = addBands(india_image);

//Loading the points from the fusion table and training the classifier
var ft = ee.FeatureCollection('ft:1fWY4IyYiV-BA5HsAKi2V9LdoQgsbFtKK2BoQiHb0');
var ft_builtup = ft.filter(ee.Filter.eq('class',1)).limit(1200);
var ft_nonbuiltup = ft.filter(ee.Filter.eq('class',2)).limit(1800);
ft = ft_builtup.merge(ft_nonbuiltup);
var new_bands = ['B1','B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B10', 'B11','NDBI','NDVI'];

function addBands(image){
  var ndvi = image.normalizedDifference(['B4', 'B3']).rename('NDVI');
  var ndbi = image.normalizedDifference(['B5', 'B4']).rename('NDBI');
  var ndwi = image.normalizedDifference(['B6', 'B6']).rename('NDWI');
  return image.addBands(ndvi).addBands(ndbi).addBands(ndwi);
}

// Load a Landsat 8 image to be used for prediction.
var training = india_image.sampleRegions(ft,['class'],30);
var trained = ee.Classifier.cart().train(training, 'class', new_bands);

input = input.clip(district);
input = input.classify(trained);
input = input.expression('LC==1?1:0',{'LC':input.select('classification')});
Map.addLayer(input.clip(district));

/*Export.image.toDrive({
  image: input.clip(district),
  description: 'Test',
  scale: 30
});*/

Now I want to calculate the surface area of built-up area and non built-up area which are in black and white pixels.


texts:
I have a DXF (layout) which is to be spatially adjusted to a point shapefile that has correct X Y cords.

When I add both as vector layers to Qgis, point shapefile is right on place but dxf shows a single line. I assume it needs rotation.

Vector bender, Vector transformation, Affine Transformation, DXFtoshapeconverter, I tried it all but nothing works.

I need help in understanding the process in such cases, where first I need to rotate the layer to match XY plane of the target layer and then georeference.


texts:
I'm receiving a Python Error when i try to reload a map i am working on, anyone with an idea how to solve this?
WARNING    Traceback (most recent call last):
              File "C:/Users/Helfer/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ale\advanced_line_editor.py", line 299, in currentLayerChanged
              self.currentlayer.editingStarted.disconnect(self.curLayerIsEditable)
             RuntimeError: wrapped C/C++ object of type QgsVectorLayer has been deleted

Running QGIS 3.6.0 Noosa Windows 10


texts: How to run ST_Intersects on a geometry from text and an existing table

texts:
I am developing a location based application that stores longitude and latitude coordinates in a string. I then (using PostGIS 2.0) need to use these coordinates and run ST_Intersects on it with the 'geom' column of another table called 'regions' so I can find the name of the region which the lat/long coord is part of. I am trying to use ST_PointFromText, but the ST_intersects query returns 0 rows, which is wrong.

Query:

SELECT regions.name
FROM regions
WHERE ST_Intersects(ST_PointFromText('POINT(38.53872 -121.7532461)', 4269),  regions.geom);

-(38.53872 -121.7532461) is the long/lat coord. I want to find the name of the region this coord is in.
-4269 is the SRID
-'regions' is a table containing a geometry column and a name column.

Any tips on why ST_Intersects is not returning the right region name? Or an alternative way to perform the query?


texts: How can I estimate a Least Cost Path in Google Earth Engine?

texts:
I'm using Google Earth Engine to estimate walking time based on slope, using the Google tutorial and this example based on a DEM. My code actually runs, but I don't know what units the output raster is in.
To estimate the travel in time, I used an equation that gives me the hours needed to cross 30 m (the size of the pixel) for each degree of slope (Rees' update of Naismith's rule). For example, between 1 and 2 degrees, it takes 0.037 hours (2.2 minutes) to cross a 30 m pixel. According to the function reference, the cost should be to move across one pixel. I wonder if it accounts for diagonal or knight's moves. I used this code in GEE:
 cover.gt(1).and(cover.lt(2).multiply(0.0376700260935214).add(

I calculated the values in Excel. The equation looks like this:
=(0.75+(0.09*ABS(TAN(RADIANS(slope in degrees))))+(14.6*(ABS(TAN(RADIANS(slope in degrees)))*EXP(2))))/3600*30

The cumulativeCost function does seem to work – the cost raster shows higher costs for higher slopes (contours every 500 units).

My main question: The resulting cumulativeCost raster has values up to 10,620. What are units are these? My input is in hours but there's no way it takes 10,620 hours to walk across 10 km (the maximum distance). I want the output raster to be in hours of travel time.
A minor issue: What is the syntax for inputting the cost equation directly into the code, instead of adding a line of code for each degree of slope?
A broader question: How can I use this cost raster to estimate a least cost path between two points? I would need to estimate direction of travel somehow. I can't find any related functions and very few applications – is this even possible in Google Earth Engine?


texts: Is there a call in pyqgis that clips a layer similarly to the Geoprocessing Tool?

texts:
I've loaded two shape files using pyqgis like so:

data_layer = QgsVectorLayer("lines.shp", "highways", "ogr")
clip_layer = QgsVectorLayer("polygon.shp", "highways", "ogr")

As the names of the source files suggest one of the files consists of line geometry data and the other of polygon data. I'd like to do the GUI operation Vector->Geoprocessing Tools->Clip operation in code. Something like: new_layer = QgsClip(clip_layer, data_layer)

I notice QgsClipper in the API docs but that only does rectangular clipping as far as I can see.

Is there a function that does what I want?


texts: How to solve "Error: Exported bands must have compatible data types; found inconsistent types: Float32 and Float64"

texts:
I get an error when attempting to export an image from Earth Engine:

  Error: Exported bands must have compatible data types; found inconsistent types: Float32 and Float64

I checked these links:

Getting Exported bands must have compatible data types; found inconsistent types: Float64 and Float32 using Google Earth Engine
Getting Error: exported bands must be compatible from Google Earth Engine

How can I solve this?

Here is my code:

var area = ee.FeatureCollection('users/wandygs8/municipal_boundaries');
var name = 'Batallas_Jan_March_2017-';
var period = 2018;
var version = 2;
var SRTM = ee.Image("USGS/SRTMGL1_003");
function maskS2clouds(image) {
  var qa = image.select('QA60');

  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;

  var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
      .and(qa.bitwiseAnd(cirrusBitMask).eq(0));

  return image.updateMask(mask).divide(10000);
}

var indices = function(image) {
  var ndvi = image.normalizedDifference(['B8', 'B4']).rename('NDVI');
  var ndwi = image.normalizedDifference(['B8', 'B11']).rename('NDWI');
  return image.addBands(ndvi).addBands(ndwi);
};
var dataset = ee.ImageCollection('COPERNICUS/S2')
                  .filterBounds(area)
                  .filterDate('2017-11-01', '2018-05-01')
                  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 100))
                  .map(maskS2clouds)
                  .map(indices);
var rgbVis = {
  min: 0.0,
  max: 0.3,
  bands: ['B4', 'B3', 'B2'],
};
var imagen = dataset.median();
var maxNDVI = dataset.select("NDVI").max().rename('ndvimax');
var minNDVI = dataset.select("NDVI").min().rename('ndvimin');
var meanNDVI = dataset.select("NDVI").mean().rename('ndvimean');
var desvNDVI = dataset.select("NDVI").reduce(ee.Reducer.stdDev()).rename('ndvidesv');
var maxNDWI = dataset.select("NDWI").max().rename('ndwimax');
var minNDWI = dataset.select("NDWI").min().rename('ndwimin');
var meanNDWI = dataset.select("NDWI").mean().rename('ndwimean');
var desvNDWI = dataset.select("NDWI").reduce(ee.Reducer.stdDev()).rename('ndwidesv');
var dem = SRTM.select('elevation').clip(area).rename('dem');
var CompImagen = imagen.addBands(maxNDVI).addBands(minNDVI).addBands(meanNDVI).addBands(desvNDVI).addBands(maxNDWI).addBands(minNDWI).addBands(meanNDWI).addBands(desvNDWI).addBands(dem);

Map.centerObject(area, 10);
Map.addLayer(CompImagen, rgbVis, 'Imagen S2');
print('Metadatos',CompImagen);
Map.addLayer(area,{color:'red'}, 'Area Estudio');
Map.addLayer(CompImagen.select('ndvidesv'),{},'DesvStandart');
Map.addLayer(CompImagen.select('NDVI'),{},'NDVI');
Map.addLayer(CompImagen.select('NDWI'),{},'NDWI')
Export.image.toDrive({
  image: CompImagen,
  description: 'iS2_'+ name + '_'+period+'_'+version,
  scale: 20,
  region: area
});

I must also export the algorithm training points in a shapefile for another job, how can I do it?


texts:
I have access to a database here (description of the columns are also available) containing spatial data in text format and with WGS84-EPSG:4326 coordinates.

I would like to only select data in my country (Czech Republic) and save them to our database. Is there any easy way to do this without need to import it to spatial DB and then filter it out?

I am thinking about very simple calculation using simple conditions etc. Is there a better solution than to draw a rectangle in QGIS covering whole country and then use it to define range for longitude and latitude and use it as condition for filtering?

Thanks


texts: Fixing Raster layer: Provider is not valid error when loading PostGIS rasters?

texts:
I compiled and installed the current QGIS master as usual and I imported some raster data into my postgres 9.3 database with postgis 2.0.2 extension. Whenever I try to import the raster data into qgis using the database manager, I get this message:

GDAL provider: Cannot get GDAL raster band:
Raster layer: Provider is not valid (provider: gdal, URI: PG: dbname=gis host=127.0.0.1 user=xxx password=xxx port=5432 mode=2 schema=public table=elevation

In the command line, I get

ERROR 1: Computed PostGIS Raster dimension is invalid. You've probably specified unappropriate resolution.

I have no idea where to search for the error.

I just moved to Postgis 2.1.2 and the same problem is seen there.


texts: I am new to QGIS. I found the problem impossible to solve the parts of raster data that are in TIFF format should be made transparent. What do I do?


texts:
I am trying to build an atlas with the QGIS-atlas-function and I want to know if it is possible to label the legend entries (165) with my own entries from the attribut-tabel. Important is that the Legend use the the original symbology colors/patterns from the svg in combination with my own created entries from the attribut-tabel. Is it the right way to try to change the labels in the rulebased layerdesing? And is there an option to do this automatically or do I have to change them manualy?

Here some Screenshots:


texts: GRASS: shift point locations in a random direction

texts:
I have a vector map that contains 100 points.  For each point, I would like to shift it 250 units in a random location.  It's easy enough to shift all points in a specified direction using

v.edit map=<mapname> type=point move=250,250

But what I need to do is to do this for each point and vary the direction randomly.  The magnitude of the shift can be constant.  (i.e. xshift can be -250 or 250).

Is there a solution that doesn't require me to iterate over the set of points individually?

Ideally, I'd like a solution that doesn't require me to use Python -- I'm trying to do all this with bash.


texts: Failing to use GeoTools to transform from WGS84 UTM 43N to WGS84

texts:
I am trying to transform a Polygon from EPSG:32643 to EPSG:4326 using GeoTools version 15.1.

However doing so, I seem to get incorrect values, and I cannot work out what is going wrong.

The source polygon I want to transform is:
POLYGON ((-673624.76 -9998082.58, -673624.76 9999900, 9999900 9999900, 9999900 -9998082.58, -673624.76 -9998082.58))

My approach is below:

WKTReader reader = new WKTReader(geometryFactory);
    Polygon polygon = (Polygon) reader.read(
            "POLYGON ((-673624.76 -9998082.58, -673624.76 9999900, 9999900 9999900, 9999900 -9998082.58, -673624.76 -9998082.58))");

    CRSAuthorityFactory   factory = CRS.getAuthorityFactory(true);
    CoordinateReferenceSystem sourceCRS = factory.createCoordinateReferenceSystem("EPSG:32643");
    CoordinateReferenceSystem targetCRS = factory.createCoordinateReferenceSystem("EPSG:4326");
    MathTransform mTrans = CRS.findMathTransform(sourceCRS, targetCRS, true);
    Geometry transformed = JTS.transform(polygon, mTrans);
    System.out.println(transformed.toText());

The result I get is:
POLYGON ((75.00000000000001 -90, 75.00000000000001 90, 75.00000000000001 90, 75.00000000000001 -90, 75.00000000000001 -90))

which is not a valid Polygon (too few points).

I have compared the results with qGIS, which produces the following POLYGON:
POLYGON((-15.00571089231461919 -79.54560544451550186, -15.093940630657249 79.54559128417886882, 165.00830898510739075 25.28552079066640701, 165.00050512410689407 -25.28552203835479517, -15.00571089231461919 -79.54560544451550186)).

I have also tested with epsg.io, transforming the first coordinate of the Polygon:
https://epsg.io/transform#s_srs=32643&t_srs=4326&x=-673624.7600000&y=-9998082.5800000

qGIS and EPSG.IO seems to agree.

What am I doing wrong?


texts: Masking low quality raster with polygons in R gives weird overhang?

texts:
I am pretty new to R, and have been attempting to use the mask function on a raster image of 250mx250m resolution. My problem is that for some reason I am getting overhang, as there are pixels which lie both inside and outside of the polygon. Is there a way to tighten the tolerance level of mask so that only the pixels within a certain percentage inside the polygon are accepted?

green is my polygon, blue is the resulting mask


texts: Browse features in cluster won't work in ArcGIS Web App

texts: After creating and configuring a web app i realized that the "browse features function" included in the cluster pop-up does not work properly when clicking a point layer's cluster icon. After showing the first feature contained in the cluster, upon clicking the right arrow to move to the next one, the cluster pop-up disappears. This does not happen in the web map upon which the app is built, where the browse features function works as intended. Any suggestions?


texts: How to install contour plugin for QGIS Wien on Linux mint?

texts:
When trying to install install contour plugin for QGIS Wien on Linux mint I get error "The contour plugin is disabled as it requires python modules numpy, matplotlib, and shapely which are not all installed".

the software required does not seem to be available in the repos and version would be important as well. Any one know the fix?


texts: Remove cell boundaries of raster pixels converted to vector format

texts:
I have a solar radiation shapefile with 10 km x 10 km cells. When I put it on QGIS, many pixels with boundaries take place. Please see the following image:

How can I remove them in Qgis?


texts: Creating a merged coastal terrain model using QGIS?

texts:
I have a bathymetric data set (Float32) and a standard DEM (Int16). I'm struggling to merge them using "Raster>Merge". I've set "nodata" to -9999 using "conversion>translate" this displays the DEM nodata as -3.40282e+35. The final merge retains nodata of one dataset depending on input order rather than selecting the z data from both sets. How can I merge the two.

I need to be able to run a number of sea level height models with changing uplift.


texts: Problem with the installation of Web ADF Runtime ArcGIS server 10

texts:
I'm trying to install ArcGIS server 10 (Windows 7 32-bit) and I found problem in the installation of ArcGIS Server for the Microsoft .net Framework - Web ADF Runtime.

The error is:

    ArcGIS Server 10 - Web ADF Runtime cannot be installed on your machine. Web ADF Runtime requires Microsoft internet information services which has not been found on your system.


texts:
I have 12000 circles with a radius of 50 miles on a raster with 0.05 degree resolution. Global analysis. The raster is 32 bit float and I have to calculate zonal statistics for 20 different rasters. Each calculation takes approximately 6 hours in QGIS on my local machine (16GB RAM, 4 cores i7, windows OSGeo4W suite). Looking for best ways to speed up. I do have limited knowledge of spinning up cloud instances with Linux. Options are:

multiprocessing on local machine
Linux instances with rasterstats (running into problems while installing on Linux instance using pip)
Linux instances with QGIS toolbox (having problems calling the processing toolbox. Zonal stats by QGIS is preferred over the SAGA one)
Linux instances with other tools/libraries??
Windows server with ArcPy capabilities

What flavour to choose? I'm using Python 2.7 as scripting language


texts:
As I realized once again connected with this answer to Joining attributes by location using QGIS, creating a spatial index can result in huge performance improvements.
However, I was wondering why spatial indexes are not created as a default in GIS software.
Are there any reasons why one should NOT create a spatial index?
I use QGIS 3.16 on Win10 and I am looking for answers for this setting, but I guess the answer will be not software-specific.
The only possible reason I could imagine not to create a spatial index is again connected with performance: creating a spatial index takes some time/processing power and storage capacity. For smaller datasets, these indexes do not bring such a huge improvement. And if you only want to visualize data (map making), spatial indexes are of no use (though maybe even that is not the case: https://gis.stackexchange.com/a/62302/88814).
Still, considering the huge performance improvement related to the modest additional requirements for processing and storing, I see no reason why one should not always create a spatial index.
Are there reasons/scenarios not to do so?


texts:
I've found an important style file, but it is only in MapCSS format:

https://raw.githubusercontent.com/OpenSeaMap/josm/master/INT1_Seamark.mapcss

I need to convert it to SLD to use in Geoserver. Can someone show me in a simple example how to start my job?

You can use this as start point:

/* Q: Buoys, Beacons */
node["seamark:daymark:shape"]::int1_daymark {
    icon-image:     eval(concat("https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q9/", replace(replace(tag("seamark:daymark:shape"), " ", "_"), ",", ""), "/", any(replace(tag("seamark:daymark:colour"), ";", "_"), "generic"), ".svg"));
    icon-width:     16;
}
node["seamark:type"=buoy_lateral]["seamark:daymark:shape"]::int1_daymark,
node["seamark:type"=beacon_lateral]["seamark:daymark:shape"]::int1_daymark,
node["seamark:type"=buoy_cardinal]["seamark:daymark:shape"]::int1_daymark,
node["seamark:type"=beacon_cardinal]["seamark:daymark:shape"]::int1_daymark,
node["seamark:type"=buoy_isolated_danger]["seamark:daymark:shape"]::int1_daymark,
node["seamark:type"=beacon_isolated_danger]["seamark:daymark:shape"]::int1_daymark,
node["seamark:type"=buoy_safe_water]["seamark:daymark:shape"]::int1_daymark,
node["seamark:type"=beacon_safe_water]["seamark:daymark:shape"]::int1_daymark,
node["seamark:type"=buoy_special_purpose]["seamark:daymark:shape"]::int1_daymark,
node["seamark:type"=beacon_special_purpose]["seamark:daymark:shape"]::int1_daymark {
    icon-offset-x:  1;
    icon-offset-y:  -20;
}

<PointSymbolizer>
  <Graphic>

    <ExternalGraphic>
      <OnlineResource xlink:type="simple" xlink:href="seamarks/Q/Q9/ dont know how to concat" />
      <Format>image/png</Format>
    </ExternalGraphic>
    <Size>16</Size>

  </Graphic>
</PointSymbolizer>

PS: Not work in CSS module.

EDIT: Table.

CREATE TABLE public.buoy_lateral
(
  way geometry(Point,900913),
  "seamark:name" text,
  "seamark:topmark:shape" text,
  "seamark:topmark:colour" text,
  "seamark:light:period" text,
  "seamark:light:character" text,
  "seamark:light:colour" text,
  "seamark:light:group" text
)


texts: Count features on geometric network between two points

texts: What geoprocessing tool or process will let me count the point features on a geometric network between a specified start and end point?


texts: ArcMap add-in (vb.net) datagridview will crash map when right click on the title part

texts:
I find the problem accidentally. In my ArcMap add-in, there is a search function which allows the user to search the geodb based on the value of a field. It works fine but today when I right click the title in the datagridview casually, the ArcMap crashed. After that I simulate the scenario several times, every time ArcMap crashes.

My code is listed bellow:

Sql = "SELECT ITEM_NO AS 'ITEM NO', ITEM_CATEGORY_NO AS 'ITEM CATEGORY NO', ARRIVAL_DATE AS 'ARRIVAL DATE' FROM testDB WHERE ITEM_NO = '" + item_No + "'"

Try
        adapter = New SqlDataAdapter(Sql, connObj)
        adapter.Fill(ds)
        connObj.Close()
        DataGridView1.DataSource = ds.Tables(0)
        Catch ex As Exception
           MsgBox(ex.ToString)
End Try

The result is:

Once I right click the part in the red frame, the map will crash.

Can anyone please tell me what's wrong with my code?


texts: QGIS: FieldCalculator stripping away a street address a certain way

texts:
I have set up some expression to strip away the address in multiple columns. While so far it works fine I have bit of a problem when it comes to letters.
I have a column in this table called "Address" as one example
Pieter de Smetstraat 1 A,2140 Antwerpen

This is the expression I use to "strip" the streetname and housenumber part:
replace("Address",(substr( "Address",strpos("Address",','))),'')

So it gets converted to this:
Pieter de Smetstraat 1 A

But I want to get it converted to this one:
Pieter de Smetstraat 1A

Keep in mind that the street address can be with spaces etc, special marks etc. So I need something that is universal to use, the street address can be one space.


texts: Shapely not detecting Manhattan point in Pluto dataset

texts:
I have a shapefile for Manhattan taken from the Pluto dataset:

https://www1.nyc.gov/site/planning/data-maps/open-data/dwn-pluto-mappluto.page

Removing it from the zip, I load it with Fiona.

import fiona
import shapely
fiona_shape_pluto_mn = fiona.open("MNMapPLUTO.shp")
first = fiona_shape_pluto_mn.next()
shp_geom = shapely.geometry.shape(first['geometry'])

According to the Pluto CSV file for Manhattan (MN2017V11.csv), these points correspond to Bush Tower in Manhattan: 988230, 214299

But when I run the following I get False:

shp_geom.contains(shapely.geometry.Point(988230, 214299))


texts:
I am working in qgis with 3 layers: one is road network and other is hospitals and locations of accidents , later two layers are as points, I want to figure out what accident location (points ) are under a specific (lets say 5 mins ) of driving time from hospital locations (points ) along roads. can anyone help me with this?

The only plugin that i found did this sort of analysis was road graph but it will give me just distance between two points but i want it to be like a buffer or range kind of output, and i can't do it manually using road graph as i have like 300 accident locations .


texts: ArcGIS Pro Script Tool Validation Not Updating Values in Tool

texts:
I have an ArcGIS Pro toolbox tool based on a python script and am trying to have tool validation pre-fill values based on the location of the ArcGIS Toolbox location.  Here is a screenshot of the tool:

This is my validation python code:

def updateParameters(self):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a parameter
    has been changed."""

    rootpathname = os.path.dirname(os.path.abspath("__file__"))
    shorepathname = os.path.join(rootpathname, "Data\\Shoreline.gdb")
    templatepathname = os.path.join(rootpathname, "Symbology\\Representation Templates")

    if not self.params[1].altered:
        self.params[1].value = shorepathname

    if not self.params[3].altered:
        self.params[3].value = templatepathname

    return

When I run the tool, neither of the parameters have been updated with the validation values; they simply remain blank.  Why are my parameter values not updating?


texts: What can I use to generate an interconnected graph from a series of coordinates?

texts:
I have a table containing latitude and longitude coordinates, and I'd like to be able to build an interconnected graph from it to use with pgRouting.

Is there an existing feature of postGIS or pgRouting I can use to do this?


texts: Timemapper.js - trying to get map bounds

texts:
I've got an application using Timemapper.js (http://timemapper.okfnlabs.org/), which uses Leaflet maps set up through Recline.js.  I want to get the leaflet map's bounds and when trying to use this.map.getBounds() come up with an '... is not a function' error.

Here is the map code from view.js.

_setupMap: function() {
 this.map = new recline.View.Map({
  model: this.model
});
this.$el.find('.map').append(this.map.el);

// customize with icon column
this.map.infobox = function(record) {
  if (record.icon !== undefined) {
    return ' ' + record.get('title');
  }
  return record.get('title');
};

this.map.geoJsonLayerOptions.pointToLayer = function(feature, latlng) {
  var record = this.model.records.get(feature.properties.cid);
  var recordAttr = record.toJSON();
  var maxSize = 400;
  var radius = parseInt(Math.sqrt(maxSize * recordAttr.relativeSize));
  if (radius) {
    var marker = new L.CircleMarker(latlng, {
      radius: radius,
      fillcolor: '#fe9131',
      color: '#fe9131',
      opacity: recordAttr.opacity,
      fillOpacity: recordAttr.opacity * 0.9
    });
  } else {
    var marker = new L.Marker(latlng, {
      opacity: recordAttr.opacity
    });
  }
  var label = recordAttr.title + '
Date: ' + recordAttr.start;
  if (recordAttr.size) {
    label += '
Size: ' + recordAttr.size;
  }
  marker.bindLabel(label);

  // customize with icon column
  if (recordAttr.icon !== undefined) {
    var eventIcon = L.icon({
        iconUrl: recordAttr.icon,
        iconSize:     [100, 20], // size of the icon
        iconAnchor:   [22, 94], // point of the icon which will correspond to marker's location
        shadowAnchor: [4, 62],  // the same for the shadow
        popupAnchor:  [-3, -76] // point from which the popup should open relative to the iconAnchor
    });
    marker.setIcon(eventIcon);
  }

  // this is for cluster case
  // this.markers.addLayer(marker);

  // When a marker is clicked, update the fragment id, which will in turn update the timeline
  marker.on("click", function (e) {
    var i = _.indexOf(record.collection.models, record);
    window.location.hash = "#" + i.toString();
  });

  // Stored so that we can get from record to marker in hashchange callback
  record.marker = marker;

  return marker;
};
this.map.render();

}
});


texts: installing gdal from osgeo to work with GeoTIFF

texts:
I just installed Anaconda Navigator (and nothing else) in Windows and want to be able to work with GeoTIFF files in
Spider (Python 3.7).
It is my understanding that Navigator can search for packages on Anaconda Cloud or in a local Anaconda Repository, but I do not know how to install what I need and have the following response:

File "C:/Users/igor/.anaconda/test.py", line 2, in
    from osgeo import gdal

ModuleNotFoundError: No module named 'osgeo'

It seems that I need to get osgeo first, but I do not have such experience either.  Would you please help knowing that I did not use Conda at all.


texts: Positioning parameters in Python script tool dialog box?

texts: Is there a way to get the boolean parameters below to be next to each other instead of one on top of the other?


texts: ST_AsLatLonText gives error 'ERROR: Cannot convert an empty point into formatted text.'

texts:
My SQL query below, is trying to get this data from my mpoly (which is just a geometry field in my database).

I can select and grab things and there are no null mpoly entries yet running this:

SELECT zone_id, mpoly, St_AsText(ST_Centroid(mpoly)), ST_AsLatLonText(ST_Centroid(mpoly), 'DDMMSS') as dms from swsite_cesiumentity where zone_id is null

ERROR: Cannot convert an empty point into formatted text

I guess to me this error is confusing since mpoly has no null fields, am I missing something in my select I guess?


texts: Intersection between two LineString gives "Non-noded intersection"


texts: Raster Calculator giving inccorect results with large numbers

texts:
I am attempting to multiply my raster values by 10000 using the raster calculator in QGIS 3.6.2. But am getting weird results. For example I have an initial raster value of 30303 and would expect a return of 303030000 but instead get a return of 303030016. However the initial value of 10101 gives me the expected 101010000 but 101010 gives me 1010099968 and 121212 gives me 1212120064.

The formula is simply ras@1 * 10000

Is there something I am doing wrong? I assume this is some kind of rounding issue.


texts:
-->Is there any way to publish 16 bit raster image in geoserver 2.7.2?
Then i tried to publish 16 bit raster image,but i got different color   variations in different zoom levels,If any solutions for this issue?


texts: Script to export OD matrix line tables for individual point features

texts:
I have a network dataset and I would like to know the network distance (not Euclidean) from each feature point in a shapefile to each other point in another shapefile with the same number of points. However, I would like to have separate tables for each feature, rather than one large table.

Is it possible to iterate through the point features in one shapefile, add the individual point as the "Origin" to an OD Cost Matrix (which already has the "Destination" locations added), solve for the Matrix, and export the lines or the line table, then move on the the next point and do the same? Or is there perhaps a simpler way to do this?

I know I will end up with a ton of tables, but I am hoping to run some analysis the individual tables.

Here is a graphic model from ModelBuilder I was working on:


texts: Is there a way to center an IPointCollection?

texts: I built an IPointCollection and can display it, but I would like to display multiple copies in different locations.  Is there a way to center a point collection on another IPoint?


texts: Download anonymous OSM full history data (no User Id/ Nicknames)

texts:
Here my Background:

I intend to use OSM Full History Data for OSM data quality analysis. This is part of my current thesis and the data will be stored on a companies computer (Germany). Since the new "General Data Protection Regulation" of the EU handling "potential personal data" legally is more difficult. OSM Contributor IDs and Nicknames are such data meaning in my case I can't store them legally on my computer. (Source i.a. FOSSGIS 2018, Zscheile, Datenschutz und die Daten der zu OpenStreetMap Beitragenden)

So my question: How can I download OSM Full History Data (or Changesets) anonymized or without any User IDs or Nicknames?

Downloading and deleting the IDs, Nicknames already violates the law as I see it. (Includes storing the data, even if for a short time.)

Kind regards


texts:
I ran a Geographically Weighted Regression (GWR) model to find out, in which local regions my independent variables have a strong, moderate or weak relationship.
After doing so, I only want to focus my further analysis on regions with a strong relationship, but the GWR tool in ArcGIS does not provide any p-values for the regions.

Which approach would be appropriate to choose "significant" regions? Would it make sense to include all regions where the coefficient value is higher than the mean, or than +1 standard deviation?


texts: Populating column in shapefile attribute table based on row values of another column in R?

texts:
I'm using R to manipulate an attribute table of a shapefile. The shapefile attribute table has two columns: Location ID, and Height. I want to add a third column titled "Mean", which provides the average height value by Location ID. There are over 300,000 rows in this shapefile, so this cannot be done manually.

Is there a function in R to accomplish this?

Below is an example of what the attribute table looks like. Note that the Location ID is not necessarily in sequential order; if there is an ID 1, and an ID 10, that does not mean there's an ID 2, 3, 4, etc.

 Location.ID Height
          43      2
          87      5
          22      6
          87      3
          43      9
          22      1

Below is the final result I am trying to achieve in R. Note that the mean values (column 3), are of height values (column 2) specific to certain Location ID values (column 1)

 Location.ID Height Mean
          43      2  5.5
          87      5  4.0
          22      6  3.5
          87      3  4.0
          43      9  5.5
          22      1  3.5

Is there a built-in function to accomplish this?

Or is there a way to iterate through row values in column 1 to populate column 3?


texts: Oracle error when copying massive feature dataset

texts:
In ArcCatalog 10.1, when copying a feature dataset with roughly 3 million objects as well as a few thousand tables and relationship classes, my team is running into an

  'Underlying DBMS error [ORA-03114: not connected to ORACLE][SDE.DEFAULT]'

message 9 times out of 10... I'm hoping someone has run into a similar issue.

We are literally copying the feature dataset from one connection file and pasting it into another connection file/environment. This works fine with smaller sets of data. However, for this bigger dataset transfer, we are running into this problem - the process copies all objects but fails in the late stages (I think when it is copying tables). This is killing us, since the process takes about 20 hours and then bombs! X(

I also get a Paste Failed Message each time:

  'Failed to paste GEODATA.NA_US_SOIL_MUPOLYGON_2013
  Invalid function arguments
  Underlying DBMS error [SDE.GDB_ITEMS]
  Underlying DBMS error [ORA-03114: not connected to ORACLE][GEODATA.NA_US_SOIL_MUPOLYGON_x]
  Underlying DBMS [ORA-03114: not connected to ORACLE]
  Underlying DBMS error [ORA-03113: end-of-file on communication channel
  Process ID: 7804
  Session ID: 205 Serial number: 52647][GEODATA.NA_US_SOIL_MUPOLYGON_x]

We've discussed this issue at length with Oracle DB team here and cannot seem to find any issue in Oracle logs. Our OS is Windows Server 2008 Std64 bit SP2, ArcSDE 10.1 SP1, and the server is a DellR710. Has anyone encountered a similar error? We're at our wits' end here. Thanks for any suggestions!


texts: An equivalent for field statistics for records

texts: I know how to obtain various statistics for a field, or "column", in an attribute table in ArcGIS. Is there any way to obtain a Mode figure for records, or the "rows" in a table? For instance, an attribute table of plots of land might contain 15 fields each showing the number of a particular type of tree on each plot. I need to find out, for a particular plot, what type of tree is the most common there. What is the easiest way to find out which of the 15 fields has the highest figure for that record? Am I right that the answer somehow involves the Field Calculator?


texts:
I have a lot of tables with column geom (Multipolygon) without SRID in PostgreSQL/PostGIS.

I need to set all tables  with a SRID of 3003.

This is my first time with SQL function.

I'm using a part of code of this answer:

DO $$Declare r record;
  BEGIN
    FOR r in SELECT srid as srs, f_table_name as name, f_geometry_column as geom
     FROM geometry_columns WHERE f_table_schema = 'Schema_name'
    LOOP
       RAISE NOTICE 'updating table: %, geom column: %, with srid: %', r.name, r.geom, r.srs;
       PERFORM UpdateGeometrySRID(quote_ident(r.name), quote_ident(r.geom), 3003);

   END LOOP;
END $$;

and the result is:

NOTIFICA:  updating table: pat4, geom column: geom, with srid: 0

ERRORE:  la funzione updategeometrysrid(name, name, integer) non esiste
LINE 1: SELECT UpdateGeometrySRID(r.name, r.geom, 3003)
               ^
HINT:  Nessuna funzione trovata con nome e tipi di argomenti forniti. Potrebbe essere necessario convertire i tipi esplicitamente.
QUERY:  SELECT UpdateGeometrySRID(r.name, r.geom, 3003)
CONTEXT:  funzione PL/pgSQL inline_code_block riga 7 a PERFORM

I don't understand because it doesn't recognise the function.


texts: What are some user-friendly GIS alternatives to Alteryx and ArcGIS?

texts:
I'm posting for some inspiration. At my last workplace we used Alteryx extensively for all data analysis, pumping out shapefiles which we'd then symbolise and output maps in ArcGIS.

In my new workplace we don't have Alteryx, and I'm finding it incredibly frustrating to have to do things in Arc which are trivial in Alteryx. For example, join fields from two tables, rename fields, summarise data, filter data, perform field calculations, do spatial operations, drivetimes, intersections etc. ArcGIS is great for making maps, particularly in Python where you can do things in batch. But for analysis and geoprocessing it's just rotten.

So, has anyone else there used Alteryx? Can anyone else feel my pain? And possibly, can anyone suggest any alternatives that I might be able to use? I don't really understand how much Alteryx costs, other than that it'll be an awful lot more expensive than ArcGIS. And boy does it show.

Any suggestions for alternative software from those who might've used both? Thanks


texts:
I would like to perform kriging using a variable call "Secchi.Disk" from a data set I have. However, when fitting the variogram I get the following warming message

Warning message:
In fit.variogram(v, vgm(0.5, "Sph", 40, 0.5)) :
  No convergence after 200 iterations: try different initial values?

I been trying different values for the partial sill, range and nugget; but, I still get the same warning message. Here is my code

library(rgdal)
library(ggplot2)
library(ggmap)
library(GISTools)
library(sp)
library(spdep)
library(gstat)

all.data<-read.csv("C:/Users/Juan/Desktop/All_Data_Fall_17.csv", header=TRUE)
str(all.data)
dput(all.data)
coordinates(all.data)<- ~ Lat + Lon
class(all.data)

#Variogram
#Secchi
v <- variogram(all.data$Secchi.Disk~1, all.data)
plot(v)
v.fit <- fit.variogram(v, vgm(0.5,"Sph",40,0.5))

Dataset View(all.data)

Output dput(data.frame(all.data)[,c("Lat","Lon","Secchi.Disk")])

structure(list(Lat = c(334374, 334381, 334391, 334423, 334426,
334431, 334465, 334455, 334444, 334481, 334481, 334489), Lon = c(4088957,
4089003, 4089040, 4089041, 4088984, 4088965, 4089025, 4088982,
4088924, 4088929, 4089004, 4089039), Secchi.Disk = c(18L, 15L,
16L, 15L, 15L, 15L, 17L, 16L, 16L, 17L, 17L, 16L)), .Names = c("Lat",
"Lon", "Secchi.Disk"), class = "data.frame", row.names = c("1",
"2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"))

Output of str(all.data)

Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
  ..@ data       :'data.frame': 12 obs. of  11 variables:
  .. ..$ Sample.ID  : Factor w/ 12 levels "CL-1","CL-10",..: 1 5 6 7 8 9 10 11 12 2 ...
  .. ..$ Temp       : num [1:12] 23 26.1 25.1 24.9 24.4 ...
  .. ..$ TDS        : num [1:12] 0.542 0.517 0.53 0.542 0.535 0.535 0.539 0.527 0.536 0.536 ...
  .. ..$ pH         : num [1:12] 8.08 8.74 8.67 8.51 8.69 8.7 8.56 8.75 8.63 8.6 ...
  .. ..$ ODOsat     : num [1:12] 60.9 216.1 156.7 112.6 114.8 ...
  .. ..$ TSS        : num [1:12] 68.3 68.8 67.5 65.4 56 ...
  .. ..$ TP         : num [1:12] 3.27 3.05 4.02 2.99 3.25 3.17 3.27 3.15 4.02 3.38 ...
  .. ..$ TN         : num [1:12] 13 12.4 12 12.4 15 12.6 12.4 12.4 12 13.6 ...
  .. ..$ NO3.N      : num [1:12] 2.71 3.02 2.71 1 2.58 1.35 1.66 1.88 4.07 4.16 ...
  .. ..$ Chloro.a   : num [1:12] 274 464 416 375 236 ...
  .. ..$ Secchi.Disk: int [1:12] 18 15 16 15 15 15 17 16 16 17 ...
  ..@ coords.nrs : int [1:2] 2 3
  ..@ coords     : num [1:12, 1:2] 334374 334381 334391 334423 334426 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:12] "1" "2" "3" "4" ...
  .. .. ..$ : chr [1:2] "Lat" "Lon"
  ..@ bbox       : num [1:2, 1:2] 334374 4088924 334489 4089041
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:2] "Lat" "Lon"
  .. .. ..$ : chr [1:2] "min" "max"
  ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
  .. .. ..@ projargs: chr NA

Output of plot(v)

Any ideas on how to fix this problem?


texts: PostgreSQL/PostGIS spatial index - no speed up

texts:
I have a spatial table in a PostgreSQL/PostGIS database. Every row in it represents a Polygon. It is of following form:

+----+--------+
|gid |   way  |
+----+--------+
|241 | 01030..|

The geometric column is "way" which contains the geometry for a polygon. In WKT it is: POLYGON(('....')). I am doing a lot of ST_Contains queries on this table, to test whether two polygons are contained in each other e.g.:

Select ST_Contains(a.way, b.way) From table AS a, table AS b Where a.gid = 15 And b.gid = 16

I was wondering how to speed up this query and added a spatial index on the table:

CREATE INDEX table_way_gist ON table USING gist(way);

But actually I don't see a speed up. I create the index AFTER I filled the table with all polygons BEFORE I do the ST_Contains queries. Should the index be added before filling a table? Are there special requirements on the table to work with the index? The projection (srid) of the geometric column way is set to 900913.

I am using: psql (PostgreSQL) 9.1.4 / POSTGIS="1.5.3"


texts: Creating new shapefile based on its attributes with python?

texts:
I have a shapefile which has an attribute year. I used to generally copy and paste these features in the dataframe and then using the definition query just show polygons which were established before that year.

I want to know how can I do it using python. Like if I can give the input feature class, add all the years I want the different shapefiles for and the workspace where it can create shapefile for the mentioned years with the right naming convention.


texts: How to prevent labels from a vector file to overlap the raster file?

texts:
I have vector file of say Sewer lines with diameter as their labels. Against some of the sewer, georef. images are placed. While displaying all together, line labels do appear over the raster file.
I want to avoid that.
I am using ArcGIS 10.5

Picture is attached (Current condition)


texts: Assistance Speeding up a Query with ST_Distance_Sphere

texts:
I'm using PostGIS/Tiger for geocoding I am trying to find the first/nearest tract for a given long/lat, and while this query works great every time, it takes anywhere from 2-5 seconds to complete.

Any opportunities to make it faster? I added an index on the tract table's "the_geom" column (it looks like I have two indexes, a gist and a regular)

Here is my query:

        SELECT tract_id, intptlat, intptlon
        FROM tract
        WHERE ST_Distance_Sphere(ST_Point(ST_X(ST_Centroid(the_geom)),
         ST_Y(ST_Centroid(the_geom))),
        (ST_MakePoint(-118.2436849, 34.0522342))
       ) <= 650
        LIMIT 1

I suspect the way I'm handling the distance might be the issue in the where clause, but I'm a bit stuck.


texts: Different output from running algorithm in toolbox and from script

texts:
I am unable to get the same results when running the qgis:reproject tool from QGIS processing toolbox (QGIS version 2.0.1) as when running it from a Python script (console). In this example I am projecting from WGS 84 to Europe Albers Equal Area Conic.

In the toolbox, I run Geoalgorithms->Vector->General tools->Reproject layer. I choose my target projection and input/output files. I uncheck the box to load the layer after finishing. After the tool has ran, I find a .shp, .shx, .dbf, .prj and .qpj file on disk.

If I in console do the following:

layer = QgsVectorLayer("C:/path/to/input.shp", "layername", "ogr")
processing.runalg("qgis:reprojectlayer", layer, "ESPG:102013", "C:/path/to/output.shp")

the result is a .shp, .shx and .dbf file on disk, as well as an empty .prj and .qpj file. Well, the .qpj file is 1 byte, seemingly a newline. Why are these not written properly?

Using a diff tool on the output files, the .shp and .shx files are not the same as the output from the toolbox algorithm. What is the toolbox version doing that I am not? According to processing_qgis.log the same processing algorithm is ran. (Note: Turns out I overlooked a critical point here, see my answer)

This question evolved from the following question: No prj file output from qgis:reproject. Basically I am trying to reproject a layer from one CRS to another, and import that layer into QGIS, retaining distortions (no on-the-fly projection). This works fine if I run the toolbox algorithm, but if I run it from script I get some sort of on-the-fly projection, even though it is disabled in settings. Note that copying the .prj and/or .qpj files does not help.

This is how it should look after importing the layer (and indeed how it looks if I run from toolbox):

This is how it looks when I project using script:

The way I import the layers is through the Layer->Add Vector Layer menu item.

Would really appreciate any help on this.


texts: Error in Conditional Statement in QGIS Field Calculator

texts:
I have a layer with multiple columns as shown in the picture below. If I want to make another column giving 'match' when column 'layer' and 'left(dista' are same value. How can I apply this in field calculator using if(conditional) or something else?

I used following conditionals;
if('layer'='left(dista', 'match', 'unmatch')
but it's showing errors

left function is called with wrong number of arguments. Expected 2 but got 1.
syntax error, unexpected COMMA, expecting $end
syntax error, unexpected COMMA, expecting $end
syntax error, unexpected ')', expecting $end


texts: Create Unique ID in ARCPAD Form Code Issue

texts:
I'm trying to create a Unique ID that pops up on a custom form I'm making in ArcPAD.  This is needed so field workers can include this number on some supplemental paper tables that they carry around.

I've pasted together the following code which mostly works; however, if someone uses the repeat attributes toggle then the "unique" ID is also repeated.

Is there any way to test to see if the repeat attributes toggle is on or off?

I can't find it anywhere in the Object Model.

Here's my code.  This runs on the ONLOAD event for the form (sorry for the lack of documentation).  This basically just loops through the features and finds the highest number in the ID field and adds 1.  If the ID box on the form is already populated this is not executed.

Option Explicit
Dim varUniqueID

Sub UniqueID2
    Dim objRS, HighValue, CurrentValue, objEFPageOneControls, objEditForm
    Set objRS = Application.map.layers("OFF_ROAD").records
    Set objEditForm = application.map.layers("OFF_ROAD").forms("EDITFORM")
    Set objEFPageOneControls = objEditForm.Pages("Page1").Controls

    If (objEFPageOneControls("IDBOX").Value = "") Then
        If (objRS.RecordCount > 0) Then
            objRS.Movefirst

            HighValue = objRS.Fields("ID").Value
            objRS.MoveNext

            While Not objRS.EOF
                CurrentValue = objRS.Fields("ID").Value

                if HighValue < CurrentValue Then
                    HighValue = CurrentValue
                End If

                objRS.MoveNext
            Wend
            HighValue = HighValue + 1
        End If
        objEFPageOneControls("IDBOX").Value = HighValue
    End If
End Sub


texts:
I want to be able to:

Run
Run Selected

in python editor using shortcuts. It does not seem possible under Settings - Keyboard shortcuts.
Is there any way?


texts:
I currently have a map created entirely in the CartoDB editor, including custom map. For some reason it doesn't allow you to add an attribution in the editor but thats a different problem.

So my map has a custom baselayer and 3 toggleable layers. Here is the code.

<script>
  function main() {
    cartodb.createVis('map', 'https://paulm.cartodb.com/api/v2/viz/5fd91fc8/viz.json', {
    })
    .done(function(vis, layers) {
      window.layers = layers;
    })
    .error(function(err) {
      console.log(err);
    });
  }
  window.onload = main;
</script>

I know that I could replace the current base map by adding

.done(function(vis, layers) {
  var basemap = layers[0];
  basemap.setUrl('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
})

However im not sure if its possible to enable a base map switcher, or if I need to add it as a new layer completely will I need to do that via the code. Adding in a whole new set of tiles seems to be more of a basemap switch than just a data layer.


texts: Converting GeoTIFF into non-compressed format for WhiteBox?

texts:
I am looking for an opensource solution to create a seamless air photo mosaic.

I came across WhiteBox from the University of Guelph which seems like it might do the trick, but it does not support GeoTiff Compression.

Is there a way to convert Geotiff's into a non-compressed format that WhiteBox would be able to use?


texts: Please suggest how to draw a style like - x x - (dash cross cross dash), with a dash length 25 mm and gap between dash and cross is 2mm


texts: Big data sets and challenges using the Leaflet client

texts:
I am using Leaflet to present around 90.000 data points. My test code is generated using the plugin QGIS2leaf in QGIS 10.10.1. I am using clustering and reviewing the code I can see that this is "leaflet.markercluster.js". In principle this works well.

For practical use I have a capacity problem. The clustering works fine when zooming in and out. The problem is that takes around 30 seconds before the map pops up. Some clients even crashes.

The reason for this seem to be transfer of the geojson file (dev tools confirms this). It is now at 12 MB down from 61MB. Removing all the attribute data evidently helped some.

I could probably remove some of the decimal numbers from the coordinates. But I would only gain a couple of percent.

How can I tweak this further:

Is there a way to transfer zipped geojson files to client (Leaflet).
The geojson file is mostly (70%) repeated text. Is there a way to transfer the coordinates and attributes without this overhead?
Can Leaflet do other formats which in this respect are more efficient?


texts: Using Field Calculator to assign values to only Odd (or Even) page fields for Data Driven Pages?

texts:
I am creating a map book but do not want the page numbers for each map page to be on the same side (since its printed double sided), I need the page numbers to be placed on opposite sides.

I am using data driven pages. On a previous post it was mentioned to use ODD and EVEN pages per How to make Map Book with facing pages numbered near outside edge?.

However I have over 200 pages.

Is there a "creative" field calculator expression to use?


texts:
I want to load a (.qml) style file to a specific layer, I tried this:
layer = QgsProject.instance().mapLayersByName(layer_name)
if layer.wkbType() == QGis.WKBLineString:
    layer.loadNamedStyle('styles/lines.qml')
layer.triggerRepaint()

Also, I tried this:
layer = QgsProject.instance().mapLayersByName(layer_name)
if layer.geometryType() == QgsWkbTypes.LineGeometry:
    layer.loadNamedStyle('styles/lines.qml')
layer.triggerRepaint()

But I get this error:
if layer.wkbType() == QGis.WKBLineString:

# AttributeError: 'list' object has no attribute 'wkbType'


texts: How to trigger qgis command from outside of qgis

texts:
Imagine you have a simple (maybe shared) EXCEL sheet lising your coordinates. For each coordinate you want to check a feature in a layer or arial imagery. To make it efficient, it would be perfect to "click" and jump to that position in QGis (a running qgis with layers and styles loaded).

A VBA code or com-addin in that example could run a command to do that.

I need to achieve the following:
call QGIS from another application and say "zoomWithCenter" and "zoomScale"

Is this possible? How?

I am running a QGIS on a windows machine.

I would like to view some layers with QGIS but the editing and tracking is done in another custom application.

It would be great to e.g. send a command line call (holding coordinates and zoom scale) from that other application to running QGIS in order to pan and zoom to a particular coordinate.

Maybe there is already a socket server and client available for qgis? That would even allow two way communication...


texts: Created custom tiles, added tile bounds to leaflet but it's still trying to load tiles outside of boundaries

texts:
I created custom tiles in TileMill with latitude/longitude boundaries of:

-89.8235,43.3377,-89.5952,43.4741

I added those tiles into the map and set the tile layer's bounds attribute, but Leaflet still is giving me a lot of "Not Found" errors in the console.

Here's my code for adding the tiles:

{
    "parks boundaries": L.tileLayer('data/custom-tiles/boundaries/{z}/{x}/{y}.png', {
           bounds: [[43.3377,-89.8235],[43.4741,-89.5952]]
    }).setOpacity(0.4).addTo(map)
}

Here are some of the errors I'm getting:

GET http://localhost/cart575final/data/custom-tiles/boundaries/14/4105/5994.png 404 (Not Found)
GET http://localhost/cart575final/data/custom-tiles/boundaries/14/4105/5995.png 404 (Not Found)
GET http://localhost/cart575final/data/custom-tiles/boundaries/14/4105/5993.png 404 (Not Found)

Why is Leaflet still trying to fetch tiles that don't exist when the bounds of my tiles are clearly stated?


texts: Adding join to table from Microsoft Access in ModelBuilder gives ERROR 999999?

texts:
I am working on a model in ArcMap (10.4.1) that calculates habitat suitability over a series of timesteps. The data needed to calculate habitat suitability at each timestep is stored in a specific table located in a Microsoft Access database (.mdb file).

For each timestep, I would like to load in the data from the .mdb file (FVS_Output_n) and join it to a feature layer (colby_layer):

When I tried to execute this join, I get the following error:

  ERROR 999999: Error executing function. The Microsoft Jet database
  engine cannot find the input table or query 'GDB_ObjectClasses'.  Make
  sure it exists and that its name is spelled correctly. Failed to
  execute (Add Join).

What is most confusing to me is that under a previous iteration of this model, I was able to join these tables without issue. I understand that with the newer versions of ArcMap there has been some reorganization of how GDB are structured, but I don't know enough to figure out what is really happening here.


texts: Find lower left corner of a rotated polygon

texts:
I am currently struggling with a mathematical problem and can't seem to get it solved.

I have a bunch of rotated rectangular polygons (solution should also work for non-rectangular polygons) in different shapefiles. I want to (automatically) find the lower left corner of each of the polygons using python (arcpy).

First I tried to simply use the extent, but since they are rotated, the extent will bring false results. So how do I approach this? I googled for hours and the only thing I could come up with, is to somehow calculate the center of the polygon or somehow temporairly rotate it to 180 degrees and then use xmin and ymin. Here are a few pictures which may help to distract the attention from my bad english (sorry for that btw)

I had no problems exporting the coordinates of the polygons by using the feature vertices to points tool. So far I extracted them once in a list of tupels and once in two different lists (one for x-coords and one for y-coords)

so here are a few coordinates to make it easier to test:

tupel-format:

tupelList=[[1792398.680577231, 4782539.85121522],
 [1792173.0363913027, 4780368.293228334],
 [1788935.7990357098, 4780713.732859781],
 [1789162.9530321995, 4782885.332685629],
 [1792398.680577231, 4782539.85121522]]

x-list/y-list format:

xList= [1792398.680577231, 1792173.0363913027, 1788935.7990357098, 1789162.9530321995, 1792398.680577231]

yList=[4782539.85121522, 4780368.293228334, 4780713.732859781, 4782885.332685629, 4782539.85121522]

I am currently using ArcGIS 10.3.1 width ally extensions and an advanced license. Version of Python is 2.7.something


texts: Distribute population to health facilities (GP Practices)

texts:
I have been using GIS (ArcGis) for some years but I do not consider myself an expert.

I am performing some analysis around GP Practices in London (UK), I would like to be able to estimate the catchment area of each practice, so that in case a new development is built I can estimate if the new incoming population will have an impact on the existing GPs.

The datasets (shapefiles) I have are the following:

Population (by super output areas / wards / etc..)
Postcodes (OS Code-Point Open - centroid of the postcode area)
GP Practices (as points - database information is inclusive of number
of registered patients and number of General Practitioners)

I don't think performing a buffer would be the right think to do as many GP Practices share the same building or are very close one to each other, therefore the buffers will overlap and I will have the problem of distributing the population equally among all the different buffers.

Every GP Practice has its own number of registered patients, therefore I believe calibrating the extent of the buffer according to the actual patient list size would be the right approach but I don't know how to do it.

Does anyone have any suggestion?


texts: Label points at regular interval using qgis

texts:
I have a point shapefile with a point index. Like the first picture.

I'm trying to label the point index every 30 points to obtain the second screen capture.
I also have an attribute R3 or R4 to differentiate the red and green group of points that could be used.


texts: I am using opengeo suite with openlayers and google maps as my base layer. I have points in a postgis database that I am using to generate wms tiles. I'm pretty sure I have the projections right because the points are spot-on for the most part. I run into problems when I get in to the last two zoom levels when the google maps turn into that 3d view in some areas. The markers then show up as in the wrong places and if I pan the map they pan at a different pace. If I don't let the map zoom in that far, its fine, but we have to be able to zoom in closer. Can I turn off the 3d view on google maps or adjust the projection?


texts: How to add points to LAS copy using liblas?

texts:
I am trying to make a copy of a LAS file while inserting new points using python liblas module.  The code below creates the copy and adds the points, but for some reason the added points are not in the correct location.  Also, it seems that x, y, z values are being stored int instead of float values.  Can anyone explain why I am having this problem? Thanks in advance for your help.

import liblas
from liblas import file as lasfile

las_file = r"path here"
out_las = r"path here"

# Read las file
f = lasfile.File(las_file, mode='r')
h = f.header

# Open file to write to, using original header
fout = lasfile.File(out_las, mode='w', header=h)

counter = 0
for p in f:
    if counter != 0:
        # Code to Interpolate
        # x, y, z for new point
        # from existing points
        vD = (new_x, new_y, new_z)
        # vD is tuple of floats
        new_pt = liblas.point.Point()          # Create Point object
        new_pt.x = vD[0]                       # Set x property
        new_pt.y = vD[1]                       # Set y property
        new_pt.z = vD[2]                       # Set z property
        fout.write(new_pt)                     # Write new_pt to fout
    # Write p to fout, retaining original properties
    fout.write(p)
    counter += 1
fout.close()


texts: How do I show the created_at column at my infowindow?

texts: Fields like created_at, updated_at or cartodb_id are a greyed out thus not allowing us to add it to the info window. Is there a way to extract the data from default fields in cartodb?


texts: How to filter a csvLayer based on attributes?

texts:
Ill start out by just explaining what I'm trying to achieve. I'm running an arcgis application based on the javascript API. I'm Rendering a CSVLayer into my SceneView like such:

 require(["esri/Map", "esri/layers/CSVLayer", "esri/views/SceneView", "esri/widgets/BasemapToggle", "esri/Graphic", "esri/tasks/support/Query", "esri/widgets/Legend", "esri/widgets/Expand"],
        function (Map, CSVLayer, SceneView, BasemapToggle, Graphic, Query, Legend, Expand) {
 var csvLayer = new CSVLayer({
                url: numberLayers[0].Url,
                popupTemplate: template,
                featureReduction: {
                    type: "selection"
                }
            });
            csvLayer.renderer = {
                type: "simple",
                symbol: {
                    type: "simple-marker",
                    style: "circle",
                    color: [255, 255, 255, 1],
                    outline: { color: [0, 0, 0, 0.4] },
                    size: 16,
                },
                label: "PurpleAir Sensors",
                visualVariables: [colorVisual]
            };
var map = new Map({ basemap: "streets-navigation-vector", layers: csvLayer });
            var view = new SceneView({
                container: "divSensorMapContainer",
                camera: {
                    position: [
                        -119.289320,
                        35.216734,
                        2100000,
                    ],
                },
                map: map,
                center: centerPoint,
                constraints: {
                    altitude: {
                        min: 0,
                        max: 9000000,
                    },
                },
            });

What i want to do is filter this data based on the attributes defined in the CSVLayer. Ive tried doing this using the .whenLayerView function to capture the layerview and then run a .filter property to filter the dataset.

view.whenLayerView(csvLayer)
                .then(function (layerView) {
                  sensorLayerView = layerView;
                    var newQuery = csvLayer.createQuery();
                    newQuery.where = "PM25 > '40'";
                    sensorLayerView.filter = newQuery;
                    csvLayer.queryFeatures(newQuery).then(function (result) {
                        if (highlight) {
                            highlight.remove();
                        }
                        highlight = sensorLayerView.highlight(result.features);
                    });
                    view.ui.move(["compass", "zoom", "navigation-toggle"], "bottom-right");
               });

Now in this .whenLayerView function we get the layerview, define a query based on the data set, and then do two things:

Highlight sensors based on the query information.
Run a filter property on the layerView. (The Api reference information is given here:https://developers.arcgis.com/javascript//latest/api-reference/esri-views-layers-CSVLayerView.html#filter)

This is the output:

So does anyone know what I'm doing wrong? I used a reference tutorial to get this far, you can find that here: https://developers.arcgis.com/javascript//latest/sample-code/featurefilter-attributes/index.html


texts: Normalize address query not working in postGIS

texts:
Okay, so I'm new at SQL, so bear with me.  I'm trying to use the tiger extensions on postGIS (2.1.7) to normalize my addresses and then geocode them.  The normalize query runs, but never returns an answer.  Here's my table:

CREATE TABLE public.clients
(
 usb_number numeric,
 affiliation text,
 type_company text,
 status text,
 region text,
 company_name text,
 o_address text,
 street_num numeric,
 street_name text,
 street_abr text,
 city text,
 state_s text,
 zip character varying,
 rating numeric,
 lon double precision,
 lat double precision,
 addid integer NOT NULL DEFAULT nextval('clients_addid_seq'::regclass),
 new_address text
);

Here's my query:

UPDATE clients SET
   new_address = subquery.address,
   street_num = subquery.address,
   street_name = subquery.streetname,
   street_abr = subquery.streettypeabbrev,
   city = subquery.location,
   state_s = subquery.stateAbbrev,
   zip = subquery.zip
FROM (SELECT o_address As orig, (g.na).address, (g.na).streetname, (g.na).streettypeabbrev, (g.na).location, (g.na).stateAbbrev, (g.na).zip
   FROM (SELECT address, normalize_address(address) As na
       FROM clients) As g) AS subquery;

What am I doing wrong here?


texts: Problem in Using fonticon at openlayers 3

texts:
I'm developing an application using openlayers 3.11.2. I have a point layer. I want to style this layer using font-icon base of this question. When I use FontAwesome fonticon, It work correctyl, But when I use My fonticon, It dose not work correctyl.

Note:
I created my fontIcon at icomoon.io.

Where is the problem?

Edit:
I define the style as follow:

var style = new ol.style.Style({
  text: new ol.style.Text({
    text: '\e900',
    font: 'normal 18px MyFontIcon',
    textBaseline: 'Bottom',
    fill: new ol.style.Fill({
      color: 'white',
    })
  })
});


texts: ICESat/GLAS coordinate system conversion

texts:
I have to import ICESat GLAS14 product data into ArcGIS. I managed to export into an ASCII file the binary GLAS data using NGAT tool, but the coordinates system are in an uncommon format (TOPEX/Poseidon).
Apparently they provide an IDL script to convert the coordinates, but I can't get it work.
The tools are listed here: http://nsidc.org/data/icesat/tools.html

Does anyone have experience working with ICESat/GLAS product and can help me getting this points in WGS84 coordinates?


texts: Calculating total area overlapping specific raster DEM color interval whose boundaries are confined by another vector?

texts:
I know this sounds quite difficult, but maybe it isn't for you or at least it shouldn't if I explain it correctly.

(I'm using QGIS 2.14) I'd like to know to calculate total area overlapping a specific raster DEM color (user-specified altitude interval) whose boundaries are confined by another vector.

So basically there's a raster DEM as background map, I assigned a specific color to an altitude interval.
I applied a vector I created to show where boundaries of a certain area area.
Now within this area, I applied another raster which partly overlaps the altitude interval I applied in the background DEM.

I'd like to know what is the area, within the vector boundaries, that overlaps my altitude interval in the DEM map.

EDIT: I tried running raster calculator on intersections then zonal statistics checking "count" and "sum" but I get a huge table of 8000+ rows and two columns, however each cell usually have a value around 0.4 or 1.x, so I don't know how to interpret this or if I should somehow sum all those cells together to get the number of pixels falling in my area of interest (overlapping altitude range, shaded and within vector bounday).


texts: How to simplify and generalise global data for cartography?

texts:
I have a TIFF that shows biodiversity and I want to create a nicely looking cartography output. The data look like this

If you can observe there are a lot of 'dots' and things can get a bit messy especially close to the boundaries of different zones. What do you recommend to get a much simpler version?
I converted it to a vector and tried several simplification algorithm runs, but although it gets better, I had to run it for 10 times to get something better but still it is not very good.

How can I derive something like this for example?


texts:
I have problem with display geojson "info".When I "click" on geojson layer I see also previous "info". In result I see multiple information.
I would like to see only one info . (3 times i cicked in one place)Below is my script:

      map.on('click', function(e) {
  var feature = map.forEachFeatureAtPixel(e.pixel, function(feature) {
    return feature;
  });

  var infoElement = document.getElementById('info');
 // infoElement.innerHTML = feature ? feature.get('gml_id') : '';
   $(info).append('Title : '+feature.get('gml_id')+'
 Title : '+feature.get('gml_id'))


texts: Adding a Property (attribute) to a geometry in Shapely/Fiona

texts:
Once you have line and polygon geometries, intersection using Shapely is very straight forward. What I did after that is to integrate all the looped 'intersected' geometries into a MultiLineString.

Now my query is, while mapping the MultiLineString using Fiona, the output is a single geometry, with a single attribute.
If I could add individual attributes to each intersection geometry result, my MultiLineString would consist of multiple geometries.

How do I add a property or attribute to a LineString once the geometry is ready???

This problem is with reference to previous issues.

Step One - Vertical Lines in a Polygon Shapefile

Step Two - Clipping Line shapefiles to within the Extent of Polygon

The reason why I am doing this is because once I have the geometries of all the clipped lines, I need to extract the Node coordinates of each of them.


texts:
I can't get any value from featurelayer. This is the code:

function testarvin1() {
    require([
        "esri/Map",
        "esri/layers/FeatureLayer"],
             function (FeatureLayer) {

                var layerName = $('#ClassifyLayer').val().replace(LAYER_PREFIX, '');

                var fl = new esri.layers.FeatureLayer("http://192.168.0.205:6080/arcgis/rest/services/SAMA/MapServer/3", {
                    id: 3,
                    mode: FeatureLayer.MODE_SNAPSHOT,
                    outFields: ["*"],

                });

                console.log("fl is " + fl);
                var g = fl.minScale;
                var h = fl.name;

                console.log("the minscale is =  " + g);
                console.log("the name  is =  " + h);

                fl.applyEdits();
                map.addLayer(fl);

        });}

I get "the fl is [object object]", "the minscale is = 0" and "the name is undefined" in console.

What am i doing wrong? I changed the featurelayer mode but didn't help.


texts: Running Python toolbox tool both standalone from other tools within same Python toolbox?

texts:
I have created a Python toolbox for work that has two tools inside.  These tools use the toolbox template and so have a init, getParameterInfo, etc.

I want to be able to run one tool both standalone and call it inside other tools within that toolbox.  I can't seem to get the parameters correct though.

class foo(object)
    def __init__(self)
        #stuff
    def getParameterInfo(self):
        # list parameters for UI tool
    def execute(self, parameters, messages)
        print parameter[0]
        return

class bar(object)
    def __init__(self)
        #stuff
    def getParameterInfo(self):
        # list parameters for UI tool
    def execute(self, parameters, messages)
        foo("hello, world)
        return

I have tried adding a parameter to the init(self, parameter) or the foo class but I can't get it to work.

I am new to Object-Oriented Programming (OOP) and ArcGIS in general.


texts: Population centroid of irregular-shaped German counties based on a population density grid

texts:
I'm new to QGIS and stuck with this task. Here's the data I'm working with:

1-square-kilometer grid Shapefile of Germany (https://www.zensus2011.de/SharedDocs/Downloads/DE/Shapefile/Inspire.zip?__blob=publicationFile&v=5)
Population Data for each kilometer-grid as CSV. Can be joined with the grid Shapefile with column "ID_1km". Column "Einwohner" represents population divided in 7 classes (-1 unknown, 0 to 6 with 6 being the highest population density) (https://www.zensus2011.de/SharedDocs/Downloads/DE/Pressemitteilung/DemografischeGrunddaten/csv_Zensusatlas_klassierte_Werte_1km_Gitter.zip?__blob=publicationFile&v=8)
Germany's counties "Kreise" as Shapefile (VG250_Kreise.shp)(https://www.zensus2011.de/SharedDocs/Downloads/DE/Shapefile/VG250_1Jan2011_WGS84.zip?__blob=publicationFile&v=29)

The goal is to calculate the weighted population centroid for each county (image 1) based on the population density grid (image 2). In the end I want to export a list of the latitude/longitude coordinates of the centroids of all counties.

So far I was able to join the CSV data with the 1km-grid Shapefile. Then I've tried intersecting the two layers and playing around with the vector centroid function but nothing has worked. I have no clue how I can tackle this task and I couldn't find any solution online.


texts: Intersection between line & polygon in PostGIS?

texts:
I have a linestrings consist of 2 vertices. I want to get all lines that don't intersects with any polygons on the way. In my example: blue line Not intersects - only touches some polygons, but black line although touches with some polygon, it also intersects another. So in conclusion the result is only blue line.

What I did:

 SELECT lines.geom
 FROM lines, polygons
 WHERE ST_Intersects(lines.geom, polygons.geom) = false
       AND
       ST_Touches(lines.geom, polygons.geom) = true;

The ST_Touches seems to work - I guess because the representation of the line-string consist of the vertex that really touches the polygon.

The ST_Intersects not working - The result is that there is no even 1 line that intersect any polygon.

So what I started to thinking: Maybe because in the space where the line intersect polygon - ain't any 'real' representation of the line-string: Because what is line-string? 2 vertices both outside the polygon...

Whats going on? I thought that GEO-DB should deal exactly with this kind of challenges and 'knows' what spatially intersection is...

Altough I don't know how to do this (because ST_Segmentize not worked for me from some reason) I prefer not to overcome this issue with just 'breaking' the line-string to more elements such that with high probability some vertex would be inside the polygon.


texts: How to query PostGIS for the XYZ tiles covered by features?

texts:
I have a feature table in PostgreSQL and I need to calculate the XYZ tiles that the queried features encompass.
So my query would look something like this:
SELECT getTiles(geom, min_zoom, max_zoom)
FROM feature

And I want it to return a XYZ array for each tile:
[167,367,10],[159,368,10],[160,368,10],[161,368,10],[162,368,10]...

How can I calculate the tile XYZ values like this pseudocode getTiles? I've looked through the PostGIS documentation and Mapbox's Postgis utils but haven't found examples of this. I feel like such a function probably already exists in some applications.


texts: Choosing and zooming to features using SQL query in ArcPy with ArcGIS Pro?

texts:
When using ArcPy with the ArcGIS 10.x architecture there is a simple coding pattern that I find I use frequently:

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd,"ne_10m_admin_0_countries",df)[0]
lyr.definitionQuery = '"ADMIN" = ' + "'Chile'"
df.extent = lyr.getSelectedExtent()
arcpy.RefreshActiveView()

To see it in action:

Start ArcMap with a Blank map
Add a layer using a shapefile like ne_10m_admin_0_countries.shp from Natural Earth
Copy/paste the code above into the Python window and you should see the country of Chile zoomed to

However, when I try to do something similar using ArcPy with ArcGIS Pro what I find is:

Start ArcGIS Pro
Choose Map.aptx to open a map
Add a layer using a shapefile like ne_10m_admin_0_countries.shp from Natural Earth
Copy/paste code like below into the Python pane

The definition query works great but then the Map class does not have a method available to perform a zoom to the extent of the features thus defined.

import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")
mapx = aprx.listMaps("Map")[0]
lyr = mapx.listLayers("ne_10m_admin_0_countries")[0]
lyr.definitionQuery = '"ADMIN" = ' + "'Chile'"

Is there a simple way to choose and zoom to features using an SQL query in ArcPy with ArcGIS Pro?

As a workaround I've been investigating how to perhaps incorporate Layout and MapFrame classes into my coding pattern and, although the latter has a zoomToAllLayers method that looks more hopeful, I have not yet been able to find a way to do this.


texts:
I'm new to PyQGIS and I'm stuck here.
So I've created a ComboBox so the user could select which layer he wants to work with. Everything's fine so far. I've also added all layers but now I'm having issues to filter the output in the 2nd ComboBox.

for layer in QgsProject.instance().mapLayers().values():
    self.dlg.ComboAll.addItem(layer.name())

self.dlg.ComboAll.currentIndexChanged.connect(IndexChange)

So this is how I prompt all layers in my ComboBox and get the information that the user has choosen another option.

def IndexChange():
    selectedLayer = self.dlg.ComboAll.currentIndex()
    #Prompt every fields of selectedLayer in ComboLayer

And this is how I get the number of the selected layer.
But I don't know what to do after that.
For example, if the user choose the layer number 3 I only want fields from this layer appearing in my second ComboBox.


texts:
I am trying to create a map from raster data. The file came from a crop model, with resolution of 0.5 degree. Even when I disaggregate it (i.e. increase spatial resolution), the map looks really pixelated. I am trying to make it look better.

My current code produces this image:

where I would like to "smooth" the data, by supressing the pixelated look. Some other visualization programs do this automatically, so I guess it should not be hard to reproduce using R.

For example, this is the same file plotted using Panoply:

It doesn't look absolutely smooth, but at least it doesn't have the pixelated look neither. How to achieve a similar result in R?

This is the code to reproduce my problem:

library(RCurl)
library(rasterVis)

# Go to temp dir and download file - approx. 1.7M
old <- setwd(tempdir())

# download raster and shapefile
download.file('https://dl.dropboxusercontent.com/u/27700634/yield.nc', 'yield.nc', method='curl')
download.file('https://dl.dropboxusercontent.com/u/27700634/southern.zip', 'southern.zip', method='curl')
unzip('southern.zip', exdir='.')

# load southern Brazil shapefile
mapaSHP <- shapefile('southern.shp')

# load brick
b <- brick('yield.nc', level=16)

# create color scheme
mycols <- rasterTheme(region=colorRampPalette(brewer.pal(9,'Greens'))(100))

# use second brick layer to plot map
levelplot(b[[2]], margin = FALSE, main = "Rice yield in tons/ha", par.settings = mycols) +
  layer(sp.lines(mapaSHP, lwd=0.8, col='darkgray'))

# return to your old dir
setwd(old)


texts:
I am very new to QGIS and I am wondering is there a way to add this map to  QGIS.

The map can be found on:
https://glasgowgis.maps.arcgis.com/apps/webappviewer/index.html?id=8eb9f600ed154ae58b09c2c5902ce7f0.


texts: Option to auto refresh map every [n] seconds in CartoDB?

texts:
Is it possible to make a CartoDB map auto-refresh using the latest data every [n] seconds using the web interface? I am using the SQL API to update with new positions and would like to see them reflected on the map automatically.

Disclaimer: I am aware of the CartoDB.js library, specifically the refreshTime option for createLayer(). I have successfully created an HTML file following the tutorial to implement the auto-refresh layer. Just wondering if there is an easier way to do this via CartoDB website directly.


texts: Find missing polygons from two layers with select by location tool

texts:
As the attached screen shot I have one polygon layer (black) which has some missing polygons and another layer (red) which contains these polygons. Both were created from the same shapefile originally and they are multipoint polygons both CRS are set to WGS84

What I'm trying to do

Select polygons from complete layer (red) where gaps in target layer (black).

What I've tried

First selecting everything in the complete layer (red) then;

Using Vector / Research tools / Select by location.
Select all the complete layer then remove from selection based on the overlap selection. This results in some but not all.

I then tried

Select all the complete layer then remove from selection based on the intersection selection. This results everything getting selected.

I was trying to find documentation on the precision function within the select by location to see if this might help. In my head overlap is the right function as i want to remove all the polygons that overlap one another which should leave just the mismatches which are my gaps.

EDIT; There's some useful reference on the Geometry predicate here ; Documentation "Join Attributes by Location" QGIS 2.18.

Have now additionally tried using the contains predicate but this also selects all as does within


texts:
I want to have arrow heads at the end of a number of lines. I add these through Line properties --> Line decorations.

It looks nice and all when displayed in the legend:

But in my map, due to different angles it looks more like this:

or this:

The arrowhead is not centered on the line, it is not even at the end of the line! It looks even worse if I have thicker lines (which I want).

I have tried to fix this with adding a displacement, but I can't do that in a direction relative to the line, only relative to the map (x/y directions).

What can I do to fix this? Or is there an alternative way of adding arrows to my map, preferably with my lines as starting ground?

I have noted this question, which to some degree deals with the same issue. Although it is asked for Arcgis 9.3 and the accepted solution is not solving my problem (I want exactly one arrow head for each line feature).


texts:
I'm using QGIS Desktop 3.8, and unable to import a shapefile.  I get the following error:

"The layer already exists.  Are you sure you want to overwrite the existing file?"

I'm super frustrated, as I have tried installing different versions to fix the issue and I get the same message.  I just used QGIS yesterday on my work laptop and it was fine, but this issue occurred on my personal laptop as I worked from home today.

When I answer "Yes" to overwrite file, the shp shows as listed in the layers panel but is not visible in the map view.  When I try to "Zoom to Layer" there is still nothing.

Suggestions?


texts:
I am pretty new in GIS things and i have been learning how to use QGIS. Most of the maps are fine, but yesterday I went to GIS center at my University and I got the maps of my country that I will be using for my study. But when I add them in QGIS they are not on the right spot. I checked the coordinate system and it is WGS 84. when I add the species, they are on the right place and map is little bit diagonally towards the right upper corner. I checked the species with the other map that I downloaded from internet and they are on the right place. Also the species and the other map that I downloaded from internet are WGS 84.

Any suggestions how can I correct this?


texts: Creating new buttons and removing default ones - Openlayers-3

texts:
I am trying to create new buttons but I seem to use the wrong function.
To delete the default buttons I added the following code:

var map = new ol.Map({
  target: 'map',
  controls: [],
  layers: [
  new ol.layer.Tile({ ... etc

This works great.
Now I am trying to connect a button I created with HTML (id=btnZoomOut) to the Zoom function:

var buttonZoomOut = new ol.control.Control({element: $('#btnZoomOut')});
map.addControl(new ol.control.Zoom({target: buttonZoomOut}));

But this does not seems to works and trows an error:

Uncaught TypeError: (intermediate value)(intermediate value)(intermediate value).appendChild is not a function

How to correctly do this?


texts: Neo4j distance vs PostGIS distance with spatial data

texts:
Does anyone know how the distance function of neo4j/cypher works exactly?

When i compare the evaluated distances between neo4j and postgis, i always get a difference of about 0.1-0.5%.

As postgis st_distance uses an srid i assume that the problem is the distance function from neo4j.


texts:
I have been using the rule-based option to style some of the layers (from a postGIS database) in my qgis project. Then I put the project on the server and when I checked the WMS connection in QGIS, I only got the layers that were styled not using the rule-based option (i.e. categorized, single symbol).
Does anyone have a idea why? Is the rule-based styling not supported on the server? Any hints where I could look for the problem?

I am using QGIS 1.8. Should I switch to 2.0 ? (I would prefer not to for several reasons specific to the project).

What I already tried: I checked the connection connection to the database – OK; I used a categorized styling for the layers that were not appearing – it worked, so not a problem with the layer itself;


texts: Categorizing Layers in ArcGIS Pro Like QGIS

texts:
Is there a way in ArcGIS Pro to easily and quickly categorize, display, and hide layers as there is in QGIS (example in image)? This feature in QGIS makes it easy to work with layers that have the same geometry, and I haven't been able to find a way to quickly do this in Arc Pro.

Is there is a way, like in QGIS, to quickly display/hide layers with the check box? For example, I want to look at "11" and "13" so I would mark the box beside them. If I wanted to, I can quickly hide them by unchecking and then checking a new layer like "A1".


texts: ST_GEOMETRY points: get attribute of intersecting polygon

texts:
I have an SDE.ST_GEOEMTRY point feature class.
I want to create an SQL query from the points. The query would perform a spatial join/intersection with an SDE.ST_GEOMETRY polygon feature class. An attribute would be returned from the polygon that the points intersect.

The polygons don't overlap, so a point would never intersect multiple polygons.
The query would be output to a static table on a schedule. So performance is not a major concern.

Is there a way to do this with SDE.ST_GEOMETRY functions? I've looked at the function list, but I don't see any spatial operations that return an attribute.


texts: the difference between pattern recognition and image classification in remote sensing?

texts: Does anyone know the difference between pattern recognition and image classification?


texts: Which ESRI Silverlight API version goes with which Silverlight version?

texts:
I am trying to get my references right in a Silverlight app. I cannot find the ESRI Silverlight API goes with Silverlight 3. I can only find the latest version of the ESRI Silverlight API (Version 2.4).

So the Question boils down to which ESRI Silverlight API version goes with which Silverlight version? And where can I download the ESRI Silverlight API?

Just as a sidenote. The ArcGIS Silverlight toolkit seems to following the API version (please correct me if I'm wrong) and all the versions are downloadable from codeplex.


texts: Place map legends and titles in GeoServer?

texts:
I am new to GeoServer and tried to learn from basics and be familiar with GIS concepts. I published a shapefile in GeoServer, now I want to add a title and legend to the published file.

Please advise me the solution.


texts: Displaying multiple records in CartoDB with common zip code

texts: I am uploading multiple records and want to use five digit zip code as the georeference.  I would like to display each of those records on a map. Some of the records have identical zip code fields, meaning that several records share a single zip code.  In the map view, only one of those records, among the handful that share a single zip code, appears. Is it possible to show on the map all of the records that share that single zip code?


texts: Automatic refreshing of Styles and legends in QGIS?

texts:
I am a new QGIS user. I come from an Arcgis background, but in my current work for a public administration I must use QGIS for interoperability.

As an ArcMap user, I am used to certain "comforts", such as the automatic legend refresh, but also to the ability to personalize which elements to show and which not.

Here in QGIS I wasn't able to find a way to have the legend updated without adding again all the layers that where previously purged.

I need it because I'm trying to have a specific value to be showed in my Map/print layout, and I need that number (which is an area) to change every time I want to represent a new zone. What I need is a sort of automated layout in which quantities change accordingly to the area I select. Since I knew i could do this with ArcMap, I was sure to do the same in QGIS.

Is there a way to obtain this?


texts: Looping through an array to show multiple points on the map

texts:
I am trying to add multiple points on the map. Data comes from the server as a multi array.

JSFiddle.

Notice that all points share the same name (when clicking on the point)

This is the response from PHP:

[
{
name: "Parking0001",
lat: "35.1495",
lon: "33.39243"
},
{
name: "RecycleBin0001",
lat: "35.1495",
lon: "33.39243"
},
{
name: "WaterA27",
lat: "35.1495",
lon: "33.39243"
},
{
name: "WaterA12",
lat: "35.1495",
lon: "33.39243"
}
]

Something I am doing wrong and i get undefined on iconFeature in the loop

function OpeNlayers(data) {

    var iconFeature = new ol.Feature({
        geometry: new ol.geom.Point([199, 154]),
        name: 'A point',
        population: 4000,
        rainfall: 500
    });

    var iconStyle = new ol.style.Style({
        image: new ol.style.Icon({
            anchor: [0.5, 0.5],
            anchorXUnits: 'fraction',
            anchorYUnits: 'pixels',
            src: 'icon.png'
        })
    });

    var vectorSource = new ol.source.Vector({
        features: []
    });

    var vectorLayer = new ol.layer.Vector({
        source: vectorSource
    });

    var rasterLayer = new ol.layer.Tile({
        source: new ol.source.TileJSON({
            url: 'https://a.tiles.mapbox.com/v3/aj.1x1-degrees.json',
            crossOrigin: ''
        })
    });

    $.each(data, (index, data) => {
        let iconFeature = new ol.Feature({
            geometry: new ol.geom.Point([data.lon, data.lat]).transform('EPSG:4326', 'EPSG:3857'),
            name: data.name
        })
        iconFeature.setStyle(iconStyle)
        vectorSource.addFeature(iconFeature)
    })

    var map = new ol.Map({
        target: 'map',
        layers: [rasterLayer, vectorLayer],
        view: new ol.View({
            center: ol.proj.fromLonLat([35.1495, 33.39243]),
            zoom: 7
        })
    });
}

$.post("MapMarkers.php", null, null, "json")
    .done(data => {
        OpeNlayers(data)
    }).fail(function () {
        alert("error loading data")
    });


texts: Can't access PostGIS data after Ubuntu update

texts:
Our PostGIS database is installed on Ubuntu. Recently I made an upgrade to Ubuntu 20.04. Now we can't access any PostGIS data. Example:
postgres=# select * from default_line limit 10;
ERROR:  could not access file "$libdir/postgis-2.5": Datei oder Verzeichnis nicht gefunden

Ubuntu updated our PostgreSQL from 11.? to 11.7, but obviously deleted some important extension files. It installed a second PostgreSQL 12 with PostGIS 3.0. After some fiddling I can access both instances and I am willing and prepared to move the data to the new instance. But all tools like pg_dumpall, pg_upgrade also barf on missing extensions - apart from postgis-2.5 these are rtpostgis-2.5, plpython3, libpgrouting-2.6 and ogr_fdw.
So I think I need the appropriate .so files. I can't find the needed packages and don't know how to build them myself (from which source files?). What can I do?
EDIT: I have seen the similar questions mentioned in the comments. As far as I see none of the answers let me access the existing data.
EDIT three days later: I didn't find any way to access our data in Ubuntu 20.04. What I did is install Ubuntu 19.10 on another (virtual) PC with PostgreSQL 11/PostGIS 2.5 and let it access a copy of the database, this made the data readable again. I dumped the database and imported it in PostgreSQL 12 in Ubuntu 20.04. I had a "downtime" wednesday morning to friday morning where projects stalled, and I lost a night of sleep.


texts:
I am in my first steps in PyQt and I face difficulties in how to run the following code within QGIS console. I want to create a simple window, but nothing happens. I change main by console and then QGIS crashes. Any help is welcome.

import sys
from PyQt5.QtWidgets import QApplication, QWidget

def main():
  app = QApplication(sys.argv)
  w = QWidget()
  w.resize(250, 150)
  w.move(300, 300)
  w.setWindowTitle('Simple')
  w.show()
  sys.exit(app.exec_())

if __name__ == '__main__':
  main()


texts:
It seems to me that the legend and scalebar in QGIS Atlas cannot change per feature. Is there a way to have a separate, manually tweaked scalebar and legend for each page in my Atlas? How do I do this without using some complicated qgis expression?

EDIT

Here is a simple atlas to illustrate what I mean by  "manually tweaking" each page in my atlas: