texts: Plugins incorrectly being disabled due to "causing QGIS crash"

texts:
I have QGIS 2.14.0 installed on my machine (W7 x64, AMD FX-8150 3.6GHz, 8GB RAM, SSD) and I'm having issues with plugins not opening by default when I open QGIS. The message I get (for each plugin that is "broken") is:

  Plugin MetaSearch: The plugin will be disabled because it crashed QGIS during last startup. Please report an issue and re-enable the plugin when the problem has been solved.

I also have QGIS 2.8.6 installed and do not get these issues when using this build.

Within QGIS 2.14.0, I am able to open the "Manage and Install Plugins" window and enable the disabled plugins once QGIS is open with no issues. They work as expected. This issue seemed to start around the same time as some Windows updates a couple of weeks ago, however other PCs on the network with QGIS 2.14.0 installed and the same plugins received the same updates and are working correctly. I have also disabled some of the Windows updates and re-installing QGIS 2.14.0 since then with no luck.

EDIT: I've noticed the problem doesn't occur on the same PC for different logged on users. I've tried temporarily renaming the folder "C:\Users\.qgis2\" but one of the plugins (MetaSearch) still complains. Tried reinstalling the plugin - still got the issue.

EDIT: Two weeks later and after installing a new update for the Contour plugin, I no longer receive the error for Contour or my own plugin (no update). I'm still getting the issue with "Metasearch".

EDIT: 26-04-2016 - The issue appears to have solved itself. I believe the IT team in our company have been installing various updates and changing various settings in our accounts. Not quite sure what's changed but it's no longer an issue. Will update with answer if I find out exactly what caused this.


texts: How to show labels depending on the zoom scale and save it forever in one project?

texts:
I have got a problem in showing labels for a polygon layer :

When I select "Show labels" in the layer's properties, then I select that I want to use the scaling to show or not my labels and I configure it.

Then everything works fine, I save and close my project.
When I reopen it, the labels are still visible, but the scale configuration doesn't work. They are showed at every scale.

Is there a way to keep this configuration even after closing the project ?


texts: Polygonizing raster cells in rasterio regardless of value?

texts:
I would like to polygonize every single cell of a raster dataset using rasterio. I have been experimenting with the following function based on this question:

def polygonize_raster(dataset):

    # Read the dataset's valid data mask as a ndarray. Dataset is a rasterio read object open for reading
    mask = dataset.dataset_mask()

    array = dataset.read(1)
    generator = rasterio.features.shapes(source=array, mask=mask, transform=dataset.transform)
    # Extract feature shapes and values from the array
    geom_list = []
    for geom, value in generator:
        # Print GeoJSON shapes to stdout
        geom = shapely.geometry.shape(geom)
        geom_list.append(geom)

    return geom_list

The part which vectorizes everything is:

generator = rasterio.features.shapes(source=array, mask=mask, transform=dataset.transform)

It seems from the docs that rasterio.features.shapes has built-into it the fact that regions with identical values get their own polygon. I don't want this. I want every single cell to get its own polygon even if an adjacent cell has the same value.

One solution I thought of is to give each cell a unique value, but this would require writing another function which could be computationally expensive. I would much rather if a more built-in method within rasterio or shapely could do this?


texts: How to extract land cover type data (%) from raster file using Zonal Stats from overlaid polygon grid, QGIS

texts:
I have a very large raster file of land use types for a landscape. I am trying to run an occupancy model of large carnivores and need to test the weight as a covariate, of human settlements. Human settlements are marked red in the raster file band palette and the label reads 'human settlements'.

I've created a shapefile of a polygon grid of 6x6km cells. I need to know the % of each cell covered by human settlements.

I've ran Zonal Stats with the said polygon grid shp file (as 'vector layer containing zones') and the raster file but my resulting attribute table for the polygon shp file gives me no indication of %s (or any stats) of specific land types, just overall stats for the raster layer it seems.

How can I get data from my cells for specific land use types?


texts:
I'm trying to build a network from several GPS-trakcs, to digitize hiking routes on my land.

I have several GPX-files from routes I've tracked with the gps. I managed to display them in Arcmap 10.2 and also create lines between the points.

But my knowledge/skills kind of fall a bit short from here on.

so can somebody give me an easy step-by-step how to create a network from gps-tracks?

one of my problems so far is this:

several of the routes have some line segments overlapping, how do i make the overlapping segments in to one(preferably the averaged/middle one) and create a junction where they split? see picture "Q1"

My second challenge is this:

I want to add an attribute with information about average speed between my gps point, this is a simple operation but since there is a lot of gps points i need to be able to do it fairly automatic.

So far what I've tried is "points to line" to get a line, then i used "split line at vertices" to get separate line segments between each gps point.
Then I tried to join tables, between the line segments and gps-points, so that the line segments would have time information on its start and end, then it would be easy to calculate the speed for every row. So i tried using "spatial join", the problem here is that it creates separate rows for the join of "line segement and its start point" and the "line segement and its end point"

see table:

marked in yellow is one line segment and its join to two gps points(see Shape Length is the same and DateTime is different)

My goal is as mentioned to find the average speed the used on this line segment.

If my approach to the problem is totally off I'm open to try other methods!


texts: Simplest way to make web maps with lots of shapes

texts:
I have some computed data about US Census blocks.  I'd like to make a web map to display that data.  I've searched around and found various tools, but I can't tell what is the simplest "lazy man's way" to just take a bunch of data and make a map, while letting the tool (whatever it is) make whatever decisions need to be made about performance.  The map would be a choropleth map, and I'd like the ability to have some simple interactions (e.g., clicking or hovering over a region to display a popup with info).

Right now I'm working with California census blocks, of which there are over 700,000.  I gather from what I've read online that simply loading the raw shape data (in GeoJSON or the like) with Leaflet or the like is going to perform very poorly.  I've also seen various discussions about alternatives, but I haven't found a clear description that says something like "put your data in this tool and use this code to get your map".

I have shape data, and numerical data associated with each shape.  What is the simplest way to create a web map with that data, such that as much detail as possible is displayed at as large a scale as possible?  By "simplest" I mean "the one that requires me to do the least work myself, apart from providing the shapes and the data".  By "as much data as possible at as large a scale as possible" I mean that if some detail has to be lost when zoomed out, that's okay, but I'd prefer not to have to do the work of deciding exactly how that's done, because I'll probably do it wrong.  I just want a tool that will lose as much detail it needs to lose, but no more, at each zoom level.

Is there a "fire and forget" solution that would allow me to just dump my data into some tool, and have the tool automatically create/generate/serve whatever is needed to make the map work?  I'm fine with creating the actual web page and so forth to display the map, I'm just looking for a way to get the data into a form that will "just work" with something like Leaflet.


texts: Seeking tool to work out overlap between two polygon layers and their statistics using QGIS

texts:
I have two polygons in QGIS. One is a land-use map, which polygons that include different types (forest, agriculture, urban etc). I also have a vector polygon that represents a flood extent. I want to work out the amount of flooded land-use types, so that I get:

Forest - 5,000m2
Agriculture - 15,000m2
Urban - 10,000m2

(for example)

What is the correct tool to do this analysis?


texts: Dissolving by common name and boundaries using ArcMap

texts:
I am looking for a way to merge or dissolve polygons from the same shapefile that both share a common attribute (in this case, owner name) and area adjacent to each other/share a common border. Just using the normal dissolve tool by owner name combines polygons which are not connected, which I would like to leave separate.

Is there a way to manipulate the dissolve tool inputs or a different tool that can achieve this?

I am using ArcMap 10.7.

I currently work around this by using the edit tool, highlighting all the commonly owned parcels, and merging if they are contiguous, but this gets very time consuming with larger datasets.


texts: i want to know, can arcgis software do the database such as oracle or ms access?? for example, create own database and form?? and can the database in arcgis read the programmer program such as from matlab or visual basic. i want to create component maintenance in this software and the component link each other. but i want to use arcgis because i want to show database with the image when we click on the object. so, it is compatible to choose arcgis software to complete my project.


texts: Performing weighted overlay analysis in MapInfo?

texts: I want to prepare a landslide zone map using weighted overlay analysis. Is there a tool in MapInfo to do weighted overlay as in ArcGIS?


texts: I have few problems understanding how units are managed in QGIS. According to the area column I created for a shapefile, the area of a shape is 0.7727... I just checked on Wikipedia and indeed the area of the region is 7,727 km2. So in which unit is the area column expressed? It was my understanding that because my projection was WSG84 all the units are in meters, so why my column doesn't say 7.727×10^9?


texts: How to fix the possible memory leak issue in Openlayers 2.13.1 version?

texts:
Recently we have upgraded the Openlayers from version 2.12 to 2.13.1. However the performance of the new version is not that promising, infact it has degraded exponentially. I have a draggable model window and once the base map has been loaded if I do the drag and drop operation over the top of the map window, the user experience is not so smooth as for 2.12 version. After some memory leak detection approach three snapshot technique, I found that there is some memory leakage issue in OpenLayers.Control.Navigation.OpenLayers.Class.initialize.
Is there any tuning need to be performed while upgrading to the new OL?
Did someone face the similar performance issue as well?
Thanks for your answers.


texts: How to Properly Format geocodeAddresses POST with ArcGIS REST

texts:
I am able to successfully process a batch geocoding request (described here geocodeAddresses—ArcGIS REST API: World Geocoding Service | ArcGIS for Developers ) using a GET request. However, I know I will want to use the POST method as the documentation describes since my batches may be large.

When I try to submit the data via POST, I get a very unhelpful error message.

{'error': {'code': 400,
  'details': [],
  'message': 'Unable to complete operation.'}}

The request I am trying to make looks like this (I have tried various iterations):

URL:
http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?sourceCountry=USA&token=&f=pjson

POST Data (raw)

{
    "addresses": {
        "records": [
            {
                "attributes": {
                    "OBJECTID": 1,
                    "Address": "380 New York St.",
                    "City": "Redlands",
                    "Region": "CA",
                    "Postal": "92373"
                }
            },
            {
                "attributes": {
                    "OBJECTID": 2,
                    "Address": "1 World Way",
                    "City": "Los Angeles",
                    "Region": "CA",
                    "Postal": "90045"
                }
            }
        ]
    }
}

Where of course TOKEN is replaced with a valid token I have successfully tested via a GET request.

Variations I have tried included having "records" as the top level key and including the GET parameters such as the token as keys in the POST payload.


texts:
Using the census road network for Los Angeles, I am trying to clean the network to have nodes at all intersections.  The GRASS v.clean algorithm seems to do this, but is missing some intersections - actually, many intersections.  I cannot fathom why this is - the short line segments appear to be very close (if not on) to the main street segments, but they are not splitting the lines as I expect.

I read the documentation and Threshold is not used by break, so that's not an issue.  I have zoomed into the intersections as closely as i can and they appear to abut.   Any thoughts on how best to address this?

To demonstrate this, the red lines are the original road segments and the short stubs are connectors from block centroids (for a routing analysis i am doing).  You'll see one broke the segment and the other did not.  Also, it broke where clearly the lines cross, just not always when they abut.

One thought is to add a vertex to the street segment at the nearest point to the end of each short stubs - i wrote the short stubs, so i know they are all directionally towards the street.  With that, then i could use v.clean snap.  Would have to find a recipe for doing that.


texts: Convert values from a string column into a numerical column

texts:
I have a table, coming from Excel, with 21K rows, which is partially filled with numbers, and partially with the "" value from excel, which is displayed as <Null> in the table view.

I need to use the number values to display as graduated colors, which ArgMap won't allow me, as they are stored in a string column.

I tried converting those values into Double()'s using the field calculator as is mentioned in this article from ESRI: https://support.esri.com/en/technical-article/000002287

The code I used from the article is:

Dim String, Check
String = [String field name]
Check = IsNumeric(String)
If Check = True then
Output = CDbl(String)
else
Output = null
End if

And wrote Output in the second field.

Where I clicked on the appropriate field name to insert the name behind String.

This however produces a column full of <NULL> values, without any error message.


texts:
I have shapefiles pertaining to NYC traffic density as well as NYC trucking routes, and what I'd like to do is join the attribute data from the trucking route file into the traffic file.

Seen here, blue is the traffic data and red is the trucking route data. In the trucking route attribute table is a column (titled TruckRoute) indicating that yes, this stretch of road is indeed a trucking route. Because only the trucking roads are included, there is only one value for that variable.

What I want to do: I want to get that TruckRoute column into the attribute table for my traffic data shapefile, so that when I eventually cross-reference this with another data source I can have traffic data and truck route data for any given point. I realize that for the non-overlapping street that column won't port over, but I can address that in R later on.

What I've tried: I tried just doing a standard spatial join (Vector -> DM tools -> Join attributes by location) but if it works at all, I only end up with null values in the TruckRoute column of the traffic attribute table, regardless of the settings I use. I tried manually creating the TruckRoute column in the traffic attribute table so that they would have that variable in common, but no dice.

I've also tried creating a small buffer around the traffic line layer so that the truck line layer would be well within it. Same result.

I've tried converting the layers to points and polygons, and doing a spatial join with every combination. No luck.

Any suggestions?


texts: How to append a vector layer using QGIS and Python?

texts:
I am working on scripting some data processing using QGIS and Python, but I'm running across issues that I need to debug.  Since my data is really large, and run-times can be lengthy, I would like to be able to write out results periodically and then append to those results so I don't have to re-run my scripts.

I'm outputting a polygon shapefile, and I am using the following Python code currently to work with the shp file:

poly_provider = poly_layer.dataProvider()
fields = { 0 : QgsField("STAT_NO", QVariant.String) }

writer = QgsVectorFileWriter("/localstore/data/shps/contrib_area.shp", "CP1250", fields, poly_provider.geometryType(), poly_layer.crs(), "ESRI Shapefile")

if writer.hasError() != QgsVectorFileWriter.NoError:
  print "Error when creating shapefile: ", writer.hasError()

#processing...

def collect_geoms(geometries):
  if len(geometries) > 0:
    union_geoms = geometries[0]
    for geometry in geometries:
      union_geoms = union_geoms.combine(geometry)

    fet = QgsFeature()
    fet.setGeometry(union_geoms)
    fet.addAttribute(0, QVariant( point_feat_dict[point] ))
    writer.addFeature(fet)

The collect_geoms() function is then called in a loop, and when I'm done, I use del writer and I get the shapefile written to the disk.

Is there a way that I can write the shapefile out incrementally and append new polygons to it?  So for instance I can run 10 iterations of the loop, write the shapefile, and then run the next ten without overwriting the first set?


texts: Using FeatureLayer or ArcGISDynamicMapServiceLayer

texts:
I am in the process of updating a web map that was using the ArcGISDynamicMapServiceLayer object for my layers.  At the time, it was the best choice since we were on 9.3 and there was limited support out of the box for the FeatureLayer object.  Now, we're on a 10.3+ server, which has better support for things like symbology.

I could not find good metrics or suggestions on which of the two layers provide better performance and overall usability for applications.  I will have scale dependencies so I don't need to worry about 1000s of point features showing when zoomed out, and I think each extent won't hit the FeatureLayer feature limit when the layer is visible.

Performance and experience wise, is it better to have the server render the images for the layers and rely on QueryTasks to work with the layer, or is it better to send the coordinates to the client and have the client do the processing?  I haven't noticed much of a difference testing, but I also can't find good recommendations on it either.


texts: Symmetrical difference result in Geotools not drawing correctly

texts: I have two polygons and I perform a symmetrical difference on them but the result doesn't make sense. Can anyone explain what could be going wrong? I suppose its something in the geometry, is there a method to verify the geometry before performing the difference?


texts: Selection problem in WMS layer using OpenLayers

texts:
I added 4 WMS layers (three polygons and one have point geometry) from GeoServer on my webpage

My requirement is:

I have to select a single polygon of one wms layer using a mouse click. After the selection, the polygon color should be changed. If you select another polygon, the previous selected polygon color is to be changed to original color.
If I select a polygon of one wms layer, I want to get the NAME of the selected polygon as an alert.

Any help is greatly appreciated..

Thank you..

layer = new OpenLayers.Layer.WMS(

 "Layer", "http://********:8080/geoserver/POC/wms",

            {
                LAYERS: 'POC:CIRCLE_VIEW',
                STYLES: '',
                wrapDateLine: true,
                format: format,
                transparent:true

            },
            {
               singleTile: true,
               ratio: 1,
               isBaseLayer: false,
               yx : {'EPSG:42106' : false}

            }

        );

`

I added four layers in this way..

var infoControls = {
         click: new OpenLayers.Control.WMSGetFeatureInfo({
             url: 'http://********:8080/geoserver/POC/wms',
             title: 'Details',
             layers: [layer,layer2,layer3,layer4],
             queryVisible: true
         }),
         hover: new OpenLayers.Control.WMSGetFeatureInfo({
        url: 'http://********:8080/geoserver/POC/wms',
             title: 'Details',
           layers: [layer,layer2,layer3,layer4],
             hover: true,
             queryVisible: true
         })
     };
    for (var i in infoControls)
    {

        infoControls[i].events.register("getfeatureinfo", this, showInfo);
        map.addControl(infoControls[i]);
    }
        infoControls.click.activate();
function showInfo(evt) {
            if (evt.features && evt.features.length) {

                 highlightLayer.destroyFeatures();
                 highlightLayer.addFeatures(evt.features);
                 highlightLayer.redraw();
            } else {
                highlightLayer.destroyFeatures();
                 highlightLayer.addFeatures(evt.features);
                 highlightLayer.redraw();
                document.getElementById('responseText').innerHTML = evt.text;
            }
        }

In this I am showing attribute data of selected polygon.


texts:
I am trying to wrap my head around spatialite views in QGIS. However there are severe limitations that make it very cumbersome:

Spatialite views in QGIS do no update, if the corresponding tables in the DB change
Edit: they do in fact update after restart, views behave differently (see comments)
It is not possible to create virtual fields for spatialite views
Attribute types that are defined as INTEGER revert to STRING in the View layer

I often have independent layers (points, polygons) that are connected by a foreign key. The spatialite views join and filter these together.

How are you addressing these issues?


texts: Permanently reordering fields in feature class programmatically using ArcObjects with VB.Net

texts:
Would someone be able to share the logistics on how to permanently programmatically reorder fields in a feature class with ArcObjects, VB.Net.

I want to be able to do this in the geodatabase not in the IOrderedLayerFields Interface of the Carto assembly.


texts: Geoserver/Openlayers: Polygon disappears on some zoom levels

texts:
I have a Geoserver WMS layer that, when displayed with the Open Layers preview, doesn't draw a specific polygon when the scale is below 1:2M.

The layer is a SQL view with the following query:

SELECT * FROM osm.adminareas WHERE fclass='admin_level4' AND ST_Intersects(geom,(SELECT geom FROM osm.adminareas WHERE fclass='national' AND int_name = 'Germany'))


texts: Geoserver 2.8 image mosaic reprojection non transparent artefacts

texts:
I'm currently upgrading my companies instances of Geoserver from version 2.4 to 2.8 everything has worked fine for the vector layers. However when a request  is made for aerial imagery as an image mosaic layer, projected to EPSG:3857 is made we have non transparent artefacts where new data is created from the projection.

The files making up the mosaic are RGB tiffs with a white background.

Now as far as I can tell all the settings are the same as the 2.4 instance, the settings for 2.8 are

So far I haven't been able to find a solution to the problem and have found myself going round in circles. I hoping some else has come across this issue whether as a configuration mistake or a bug with 2.8.


texts: How do I update the sld of layer dynamically

texts:
I am using Geoserver 2.1.3 and Openlayers2.3. I have set the default sld for each layer in geoserver which it take by default on map startup, but when I update the sld using code

map.layers[3].mergeNewParams({SLD:"http://'localhost':8080/geoserver/www/mapstyles/simpleRoads.sld" });
map.layers[3].redraw();
map.layers[4].mergeNewParams({ SLD : "http://'localhost':8080/geoserver/www/mapstyles/Them1.sld" });
map.layers[4].params.styles =  sld.namedLayers["banks"].userStyles[0];
map.layers[4].redraw();

nothing happens except a blink to both layers.


texts: Why is raster data in range 0-255 in PostGIS?

texts: I'm having trouble interpreting some data I've loaded into a PostGIS database. I scraped rasters from here and converted to sql files using raster2pgsql. I'm now using PostGIS's special functions to query the database, to return rainfall data from a particular point. However, it seems to be that whatever I get returned is in the range 0 to 255. Some of the points only have values of 255, for any day. I am guessing that this is something to do with 8-bit colour graphics having a range from 0-255. Does anyone have any idea of how to convert what I have to the actual rainfall value? I can't find any kind of value to rainfall mapping system on the site itself, except an Adobe Color Table file -- is this what I need?


texts: QGIS 2.4 match borders of two shapefiles

texts:
I have two shapefiles of the same place, but one of them is wrong and I need to match the borders with the other one.

I am using QGIS 2.4 and could not do it so far.


texts: When trying to convert an .e00 file into a shapefile with ogr2ogr, getting "ERROR 4: This looks like a compressed E00 file"

texts:
When I ran this command:

ogr2ogr topo.shp flowe86hyp.e00

I got this error:

ERROR 4: This looks like a compressed E00 file and cannot be processed directly. You may need
to uncompress it first using the E00compr library or the e00conv program.
FAILURE:
Unable to open datasource `flowe86hyp.e00' with the following drivers.
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> SDTS
  -> TIGER
  -> S57
  -> DGN
  -> VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> NAS
  -> GML
  -> GPX
  -> LIBKML
  -> KML
  -> GeoJSON
  -> Interlis 1
  -> Interlis 2
  -> GMT
  -> SQLite
  -> DODS
  -> ODBC
  -> PGeo
  -> MSSQLSpatial
  -> OGDI
  -> PostgreSQL
  -> PCIDSK
  -> XPlane
  -> AVCBin
  -> AVCE00
  -> DXF
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> VFK
  -> PGDump
  -> OSM
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> PDS
  -> WFS
  -> HTF
  -> AeronavFAA
  -> Geomedia
  -> EDIGEO
  -> GFT
  -> SVG
  -> CouchDB
  -> Idrisi
  -> ARCGEN
  -> SEGUKOOA
  -> SEGY
  -> XLS
  -> ODS
  -> XLSX
  -> ElasticSearch
  -> PDF

I've done some research on e00compr & e00conv so far, not a lot, but some, and have so far not been able to find a simple download that lets me build/make/install the program(s) on a mac. The e00compr I found here (https://github.com/fd00/yacp) on github had some kind of weird makefiles (apparently according to its README) for cygwin but none that I was able to use for the make command on my mac. And I found some e00compr source code at one point but it was all microsoft builds.

Anyway, I'm looking to use something like Grass, ogr2ogr, or some other command line tool to convert this e00 into shp and apparently am needing to uncompress it somehow. I've gone ahead and hosted a sample of the .e00 file on google drive here: (https://drive.google.com/file/d/0B5inC0VAuhH1Qm9OUGhGUFNOdk0/edit?usp=sharing) in case any of you would like to inspect it.


texts:
I'm trying to develop a QT C++ application that uses QGIS API and I can't manage Qt Creator to compile the code. I've read several topicts at gis.stackexchange and from other sources. The information is mostly outdated and I havent't found a solution. What I need is an overall guideline about the compatibility of the following items that help me find the right combination:

Qt version: tried 4.8.6 and 5.9.
Qt compiler: tried MinGW, VS2008 Express (Qt 4.8.6) and VS Community 2017 (Qt 5.9)
QGIS version: tried 2.14 to 2.18.
QGIS compile: I only use the regular OSGeo4w installer and AFAIK QGIS is compiled with Qt4 and MSVC. I've tried to compile QGIS from source using MinGW with no success (again, versions compatibility issues).
Windows version: I'm using Windows 10 64bit.
OSGeo4W or OSGeo4W64.

Qt works Ok in every case with it's own libraries, but when I try to import QGIS libraries it gives an 'undefined reference' error when building, even though intellisense works fine as it recognizes QgsApplication as a member of qgsapplication.h.

The following is just a test I can't get working. My Pro file is:

QT       += core gui xml

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = QgisWindow
TEMPLATE = app

DEFINES += QT_DEPRECATED_WARNINGS

SOURCES += \
        main.cpp \
        mainwindow.cpp

HEADERS += \
        mainwindow.h

FORMS += \
        mainwindow.ui

# QGIS
INCLUDEPATH +=  "C:/OSGeo4W64/apps/qgis-rel-dev/include"
INCLUDEPATH +=  "C:/OSGeo4W64/include"

LIBS += -L"C:/OSGeo4W64/apps/qgis-rel-dev/lib" -lqgis_core -lqgis_gui

#DEFINES += GUI_EXPORT=__declspec(dllimport) CORE_EXPORT=__declspec(dllimport)
DEFINES+=CORE_EXPORT=
DEFINES+=GUI_EXPORT=
# QGIS

main.cpp is:

#include <QApplication>
#include <qgsapplication.h>

int main(int argc, char *argv[])
{
  QgsApplication app(argc, argv, true);
  QgsApplication::setPrefixPath("C:/OSGeo4W64/apps/qgis-dev", true);

  int retval = app.exec();
  QgsApplication::exitQgis();
  return retval;
}

Then it fails to build/compile whith this error:

main.cpp:20: error: undefined reference to `QgsApplication::QgsApplication(int&, char**, bool, QString const&, QString const&)'

I'm actually porting a PyQgis app I've made two years ago and as I'm fairly new to Qt Creator I'm stuck at he beginning.


texts: Do python codes need to be changed moving from ArcGIS 10.2 to 10.3

texts: What changes (if any) do I need to make to my python scripts to migrate from ArcGIS10.2 to ArcGIS 10.3


texts: Is there a way to run your own OpenLS using OSM data?

texts:
I'm looking to create my own geocoding service for a client.
The web application will run on intranet and won't have access to the internet.
Is there a way I can run OpenLS like service of geocoding using OSM data ?
The map will be displayed with OL + Geoserver and OSM shp file.

thx


texts: Get all the coordinates of a feature in OpenLayers 4

texts:
I am trying to highlight all the vertices (coordinates) of polygon by adding ol.style.Style() as in following code snippet.

var polygonStyles = new ol.style.Style({
      image: new ol.style.Circle({
        radius: 5,
        fill: new ol.style.Fill({
          color: 'orange'
        })
      }),
      geometry: function(feature) {
        // return the coordinates of the first ring of the polygon
        var coordinates = feature.getGeometry().getCoordinates()[0]; //throws error if feature.getGeometry() returns an Object of GeometryCollection
        return new ol.geom.MultiPoint(coordinates);
      }
    })

But the problem is if the polygon Geometry is of type GeometryCollection then var coordinates = feature.getGeometry().getCoordinates()[0]; throws error (ol.geom.GeometryCollection does not have function getCoordinates() but again another getGeometries() function).
Is there any method or any other workaround to get all the coordinates of the feature regardless of the type of Geometry returned from feature.getGeometry() function. The polygon is loaded into the vector as below.

var polygon = new ol.layer.Vector({
            source: new ol.source.Vector({
                format: new ol.format.GeoJSON(),
                url: 'data.json'
            }),
            style: polygonStyles
        })

where 'data.json' can have geometry of type either MultiPolygon or GeometryCollection as of now.


texts: Simulating a point pattern under Complete Spatial Randomness in R

texts:
As per title, I am trying to figure out how to simulate such point pattern without the use of the 'spatstat' package (which I cannot install due to the old version of R which I am using, which in turn I cannot update due to the old OS I am currently using).
So, I am wondering if there is a viable workaround? I have performed a web search, but I have only found reference to 'spatstat'.


texts: Mosaic Landsat Scenes for NDVI Generation

texts:
I would Like to generate an NDVI map for my study region, which is positioned between three Landsat scenes.

Which method suits:

1) compute NDVI for each Landsat scenes and then mosaic or

2) Mosaic Red and NIR band separately and then performed NDVI


texts: Converting LiDAR data to raster (DEM/DSM) for ArcGIS input?

texts: I was wondering if there is an option to convert LiDAR data (.las) to a raster/grid (DEM/DSM) format that ArcGIS 10.0 can read?


texts:
We have a large application running on Java, RHEL, where our ArcGIS Server resides also.

We have a lot of inteligence on some of our classes and we wish to publish them via arcgis server. The problem is, that being RHEL I cannot just register the class extension dlls in it and when AGS tries to initialize them, it fails.

I don't need the class extensions to work via web, I just need to be able to show them up on a map (no editions will be made). Is there any viable solution that does not involve:

A) recoding;
B) switching to a different environment;

Can I figure out a way of skipping the initialization of the class extension on the server?

EDIT:

Since I don't need the complex edit behavior we have in ArcGIS Desktop, I'm gonna try to fool AGS. I'm going to build the same class extension as we have on the .NET side, but with Java, without behavior and deploy it to the ags.


texts:
I have two raster objects r1 (in grey and green) and r2 (in pink) that I want to intersect with R.
I tried with the R function intersect from the raster package but it only intersect the extent of the two objects :

I would like to get a raster object r3 that have the shape of r2 (pink), but the values of r1.

Do you know how I can do this ?

EDIT :

I have a find a solution by firstly insersecting r1 and r2 into r3 then converting r3 and r2 to SpatialPolygonsDataFrame using the rasterToPolygonsfonction. The intersection of r3 and r2 converted into SpatialPolygonsDataFrame is close to what I wanted to get :


texts: QGIS 2.4.0 Setting raster layer to singlebandpseudocolor using minimum and maximum raster values

texts:
I am using QGIS Chugiak 2.4.0, and I have some code in which I want to:

Add raster layer to map canvas
Look for the minimum and maximum raster value
Apply singleband pseudocolor render type for the min max values
Use a nice color map (e.g. RdYlBl)
Update the map canvas/legend with these settings

I found some code in the PyGis cookbook as shown below:

layer = QgsRasterLayer(file, layername)
rastermin = ?
rastermax = ?
layer.setDrawingStyle("SingleBandPseudoColor")
layer.setColorShadingAlgorithm(QgsRasterLayer.ColorRampShader)
lst = [ QgsColorRampShader.ColorRampItem(rastermin, QColor(0,255,0)), QgsColorRampShader.ColorRampItem(rastermax, QColor(255,255,0)) ]
fcn = rlayer.rasterShader().rasterShaderFunction()
fcn.setColorRampType(QgsColorRampShader.INTERPOLATED)
fcn.setColorRampItemList(lst)

First of all, I don't know how to retrieve the minimum and maximum values of the raster layer.
Secondly, it seems that setColorShadingAlgorithm does not work in QGIS Chugiak 2.4.0.
Thirdly, instead of using the QColor(0,255,0) I'd like to use one of the nice existing colormaps in QGIS, e.g.RdYlBl.

Does anyone have any clue how to solve this?

Best Regards,
Wilco


texts: Problem with PostGis Shapefile Import/Export Manager with no explanation

texts:
I am trying to import a shapefile into PgAdmin4.
I do it with PostGis Shapefile Import/Export Manager.
I have a « connection failed » message with no explanation so I do no know where to search …

My datatable does not seem to have encoding problem anymore, my path neither ..
And I can open the shapefile in arcgis/qgis.

Does someone has a suggestion ?

UPDATE
I set the correct SRID, still not working.


texts: Filling combo box of form with map layers name?

texts:
While writing the code for adding all the layers in arcmap into combobox of a form, I am getting the error:

  'Bestaurents.frmRestaurentviewer' does not contain a definition for cmblayer and no extention method 'cmblayer' accepting a first argument of type Bestaurents.frmRestaurentviewe could not be found (are you missing a using directive or an assembly)

at last line:

frmRestaurentViewer prestViewer = new frmRestaurentViewer();
prestViewer.Show();

IMxDocument doc = m_application.Document as IMxDocument;
IMap pMap = doc.FocusMap;

ILayer play = pMap.get_Layer(0);
prestViewer.cmblayer.Items.Add(play.Name);


texts:
I have a problem with replacing in field calculator.
For some reason my Python parser is not working. So I'm going to use VB and having tonns of this

Replace([field],"x","y")
Replace([field],"z","a")
Replace([field],"1","2")
.
.
.
.
Replace([field],"g","j")

I would like to make all this into 1 line script. How to combine all of this?


texts: Why is my new Shapefile layer not showing up?

texts:
I am having trouble with a new shape layer not showing up on my map. The attribute table is showing up fine and all of the points are in there, however visually, there are no dots showing on the map. I have made sure that the new shape layer was at the very top of the stack. I tried placing the new shape layer on a blank new project and it worked perfectly as it should. Then I re-opened the original problem project, deleted all of the existing layers, saved it as temp with no data in it at all, and then closed and re-opened the project and re-loaded the problem shape layer into the new temp project. It did not show up again.

I have gone back to my original data and re-created the csv that I initially used to create the shape file (did this a couple of times), in case there was some spurious content in there, however, this had no effect, and the problem remains.

Using QGIS 1.8.0 and Windows 7 64-bit. However I installed QGIS onto a Linux machine and the identical problem occurred.

Hope someone can help, or has an idea what it might be...


texts: Print Composer Atlas multiple feature select in one page

texts:
I am trying to select multiple features on Print Composer in QGIS 2.18 (Las Palmas) in the atlas filter: for instance, I have one layer whose atributte "name"=2 has 4 features as a result; the resulting atlas shows me 4 pages (one page per feature).
But I want to show these 4 features highlighted just in one page. Is it possible?


texts: Join traffic data (point) to a road network (line) - Section between two roads - ArcGIS

texts:
I am trying to analyze the vehicle traffic in Melbourne's (AUS) road network.

I have two files: the traffic data (point data for a given latitude and longitude with the average hourly traffic between roads) and the road network as can be seen below:

Traffic data (purple point) and Road network (green)

The road layer is divided in sections as seen below:

I have to assign the traffic data to a couple of sections as seen below:

I have 1,616 traffic entries that I have to assign to sections of the road network. Is there any way to do it automatically or should I do it manual?


texts: Searching for a point within a multipolygon


texts: Using virtual fields as join fields in QGIS fails (NULL values in joined fields)

texts:
I have a point shapefile and a CSV file containing various attributes and three columns (here: street,num,addnum) based on which I would like to join both tables like

attribute1;...;attributen;street;num;addnum
1;...;100;Goethestr.;10;A

Since 'Straße' might be abbreviated or not and lower/uppercase might not be used consistent, I generate a virtual field adr for each table upon wich I'd like to build a join by an expression like

replace(lower(if("addnum" is null, "street" || "num", "street" || "num" || "addnum")),'str.','straße')

I create a join on the point shapefile like this:

but as a result I get NULL values for the prefixed joined attributes/fields:

What might be the problem? Virtual fields not suitable for joins?
[QGIS 2.14.5LTR]


texts:
I'm building a web application - my requirements are:

Must have global satellite imagery.
Must have easy to use API's that are
capable of geoJSON data imports, mouse and keyboard gestures, etc.

To my knowledge Bing, Google and Yahoo are the only companies that supply both of these. Some support the former to an extent; perhaps not global (NASA, third party mapping solutions), and some support the latter (OSM for example)...but few support both.

Are my only options Bing, Google, and Yahoo?

If so, is anyone aware of any ongoing projects (satellites) that are under construction that will eventually be launched and provide global satellite coverage under open source?


texts: Listing feature classes with active domains?

texts:
I have an Esri file geodatabase with attribute domains defined. I need to delete some of the attribute domains but can't because "The domain is used by an attribute rule.". How might I discover which feature class(es) are using the domains?

Executing: DeleteDomain R:\v5\YT_Canvec.gdb Permanency
Start Time: Thu May 19 11:01:02 2011
ERROR 999999: Error executing function.
The domain is used by an attribute rule.
Failed to execute (DeleteDomain).
Failed at Thu May 19 11:01:02 2011 (Elapsed Time: 0.00 seconds)

There are over a hundred feature classes in the geodatabase, interactively looking at the FC field properties for each one is a non-starter. The gdb is too large to convert to a personal gdb and go in the back door with ms-access (a dodgy method anyway).

(2011-May-26): Another way to phrase this is "which Feature Class is using domain X?"


texts: Image Classification on Photos From Camera?

texts:
I have some photos of 1X1 meter plots that were taken with a NIR digital camera. They have been georeferenced, corrected, etc.

I am interested in performing an image classification for the vegetation, however, I have only ever done this on a landscape scale with Landsat, MODIS, or on the scale of a small city-sized area.

I know the vegetation types, I just have a lot of photos and from multiple years and need to train the model to automate the process. I will most likely be utilizing the NDVI, which I am familiar with.

Does anyone know of any journal articles, tutorials, other resources, other feeds where this has been addressed etc. where others have done image classifications/change analyses on as small a scale as a meter squared plot?


texts: How to extract and save polygons by attribute in QGIS?

texts:
I have a shapefile layer from a vegetation mapping project with 417 polygons that represent 21 different vegetation classes. These are stored in a single column called 'type'.

I want to break the shp file down into each different vegetation class, so that I end up with 21 shp layers, one for each class.

How can I do this efficiently in QGIS? Bear in mind that I have no experience in Python or in SQL.

I have added a screenshot of the shapefile (from MapInfo, but I want to use QGIS for the disaggregation).


texts: Accessing feature service properties for pop ups in AGOL

texts:
Within an AGOL web map/app, is there a way to access feature service properties as a variable to show in the feature popup?
I would like to be able to show when the feature service was last updated in the popup on my web map/app. I have the edit date listed in the feature service description and can change it via the arcgis python api, and I can also see the last edit date in the feature service details and through the rest service. Is there any way of accessing any of these locations through Arcade to show them in the feature pop up? There is the obvious work around of including an "Updated Date" field for each row in the feature service and then calling that, but the service already exists and is updated through a separate workflow, so changing the schema now would break the existing structure.


texts: How to find a layer by name in the QGIS layer panel?

texts:
I have a large QGIS project organized with several groups in the QGIS layer panel. It happend to me a couple of times that, when the computer is operating with low resources (low free memory-high CPU usage), the exact control of the mouse is lost for some seconds and I by mistake dragged and dropped a layer into another group.
Then to find where it went manually could take a long time.

Is there a way to look for layers by name in the Layers Panel?


texts: How to determine Grass (i.atcorr) tool control file's "visibility for the aerosol model [km]" value

texts:
In Grass, the Atmospheric Correction tool (i.atcorr) reference do not provide information with regards to the parameter "visibility for the aerosol model [km]"stated in the control file.I have searched exhaustively online. But could not find the data source or methodology to generate it. Does it mean Vertical visibility or viewing height? As far I can understand, the parameter should be independent of the visibility map (because visibility map raster cell value reflects count # of other cells it can see). I have already explored the Aeronet website but could not find any Visibility (km) data. Please let us know the data source (if there is any) and calculation methodology for "visibility for the aerosol model [km]" preferably, in layman's term.

Update: The following paper indicates, Visibility (km) refers to horizontal visibility measured at airports. I'll look further to find any free source where historical record of such data is available. Any suggestion is welcome.

https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwjV_ZOgkMLJAhVCOBQKHUkVDiEQFggmMAE&url=http%3A%2F%2Fwww.rtwilson.com%2Facademic%2FWilsonMiltonNield_2015_VisAOT.pdf&usg=AFQjCNGxH9CL0U8fDQJawtA8aazVpy4KJg


texts:
I encountered the problem while exporting scene into 3D in ArcScene.

All other shapefiles work fine and are exported to 3d format, but the files involving "circle" as the construction tool makes ArcScene stop responding, and the file that has been created gives vrml parsing error.

What could be the possible solution?

I have used different versions of ArcGIS Desktop, like 10.1, 10.4. and different windows with updated 3d builder.


texts:
I've already tried snapping to the network, tried switching end points to any vertex and still don't work. I have even created single layer of my all routes, and then created network layer and still error occurs. Please help me.

On the straight route it works

but when I try to select after the turn it won't work.

Warning text:

  Warning: No route from location "Location 1" to location "Location 2".
  Error: No solution found.

Location 1 and Location 2 are replaced with addresses in my province.

My goal is to highlight a route from point to point (like from the border of my province to the harbour; it's a point feature but it isn't shown on screens) and every time when i want to highlight a route, and turn occurs the error appears.


texts:
Is there any GET paramerter that can be pasted to get both the total_count (with limit) as well as the total count (without limit constraint)?

If I have

SELECT * FROM table WHERE val < 100

I might get a total_count of say 140 records but when I hadd

SELECT * FROM table WHERE val < 100 LIMIT 20

I will only get total_count 20 every time.  I know I can send 2 queries but wondering if there is something that exists as a param that we are overlooking.


texts: Setting particular program for opening hyperlink in ArcGIS for Desktop?

texts:
I have some hyperlinks set up in ArcGIS for Desktop which, when accessed, open a small mobile mapping JPEG file.

Currently the images open in the default windows photo viewer but I would like for them to open in a different program which we have personalised for these JPEG files. The JPEG files are from a 360 degree ladybug system and the normal windows photo viewer isn't suitable for viewing them. Hence the need to use the personalised program.

Is there a way to set a different program for opening the hyperlink other than setting a default program in windows? I have to send the data/mxd to a client and didn't really want them adjusting their default windows settings.


texts:
Wondering if anyone else can reproduce this kind of problem? I dual boot windows 7 and ubuntu 13.04 with QGis on both. Have updated QGis to latest on both, and created a layer in my project in 2.2 in Windows (voronoi polygons with 5 data layers). When opened in ubuntu it displays fine, but if I edit the style at all the layer disappears.
EDIT: Checked in 2.3 in Windwos 7 and had the same problem, so it's a problem with master not ubuntu/windows. Title changed accordingly.
Link to imgur album explaining it. Image sequence: 1: version. 2: appearance when opened fresh. Looks fine. 3: details of that layer: 25 equal counts on the first data layer. 4: changed to pretty breaks and hit apply - layer disappears in background, data field now blank. 5: but no blank data field present.
Reminds me of similar bugs I've found before e.g. blank data fields


texts: Referencing other points(rows) in field calculator

texts:
I'm trying to calculate an angle between points using a field calculator.  Is it possible to reference the previous or next FID with reference to the current one using the field calc?

Eventually I'd like to have an angle between the next and previous point be input into a field for the current point - like shown below


texts: Having trouble with the getFeaturesAtCoordinat() method in OpenLayers

texts:
Why reason when I do click in a polygon, it works and not in a point?

I have the following jQuery Code:

var despachosFeatures = despachosWFS.getFeaturesAtCoordinate(evt.coordinate);
var despachosJSONByWFS = format.writeFeatures(despachosFeatures);

var grifosFeatures = grifosWFS.getFeaturesAtCoordinate(evt.coordinate);
var grifosJSONByWFS = format.writeFeatures(grifosFeatures);

In the first and second line code, It returns a JSON with all features on the source (It's a polygon).

But, third and fourth line code, it doesn't return nothing. Why is the reason?

{"type":"FeatureCollection","features":[]}

I've checked the vector source "grifosWFS" and it works perfectly. Really I don't understand anything.

Any ideas?


texts: Creating a vector based design from a raster database

texts:
I have a raster table that I've created using Postgis raster. It has 365 records and the table looks like this:

+-----+------------+---------+------------+
| rid |  rast      |filename |date_of data|
+-----+------------+---------+------------+
| 100 |            | file56  |2002-01-09  |
| 101 |            | file57  |2002-01-10  |
+-----+------------+---------+------------+

The second column rast is raster files in WKT format and data type is raster. All my raster files have the same extents and cellsizes.

I want to turn this raster design into a vector design like the following:

+-----+---------------+----------+
| ID  |pixel_centroid |array_366 |
+-----+---------------+----------+
| 1200|               |{26,20,..}|
| 1201|               |{28,68...}|
+-----+---------------+----------+

Imagine the raster files have 1600 pixels and accordingly I will have 1600  records in my new table. 'Pixel_centroid' is the point geometry of the pixels and could be calculated using

select ST_centroid((ST_PixelAsPolygons(rast, 1)).geom)  from raster_table

and array_366 is pixel values of all the records in the order of date_of_data:

select (ST_PixelAsPolygons(rast, 1)).val  from raster_table

might be used but I don't know how to put all the values in their place and populate the array.


texts: Why does QGIS legend does not take the indentation?

texts:
I created a legend with refinement in QGIS print composer. As you can see (picture 1) in the item properties for the legend the items are hierarchical indented.

 picture 1

But in my map the indentation is not taken from QGIS (see picture 2).

 picture 2

How can I manage this indentation in the legend?


texts: Creating new geometries from existing data into routes using QGIS

texts:
I have a number of roadlinks in which I have created routes from i.e. for each roadlink I have given a '1' or '0' indicator to whether it was part of a specified route or not with each route its own column and given a unique number. This is outlined in the figure below.

I now need to change this information in the attribute table into line geometry which visually displays the route as illustrated below. Currently, I am copying features for each route in the attribute table, pasting into a new layer and merging the roadlinks. This process has to be repeated for 1000+ routes.

Is there an easier way to do this?


texts: Add TileLayer to QGIS with link containing bbox parameter only

texts:
I want to add a custom TileLayer to QGIS that doesn't use only x and y coordinate.

Here is a link to a custom tile:

http://link_to_wms:8080/rest/services/some_service/export?dpi=96&transparent=true&format=png8&layers=show%3A0&bbox=3977.981201590248%2C4252.094193626508%2C12477.737784436798%2C14061.079227260492&bboxSR=%7B%22wkt%22%3A%22PROJCS%5B%5C%22Moscow_bessel%5C%22%2CGEOGCS%5B%5C%22GCS_Bessel_1841%5C%22%2CDATUM%5B%5C%22D_Bessel_1841%5C%22%2CSPHEROID%5B%5C%22Bessel_1841%5C%22%2C6377397.155%2C299.1528128%5D%5D%2CPRIMEM%5B%5C%22Greenwich%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Degree%5C%22%2C0.0174532925199433%5D%5D%2CPROJECTION%5B%5C%22Transverse_Mercator%5C%22%5D%2CPARAMETER%5B%5C%22False_Easting%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22False_Northing%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22Central_Meridian%5C%22%2C37.5%5D%2CPARAMETER%5B%5C%22Scale_Factor%5C%22%2C1.0%5D%2CPARAMETER%5B%5C%22Latitude_Of_Origin%5C%22%2C55.66666666666666%5D%2CUNIT%5B%5C%22Meter%5C%22%2C1.0%5D%5D%22%7D&imageSR=%7B%22wkt%22%3A%22PROJCS%5B%5C%22Moscow_bessel%5C%22%2CGEOGCS%5B%5C%22GCS_Bessel_1841%5C%22%2CDATUM%5B%5C%22D_Bessel_1841%5C%22%2CSPHEROID%5B%5C%22Bessel_1841%5C%22%2C6377397.155%2C299.1528128%5D%5D%2CPRIMEM%5B%5C%22Greenwich%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Degree%5C%22%2C0.0174532925199433%5D%5D%2CPROJECTION%5B%5C%22Transverse_Mercator%5C%22%5D%2CPARAMETER%5B%5C%22False_Easting%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22False_Northing%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22Central_Meridian%5C%22%2C37.5%5D%2CPARAMETER%5B%5C%22Scale_Factor%5C%22%2C1.0%5D%2CPARAMETER%5B%5C%22Latitude_Of_Origin%5C%22%2C55.66666666666666%5D%2CUNIT%5B%5C%22Meter%5C%22%2C1.0%5D%5D%22%7D&size=831%2C959&f=image

According to this I need to use my current map canvas min/max coordinates, i.e. something like

bpx = iface.mapCanvas().extent()
xmin = bpx.xMinimum()
ymin = bpx.yMinimum()
xmax = bpx.xMaximum()
ymax = bpx.yMaximum()

and paste it into bbox attributes.
But how end this by creating a new tile layer?


texts: Is there a geocoding service that can return building or area type?

texts:
I'm about to shop around for a geocoding service that can return more details about geocoded addresses. For example, if a result is returned to a building rooftop, can the service tell me that the building is an 8-story apartment complex or a warehouse. If not rooftop level, can I found out if the result is in a residential suburb, or central business district? Can anyone give me a head start as to what's out there that can do the above? I'm interested in US only and international coverage.

Thanks


texts:
I need to create a backup from my database (in PostgreSQL 9.3). I have used the pg_dump tool, gives me an error. I have also used pgAdmin III for backing up which also gives me the following error:

  pg_dump: [archiver (db)] query failed: ERROR:  could not load library
  "C:/Program Files/Boundless/OpenGeo/bin/../pgsql/lib/postgis-2.1.dll":
  %1 is not a valid Win32 application.

I tried checking the path but I couldn't find it. The nearest path that I reach is:

  "C:/Program Files/Boundless/OpenGeo/bin"


texts: Combine two raster with PostGIS or gdal_calc

texts:
I want to combine two rasters (GeoTIFF or PostGIS raster) so that the result is a table showing each combination of values and their count.
Example:
raster 1  raster 2
1 2 3    40 40 10
2 3 3    10 20 20
2 3 1    10 10 20
The resulting Table would look like this
raster1|raster2| cnt
      1|     40|   1
      2|     40|   1
      2|     10|   2
      3|     10|   1
      2|     10|   2
      3|     10|   2
      3|     20|   2
      2|     10|   2
Essentially this is what ESRI's Spatial Analyst Tool 'combine' does (really fast), by creating a raster and an associated value attribute table.
I was able to do this in PostGIS using the following code
with hw as (
SELECT val::integer as hw,geom as geom
    FROM
    (
      SELECT dp.* FROM raster1 hw
         , LATERAL ST_PixelAsCentroids(hw.rast, 1) AS dp
     ) foo1
)
, beam as
(

SELECT val::integer as beam, geom as geom
    FROM (SELECT dp.* FROM raster2 beam
         , LATERAL ST_PixelAsCentroids(beam.rast, 1) AS dp
  ) foo2
)
,
stats as
(

  select (split_part(combi,'_',1))::integer as hw
      ,(split_part(combi,'_',2))::integer as beam
      , n
  from
  (
    select  combi, count(*) as n from
    (
        select  hw::TEXT || '_' || beam::TEXT as combi
         from hw, beam
         where hw.geom=beam.geom
    ) c
    group by combi
  ) g
)

select stats.esri_id, stats.hw, 100, 'Echaz', stats.n, 5

However, it works only for rasters which are not too large.
I have huge rasters 50000x50000)  , with those I run into memory problems quickly.


texts: Menu actions in QGIS 2.6 feature attributes

texts:
I would like to ask about new menu 'actions' in feature attributes which appears in new QGIS 2.6. This menu shows 'actions', defined for the layer but I am wondering if it is possible to add some other menus in features attributes window (for example group actions in different menu bars).
I didn't find anything in QGIS layer properties but maybe it's possible in QT designer?


texts: FIeld calculator gives integer not a real as requested

texts: Two fields "population" and "F06_popula" (both integers)  were used in calculating a new field pct-diff. I asked that the new field be a decimal with a width of 10 and precision of 3. The result has no decimals. See the graphic. But the Layer Properties indicates that pct-diff is a real with 3 decimals. Why are the decimals not visible?    Thanks -


texts: Filling in gaps between polygons using PostGIS functions

texts:
I have a similar question to Filling gaps between polygons using QGIS
The solution talks about using it in QGIS but I want to use PostGIS functions on a table on the geometry column.
The solution talks about convex hull but not sure how to use the convex_hull PostGIS function here. I want to fill the gap by moving/merging the gap to the neighboring polygon.


texts: How calculate pixel by pixel the mode (statistic) of multiple rasters (geotiff)?

texts:
I have 12 land cover maps, and I would like to calculate the mode to each pixel of the 12 maps (they have the same resolution and dimension). I mean, the final map would be the mode for each pixel of the 12 land cover maps.

I already tried using this GRASS module (raster calculator): r.mapcalc raster_mode = mode(raster1, raster2,...raster12), but I just obtained an empty map. I also tried with raster calculator of Qgis, but it seems it hasn't the mode function.

I can use GRASS, Qgis, R, Python...(Open Source).


texts: Load and apply Style from Postgres in QGIS 3

texts:
I want to write a plugin in QGIS3 that changes the style of a vector layer. The styles to be loaded are saved in a postgres database in the table 'layer_styles'.

I read here or here , to use applyNamedStyle() which is not available anymore in QGIS3.

Therefore, I tried using loadNamedStyle():

uri=QgsDataSourceUri()
uri.setConnection("host_name", "5432", "database_name", "user", "xxx")
uri.setSchema("public")
uri.setSql("SELECT styleqml FROM public.layer_styles WHERE stylename='nice'")
self.layer.loadNamedStyle(uri.uri(False))

This doesn't give me an error but nothing happens.

Do I only 'load' the style and not apply it?

My layer is of class QgsVectorLayer, could this be the problem?

Is there another way of loading and applying the style to the vector layer?


texts: How to export data from QGIS to display in Google Maps?

texts:
I'm exporting layers of a project for a quantum gis postgis table and visualizing the data in gmaps, but the coordinates are very wrong.

Is there any special way to export the quantum gis? The postgres table is using 4326 SRID like gmaps.

My shape in gmaps:

qgis:


texts: How to count number of feature classes in geodatabase using ArcPy?

texts: I would like to count the number of feature classes in a geodatabase.  Some of the classes are in feature datasets as well.  I have tried get count management, but that returns the number of rows in each feature class in the GDB.


texts: QGIS server (WMS) how serve raster constructed on the fly from multiple tiles with expression

texts:
I’m not sure how to precisely describe the functionality but I have been looking around and I didn't find an answer.
Basically I have a large number of small raster files - say 1000 served by WMS server (QGIS).
These raster layers do overlap and some don’t.
User can dynamically request to select any of these layers. Say 100 out of the 1000. This is a variable input so can not be pre-established.

From user selection I need to construct a single virtual layer which combines all the individual raster layers selected by the user.

This virtual layer would ideally be computed by the WMS server and streamed to the user so less computation done on the client side.

The layer would be computed using an expression such as A+B or A>B?A:B at pixel level.

Is WMS server suited for such application?


texts: Differentiating between Water and Built-Up pixels in ArcGIS Desktop?

texts:
I am classifying an imagery that has 3 bands i.e., NIR, Red, and Green band.
While classifying I am not able to differentiate between Water and Built-up pixels and there is lot cross contamination irrespective of method of classification.
Is there any method to handle such problem using band operations?
RGB Composite

Classified image
builtup in blue, which indicates water erroneously

EDIT: Inserted images


texts: Calculating NDVI per region, month & year with Google Earth Engine

texts:
This question refers to post: https://stackoverflow.com/questions/53280885 on stackoverflow. It was recommended by a user to repost here.

I have modified the code posted by @Kel Markert https://code.earthengine.google.com/349615d7802d59f677181bef0badad9f to attempt to get a maximum monthly NDVI value from a small polygon over a number of years from Landsat 8 in Google Earth Engine and export to CSV.

But I keep getting an error of

  Dictionary.get, argument 'key': Invalid type. Expected: String.
  Actual: List

Any advice on how to fix this?

Code Link
Google Earth Script

Table Link

    var region = table,
L8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA");

var cloudlessNDVI = L8.map(function(image) {
  // Get a cloud score in [0, 100].
  var cloud = ee.Algorithms.Landsat.simpleCloudScore(image).select('cloud');

  // Create a mask of cloudy pixels from an arbitrary threshold.
  var mask = cloud.lte(20);

  // Compute NDVI.
  var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');

  // Return the masked image with an NDVI band.
  return image.addBands(ndvi).updateMask(mask);
});

var startDate = ee.Date('2013-05-01'); // set analysis start time
var endDate = ee.Date('2019-12-31'); // set analysis end time

// calculate the number of months to process
var nMonths = ee.Number(endDate.difference(startDate,'month')).round();

// get a list of time strings to pass into a dictionary later on
var monList = ee.List.sequence(0, nMonths).map(function (n) {
  return startDate.advance(n, 'month').format('YYYMMdd');
})
print(monList)

var result = region.map(function(feature){
  // map over each month
  var timeSeries = ee.List.sequence(0,nMonths).map(function (n){
    // calculate the offset from startDate
    var ini = startDate.advance(n,'month');
    // advance just one month
    var end = ini.advance(1,'month');
    // filter and reduce
    var data = cloudlessNDVI.filterDate(ini,end).max().reduceRegion({
      reducer: ee.Reducer.max(),
      geometry: feature.geometry(),
      scale: 30
    });
    // get the value and check that it has data
    var val = ee.Number(data.get(['ndvi']));
    val = ee.Number(ee.Algorithms.If(val,val,-999));
    // return max
    return val;
  });
  // create new dictionary with date strings and values
  var timeDict = ee.Dictionary.fromLists(monList,timeSeries);
  // return feature with a timeseries property and results
  return feature.set(timeDict);
});

// print to see if it is doing what we expect...
print(result);

// Export the data to a table for further analysis
Export.table.toDrive({
  collection:result,
  description:"MCM1_NDVI",
  fileFormat:"CSV",
  //selectors:["HRpcode","timeseries"]
})


texts: What might cause "python.exe has stopped working" when closing ArcPy script?

texts:
I created a script that takes a .tab file and joins it to a shapefile. The script works perfectly but when it finishes, it gives me an unhandled exception which crashes Python.

I don't know what might be causing it but I think I have identify where it's happening. I wanted to ask if someone could help me identify the problem so I can fix it. I'm using ArcPy 10.1 and Python 2.7. I think it's happening in this part. For all the variables I get values prior to this portion of the script. I do the same calculation for other fields so this code repeats itself but for different columns.

#Create and calculate new fields
        #Population
        if(p == 1):
            pop_calc = '!pop_20{}!-!pop_2010!'.format(year)
            arcpy.AddField_management(outFeature, "pop_diff","LONG",15,"","","","")
            arcpy.CalculateField_management(outFeature,'pop_diff',pop_calc,"PYTHON_9.3")
            arcpy.AddField_management(outFeature, "popShare","DOUBLE",15,10,"","","")
            popSharedTotal = 0
            popFields = 'pop_diff'
            with arcpy.da.SearchCursor(fc, popFields)as cursor:
                for row in cursor:
                    popSharedTotal = row[0] + popSharedTotal
            arcpy.AddField_management(outFeature, 'temp',"LONG",15,"","","","")
            arcpy.CalculateField_management(outFeature,'temp',popSharedTotal,"PYTHON_9.3")
            arcpy.CalculateField_management(outFeature,'popShare','[pop_diff]/[temp]',"VB")
            arcpy.DeleteField_management(outFeature,'temp')

I can provide the entire script if needed but by commenting sections, this portion is what makes Python not close correctly when done with the script.


texts: Consuming MapServer service using ArcGIS API for Silverlight?

texts:
Is it possible to use a service published from MapServer using ArcGIS API for Silverlight?

For example:

<esri:FeatureLayer ID="Schools Without Attendance Areas"
                               MouseEnter="FeatureLayer_MouseEnter"
                               MouseLeave="FeatureLayer_MouseLeave"
                               Visible="False"
                               Url="http://webaddress"
                               OutFields="SCHNAME, ADDRESS, PHONE, URL"/>


texts:
I have a bit of a problem with WPS(1.0) chaining on GeoServer (2.9.1.).
I am following this tutorial for
http://geoserver.geo-solutions.it/edu/en/wps/chaining_processes.html
Chain 1: Extract the rivers into the “restricted areas” polygons
Problem is in third step, when i am choosing SUBPROCES of gs:CollectGeometries, imput XML looks empty

    <?xml version="1.0" encoding="UTF-8"?><wps:Execute version="1.0.0"service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  <ows:Identifier/>
  <wps:DataInputs/>
  <wps:ResponseForm/>
</wps:Execute>

It have no imput at all, and execute of the process will end up with ErrorMessage "Failed to parse process inputs"
It happends not only with this example, but with all the chaining

This is a whole XML from process imputs/outputs

    <?xml version="1.0" encoding="UTF-8"?><wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  <ows:Identifier>gs:Clip</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>features</ows:Identifier>
      <wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs" method="POST">
        <wps:Body>
          <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" xmlns:sf="http://www.openplans.org/spearfish">
            <wfs:Query typeName="sf:streams"/>
          </wfs:GetFeature>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>clip</ows:Identifier>
      <wps:Reference mimeType="text/xml; subtype=gml/3.1.1" xlink:href="http://geoserver/wps" method="POST">
        <wps:Body>
          <wps:Execute version="1.0.0" service="WPS">
            <ows:Identifier/>
            <wps:DataInputs/>
            <wps:ResponseForm/>
          </wps:Execute>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput mimeType="text/xml; subtype=wfs-collection/1.0">
      <ows:Identifier>result</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>


texts: Finding optimal Bus Transit Center location

texts:
My project aims at finding the accessibility of transportation to my university.
I have around 6000 student data points(lat/long coordinates of each 6000 student location) and I have plotted them on QGIS, I have figured out 3 areas in which there are no bus stops or public transport.
I want to do an analysis to set up a transit center in either of these 3 locations so that most of the demand will be covered and students will be able to access these bus routes to reach university.
How can I do it in QGIS? Any Plugin? or any other suggestion?


texts: GeoServer preventing overwriting html files

texts:
I have GeoServer installed on Windows XP as part of the OpenGeo bundle. It's working well and I have just started creating my own app using it.

I have created an html file in \WebApps\apps and can view it via localhost:8080. My problem is that once I have viewed the file in a browser it becomes locked and I can't save over it.

Has anyone else had this problem? Is there a fix?


texts: Store and use compass and dip with QField

texts: We will be using QField for structural measurement and geological mapping. Tablet and cell phone can measure plane orientation and dip. How can we set-up these measurement with QField?


texts: Converting Shapely MultiPolygon to Polygon: Technique doesn't always work

texts:
In order to get the exterior coordinates I need to convert a shapely MultiPolygon to a Polygon. I do it like this:

if poly.geometry.type == 'Polygon':
    x, y = poly.geometry.exterior.xy
elif poly.geometry.type == 'MultiPolygon':
    allparts = [p.buffer(0) for p in poly.geometry]
    poly.geometry = shapely.ops.cascaded_union(allparts)
    x, y = poly.geometry.exterior.xy  # here happens the error

This succeeds very often, but there are also cases where the Polygon obviously stays a MultiPolygon as the following error is still raised:

AttributeError: 'MultiPolygon' object has no attribute 'exterior'

I've checked, however, that every part of the MultiPolygon is a polygon and not itself a MultiPolygon:

>>>>[p.type for p in poly.geometry]
['Polygon', 'Polygon']

Any ideas why this happens and how to fix it?

Can it be the holes in the polygon? I looks like this:


texts: Failed to open Python console error message

texts:
In the past, I was able to open my Python console without any problems on QGIS. However, just recently, I tried to open the Python console on QGIS 2.18.2 (Las Palmas) on my mac, but I get this error message:

Traceback (most recent call last):
  File "", line 2, in
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/console/console.py", line 46, in show_console
    _console = PythonConsole(parent)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/console/console.py", line 83, in __init__
    self.console = PythonConsoleWidget(self)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/console/console.py", line 109, in __init__
    self.shell = ShellScintilla(self)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/console/console_sci.py", line 86, in __init__
    self.refreshSettingsShell()
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/console/console_sci.py", line 141, in refreshSettingsShell
    self.setCaretForegroundColor(cursorColor)
TypeError: QsciScintilla.setCaretForegroundColor(QColor): argument 1 has unexpected type 'unicode'

I have no idea what any of this means. I originally downloaded QGIS from kyngchaos.com, and redownloaded from the same source to see if it would work, but it didn't.


texts:
I am looking to create polylines that define the break of slope along a cliff line.

Using LiDAR data I have created a slope raster using r.slope.aspect in QGIS. This nicely displays where the breaks of slope are. What I would like to do now is create polylines that follow along the break of slope. I have tried using r.to.vector but that doesn't give me what I'm looking for but perhaps maybe useful as an intermediate stage?

As I say I am using QGIS to do this at the moment but if necessary would have to resort to using Arc.

Any ideas anybody?


texts: How to use PyQGIS ( Python QGIS API ) to open/close Update Drawing Order checkbox in QGIS2's Layers (Legend Interface)

texts:
Thanks qgis 2, the Legend Interface (layers dockwidget) now has Update Drawing Order check box on right-click mouse context menu. I think this feature can let user temporally closes rendering, then changes order of layers without no-used rendering.
And how to use PyQGIS control this feature??

Btw, the PyQGIS API iface.legendInterface().moveLayer( layer, group_index )
in qgis, group_index include any layer and group (on top level?), but
in qgis2, group_index just include group

e.g. If the layer/group structure:

--layer1
--group1
  --layer2
  --layer3

To move layer1 to group 1
in qgis, use qgis.utils.iface.legendInterface().moveLayer( layer1, 1 )
in qgis2, use iface.legendInterface().moveLayer( layer1, 0 )

Edit:
I use moveLayer, but mapCanvas doesn't refresh, even I use mapCanvas.refresh()

iface.legendInterface().moveLayer( iface.activeLayer(), 0) # activeLayer move to top of gruop in layer legend, but mapCanvas doesn't refresh
iface.mapCanvas().refresh() #nothing happened

But I uncheck and then check Update Drawing Order, it works.
How could I refresh mapCanvas after layer moved??
If I can use PyQGIS to uncheck and check Update Drawing Order, it will work.


texts: Insert geometry into new postgis table using python 2

texts:
I am having trouble inserting a geometry, queried from one table, into a geom column in a new table in postgis using python (psycopg2).
The code:

> cur.execute("select * from a_schema.a_table limit " + str(limit) + "
> offset " + str(offset) + ";")
>     features = cur.fetchall()
>
>     for feature in features:
>             cur.execute("INSERT INTO a_schema.a_table (gid, id, class, geom, country, state, updated) VALUES (nextval('seq_atable_gid'), " +
> str(feature[1]) + ", " + str(feature[2]) + ", "+ feature[3] + ", " +
> str(feature[4]) + ", " + str(feature[5]) + ", " + str(feature[6]) +
> ");")

The error:

  Traceback (most recent call last):   File
  "E:/add_data_postgres_v3.py", line 79, in
      cur.execute("INSERT INTO a_schema.a_table (gid, id, class, geom, country, state, updated) VALUES (nextval('seq_atables_gid'), " +
  str(feature1) + ", " + str(feature[2]) + ", " + feature[3] + ", " +
  str(feature[4]) + ", " + str(feature[5]) + ", " + str(feature[6]) +
  ");") ProgrammingError: syntax error at or near
  "B000000F06DFAB31F491AC0C6BFCFB870104040F05014E813491AC07AA702EE791040400CC85EEFFE481AC06808C72C7B1040400D71AC8BDB481AC0EBE6E26F7B104040A609DB4FC6481AC032C7F2AE7A1040407347FFCBB5481AC07061DD787710404040BFEFDFBC481AC08FE21C7574104040BD1AA034D4481AC037FFAF3A72104040570A815CE2481AC0FC00A4367110404023F609A018491AC05680EF366F104040F06DFAB31F491AC0C6BFCFB870104040"
  LINE 1: ...age,
  0106000020E6100000010000000103000000010000000B000000F06...

The geom column is of type geometry(MultiPolygon,4326).
How would this be rectified?

EDIT:
kttii answer solved the geom issue and I accepted the answer. However, I ran into a date issue afterwards and resorted to using this method of insert as described by the psycopg2 docs.

>>> cur.execute(
...     """INSERT INTO some_table (an_int, a_date, a_string)
...         VALUES (%s, %s, %s);""",
...     (10, datetime.date(2005, 11, 18), "O'Reilly"))

This method solved the geometry and date issues encoutered.


texts: openlayers 3 pgrouting: unable to get lat/long by clicking on the map

texts:
I followed all the steps from the pgrouting workshop using pg routing 2.0 and geoserver 2.5 from this site http://workshop.pgrouting.org/ .

I can generate an itinerary in QGis by requesting Postgres below:

I need some help because I'm stuck when I tried to get a an itinerary. In fact, when I click on the map I can not get the long/lat for the startpoint and the endpoint. I'm wondering if I have done something wrong problem with the geoserver configuration. I created my map html  code from this file: https://github.com/pgRouting/workshop/blob/master/web/ol3-routing-final.html

Update 15 May: I have this error below in the browser. I used the ol.js and the file ol.css from ol3js.org. I did not use the files from the workshop because they do not work.

Here is my html file:
 Thanks for your help

      #map {
        height: 500px;
        width: 100%;
      }

    OpenLayers 3 example

    My Map

      start
      final

<button id="clear">clear</button>

<script type="text/javascript">
  var map = new ol.Map({
    target: 'map',
    layers: [
      new ol.layer.Tile({
        source: new ol.source.OSM()
      })
    ],
    view: new ol.View2D({
      center: [-8579550, 4710226],
      zoom: 15
    })
  });

  var params = {
    LAYERS: 'pgrouting:pgrouting',
    FORMAT: 'image/png'
  };

  var startPoint = new ol.Overlay({
    map: map,
    element: document.getElementById('start-point')
  });
  var finalPoint = new ol.Overlay({
    map: map,
    element: document.getElementById('final-point')
  });

  var transform = ol.proj.getTransform('EPSG:3857', 'EPSG:4326');

  map.on('click', function(evt) {
    var coordinate = evt.getCoordinate();
    if (startPoint.getPosition() == undefined) {
      // first click
      startPoint.setPosition(coordinate);
    } else if (finalPoint.getPosition() == undefined) {
      // second click
      finalPoint.setPosition(coordinate);

      // transform the coordinates from the map projection (EPSG:3857)
      // into the server projection (EPSG:4326)
      var startCoord = transform(startPoint.getPosition());
      var finalCoord = transform(finalPoint.getPosition());
      var viewparams = [
        'x1:' + startCoord[0], 'y1:' + startCoord[1],
        'x2:' + finalCoord[0], 'y2:' + finalCoord[1]
      ];
      params.viewparams = viewparams.join(';');

      // we now have the two points, create the result layer and add it to the map
      result = new ol.layer.ImageLayer({
        source: new ol.source.SingleImageWMS({
          url: 'http://localhost:8080/geoserver/pgrouting/wms',
          params: params
        })
      });
      map.addLayer(result);
    }
  });

  document.getElementById('clear').addEventListener('click', function(event) {
    // hide the overlays
    startPoint.setPosition(undefined);
    finalPoint.setPosition(undefined);

    // remove the result layer
    map.removeLayer(result);
  });

</script>


texts: How to change tooltip of an esriControl?

texts:
Is there a way to change an esriControl's tooltip?

I tried using the ICommand interface but the tooltip propertry is read-only.

If I have to build a whole new ICommand and/or ITool is there anyway I can extend an esriControl so I do not have to build a new control from scratch?


texts: Moving / offsetting point locations using ArcPy or ModelBuilder?

texts:
I have a number non-georeferenced CAD layers (see this question) that have text annotation features.  I have created a model to convert the text to points, but after converting the annotation to a Point featureclass, I see that the CAD text anchor points do not coincide with the center of the CAD text (which is where the points belong).

Therefore, I would like to programatically (using ArcPy or ModelBuilder) [move] a feature relative to its current location (delta x,y) using a measured X,Y value that I will provide.

This would allow me to move the GIS points back to where they belong, instead of the offset CAD anchor point.

How can I accomplish this task?

@PolyGeo gave an excellent answer using SHAPE@XY IN 10.1, but currently I am running 10.0.  Any 10.0 ideas?


texts: Can a PostGIS table or view have two geometry columns?

texts:
I am just wondering if it is possible for PostGIS to have two geometry columns.

I use shapefile a lot, which has only one "Shape" column for geometry and all geometries in that column has the same geometry type (i.e. POINT, POLYLINE, POLYGON).

I wonder what are the rules for PostGIS regarding the geometry column? Can we have two geometry columns. If so, which is the default when one refer to a row? I've seen the use of the_geom or geom some times, are these names required?

I read that PostGIS maintains a view geometry_columns about geometry columns in tables. The view has a field called f_geometry_column. I also read that PostGIS takes care of the maintenance of this view automatically. That's what makes me wonder the rules under which it operates.

-- Update --

I have the question because as mentioned above, the way the geometry_columns view is organized seems to suggest that the correspondence between a table and  its geometry column is one to one. Is that right?

Also, if geometry is just another attribute type like Numeric or string, why do we need catalogs like geometry_columns.


texts: Multiple values from other fields in QGIS Field Calculator?

texts:
I have table, many rows, with column "landuse" (code numbers). I need column with text. How to do this in Field Calculator?

I mean this:

landuse
200
300
1231
300
200

new column:
wood
field
road
field
wood

EDIT

I have a solution...

CASE
  WHEN "lu" IS 200 THEN 'Vacice virginska'
  WHEN "lu" IS 700 THEN 'korytnačkař'
  ELSE 0
END


texts: Which algorithm does gdal_polygonize use?

texts: I would like to know which algorithm (i.e. Sobel operator ) is used to extract the polygons in gdal_polygonizer. I searched here and here but could not find it.


texts:
I'm using rgdal in R to generate a map of Minnesota at the county level, except that counties which are part of MSAs or micropolitan statistical areas are merged into one:

However, it's a bit unwieldy as some of the labels overlap. Is there any easy way to lessen this problem? I can think of some solutions, but most seem to be manual. Here is my current code:

library(rgdal)
library(GISTools)

mn_MSA <- readOGR(".", "mn_cbsa")
plot(mn_MSA)

numObs <- dim(mn_MSA@data)[1]
mylist <- c(1:numObs)

for (item in mylist) {
  text(coordinates(mn_MSA)[item, ][1], coordinates(mn_MSA)[item, ][2], mn_MSA$NAME[item], cex = 0.5)
}


texts: OpenLayers Vector Layer not aligned with Google Oblique Imagery

texts:
Check http://jsfiddle.net/vasile/BKvcX/6/

In the first map, the yellow line should follow the street curve, however if you pan the map up-down, you clearly see the misalignment due to what ?
Different projection used by the oblique imagery ?

The same line, on a normal Google Maps integration (second map) is rendered "normal"

How can the misalignment in the first map be fixed ?


texts: Spatial Autocorrelation with a low number input feature

texts:
I am an archaeologist using ArcGIS to run spatial statistics/analyses on my data. I want to study the spatial autocorrelation of artifact categories found within house structures across an archaeological site. I only have 18 features (house structures) and the statistic needs 30 features in the Input Feature Class field to yield reliable results.

Does anyone know of another statistical tool that I could use to run the analysis on a data set with a low number of features, or a way I could still use spatial autocorrelation with 18 features?

I am not very statistically savvy, so increasingly technical models would be difficult to apply.

The features are classified as polygons, there is only 18 in total, the data set
has 338 observations.


texts: Copying feature class within the same geodatabase using ArcObjects?

texts:
I'm trying to copy/clone a feature class within the same file gdb using C#.
I've figured out that this won't work with IDataset or IFeatureDataset.
So far I only found IGeoDBDataTransfer.Transfer but this is for copying between different workspaces.

Copying and pasting geodatabase datasets ArcObjects 10.1

I know I could do the whole things with a featureBuffer, but that's a very long winded way. And I don't want to use geoprocessing like CopyFeatures.

Do you have an idea how to get around this?


texts: Viewshed / Line of Sight analysis- as a batch process?

texts:
I wish to carry out a line of site analysis similar to the subject in here (preferably within QGIS): Visual Impact Assessment in QGIS or GRASS

Scenario:

I have two points, A and B. Point A is a signal provider and Point B is a signal receiver. Point A is at X altitude and Point B is at    Y altitude.
There may be hills between Points A and B (represented by either vector contour lines or a raster DTM) that block Point B from receiving signal.

Data:

A vector shapefile containing hundreds of points (the viewing position / Point A)

A vector shapefile containing several thousands of points (each point in this shapefile represents a position that needs to be viewed / Point B)
A 50 m resolution DTM in raster format (currently looking for higher resolution free data for the UK)

Question:

How can I establish that Point As are able to view all of Point Bs (via say, a mask?). And how do I run this as a batch process? At the moment I can only run the line of sight (LOS) analysis for one coordinate at a time:


texts: Calculating fraction of area characterized with certain values?

texts:
I have a rasater data with cell values of the following: missing, 1, 2, 3, 4, and 5

Now I need to find the fraction defined as (area with value 5)/(Sum of areas with values 1,2,3,4) for a certain polygon.

So I need to ignore missing values.

How do I do that in Arcmap?


texts: Polygonizing a raster yields lots of little squares?

texts:
I have a pdf with the area of a county that I want to separate into multiple shapefiles (polygons) based on color.

As shown in the first picture there are 4 colors so I would need to separate based on color between those four. But first, I need to convert it into a vector (unless there is an easier way).

Doing so, I get the second image as an output by using the polygonize tool which when zoomed in very close, has a lot of tiny squares where color should be different. I was wondering if there is a way to break a raster up by color even though the image isn't smart.


texts:
I have a script tool in ArcGIS 10.1. Some of the parameters are optional and if they are left blank, will not be processed. They are numerical parameters and I want to enforce this in the tool, so an error is raised if entering any letters in the parameter for example. I have achieved this in updateMessages() setErrorMessage(...) and I get the correct error raised (see graphic)

Validation code is as follows:

 @staticmethod
 def is_string(s):
 try:
   float(s)
   return False
 except ValueError:
   return True
 except TypeError:
   return True

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."""
return

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

self.params[1].clearMessage()

string_error = 'Please input a number, not text'
if ToolValidator.is_string(self.params[1].value):
  self.params[1].setErrorMessage(string_error)
if ToolValidator.is_string(self.params[2].value):
  self.params[2].setErrorMessage(string_error)
if ToolValidator.is_string(self.params[4].value):
  self.params[4].setErrorMessage(string_error)
if ToolValidator.is_string(self.params[5].value):
  self.params[5].setErrorMessage(string_error)

return

However, the "internal" ArcGIS validation seems to clear the field. If the tool is run the same error message will come up. However since I want to be able to have a blank field, this is not optimal as there is now no way of entering a blank value because the error keeps coming up. Is there any way of preventing ArcGIS validation from blanking out the field so that it retains the original value entered, which is more intuitive?

Also, I thought error messages were supposed to be red, not green - documentation for setErrorMessage() here.


texts: Understanding why MSAVI II values are outside the theoretical range

texts:
I am trying to understand why certain vegetation indices do not fall into the -1, 1 theoretical range.

I generated Modified Soil Adjusted Vegetation Index II values in Google Earth Engine using surface reflectance images.  My MSAVI II values are all below 1, but can drop down to -7 (-288 in one extreme case). When I calculate the zonal statistics for a given polygon in QGIS 2.18, the extreme negative values impact the mean.

Based on a response by Jeffery Evans (Soil Adjusted Vegetation Index Values (MSAVI2) are Not Within Expected Range), I understand that MSAVI II is one of the slope corrected indices that will have values greater than 1 or less than -1; however, I cannot find information with a full explanation even after reading the two cited articles.

Could anyone provide documentation that explains this phenomenon, or suggestions on how to correct this issue? If negative values are theoretically acceptable, do I just have to ignore questionable means and go with the median?


texts: Stratified ordinary kriging using gstat and stars packages

texts:
The gstat package supports stratified ordinary kriging using sp objects as shown at https://github.com/r-spatial/gstat/blob/master/demo/examples.R (the code below).
This year (https://r-spatial.github.io/gstat/news/index.html) gstat also got support for sf and stars objects.
While sf and stars works well for many geostatistical methods, I am unable to make it work for stratified ordinary kriging.

# an example of gstat + sp
library(gstat)
library(sp)
data(meuse)
coordinates(meuse) = ~x+y
data(meuse.grid)
gridded(meuse.grid) = ~x+y

meuse$part.a = krige(part.a ~ 1, meuse.grid, meuse, nmax = 1)$var1.pred
#> [inverse distance weighted interpolation]
x1 = krige(
        log(zinc) ~ 1,
        meuse[meuse$part.a == 0, ],
        meuse.grid[meuse.grid$part.a == 0, ],
        model = vgm(.548, "Sph", 900, .0654),
        nmin = 20,
        nmax = 40,
        maxdist = 1000
)
#> [using ordinary kriging]
x2 = krige(
        log(zinc) ~ 1,
        meuse[meuse$part.a == 1, ],
        meuse.grid[meuse.grid$part.a == 1, ],
        model = vgm(.716, "Sph", 900),
        nmin = 20,
        nmax = 40,
        maxdist = 1000
)
#> [using ordinary kriging]
x = rbind(as.data.frame(x1), as.data.frame(x2))
gridded(x) = ~x+y
spplot(x["var1.pred"], main = "stratified kriging predictions")

The main problem is how to use only selected values from a stars object.

library(stars)
#> Loading required package: abind
#> Loading required package: sf
#> Linking to GEOS 3.7.1, GDAL 2.3.2, PROJ 5.2.0
library(sp)
data(meuse.grid)
gridded(meuse.grid) = ~x+y
meuse.grid_stars = st_as_stars(meuse.grid)
meuse.grid_stars[meuse.grid_stars$part.a == 1, ]
#> Warning in structure(eval(rlang::expr(x[[i]][!!!args])), levels = attr(x[[i]], : Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
#>   Consider 'structure(list(), *)' instead.

Is it possible to do stratified ordinary kriging using gstat and stars?


texts: In QGIS, has FGDB support improved this year, 2013?

texts: I'm aware that there are users who successfully use Esri File Geodatabases with QGIS 1.8 Lisboa.  FGDB support in QGIS requires the Esri API for FGDB, which is not open source (as I understand), and QGIS does not support it by default.  Has this year (2013) brought any new significant improvements in support for the FGDB format, for improved read/write functionality for instance, or is something forthcoming for next year (2014) to lessen the setup time for using this format?


texts: Testing Tools For Simulating User Interaction - Especially Map Panning

texts:
Can anyone suggest any tools that can simulate users panning around in a map?  I have used tools such as SoapUI to do load testing, but never anything to simulate users.

In case it matters, the app I will be testing is based on ESRI Javascript API.


texts: Convert MapInfo raster file (.tab) to use it in QGIS and/or ArcGIS

texts:
I am trying to convert raster files from MapInfo (.ecw, .jpg, .TAB) in order to use them with QGIS or ArcGIS. I have access to all 3 softwares.

I have tried Data interoperability tools in ArcGIS but it is not working ("Tool execution failed.").
I have also used a MapInfo tool (.mbx) designed for this purpose (http://georezo.net/wiki/main/logiciels/mapinfo/outils/ut4rt) with more success. I can then open the file with QGIS, but the output file is a bit off (even with the right coordinate system).


texts: When it comes to 2D-data it seems there are a couple standards out there to represent it in a semantic way (GeoSPARQL, NeoGeo, ...). However I couldn't really find one to do that for 3D-data. I have some CityGML-data but that does not seem to be an appropriate format to do formal reasoning of a geometry level. Do you know of any current standard or groups that work on that problem?


texts: Define characteristics (wave lengths, etc) of bands created by split order in Orfeo Toolbox

texts:
I have an orthophoto layer (exported from photoscan, drone images) that consist of four bands.

I extracted bands using "split image" order, but I can't understand which of them are NIR, green, red and red edge. How I should understand the output of the split image tool?


texts:
I am trying to add the political boundaries baselayer from http://www.cec.org/Page.asp?PageID=924&ContentID=2336
and then on top add points where I gathered coordinates from Google Earth (using a delimited text layer). I can see both layers in QGIS but my points are not in the right location and I have to zoom in way too close to be able to see them. It seems to be an issue of scale or projection or something. Im new to QGIS and GIS in general, what things can I try to try and make these layers fit better.


texts: count how many times an attribute is repeated, using "field calculator"

texts:
I'm using Arcgis 10.2.2
there is a way to count how many times an attribute is repeated, using the "field calculator"

to make a selection after example of repeating more than 20 times


texts: Removing last part of a field in QGIS attribute table, not the same length of cells

texts: I got a question regarding removing and/or creating a new field just with the 4 first characters of a field. Whenever I search for this I just find answers about how to remove a specific number of values from the front or the back, the problem here is that I have fields with a 4 digit number and then different names! like for example "2481 New York" and the next one "4521 Seattle" and I want a new field with only the first digits!


texts: AddLayer method does not add all bands of .tif image (3 bands total)

texts:
I am currently having trouble getting 3-band raster's to display correctly when I call the arcpy.mapping.AddLayer() method.  It should be said that I am using a pre-existing mxd template to automate the mapping process and output jpg's as the final product.

here is a snippet to demonstrate how I am adding the layers;

    import arcpy

    mxd = arcpy.mapping.MapDocument("path_to_mxd")

    data_frames = arcpy.mapping.ListDataFrames(mxd)

    df = data_frames[0]

    layer = arcpy.mapping.Layer("path_to_layer")

    arcpy.mapping.AddLayer(df, layer, "TOP")

this code adds the layer object but it does not include all bands of the image so what I am left with looks like a negative copy of the original image.  I have tried to work around this by including a layer with correct symbology and then using the ApplySymbologyFromLayer_management() method but it does not work and when tried with the python command line in ArcMap, the image(s) display a lock in the bottom right corner of their description in the table of contents.  I only want the images to display with RGB composite symbology.  Any help would be greatly appreciated and I will check often if more info is needed.  Also I did read the post titled: "Is there a way to programatically force RGB (3 bands)" etc... the rasters I am adding already contain 3 bands and arcpy is only adding one in a stretched format so please consider this when answering, Thanks