texts: QGIS "Failed to add field" to PostGIS table

texts:
I have just ran into an issue with QGIS/PostGIS. Here is a summary of my problem:

I have uploaded a world country boundaries shapefile as a PostGIS table to my database.
I add the new PostGIS table to QGIS as a layer.
I toggle editing for the table so that I may edit the file.
I click on "New Field" and enter "test" as the field name, leaving everything else default.
I click "OK" and the following error message pops up: "Failed to add field 'test' of type 'int2'. Is the field name unique?"
There is no other field named "test", and no other field name works.

All the googling I have done on SE/SO and this sub have left me empty handed. Does anyone have an idea as to why I cannot add a field to this PostGIS table?

At first I thought it may have been a privilege issue with Postgres but I double checked the login role that I used has insert/update/delete privileges. Additionally, I connected to the database using the superuser credentials and had the same issue.
For reference, I am using QGIS 2.18.9 with Win7 x64.

Also, some additional information: When I toggle editing for the table, the "Delete field" button is still grayed out, which I thought was odd as usually that button is usable when editing is toggled on. Not sure if that's helpful or not.


texts: "Schema does not exist" error trying to load raster using raster2pgsql

texts:
I receive a "schema does not exist" error when trying to load a raster to a PostGIS database (see full error at the bottom). The schema does exist in the database. This is the syntax I'm using:

raster2pgsql -s 2048 -I -C -Y C:\Users\My_Book\Desktop\LOAD2POSTGIS\Aspect.tif environmental.aspect > Aspect.sql
psql -h localhost -U postgres -d Howbill -f Aspect.sql

I am able to load the raster into the default public schema if I leave out environmental.aspect. However, that leads to other problems when moving the raster table from the public schema to another schema. More details regarding the moving from public schema to other schemas can be viewed here:

Can't view PostGIS rasters after changing schemas

**Full error:**

C:\Program Files (x86)\PostgreSQL\9.2\bin>raster2pgsql -s 2048 -I -C -Y C:\Users\My_Book\Desktop\LOAD2POSTGIS\Aspect.tif environmental.aspect > Aspect.sql
psql -h localhost -U postgres -d Howbill -f Aspect.sql
Processing 1/1: C:\Users\My_Book\LOAD2POSTGIS\Aspect.tif

C:\Program Files (x86)\PostgreSQL\9.2\bin>psql -h localhost -U postgres -d Howbi
ll -f Aspect.sql
BEGIN
psql:Aspect.sql:2: ERROR:  schema "environmental" does not exist
psql:Aspect.sql:3: ERROR:  current transaction is aborted, commands ignored unti
l end of transaction block
psql:Aspect.sql:5: invalid command \.
psql:Aspect.sql:6: ERROR:  syntax error at or near "010000010013"
LINE 1: 010000010013B444D4496B144013B444D4496B14C082F38736BB1CD94011...
        ^
psql:Aspect.sql:7: ERROR:  current transaction is aborted, commands ignored unti
l end of transaction block
ROLLBACK

C:\Program Files (x86)\PostgreSQL\9.2\bin>


texts: Remove Feature from Layer on Zoom - OpenLayers 3.19

texts:
I'm trying to erase the content of my layer when I zoom but even if I clear the source, the icons are back on the map again. I'm blocked since one week, please help. There is my code

/**** Define the layer and the vector of feature ****/
var vectorSource = new ol.source.Vector({});
var vectorLayer = new ol.layer.Vector({
    source: vectorSource
});

/**** Define the map ****/
var map = new ol.Map({
     controls:[],
     layers:[new ol.layer.Tile({source: new ol.source.OSM()})],
     target: document.getElementById('main-map'),
     view: new ol.View({
         center: [0,0],
         zoom: 3
     })
});

/**** Define one icon ****/
var iconStyle = new ol.style.Style({
    image: new ol.style.Circle({
      radius: 5,
      fill: new ol.style.Fill({color: 'yellow'})
    })
});

var feature = new ol.Feature({
    geometry: new ol.geom.Point(ol.proj.fromLonLat(["0","0"]),
    style: iconStyle
});
vectorSource.addFeature(feature);

/* On change, erase the previous icon (not working) and add a new one */
map.getView().on('change:resolution', function() {
    vectorLayer.getSource.clear();

    var feature = new ol.Feature({
        geometry: new ol.geom.Point(ol.proj.fromLonLat(["1","1"]),
        style: iconStyle
    });
    vectorSource.addFeature(feature);
});


texts:
Does anybody know if there is a way to export the current view of a Leaflet map to jpg?  The setup is as follows:

Leaflet is hooked up to an Oracle database. Depending on user interaction, various Geojson layers are displayed.  I'd like to include a way for the user to export the current view to a static file (jpg or png).  The static file should include the basemap.

Any ideas?


texts: Can't set a geometry data type in PostgreSQL

texts: I have the datatype geometry defined. But I can't set it to one of the columns geom. as shown in the figure.


texts:
What is the .NET code equivalent for this general ArcMap command syntax:

Application.Document.CommandBars.Find(ArcID.Query_ClearSelection).Execute()

I have been using this one below as a work around, however it is much more code than what I would like to use.

Dim pUID As New UID
Dim pCmdItem As ICommandItem
'Use the GUID of the Save command
pUID.Value = "{AB073B49-DE5E-11D1-AA80-00C04FA37860}"
'or you can use the ProgID
'pUID.Value = "esriArcMapUI.MxFileMenuItem"
pUID.SubType = 3
pCmdItem = m_App.Document.CommandBars.Find(pUID)
pCmdItem.Execute()


texts: TileStache Cache tiles to Digital Ocean Space

texts:
Using Tilestache, i can configure tiles cache directory to Amazon S3 Bucket
http://tilestache.org/doc/TileStache.S3.html
  "cache": {
    "name": "S3",
    "bucket": "<bucket name>",
    "access": "<access key>",
    "secret": "<secret key>"
  }

But i have a digital ocean space, where my rest of data is hosted. How can i configure it to Digital Ocean space ?


texts: Using Geometry.distance_to() in ArcGIS API for Python

texts:
I'm calculating distances between points in arcpy or ArcGIS API for Python, and am probably doing something wrong.  Hopefully, someone can show me what.  Take this as an interactive session with ArcGIS Pro's Python interpreter.

I'm starting with:

earthRadiusInKm = 6378.137

sr = arcgis.geometry.SpatialReference(wkid=4326)
type(sr)    # arcgis.geometry._types.SpatialReference
sr          # '{ "wkid": 4326 }'

# Looking good so far
p1 = arcgis.geometry.Point (x=0, y=0, spatialReference=sr)
p1    # { "x": 0, "y": 0, "spatialReference": { "wkid": 4326 } }
p2 = arcgis.geometry.Point (x=1, y=1, spatialReference=sr)

p1.distance_to(p2)           # 1.4142135623...
math.radians(p1.distance_to(p2)) * earthRadiusInKm # 157.4295
# which, the cos(theta) being ~= theta for small angles, looks correct

Going to skip a few specifics (since I can't cut and paste from where I did my testing)

The long and short of it is, though, that, no matter what coordinates I put in (including, say, just off from the poles, or near the Date Line), Point.distance_to() is returning the Pythagorean distance between those two points.  So, it's very close on small angular differences, except for the edge cases above, and gets further off the larger the degree difference is.

I assume that's because the SpatialReference is somehow wrongly-formed, but I have no idea how it is (the documentation on SpatialReference is lacking some specifics.  I have no clue what sort of iterable it would take as an unlabeled argument, for instance).  I also tried playing around with different spatial reference arguments (just passing an integer of 4326 in, say), but always got the same results.

Can anyone point me in the right direction?

I have tagged this with ArcPy, even though my examples are written in ArcGIS API for Python, since it appears that ArcGIS API for Python uses ArcPy internally (I've always gotten 0 from distance_to() when ArcPy was not already imported).


texts:
I'm creating a tool that when you type in the city name it will select the city, zoom in and label it. I have the zoom and label working but can't figure out the SQL Query needed to select the city I type in the tool in ArcMap. My code in below.

I'm still new at this

import arcpy as ARCPY

def citySelect():

    mxd = ARCPY.mapping.MapDocument("CURRENT")
    df = ARCPY.mapping.ListDataFrames(mxd)[0]
    city = ARCPY.GetParameter(0)
    cities = ("N:/Lab13/Lab13/cities.lyr")
    ARCPY.SelectLayerByAttribute_management("cities", "NEW_SELECTION",''' "CITY_NAME" = ' city ' ''')
    print city[0]
    layers = arcpy.mapping.ListLayers(mxd, "", df)
    citiesLayer = layers[0]
    df.zoomToSelectedFeatures()
    citiesLayer.showLabels =True
    ARCPY.RefreshActiveView()

citySelect()


texts: Find rectangle around point with python?

texts:
Given a point, latitude and longitude, how would one find the coordinates of a rectangle centered on that point with a known width and height in meters? I tried using the Geodesic stuff from geographiclib in python to compute the rectangle coordinates, but the resulting rectangle has the wrong aspect ratio. The general idea here is to compute a rectangle around a given point and then use that rectangle to clip LANDSAT 8 imagery to a final image with a known aspect ratio.

Sorry if this is a dumb question, I've just started doing work with GIS recently.

[EDIT]

I tried modifying my code to do something like what the first answer below does, but this doesn't quite work for me, I run into the same problem I was having before, when I clip the landsat tiff I get an image with the wrong aspect ratio. The command I'm using to clip the geotiff looks something like this
    gdalwarp -of gtiff -t_srs EPSG:4326 -te <bounds from the polygon that I calculated> input.tif output.tif.
The width and height I used should give me an image with an aspect ratio of 1.6 but instead I get an image with an aspect ratio of about 1.9 or so.


texts: CartoDB - feature appears only on some scales

texts:
I have a single feature in a cartodb which I am pulling into my HTML page using var layerUrl = 'path-to-/viz.json';

cartodb.createLayer(map, layerUrl)
    .addTo(map)

And I can see the layer on some zoom scales but others it vanishes.

It can't be a conflict with another geometry as there are no others in the table.

Any ideas?

EDIT

The path to a test viz is here: https://osnhs.cartodb.com/api/v2/viz/39628358-3206-11e5-8ec0-0e4fddd5de28/viz.json

My HTML page enables a user to draw a polygon using the Leaflet draw polygon tool and this is then saved to a table.

This table is then used for the viz.json

It seems the polygon does not show at the zoom level that the polygon is drawn at. If I zoom one level out or in the polygon appears.

Unfortunately, I cannot share the complete HTML but I used the following example http://bl.ocks.org/matallo/130b969a6cc76939985d


texts:
We are upgrading ArcGIS from version 10.0 to 10.3 and need to update our server object extensions.

Esri state that when upgrading:

"Avoid using ArcObjects from the Carto library that are specifically designed for use with MXDs. This includes IMap, ILayer, and items related to data frames and page layouts.

In 10.0, we developed an SOE that could dynamically generate map images (with legends, scale bar etc.) using the PageLayout class from ArcObjects Java API. But as the above statement suggests, apparently we can't use that PageLayout class anymore. We need fine control of the page layout and so what is the alternative in 10.3? Sample Page Layout SOEs provided use the PageLayout class. So can we still use this class in our SOEs when upgrading to 10.3 or not?


texts:
I am new to OpenLayers, I am using it for an office layout, so I use an ImageStatic layer as background, image size is 1024x968. As it is not an earth map, I want to draw a box on map and get the real size of the box. I don't know where I can set the ratio, I mean if 1024 equals to 1024 meter, how can I set this value? Or maybe 1024 pixels equal to 2048 meter for another image, how to set that too?

Below is the code I use to create map:

const extent = [0, 0, 1024, 968];
const projection = new Projection({
  code: 'mycompany',
  units: 'pixels',
  metersPerUnit: 10,
  extent,
});

const imageLayer = new ImageLayer({
  source: new ImageStatic({
    url: 'http://localhost:8081/static/a35.png',
    projection,
    imageExtent: extent,
  }),
});

const source = new Vector({ wrapX: false, features: this.features });

const vector = new VectorLayer({
  source,
});

const map = new Map({
  controls: Control.defaults().extend([new FullScreen()]),
  layers: [imageLayer, vector],
  overlays: [overlay],
  target: 'map',
  view: new View({
    projection,
    center: Extent.getCenter(extent),
    zoom: 2,
    minZoom: 2,
    maxZoom: 4,
  }),
});
map.addInteraction(draw);
this.createMeasureTooltip(map);
draw.on(
  'drawstart',
  evt => {
    this.sketch = evt.feature;
    this.listener = this.sketch.getGeometry().on('change', evtChange => {
      this.measureTooltipElement.innerHTML = this.formatArea(evtChange.target);
      this.measureTooltip.setPosition(evtChange.target.getInteriorPoint().getCoordinates());
    });
  },
  this,
);

I am using following function to get the area size:

formatArea(polygon) {
  const area = Sphere.getArea(polygon);
  let output;
  if (area > 10000) {
    output = `${Math.round(area / 1000000 * 100) / 100} km<sup>2</sup>`;
  } else {
    output = `${Math.round(area * 100) / 100} m<sup>2</sup>`;
  }
  return output;
}

But this just called getArea, and I don't understand how can it calculate the size in meter?

Whenever I change the metersPerUnit to 10 or 10000, the area are always same.

I changed my code as below and by changing radius I can get any number I want, but I don't know if it's a good way:

  const area = Sphere.getArea(polygon, {
    radius: 1000000,
  });


texts: Update column in .shp from .tab with QGIS

texts:
Is it possible to perform in QGIS an "update column" on a .shp table with data from a MapInfo.tab having one field apparently in common?

One of the greatest uses of QGIS (for me) is the availability of working with different types of archives simultaneously (.tab, .shp) without having to change from one program to another or having to convert everything into one format.


texts: How to do a coordinate transformation with EPSG codes in CTS?

texts:
Let's say I want to convert the following WGS84 (EPSG:4326) coordinate to UTM32N (EPSG:25832):

54.321, 9.876

Is there any tool to reproject x,y coordinates, apart from Proj4? links to the CTS wiki.
The CTS wiki has a rough outline at https://github.com/orbisgis/cts/wiki

So, according to the wiki it would be something like this:

double[] coord = new double[2];
coord[0] = 54.321;
coord[1] = 9.876;

CRSFactory cRSFactory = new CRSFactory();
CoordinateReferenceSystem crs1 = cRSFactory.getCRS("EPSG:4326");
CoordinateReferenceSystem crs2 = cRSFactory.getCRS("EPSG:25832");
GeodeticCRS sourceGCRS = (GeodeticCRS) sourceCRS;
GeodeticCRS targetGCRS = (GeodeticCRS) targetCRS;
List<CoordinateOperation> coordOps = CoordinateOperationFactory.createCoordinateOperations(sourceGCRS, targetGCRS);

if (coordOps.size() != 0) {
    for (CoordinateOperation op : coordOps) {
        double[] dd  = op.transform(coord);
        for (int i = 0; i < dd.length; i++) {
            System.out.println(dd[i]); // for debugging
        }
    }
}

But this leaves me with

Exception in thread "main" org.cts.crs.CRSException: Cannot create the CRS
    at org.cts.CRSFactory.getCRS(CRSFactory.java:109)
    at my.package.CTSCoordinateTransformation.main(CTSCoordinateTransformation.java:34)
Caused by: org.cts.registry.RegistryException: This registry EPSG is not supported
    at org.cts.CRSFactory.isRegistrySupported(CRSFactory.java:149)
    at org.cts.CRSFactory.getCRS(CRSFactory.java:97)
    ... 1 more

Trying to find valid codes I used

CRSFactory crsFactory = new CRSFactory();
System.out.println(crsFactory.getSupportedCodes("EPSG"));

but that gave me

Exception in thread "main" java.lang.NullPointerException
    at org.cts.CRSFactory.getSupportedCodes(CRSFactory.java:227)
    at my.package.CTSCoordinateTransformation.main(CTSCoordinateTransformation.java:33)

org/cts/registry/epsg exists within the jar.

I also filed this as issue at https://github.com/orbisgis/cts/issues/65

PS: I can transform if I create the CRS from PRJ strings first but that is not an option for me, I want to be able to use EPSG codes.


texts: Automatically calculate elevation difference of polylines in QGIS

texts:
I have a layer of polylines and I want the elevation difference (how many metres the line goes up and down) for each feature in the attribute table, using QGIS 3.2.

So far I tried the plugin "Profile Tool", but it shows only the minimum and maximum elevation point, so I have to manually calculate and enter the differences in the attribute table. I also tried the GRASS tool "r.profile", but I didn't make it work and I'm not sure if it achieves my goal.

So, is there a more automated way to get the elevation difference, than manually calculating it from the Profile Tool?


texts: Adding local directory path as hyperlinks in qgis2web

texts:
I'm using qgis2web, and I wonder if it is possible to add a local directory path as hyperlink in Leaflet or openlayers map popups, maybe or automatically from field's edit widget or by editing the code?

I'm trying to be able to open the local directory when I do click the hyperlink on the popups.


texts: Extracting data from Address field using ArcGIS for Desktop?

texts:
I am fairly new to using python in field calculator and could use some help.
I want to populate SitusRdType with RD or AVE or LN or ST or DR depending on the road type.  I also want to just have the street name in SitusSt.  Any thoughts on how to go about this?


texts: How to refer to Obj file when storing tab file name in a String variable?

texts:
I need to loop through tab files and use select, am doing the following:

 Dim file_name as string
 Dim file_name_obj as string

 file_name = area1
 file_name_obj = area1.Obj

Am getting an "Datatype mismatch in expression" message in MapInfo, is it incorrect to have the above assignment? and what is the alternative method to refer to object files while file name is stored in a string variable?


texts: Splitting polgons in QGIS produces topology errors

texts:
I am trying to split existing polygons but when I do, gaps and overlaps are created between the polygon I am cutting and adjacent polygons.

I have snapping switched on and have enabled topological editing. I also get lines appearing across the screen which then disappear if I zoom in or out.

For example in the image below the line with the red arrow pointing to it is not a polygon boundary and disappears when I zoom. Also if I delete a polygon I am sometimes left with strange dangling nodes that should not be there.


texts: How to extend line features up to their intersection point in QGIS?

texts: Is there a tool or plugin in QGIS to extend line features up to their intersection point?


texts: Making button that calls Python script as command rather than script tool?

texts:
I believe that in Arc9.3, commands could be created using VBA scripts. To add a custom command, you would navigate to Customize > Toolbars > Customize... and click UIControls. However, UIControls is not there in version 10.

I am creating two separate scripts for a map book project. One script will save the layout settings to a table, and the other will update the layout with settings from the same table. I want both of these scripts to be commands assigned to buttons in a toolbar. I created them as script tools, but whenever I click on them, they run the script as a geoprocessing tool. It brings up a progress window, and it takes about 10 times longer to execute than if I had run the code in the Python command line window. I don't want the progress window or the much longer execution time.

How can I make it so that the script isn't considered a "tool" and is instead a command similar to the Save button?


texts: Blank Base Map when exporting from Print Composer

texts:
When exporting from composer in QGIS to either an image or PDF the map does not print. I get a white page with only the shapefiles showing up.

This happens when the map is rotated 90 degrees. This only happens with maps from QuickMapServices plugin. If I load a raster image there are no issues.

Wondering if there is a way to get the QuickMapServices maps to show up when rotated 90 degrees?

This is what the map looks like in composer:

And this is what I get when I print the map


texts: High-DPI printing with ArcGIS API for JavaScript and esri.dijit.Print?

texts:
I've got cached tiles for all map layers at various zoom levels, and would like to print at DPI higher than the default (around 96) by using tiles from a deeper zoom level. It doesn't matter if map features become very small or unreadable. I've tried passing a higher DPI setting:

template=new PrintTemplate();
template['layout']='MAP_ONLY';
template['exportOptions']={dpi:300,width:3200,height:2400};
template['preserveScale']=false;
template['format']='PDF';

printWidget=new Print({
    async:true,
    map:map,
    url:url,
    templates:[template]
},dom.byId('printButton'));

printWidget.startup();

However pixels in the resulting PDF are still very large. The server seems to choose the zoom level of the tiles based on the map extent only, but always according to about 96 DPI. The preserveScale option does nothing (I checked that it doesn't get passed to the server at all) and the DPI setting is sent to the server but doesn't affect the resulting image.

What can I do to increase the output DPI by printing tiles from a deeper zoom level than is shown on screen?

Creating an A3 or A2 sized printing template and instructing users to configure their printing settings to scale it to A4 fixes the problem, but it would be preferable to produce a correct PDF.


texts: QGIS 3 relationship strength "Composition"

texts:
is there somebody who can explain the usage of the relationship strength "Composition" in QGIS 3? What can the user do in detail when setting to "Composition"?

Relationship strength sets the strength of the relation between the
parent and the child layer. The default Association type means that
the parent layer is simply linked to the child one while the
Composition type allows you to duplicate also the child features when
duplicating the parent ones.

This is only a short description. I checked out to copy and paste a polygon feature with a relation to a point feature (relationship strength "Composition"). Failed.


texts:
Some questions about VB scripts:

Can I read and modify the code of a VB script?
If the answer is yes, how can I do it?
How can I run a VB script?
Can I use it as a VBA code eg.using variables instead of certain data as defined in a model created using the ModelBuilder?


texts:
I'm looking for an open source cloud GIS solution.

Current situation:
Up to 100gb of data stored in file geodatabases that is updated daily. Data is used to create maps as well as geoprocessing tasks.

Ideally I only want one copy of the data however it needs to be shared across multiple companies working on the project who will also be adding new data and updating old.
The GIS users are using ArcGIS Desktop v10.1 but for the rest of the project team I would like to have a data viewer that can do simple tasks such as measure and buffer. If we could create a few custom tools for the data viewer that would be great.

So my main criteria is Data storage:

Store large volumes
Good access from anywhere
Quick and easy to update
Manageable from custom front end?
Easy to share data
Secure
Backed up
Permission levels

Data viewer:

Good symbology
Transparency
Good base mapping
Deal with different projections
Fast
2D and 3D?
ID tool
Link through to documents/images
Add simple tools
Zoom and measure
View CAD and GIS, raster, vect, TIN
Good access
Create features
Add in data and coords
Permission levels

I am hoping to achieve a solution that is cost effective and well supported. I'm thinking it will be a bolt together solution made up of multiple components but I just don't know where to start.

There are better options than file geodatabases for storing the data which are better suited to multiple access but I can't remember what they are called (still an ESRI database)? Happy to use large database functionality attached onto them such as SQL or Oracle - would this help? I don't have ArcGIS Server only desktop which we'd like to remain using.... Surely open-source elements can still use ESRI desktop?
I haven't had much joy with decent viewers either - the only two nice ones I have seen are Autodesks Infrastructure Modeller (Autodesk 360) and Google Earth Builder.... I know there is a price to pay for those two but if there is nothing open source that matches then I would be willing to pay. Apparently ArcGIS Online doesn't allow you to even interrogate raster images which would be no use to us as we deal with height data a lot.
Hence this is probably going to be a miss match of all sorts of software but I'm sure I can get something working?
I would also like a customised metadata editor rather than the nasty one in ArcCatalog... Something that would log the incoming data in a database and also apply that same metadata to the feature classes in the geodatabases automatically. I don't like producing lose XMLs like you get with shapefiles.
Am I just setting unrealistic targets with pie in the sky dreaming or do you think something is achievable?


texts: Creating custom PROJ projection from control points

texts:
I have a JPG raster, and I used QGis to georeference it with "control points", which are pixel coordinates linked to map coordinates, in EPSG:4326 (lon, lat).

Here is an example of the control points we can have from QGis from raster to EPSG:3857

I would like to create a custom projection system for this image, and generate the PROJ text line, in order to add it to PostGIS for example, and use this custom image projection like any other projection system.

I can't find any documentation on how to create PROJ parameters from a list of control points image coordinates / map coordinates. Do you have any idea of how to create these parameters?


texts: I downloaded the LeafletSlider repo https://github.com/dwilhelm89/LeafletSlider to test it out and then modify it to my needs, but when I open the index.html it doesn't have the slider as shown in the demo and the points in points.json aren't showing either.


texts:
I have a contour line file that covers the most part of north italy (shape is 0,6 gb) and I want to use v.generalize (snakes algorithm) on it.
Because of the large file size, if I use Grass 6.4.3 I saturate all my memory and after 1,5 days of work nothing appends (the progress bar does not increase).
I tried to use Grass 7.0 and I got this error "ERROR: G_calloc: impossibile allocare 11777 * 8 bytes di memoria a matrix.c:37"

For a good generalization I can't devide the layer... Someone have a suggestion for doing that?

Thanks in advance.


texts: Restricting base map on specific extent in ArcGIS API for JavaScript 3?

texts:
Currently I am using ArcGIS JS API ver 3.3/3.5 in my application.

I want to restrict the basemap for US only .For example one can use default navigation features like zoom in, zoom out for the US Country only.

Trying following things:

I have set the US extent code in my application but when I zoom out then I can see the whole world map I want to restrict it to certain extent only
Going through this question: Restrict pan and zoom in ArcGIS Javascript API?
Restricting the streets basemap using this question, but unable to restrict the map: Using own basemap with ArcGIS API for Javascript?
I am using this sample map in my application.


texts: Best Approach to display charts on a web map?

texts: I have a very basic understanding of GIS through some basic work with openlayers in Drupal CMS. I am trying to understand what is the best approach to display a chart on a map (like the one below)? I want the users to be able to at least control/change the numbers of the charts in the map. I understand that the layer itself and the associated legend can be served through a WMS. But what about the statistics that appear above the city. What would be the best "framework" to manage and display such a data?


texts: How to get path for layers listed in a combobox?

texts:
I want to get the path of a layer in my plugin, in the console it works fine but in my plugin it gives me the error  AttributeError: 'NoneType' object has no attribute 'dataProvider'

 def run(self):
"""Run method that performs all the real work"""
# show the dialog
self.dlg.show()
mapCanvas = self.iface.mapCanvas()
self.dlg.comboBox.clear()
for i in range(mapCanvas.layerCount()-1,-1,-1):
    layer = mapCanvas.layer(i)
    layerName = layer.name()
    self.dlg.comboBox.addItem(layerName)

# Run the dialog event loop
result = self.dlg.exec_()
# See if OK was pressed
if result == 1:

    index = self.dlg.comboBox.currentIndex()
    layer = self.dlg.comboBox.itemData(index)
    layer1 = os.path.dirname( unicode( layer.dataProvider().dataSourceUri() ) )
    t = "C:/Users/slop2.tif"
    processing.runalg("gdalogr:slope", layer1, 1, True, True, False, 1.0, t)

    pass


texts: Rule-based labeling moved and overlapped

texts:
When I move my labels with the move label tool my double rule-based label is overlapping.
I have tried to change the settings of its position but it is not possible to affect it once its moved.

Any ideas?


texts: Kmz features are labeled by global ID. Can I label them differently?

texts: So I have taken a layer from ArcMap and exported it to a kmz.  It is a map of electric utilities in a single county.  When I look at the kmz in google earth, it is mapped correctly, however, every utility line that has a name is labeled by the global ID column from layer attribute table.  The label I want is under a different column in the attribute table. (as you can see on the image of the table, I don't need the {A95C0012... number, I need the CircuitID1 to be the name.)  Can I export a kmz that will name each feature based upon a different column within the attribute table?


texts: QGIS 3.4 Geopackage Raster Handling and DB Manager

texts:
I just discovered a little mytery on Geopackage rasters and QGIS 3.4:
- Exporting a img-Raster into a Geopackage works fine - also opening it
- Opening the this "geopackage raster" in ArcGIS Pro 2.3.3 does not work
- Exporting the same raster with AG Pro into the geopackage works and also opening this one in QGIS or AG Pro :-)
- Having a look with the QGIS DB Manager on the geopackage with the raster was myterious: It just showed the raster created by AG Pro in the geopackage, but not the rasters created by QGIS ???

Does someone know why the IMG-->GeoPackage raster does not work with AG Pro and is not shown in the QGIS DB Manager, whereas the AG Pro created rasterlayer in this geopackage works well and is shown in QGIS DB Manager ? The difference seems to be the data_type-field (Screenshot 3).


texts:
What are the valid values for "band" in a GeoTiff file?

I've looked through the Geotiff Spec at http://www.remotesensing.org/geotiff/spec/geotiffhome.html and I am having trouble finding information about multi-band imagery.

I'm looking for documentation that answers these questions:

Do the band values always start at 1?
Is band 0 a valid band?
What is the max band allowed?

I am looking at the Band information that is reported from running gdalinfo on a geotiff file.


texts: Pass variable Layer in function parameters in PyQGIS

texts:
I want to pass this layer = self.iface.activeLayer() into a function import_meta(self, layer) to be used like a layer object  dpr = layer.dataProvider()

But when I run the script I get error  AttributeError: 'xdr_ImportMeta' object has no attribute 'dataProvider'  dpr = layer.dataProvider()

I guess the variable's type layer doesn't pass as I want.
This is the code:

def import_meta(self, layer):
    dpr = layer.dataProvider()

def run(self):
    layer = self.iface.activeLayer()
    self.import_meta(self, layer)


texts: Simple Field Calculation With No Results in ArcGIS Pro?

texts:
I have a grid in ArcGIS Pro that I've named the X and Y axis (in separate columns) and am now trying to do a field calculation on the total grid name (I've tried using both single and double quotes. I've tried using just a space, to test if maybe I needed an escape character):

!XAxis! + '-' + !YAxis!

!XAxis! + "-" + !YAxis!

I don't receive an error, but I don't receive any results in my table (and yes, I have refreshed multiple times and multiple minutes after running the script, knowing that sometimes there seems to be a lag in Pro)

I've used the verification at the bottom of the screen to test my syntax and it comes out clean. No errors on run, in fact, it states that it is running successfully:

I've double checked my work against Esri articles and other things I've found online... https://support.esri.com/en/technical-article/000018207

I know that there are still a few odd bugs with Pro, but I'm hoping to find a work around (other than opening up Desktop and solving it there).

I have used a Field Calculation earlier in this exact same table to swap the X and Y axis values, when I saw that the labels did not match reality. So it's not that I don't have permissions to the table or anything like that.

All three fields I am working with (XAxis, YAxis and GridLocation) are all text fields with X & Y having field lengths of 5 (even though none are above 2 characters) and GridLocation having a field length of 15 (even though the calculation would never put the length above 11, even if both the other fields were maxed out).


texts: How to set saturation of raster layer using PyQGIS

texts:
I can set brightness of a raster layer with
layer = iface.activeLayer()
contrastFilter.setBrightness(16)
layer.pipe().set(contrastFilter)
layer.triggerRepaint()

To set saturation I try:
ef = QgsColorEffect()
ef.setSaturation(30)
layer.pipe().set(ef)
layer.triggerRepaint()

TypeError: QgsRasterPipe.set(): argument 1 has unexpected type 'QgsColorEffect'

How can I set the saturation?


texts: Rounding off coordinates in an SpatialPolygonDataFrame in R

texts:
After a comment of Whuber I realized it will probably be most easy to incorporate a round(...) statement within my code to be able to work with less decimals. Underneath I have added the functions I am using. My first function (allcoordinates) extracts all coordinates of a SPDF. My second function (transformloop) transforms in a loop. After every transformation I want to round off my coordinates. Simply using round(file@polygons, 2) or signif(file@polygons, 2) does not work. The polygons of a SPDF are not seen as numeric values apparently.

Does anybody know how to round off coordinates within a SPDF?

allcoordinates <- function(x) {
  ret <- NULL
  polys <- slot(x,"polygons")
  for(i in 1:length(polys)) {
    pp = polys[[i]]@Polygons
    for (j in 1:length(pp))
      ret = rbind(ret, coordinates(pp[[j]]))
  }
  ret
 }

transformloop <- function(inputfile, count){
  intermediate <- spTransform(inputfile, CRS("..."))
  inputfile <- spTransform(intermediate, CRS("..."))
  if (count==0){
    return(inputfile)
  } else
    newcount <- count-1
  transformloop(inputfile, newcount)
}

I have added the first function cause I am thinking that possibly the best option is to extract the coordinates, round them off, and then replace the existing coordinates with the coordinates I rounded off.

ORIGINAL QUESTION (outdated):

In RStudio I am transforming data from coordinate system to coordinate system and back. Then I compare the coordinates of the original file with the endfile. This shows minor differences 7 digits behind the comma. However, I want to know what happens with the numbers if a system would work with less numbers behind the comma.

Within R I managed to find the code options(digits=...). This option only visualizes the numbers in a certain amount of digits. The calculation appears to do exactly the same. This is absolutely correct and usually a very good characteristic. But it is not what I want right now. I want it to be less accurate.

Is there a way to manipulate R in order for it to work with a different amount of numbers behind the comma constantly?


texts: How to define 3 average month values in a NDVI Modis time serie

texts:
I am working with MODIS NDVI rasters from 2016. I have 365 rasters (one per day). I need to have 3 rasters per month (total = 36). First raster =  average of the first 10 days. Second raster = average of day 11 to day 20. Third raster = average of day 21 to the last day of the month (could be 28, 29, 30 or 31). My rasters are named: 2016_001, 2016_002,…, 2016_365.

Is there a way to calculate this?

I can´t stack all 365 rasters because the file will be too large (max 250 rasters).


texts:
I have a web mapping application that consists of: GeoServer + PostGIS + OpenLayers.

I need to implement an Export/Import mechanisms of my vector data.

For export, I've developed a custom WPS that gets the vector data as GML using WFS GetFeature request, then save it to a file, then return its URL to the front-end to be downloaded.

For import, I want to do the reverse: upload the GML file from the front-end to the GeoServer, then create WFS-T Insert requests to insert the data to my layer.

My problem is now how to upload the GML file to GeoServer, and how to synchronize the upload process with the process of WFS-T Insert.

There was a community plugin "Resumable REST Upload" that uploads files, but it does not exist I then new versions of GeoServer. And If I use it, how to do I synchronize it with the WFS_T Insert process?


texts: Using osx terminal ogr2ogr to batch convert .json to .kml?

texts:
using osx El Capitan terminal

This works fine one file at a time to convert .json to .kml
ogr2ogr -f "KML" xxx.kml xxx.json

I would like to do all files at once
I have tried

for %f in (*.json) do ogr2ogr -f "KML" %~.kml %f
but error is -bash: syntax error near unexpected token `('

I have also tried this in a .sh script

>#!/bin/bash
for FILE in *.json # cycles through all files in directory (case-sensitive!)
do
    echo "converting file: $FILE..."
    FILENEW=`echo $FILE | sed "s/.json/_new.kml/"` # replaces old filename
    ogr2ogr \
    -f "KML" \
    $FILENEW $FILE
done
exit
but gives this result
-bash: test_multi_json_convert.sh: command not found

Can you help?


texts: Are there any tools, plugins or methods in QGIS which allows for an analysis of the best path between two points using least cost path method? As shown below ArcGIS has several distance tools.


texts: How to read all IDs of all ways inside a polygon?

texts:
I have an OSM map of a larger region. Inside that region is a city with a boundary specified by a polygon.

I want to retrieve IDs of all ways (ideally - of all buildings) inside that boundary (inside the red polygon in the screenshot below).

How can I do it (ideally - in Java) ?


texts: Callback method geocode items nominatim not work

texts:
function addr_search() {
    var inp = document.getElementById("addr");

    $.getJSON('http://nominatim.openstreetmap.org/search?format=json&limit=5&q=' + inp.value, function(data) {
        var items = [];

        $.each(data, function(key, val) {
            bb = val.boundingbox;
            latitude = val.lat;
            longitude = val.lon;
            items.push("
" + val.display_name + '
');
        });

        $('#results').empty();
        if (items.length != 0) {
            $('
', { html: "Search results:" }).appendTo('#results');
            $('
', {
                'class': 'my-new-list',
                html: items.join('')
            }).appendTo('#results');
        } else {
            $('
', { html: "O endereço não foi encontrado" }).appendTo('#results');
        }
    });
}

This method returns the geocode Nominatim.
When clicked calls the method passing chooseAddr latitude, longitude, and limits the osm_type enreço clicked.
But, I am not able to connect those returns.

If I do so it works:

   $.each(data, function(key, val) {
        latitude = val.lat;
        longitude = val.lon;
        items.push("
" + address.value + city.value + '
');
    });

But, I need to bring the bounds of the address to zoom using this attribute and it does not work:

$.each(data, function(key, val) {
    bb = val.boundingbox;
    latitude = val.lat;
    longitude = val.lon;
    items.push("
" + val.display_name + '
');
});

I've tried various ways and I know it's something silly, but I could not seem to solve this.


texts: Is it possible to write a label expression in qgis that displays the label at a given coordinate?

texts:
I am using the QGIS expression builder for the label properties of my data.

Is it possible to put different parts of the label in different coordinates on the map?

For instance I have a linestring and I would like to have "A" displayed in the beginning of the linestring and "B" in the end of it.


texts:
I want to develop a map with Leaflet marker cluster. You can see how it looks like here: https://github.com/danzel/Leaflet.markercluster

But I need that my markers have popups with more information than just a name (three more rows). I don't have many those markers. In this example with clustering markers are only written by long and latitude, and one information without any css and popups (http://danzel.github.com/Leaflet.markercluster/example/realworld.388.js).

So how can I style my popups and enter more informations, and also how can I style my marker icons? Also, I would need that popup shows up on mouse over, not on click.

Thank you.


texts:
Can I upgrade pip on QGIS? if yes, How to do this? like this one:

def install(package):
    if hasattr(pip, 'main'):
        pip.main(['install', package])
    else:
        pip._internal.main(['install', package])


texts: How to use QGIS Raster Calculator for computing slope?

texts:
I am using QGIS 3.10 in my Windows 10. I want to create a slope of a DEM layer. First I used "Slope" in the Raster Terrain Analysis. Then I used Raster calculator to find the slope less than 10. The resulting layer only has values 0 to 1. What is wrong with this? I am expecting the values should be 0 - 9 right?

DEM DATA


texts: TitlePane not rendering - working with basemapGallery sample code

texts:
I am attempting to implement the basemapGallery code found in the API samples here.

There seems to be an issue with the TitlePane into which my basemapGallery is nested. It simply does not render. The basemapGallery appears in place and works as expected, but since the TitlePane does not exist in the app, it is not appearing as a child within the TitlePane, and instead just sits there, with no way to collapse.

Like the sample code, the basemapGallery is being created programmatically and the TitlePane is being created declaratively. Here is the JS code:

function init() {

var popup = new esri.dijit.Popup({
selectionSymbol: new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, new dojo.Color([255,0,0]))}, dojo.create("div"));

map = new esri.Map("map", {
    basemap: "topo",
    extent: new esri.geometry.Extent({xmin:-11420303.522028634,ymin:3387689.093598152,xmax:-6939259.175839653,ymax:6114962.262812516,spatialReference:{wkid:102100}}),
    infoWindow: popup
});

dojo.connect(map, "onLoad", mapReady);

var basemapGallery = new esri.dijit.BasemapGallery({
    showArcGISBasemaps: true,
    map: map
}, "basemapGallery");
basemapGallery.startup();

dojo.connect(basemapGallery, "onError", function(msg) {console.log(msg)});

}
dojo.ready(init);

And the HTML:

Notes:
I am using v3.3 of the API.
I am referencing the claro.css stylesheet.
I have included dojo.require("dijit.TitlePane");
I have included a screencap of what I see.


texts: Difference between raster subsets as defined by another raster?

texts:
I wish to determine whether there is a relationship between slope and the Corine land cover class pastures. i.e. whether areas defined as pasture have a different slope to non-pasture areas.

I've tried some of the statistics tools in Arc but haven't had any success. Thus far I've:

Extracted the pastures land cover class from the Corine raster
Created a binary raster of pastures (pasture = 1, not pastures = 0)

How do I compare those slopes categorised as pasture and those that are non-pasture?

Has anybody calculated anything similar?


texts:
In order to let a script fill specific attributes fields, I need help to build a Python function that creates the fields that have not already been built.

from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS

layer = iface.activeLayer()
dpr = layer.dataProvider()

#  ==> The fields bellow have to be created at this stage

apr_ind = layer.fields().indexFromName("apr")
iso_ind  = layer.fields().indexFromName("iso")
exp_ind  = layer.fields().indexFromName("exp")
foca_ind  = layer.fields().indexFromName("foca")
foca35_ind  = layer.fields().indexFromName("foca35")
shsp_ind  = layer.fields().indexFromName("shsp")
fyd_ind = layer.fields().indexFromName("fyd")
gyd_ind = layer.fields().indexFromName("gyd")
ra_ind  = layer.fields().indexFromName("ra")

...


texts: Why is my area offset using the V.buffer tool

texts: I am using QGIS V 3.2, and I am trying to use the v.buffer GRASS TOOL to create a 500 meters exclusion zone (Circle) around a point. After creating a point shapefile I then ran the v.buffer tool and set the parameters as seen in the screen shots. My map units are km, so if I want a 500m exclusion zone I would input 0.05 (however this doesn't work, so I input 0.005. The outcome is seen in the final figure where not only is the exclusion zone off center from the brown point, it is also 575m. does anyone know how to A) correct the exclusion zone to not be offcenter and B), create an exclusion zone equal to 500m.


texts: Summing attribute values for areas where multiple polygons overlap using QGIS?

texts:
I am working in QGIS 2.8.1.

I have a shapefile of polygons, each of which has a unique ID and a count value that represents a point count within that polygon. Many of the polygons overlap.

Where these polygons overlap, how can I get the count value to reflect the sum of the count values of all polygons that overlap that area (there are often more than 2 overlapping polygons)?

Ideally I would like to split the polygons where they intersect with each other and create a new table with a row for each polygon section and the corresponding point count value. The point count value would equal the sum of the point count values from all the polygons that overlap that area.

For example, in the picture below, if the 3 polygons have count values of 1, 2 and 4, I'd like the yellow highlighted area to have a count value of 7.

I have explored the intersect and union tools (using the shapefile as both the 'input' and the 'intersect' layer) but this only ever returns the intersection/union of two polygons. i.e. I get the intersection of A with B, and for B with C but not for A,B and C. And as far as I can tell there is no logic (without looking at the map) to determine whether A, B and C do indeed overlap.


texts: Combining overlapping polygons and values using ArcMap

texts:
I am using ArcMap 10.7.
I have 10, 15, and 30 minute pedestrian service areas for parks (pictured). I ran zonal statistics on the service areas with US Census demographic information. I would now like to know the total number of black, white, Asian, etc. people who live within a 10, 15, and 30 minute walk of a park, but many of the service areas overlap.
How would I go about counting the population in the overlapping areas only once?

I've looked at merge and dissolve, but unless I'm misunderstanding, neither seem to do what I'm looking for.


texts: Save rasters created by loop operation to different directory?

texts:
I have a set of rasters. I crop them all using FOR loop. Then, I want to save new-created rasters in new directory, not in my actual directory. For one raster it is easy:

writeRaster(raster1, filename="raster1.img", format="HFA", overwrite=TRUE)

script for my loops:

# read files
setwd("D:/Data/LANDSAT")
library(raster)
library(rgdal)

# read files containing n_msi...
raster_data<-list.files(path=getwd(), pattern="n_msi.*.img$")
a<-raster("a.img")

# create a list object containing raster objects
rast.list<-list()
for(i in 1:length(raster_data)){
rast.list[i] <-raster(raster_data[i])}

# get extent of smaller raster
e<-extent(a)

# crop larger raster to smaller raster  - it create rectangle object
crop.list<-list()
for(i in 1:length(rast.list)){
crop.list[[i]]<-crop(rast.list[[i]], e)}

# get rasters names
rst.names<-c(1:length(rast.list))
for(i in 1:length(rast.list)){
rst.names1<-names(rast.list[[i]])
rst.names[[i]]<-rst.names1}

# write raster data
mapply(writeRaster, crop.list, new.rst.names, 'HFA')

Please, how to write "mapply" to save rasters in new directory? or, how to loop it with "writeRasters"?


texts:
I'm trying to create a point pattern gradient fill for some polygons, because I don't want harsh boundaries. The boundaries should blend in with the background.

Since I use open streetmap as background there will be no colour that can blend in with some existing backgrounc colour in the map.

Therefore, I am trying to use a point pattern fill, but would like to create a gradient in this point pattern. Is this possible?


texts: OpenLayers 3: Digitizing holes (donut polygons)

texts:
I am working on an OpenLayers 3 digitizing tool, which works very fine at this point.

I would like to add a functionality that lets me add holes to existing polygons.

I know this is doable in OpenLayers 2, as you can see here:

Is there a way to achieve the same effect in OpenLayers 3?


texts: Adding meridians and parallels on world map in QGIS

texts:
I'm working on a world map in which I'm using as overlapped layers Bing Aerial, The natural Earth Vector (from natural earth data.com), and also a NASA night view because it's just nice!
I would like to add the standard meridians and parallels, I heard something about grids, but those you have to scale manually. Isn't there somewhere a download link for a layer that adds them? Or alternatively, how should I make them?

I found a post on here which could be helpful to understand what I'm looking for:
Create a Robinson world map with grid and coordinate frame in QGIS Map Composer?
The last reply to that question refers to a file called 110m_graticules_10 inside the Natural Earth package which I guess is for I was searching (not sure though), although the geographical lines layer is nice the grid showed in the last pic is what I was trying to replicate.
I tried to search for 110m_graticules_10 inside the folder Natural Earth but I could find it.


texts: MapInfo displays a JP2 raster weirdly - why?

texts:
We have some JP2 files created with FME 2013. They work just fine in ArcGIS, MapModeller and QGIS. But when viewing it in MapInfo (11.5) we get what looks rather like a 60's drug trip.

Zooming in all the way doesn't resolve the issue, so its not just with the pyramids.

Any thoughts? I'm going to try re-generating the bad ones.

Note: Not all of them are "bad" - but most are.


texts: Calculating Affine Transformation in QGIS?

texts:
I have points taken with a Total Station, but the azimuth was set incorrectly so the map is rotated. I have a reference file with common points and in the correct orientation. Both data sets are WGS84 UTM 17S. I need to use the Affine Transformation tool to rotate the Total Station points into the correct position. I found this post (https://gis.stackexchange.com/a/127653/102900) but I don't understand how to do the math to appropriately apply the tool.

Can someone help?

Here are my points (source=incorrect data and target=properly oriented data). There is one point that is constant in both data sets, and that is the set-up point for the Total Station (9799241N, 535885E)- so I would think that the whole thing should just rotate around that point. If it helps, the azimuth rotation was off -174.83 degrees.

Point 1
Source: 9799217.526N, 535898.034E
Target: 9799263.186N, 535869.865E

Point 2
Source: 9799328.378N, 535863.717E
Target: 9799155.963N, 535914.254E

Point 3
Source: 9799308.863N, 535924.124E
Target: 9799169.882N, 535852.174E

Point 4
Source: 9799247.955N,535845.868E
Target: 9799237.595N, 535924.599E

Point 5
Source: 9799260.019N,535873.767E
Target: 9799223.04N, 535897.881E

Point 6
Source: 9799251.263N, 535885E
Target: 9799230.779N, 535885.937E


texts:
We have a river network which doesn’t correspond to the reality shown by the orthoimage. Each river has the same route number (see attribute table). Every route number has several segments (see attribute table). We know the mileage point of each segment (start and end; see attribute table “vonkm” and “zukm”). Mileage 0 is always at the river section.

We will manually adjust the geometry of the river network. As you can see on the image the length of each segment will probably change due to the adjustment of the geometry. Is there a way to automatically calculate the mileage of each segment?


texts:
I have a lot of S57 files that need to be imported to PostgresDB. The process takes over 2 hours. In order to improve performance, I have tried using PG_USE_COPY to use copy instead of DB inserts. I am however getting the following error.

  Using: GDAL 1.9.1

  Env set for:

  SET PGCLIENTENCODING=LATIN1

  SET PG_USE_COPY=YES

  Command: ogr2ogr -update -append -f "PostgreSQL" PG:"dbname='ENCTest'
  host='127.0.0.1' port='5432' user='postgres' password='postgres'"
  *.000

  1/959    Processing file: US1AK90M.000   1492KB Warning 1: Attributes
  Radar ignored, not in expected schema. No more warnings will be issued
  for this dataset.

  ERROR 1: COPY statement failed.

  ERROR:  malformed array literal: "{"02260892A1C50F"

  CONTEXT:  COPY bcnspp, line 1, column lnam_refs: "{"02260892A1C50F"


texts: Make the QGIS Print Composer take WMS maps from a specific zoom level - .png AND georeferenced image

texts:
I want to create a .png print with a world projection file from a specific WMS. The WMS in question is Polish national Geoportal service containing hypsometric data. Here's the WMS adress: http://mapy.geoportal.gov.pl/wss/service/wmsimg/guest/ISOK_HipsoDyn/ImageServer/WMSServer The projects and WMS coordinate systems are the same. I have no idea why the output is "tiled" and has different colours for each tile.

Here's the output as visible in the Print Composer. However, the results when printing into the .png file are as follows:

However, when I switched the output quality to 50 DPI ("tiled" one is at 150 DPI") the result was almost correct.

I've searched through similar questions here, but none of zoom/scaling issues people usually encounter have to do with "tiled" outputs, just with quality. And quality at 150 DPI is correct, same for 300 DPI; it's "just" the "tiling" and different colouring that is a problem.

If anybody ever encountered the same problem, I'll be glad for any help ;]


texts: Creating in panel TOC widget using Web AppBuilder for ArcGIS developer edition?

texts: I'm trying to create a custom widget, in web AppBuilder for developers, for my web application that will be a TOC. Does anyone have a code already produced for this or know how to adapt code to do this? Right now I am using this (http://www.arcgis.com/home/item.html?id=98d9e760d6d1496487ca583b0e8ce73c) as a base but I don't know how to change it to create a widget.


texts: Own script fails to execute in Processing toolbox

texts:
I have the following script that i'd like to make into a QGIS toolbox.

# -*- coding: utf-8 -*-
##shpgen = name
##Fichier_CSV = file
##Chemin_de_sortie =  folder
##nomodeler
import sys
import re
import csv
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import os.path

reload(sys)
sys.setdefaultencoding('utf8')
final_list = []

with open(Fichier_CSV, "rU") as s:
    reader_tables = csv.DictReader(s,delimiter=';')
    liste_tables = list(reader_tables)
    l_tables = [i['table'] for i in liste_tables]
    l_tables = set(l_tables)
    for table in l_tables:
        l1 = [line for line in liste_tables if line['table'] == table]
        geometry = l1[1]['geometry']
        layer_mem = QgsVectorLayer(geometry+"?crs=epsg:2154",table,"memory")
        QgsVectorFileWriter.writeAsVectorFormat(layer_mem,os.path.joint(Chemin_de_sortie+"{}".format(table)),"utf-8",None,"ESRI Shapefile",False)
        layer_path = os.path.join(Chemin_de_sortie,table+".shp")
        shp = QgsVectorLayer(layer_path,table,'ogr')
        pr = shp.dataProvider()
        shp.startEditing()
        for field in l1:
            if field['type'] != 'Double':
                pr.addAttributes([QgsField(field['field'],getattr(QVariant,field['type']),field['typeName'],int(field['len']))])
            else:
                pr.addAttributes([QgsField(field['field'],getattr(QVariant,field['type']),field['typeName'],int(field['len']),int(field['precision']))])
        shp.updateFields()
        shp.commitChanges()
        del layer_mem,shp,pr

The script doesnt execute for some reason. Could someone hep me out?

EDITED

I removed # -*- coding: utf-8 -*- and now i have the following msg:

name 'Fichier_CSV' is not defined See log for more details


texts: Converting Landsat8 DN to TOA reflectance using GEE manually

texts:
I'm fairly new in Google Earth Engine and JavaScript. I'm trying to convert Landsat8 DN to TOA reflectance using GEE using a function.

// Load a raw Landsat scene and display it.
var image = ee.Image('LANDSAT/LC08/C01/T1/LC08_116050_20130425');
Map.centerObject(image, 10);
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'], min: 6000, max: 12000},
'raw');

// Compute the toa_radiance using an expression.
var toa = image.expression(
'(ML*QCAL)+AL', {
'ML': ee.Image(ee.Number(image.get('RADIANCE_MULT_BAND_1'))),
'AL': ee.Image(ee.Number(image.get('RADIANCE_ADD_BAND_1'))),
'QCAL': ee.Image(255.0)
});

print('Radiance: ', toa);
Map.centerObject(image, 9);
Map.addLayer(L, {min: -1, max: 255});

After loading running the script, I get a black image. What might probably be wrong?


texts: How to buffer a point by cardinal distances to create a polygon?

texts:
I am trying to buffer a point by distances in a table to create a polygon or line for example

For a point with known x,y

buffer based on the following radius:
North= 20m
East= 21.5m
South= 14m
West= 26m

Despite trying I haven't been successful does anyone know if this is possible?

Yes am trying to create a circle type shape from the four cardinal points.


texts: How can I improve my Ray casting algorithm?

texts:
I have been using the following function below which have been working well to decide if a point in the polygon but once I have many points which is building the polygon say over few thousand it seems to fall. Is there any deficiency in this function need to be improved? Thank you.

DELIMITER $$
--
-- Functions
--
CREATE DEFINER=`root`@`localhost` FUNCTION `GISWithin`(pt POINT, mp MULTIPOLYGON) RETURNS int(1)
    DETERMINISTIC
BEGIN

DECLARE str, xy TEXT;
DECLARE x, y, p1x, p1y, p2x, p2y, m, xinters DECIMAL(16, 13) DEFAULT 0;
DECLARE counter INT DEFAULT 0;
DECLARE p, pb, pe INT DEFAULT 0;

SELECT MBRWithin(pt, mp) INTO p;
IF p != 1 OR ISNULL(p) THEN
RETURN p;
END IF;

SELECT X(pt), Y(pt), ASTEXT(mp) INTO x, y, str;
SET str = REPLACE(str, 'POLYGON((','');
SET str = REPLACE(str, '))', '');
SET str = CONCAT(str, ',');

SET pb = 1;
SET pe = LOCATE(',', str);
SET xy = SUBSTRING(str, pb, pe - pb);
SET p = INSTR(xy, ' ');
SET p1x = SUBSTRING(xy, 1, p - 1);
SET p1y = SUBSTRING(xy, p + 1);
SET str = CONCAT(str, xy, ',');

WHILE pe > 0 DO
SET xy = SUBSTRING(str, pb, pe - pb);
SET p = INSTR(xy, ' ');
SET p2x = SUBSTRING(xy, 1, p - 1);
SET p2y = SUBSTRING(xy, p + 1);
IF p1y < p2y THEN SET m = p1y; ELSE SET m = p2y; END IF;
IF y > m THEN
IF p1y > p2y THEN SET m = p1y; ELSE SET m = p2y; END IF;
IF y <= m THEN
IF p1x > p2x THEN SET m = p1x; ELSE SET m = p2x; END IF;
IF x <= m THEN
IF p1y != p2y THEN
SET xinters = (y - p1y) * (p2x - p1x) / (p2y - p1y) + p1x;
END IF;
IF p1x = p2x OR x <= xinters THEN
SET counter = counter + 1;
END IF;
END IF;
END IF;
END IF;
SET p1x = p2x;
SET p1y = p2y;
SET pb = pe + 1;
SET pe = LOCATE(',', str, pb);
END WHILE;

RETURN counter % 2;

END$$

DELIMITER ;


texts: Converting string fields to double using ArcGIS Pro

texts:
I have an Excel table converted to GIS type table. And there is few columns (text string), which I need to make double in order to join it with other table. There's blank fields, but there's nothing I can do about them.

Is there any fast method to convert text to double?


texts: Use tracing when extending linestrings in QGIS

texts:
In QGIS 3 it is possible to extend an existing linestring by clicking on the 'virtual endpoint' cross marker as described in https://docs.qgis.org/3.10/de/docs/user_manual/working_with_vector/editing_geometry_attributes.html#digitizing-an-existing-layer

When extending a linestring along an existing feature, tracing seems not to work. Seems that I have to digitize along the feature by snapping to each of its vertices as shown here (the dotted line should trace along the thin black one, but doesn't):

This is a) time consuming and b) a source for errors.

I wonder if tracing does not work when extending a line string, is this not possible or am I missing something?


texts: OpenLayers: given the same number of Features, is it better to have one big Layer or several small ones?

texts:
Given a certain amount of features that sometimes don't fit all together inside the current window, is it better to use one single/few big layer/s or it it better to split the features among more smaller ones?
For example right now I'm rendering everything using three layers, one for all the icons, one for all the lines and one for the background. But relatively often zooming in and zooming out causes the background to lag.

Should I split the features in multiple small layers instead?


texts:
I have a feature layer with land parcels. Each parcel is a polygon. So, I want to calculate the perimeter of each polygon using VBA and ArcObjects. Is there any ready code in VBA and ArcObjects to do this?

Any help please?

Thanks
Deme


texts:
How to save changing of colors?

For example, we change color for all features of a layer in a loop. But as a result, I see only latest changing.

My code does not work perfectly:

for k in masLevel:
    iface.mapCanvas().setSelectionColor( QColor(colours[k-1]) )
    #filter features to select
    expr = QgsExpression( "\"Order\"='%d'"%int(k) )
    it = rivers.getFeatures( QgsFeatureRequest( expr ) )
    ids = [i.id() for i in it]
    rivers.setSelectedFeatures( ids )
    rivers.triggerRepaint()
    rivers.commitChanges()

Could you help me?


texts: How to use the datasets in the workspace in a "PythonCreator" transformer?

texts: I have 2 datasets in my workspace and I want to use "PythonCreator" transformer to create a new feature base on those datasets in my workspace but I don't know how to use workspace datasets in "PythonCreator" transformer. Could you help me?


texts: how to pin point type layer details on map using ms4w map server

texts:
My aim is to create pin point on map and when click event on that pin point to show some details about that point (like shop name ,street name).

My point shape file is

for rendering on the map i write bellow code.

LAYER
NAME "Siaya_towns"
DATA Siaya_towns
TYPE POINT
STATUS DEFAULT
CLASS
  COLOR 255 255 0
  OUTLINECOLOR 0 0 0
  SYMBOL "pin.png"
  SIZE 8
END
END

I get the out put perfect.But i am not able to get the town name when we click on the pin point ...Please help me .how to achieve this.


texts: What is the conceptual meaning of featureMember in GML?

texts:
In GML there is this tag:

<gml:featureMember>

I am looking for the conceptual meaning of it, but i only find syntax explanations.


texts: Assigning each point name of polygon in which it lies using QGIS?

texts:
I am completely new to QGIS, and to the world of shapefiles and GIS in general.

I have the shapefile of a city, divided into its districts. On top of it I add a layer from a csv, with a certain number of points with precise coordinates. Is it possible to assign to each one of these points the name of the districts they are in? For example, I would like to add a new 'district' column to the attribute table, and each row (i.e. each point) will have the right district value, so that I can export the updated table as csv and use this information in my analysis.

I know that there exists a feature called 'points in polygon' which can assign each area the number of points that falls within it, which basically is the exact opposite of what I would like to do.


texts: How to display multiple row counts with some varying information for one city?

texts:
My table has two rows for the same city, latitude and longitude but there are different counts, office names and office number designations.

For example:

Raleigh, NC; Long -78.6389, Lat 35.7806; Count 745; Office body shop; Office number 1

Raleigh, NC; Long -78.6389, Lat 35.7806; Count 3445; Office glass shop; Office number 2

I went to map view to display the information and turned on display count, office and office number. When I click the city it only shows one row's information and the other office is missing. What adjustments need to be made to display both offices that share the same location?

I will also need to do this for other locations that share the same location but are designated with different office names and office numbers.


texts:
We have a large (10,000 plus) repository of spatial data (shp/gdb/tab vectors and ecw/tif rasters and also las, xyz and DEM data) where some have metadata records in xml using anzlic metadata editor. I want to check if each spatial dataset has an associated xml record and check the projections, spatial extent, source and size against the associated spatial file.

I have created a arcpy based script to extract this info from ESRI readable formats but am unsure on how to handle tab files and more importantly how to check it against the anzlic metaeditor based xml record.

So if we have citypoints.shp/.tab then we should have citypoints_metadata.shp/.tab.xml as the metadata record -this is separate from the citypoints.shp.xml that some software autocreate.

Another similar forum question is Is ANZLIC Metadata supported using the new approach of ArcGIS 10.x? but it doesn't cover the requirement to check for the existence of a valid record and dealing with .tab (other non-esri) formats in an opensource/creative commons workspace as per my question (How to read MapInfo .tab files in ArcPy?). I also looked through the software mentioned in Seeking Open Source ISO Metadata Editor? but none of them autogenerate the base metadata file or allow comparing of existing records against the source.


texts: Getting single point from polygon Centroid if within polygon or any point if not using QGIS

texts: I am trying to generate label points from my polygons. The Polygon->Centroid works great except that if the centroid happens to land in a hole it is still returned. I need to get a single point (Centroid if that point is within the polygon) a point within the polygon if the centroid happens to be outside of the polygon.


texts:
I created a new polygon feature in QGIS 3.4 using the add polygon feature tool. I accidentally clicked the right mouse button to finish creating the feature. I want to continue being able to add points using one click. I am able to add new points using the vertex tool, but this is much more cumbersome than when using the add polygon feature tool because I need to click on the '+' and then click where to add the new vertex (two clicks instead of one).

Is there a way to 'go back' to the functionality of the add polygon feature tool, where only one click is needed to add a vertex?


texts: Are these sp files equal in terms of proj4string? Can I do some transformation of the proj4string?

texts:
summary(SCat_sp_E6)
Object of class SpatialPolygonsDataFrame
Coordinates:
         min        max
x -74.095072 -74.018988
y   4.647323   4.832934
Is projected: FALSE
proj4string :
[+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs]

summary(obj)
Object of class SpatialPolygonsDataFrame
Coordinates:
        min       max
x  21.99937 33.705704
y -18.07947 -8.270877
Is projected: FALSE
proj4string :
[+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0]

Are these sp files (SCat_sp_E6 and obj) equal in terms of proj4string? Can I do some transformation of the proj4string to obtain the same? Because after that I would like to apply polys.setup(), and the results are different. I am using hiv from GJRM package in R.


texts: Using ArcGIS Data Interoperability tool in ArcPy?

texts:
I created an ArcGIS Interoperability Tool, which I like to use in my ArcPY script.
In order to find the correct code I created an ArcGIS Toolbox Model including my Interoperability Tool, and exported as an ArcPy script.

Everything looks fine, I checked google and stuff. I get an DataInterop license, I import the Toolbox with my Interoperability Tool (which uses an Alias). Then I define the input and ouput. When I try to start the Interopability Tool I get the following message :

  AttributeError: 'module' object has no attribute

I didn't find anything useful on the internet which can be found with the above error message and Data Interoperability. Does somebody know how to use a self create Data Interoperability Tool with ArcPy?


texts: Mapbox Geocoding Service with OpenLayers

texts:
I have an angular app that uses the Mapbox Geocoding Service in one component to perform typeahead search and allow user to select a location. In another component I would like to display an OpenLayers map that centers on the selected location.
In the mapping component, I am listening to an rxjs Observable that fires when the Mapbox Geocoding Service MapiResult feature is selected. The information within the MapiResult feature includes a bbox and center.
How do I update the OpenLayers view to center on the point returned by Mapbox Geocoding Serivce? The ol/view centerOn(coordinate, size, position) parameters are confusing me. I do not know how to go from Mapbox bbox and center to OpenLayers View coordinate, size, and `position.
So I have a method in the MapComponent that handles updates to the location:
onChangeCurrentLocation(location: Location): void {
    this.map?.getView().centerOn(location.center, this.map.getSize() ?? [0,0], [0, 0]);
  }

Where Location is an interface:
export interface Location {
  bbox: [number, number, number, number];
  center: [number, number];
}

Details:
This service is used to communicate changes between the Mapbox geocoding response and the OpenLayers map.
    @Injectable({
      providedIn: 'root'
    })
    export class LocationService {
      private _currentLocation: Location | undefined;
      public get currentLocation(): Location | undefined{
        return this._currentLocation;
      }
      public set currentLocation(value: Location | undefined) {
        this._currentLocation = value;
        this._currentLocationChange.next(value);
      }

      private _currentLocationChange: Subject<Location> = new Subject();
      public get currentLocationChange(): Observable<Location> {
          return this._currentLocationChange.asObservable();
      }

      constructor() { }
    }

This component listens to changes coming from the service and attempts to update the map.
@Component({
  selector: 'app-map',
  templateUrl: './map.component.html',
  styleUrls: ['./map.component.css']
})
export class MapComponent implements AfterViewInit, OnDestroy, OnInit {
  private subscriptions: Subscription[] = [];

  map: Map | undefined;
  projection: Projection | undefined;
  vectorTile: VectorTile | undefined;
  view: View | undefined;
  zoom = 0;

  constructor(
    private _locationService: LocationService) { }

  private createVectorTile(): VectorTile {
    const vectorTile = new VectorTile({
      attributions:
        '© Mapbox ' +
        '© ' +
        'OpenStreetMap contributors',
      format: new MVT(),
      tileSize: 256,
      url: `https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/{z}/{x}/{y}.vector.pbf?access_token=${/*private*/}`
    });
    return vectorTile;
  }

  private initMap(): void {
    this.projection = GetProjection('EPSG:3857');
    this.vectorTile = this.createVectorTile();
    this.view = new View({
      center: this._locationService.currentLocation?.center ?? [0, 0],
      zoom: this.zoom,
      projection: this.projection
    });
    this.map = new Map({
      layers: [
        new VectorTileLayer({
          source: this.vectorTile,
        }),
      ],
      target: 'map',
      view: this.view,
    });
  }

  ngAfterViewInit(): void {
    if (!this.map) {
      this._zone.runOutsideAngular(() => this.initMap());
    }
  }

  ngOnDestroy(): void {
    this.subscriptions.forEach(subscription => subscription.unsubscribe());
  }

  ngOnInit(): void {
    this.subscriptions.push(this._locationService.currentLocationChange.subscribe(location => this.onChangeCurrentLocation(location)));
  }

  onChangeCurrentLocation(location: Location): void {
    this.map?.getView().centerOn(location.center, this.map.getSize() ?? [0,0], [0, 0]);
  }
}


texts:
I try to convert my geodatabase to Excel.
And i have a strange message:

  FME API version of module 'XLS_ADO'
  matches current internal version (3.6
  20101014) Trying to find a DYNAMIC
  plugin for reader named NULL' Loaded
  module 'NULL' from file
  'C:\apps\FME\plugins/NULL.dll' FME API
  version of module 'NULL' matches
  current internal version (3.6
  20101014) FME API version of module
  'XLS_ADO' matches current internal
  version (3.6 20101014) FME API version
  of module 'XLS_ADO' matches current
  internal version (3.6 20101014) MS
  Excel Writer: Openingnull' for write
  operation MS Excel Writer: Connection
  failed.  Connection string
  Provider=Microsoft.Jet.OLEDB.4.0;Data
  Source=null;Extended Properties="Excel
  8.0;HDR=YES"'. Provider errorLa table externe n'est pas dans le format
  attendu.' Failed to open writer

The table is not in the expected format.

An idea ?
Thanks


texts: QGIS auxiliary rotation of the label not working properly

texts:
I am using the rotation feature from the main panel at the top.
Unfortunately it doesn't work properly for all the labels. I've categorized my labels, so now I have the "Black" category and the "Red" category.
All of them have auxiliary fields stored in the data attribute table.
The problem is, that one of them can be editable straight from the panel - this is the black one, whereas the red one cannot be rotated at all (unless you click the "move label" from the panel).
You can see all the details below:

I would like to be able to rotate also the red labels.
The image above shows the problem and all the settings. Both X,Y, and rotation are enabled in all cases as well as the expression referred to the auxiliary storage are the same in both cases. Where the problem might be then?


texts: Using PostgreSQL to calculate ST_Volume on XYZ data

texts:
I have a set of XYZ data which I want to query in PostgreSQL in order to find the volume. I've been trying the ST_Volume on the geometries (have also used ST_MakeSolid and ST_Tesselate) but all queries are giving results of 0. The documentation on ST_Volume for PostGIS is very vague.
I have installed the sfcgal extension as suggested when I looked up the 3D queries


texts: Gdalwarp: how to set nodata value after warp?

texts:
I have source RGBA image here is output of gdalinfo :

Driver: GTiff/GeoTIFF
Files: src.tif
Size is 780, 670
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
GeoTransform =
  31.8166046385, -7.21157770246e-07, 3.4459118553e-06
  59.2400684661, 1.75691451519e-06, 3.7128964013e-07
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  31.8166046,  59.2400685) ( 31d48'59.78"E, 59d14'24.25"N)
Lower Left  (  31.8189134,  59.2403172) ( 31d49' 8.09"E, 59d14'25.14"N)
Upper Right (  31.8160421,  59.2414389) ( 31d48'57.75"E, 59d14'29.18"N)
Lower Right (  31.8183509,  59.2416876) ( 31d49' 6.06"E, 59d14'30.08"N)
Center      (  31.8174778,  59.2408780) ( 31d49' 2.92"E, 59d14'27.16"N)
Band 1 Block=780x2 Type=Byte, ColorInterp=Red
  NoData Value=0
Band 2 Block=780x2 Type=Byte, ColorInterp=Green
  NoData Value=0
Band 3 Block=780x2 Type=Byte, ColorInterp=Blue
  NoData Value=0
Band 4 Block=780x2 Type=Byte, ColorInterp=Alpha
  NoData Value=0

I want to set nodata value after warp to some RGBA value, because seems it setted to 0 0 0 0 as usual transparent value.

As I understand from documentation:

gdalwarp src.tif dst.tif -dstnodata '255,255,255,255'

But this is distorts the color and that is not what I'm expecting.

Also how to check what nodata value is set on existing .tif image?


texts: How long can a Dove of Planet stay on orbit?

texts:
I would like to know how many Doves are in operation right now? Also, are there some satellites in standby process or fitting to the orbit?

This question is because some customers ask me how many Doves are operative since the last launch on July  7? How long can the satellite stay online before needing maintenance or relocation or just replacement in the constellation?


texts: Transforming Indices from NumPy Array to Sliced Array, then Back

texts:
I’ve got a 2D NumPy Array derived from a Digital Elevation Model. I’m iterating through a series of specific row/col locations in the array and for each specified location, I’d like to define the nearest element whose value is lower than the current element I’m querying. Through the help of @dmh126 (Nearest numpy array element whose value is less than the current element), I’ve figured out the slice and the distance calculations, but I’m having trouble getting the coordinates of the “nearest” element from the sliced array back to the original. When the search element is near the center of the array, things work fine, but when the search element is near the axis edges, my slice entries become negative; which I believe can be a problem. I can’t seem to get the logic correct to transfer the coordinates of my “nearest” element from the sliced array back to the original for further processing. Any thoughts on what I’m doing wrong?

So far I’ve got:

# Window dimensions in metres
max_search_dist_m = 100
# Cell size of source DEM
CELLX = 1.0

# Array dimensions
arrayRowCount = array.shape[0]
arrayColCount = array.shape[1]

# Get the element value at the search location
theSinkZ = float(array[theSinkRow][theSinkCol])

# Define search window size
SinkWindow = int((float(max_search_dist_m) / float(CELLX)) / 2)

# Define corner elements for search window
col_min = theSinkCol - SinkWindow
col_max = theSinkCol + SinkWindow
row_min = theSinkRow - SinkWindow
row_max = theSinkRow + SinkWindow
col_min_orig = col_min
row_min_orig = row_min

# Define “windowed sink row/col” location. This is intended to be the row/col of the original search element relative to the sliced array.
if col_min < 0:
   col_min = 0
   WindowedSinkCol = SinkWindow + col_min_orig
else:
   WindowedSinkCol = SinkWindow
if col_max > arrayColCount: col_max = arrayColCount
if row_min < 0:
   row_min = 0
   WindowedSinkRow = SinkWindow + row_min_orig
else:
   WindowedSinkRow = SinkWindow

# Slice array to search window
# Get rows and columns where value is less than theSinkZ
c,e = np.where(array[int(col_min):int(col_max), int(row_min):int(row_max)] < theSinkZ)

# Create a list of row/cols less than theSinkZ
y = zip(c,e)

# If solution exists, proceed.
if len(y) > 0:
   # first distances are calculated between (row, col) of your input value, than nearest index value is selected.
   d = np.argmin(cdist(np.array([[WindowedSinkRow,WindowedSinkCol]]), y))

   # Extract nearest row/col location of Sliced array
   WindowedOutCol = y[d][1]
   WindowedOutRow = y[d][0]

   # Identify outlet location relative to original full array
   theOutCol = theSinkCol + col_min
   theOutRow = theSinkRow + row_min


texts: How to connect QgsMapLayerComboBox to QgsDataDefinedButton

texts:
in Qt Designer there is the possibility to use directly QGIS custom widgets.

In the UI I added a QgsMapLayerComboBox (to get the layers added in the legend) and a QgsDataDefinedButton.

What I would like to do is to connect the QgsDataDefinedButton to the QgsMapLayerComboBox so that the QgsDataDefinedButton should be updated with the fields of the selected layer of the QgsMapLayerComboBox.

While connecting QgsMapLayerComboBox to a QgsFieldComboBox or a QgsFieldExpressionComboBox is not a problem through the singal - slot combination:

layerCHanged(QgsMapLayer*) -> setLayer(QgsMapLayer*)

I'm not able to to that with the QgsDataDefinedButton.

Any hints?


texts:
I've installed the QGIS Freehand plugin.

When drawing a polygon, QGIS automatically closes the polygon when the pen leaves the graphic tablet :

Is there any way to turn this feature off, or at least be able pause it?
When drawing large intricate polygons your hand can often become tired at a chance for a breather would be welcomed!
Is there anyway to delete nodes as you go along in case you make a mistake?


texts: Refer to attribute of current record in SpatiaLite trigger function

texts:
This is my first attempt at creating a trigger, so apologies if its obvious.
In QGIS 3.14, I have two SpatiaLite layers [Tree] and [Crown].
I am trying to create a trigger to insert a record into [Crown] after_insert on tree. I want the crown to be a buffer of size [spread], which is an attribute of [Tree] on the geometry of the [Tree].
Currently I have:
CREATE TRIGGER insert_crown AFTER INSERT ON Tree
BEGIN
INSERT INTO Crown (treeid, amenity, geometry)
SELECT uuid, amenity, buffer(geometry,spread) from Tree;
END

But this creates a new crown for every record in Tree. Not just the record created (/inserted)
How do I restrict this to use only the record (tuple) from Trees that is being inserted.


texts: Raster artefacts after saving to GeoTIFF in QGIS

texts:
When processing DEMs created using downloaded SRTM data (initially HGT files) I produce a nice-looking product; however, saving this as a GeoTIFF creates square artefacts which are plain to see (and negatively affect the generation of stream networks and catchments). The only real technical difference I can see between rasters is the GDAL driver:

Note that the colour stretch for both images is exactly the same. So is the CRS. I'm scratching my about what the issue might be.


texts: GDAL in docker using pipelines in gitlab

texts:
I want use gitlab to test python with GDAL library

pip install gdal

is not working

I use gitlab to CI/CD

Source code of project:

https://github.com/lazyspot/georeference-image-library

It is possible to use docker or I must use virtual machine with installed GDAL?


texts:
I use ArcGIS 10.1 and I am dealing with viewshed and least cost path analysis. I would like to generate a path on the basis of a cost surface taking into account the viewshed data as indicated in the paper "On applying viewshed analysis for determining least-cost paths on Digital Elevation Models" by Stucky and Lee. In order to do that the authors say:

  To support the computation of the various least-cost paths discussed in this paper, two grids of visibility information should be calculated. The first is a general viewgrid (VG) that records for each cell the number of cells visible. The second is a dominance viewgrid (VD) that holds for each cell the number of cells from which the cell is visible. Both grids are constructed by calculating intervisibility between grid cells using the LoS algorithm. Two matrices are not equal because the number of cells visible from a cell does not always equal the number of cells to which that cell is visible. Next, these two visibility grids are converted to friction surfaces. These surfaces are used as the input grids to the least-cost path procedure. To do this, a few adjustments must be made to create the friction surfaces suitable for calculating viewpaths that we wish to use. For this study, we have implemented a total of four viewpaths. Each of the four viewpaths requires different friction surfaces to be setup from viewgrids.

Does someone know how to create the viewgrids and covert them into friction surfaces?


texts: Calculating Categorical Raster Areas per Polygon

texts:
I've got forest fragmentation data from which I've extracted pixels that correspond to forest edges and patches. I've also got a shapefile of counties in a US state. I'm trying to get the area of edges and patches within each county but can't figure out a good way to do it.

The only way I can think of is to vectorize the raster in GRASS and then obtain the area of categories through the resultant polygons. I've tried going through this process in GRASS but it has been running for at least 6 hours and the vector data is extremely large already, taking ~3GB and counting.

Do any of you know of another way to obtain categorical pixel areas per polygon?


texts: Union not yielding merge geometries in QGIS

texts: I'm trying to merge the geometries and attributes of a TIGER census block shapefile with those of a vector land cover shapefile. However, I'm not getting the results I want. Whenever I run Union in QGIS, I get one geometry or the other, not a combination of both. When I open up the attribute table, both entries are there but they are separate not merged. Which geometry I get seems to depend on which one I select first in the Union window. Can anyone tell me why the geometries and attributes are not merging?


texts: I have a model in ArcGIS 10.3.1 which splits a large (> 1,000) polygons by a road network (as polylines). Currently, I am using Xtools' Split Polygons, but this would require an end-user to have a copy of XTools which I need to not be a requirement. I have found this tool, but, when I have tried to use it, it takes a very long time to run (much longer than the XTools equivalent). Does anyone know of any other tools which do the same thing, but are not locked behind non-ArcGIS purchasing licenses and are ideally only using ArcGIS geoprocessing tools?


texts: How to create legends with triangular end boxes in arcGIS?

texts:
I want my legend which is now in the form of the left bar in the following image, to be shown in the form of the bar in the right side.

I couldn't find anything related for arcGIS.

Does anyone know of something?


texts: I haven't found anything on the ArcMAP forums. Is there any way to represent related tables on  arcGIS.com web maps? I have a geodatabase that has related tables, but so far I am only able to show the feature classes and not the related tables.


texts: Creating a Vineyard Map with QGIS using Fishnet

texts:
In the vineyard there is a set number of rows, with a distance between each row and then the vines sit along the rows at the same distance apart.

I have tried using a Fishnet to map the rows and then the vines on the points of the fishnet. But having trouble moving that layer to sit inline with the GPS data I have for the four points that bound the vineyard.

I was wondering if there is any quick way to create the Rows and the Vines on the rows ? And then move the drawing into place with the GPS Data ?  As there is over 20,000 vines in the vineyard and each point will need to be drawn and the Fishnet and point is taking sometime.

For example, Block A - 2.7m per row, 1.25m between each vine with 80 rows in total and 300m long ?


texts: Displaying movements of moving object in cartodb?

texts:
I have few GPS tracks with lat long and timestamp. I want to present them on a map and to show how the movement took place using the time series location values (X,Y,T). I searched a lot but could not find any suitable map visualization technique for moving objects. Cartodb offers visualization on the web with an appealing presentation.

I was wondering if it can be done in Cartodb?

I am looking to develop something like this-
http://here.com/livingcities/
Click on the metro cities on the webpage (the link provided above) and you can see the visualization.


texts: How to get libspatialite.so file for spatialite

texts:
I am creating an application using spatialite database. I checked couple of tutorial from internet. Most of them explains the same. But the problem is I need "libspatialite.so" extension library. I do not know how to get it.

So whenever i run my code it shows the following warning and error....

[Warning: SQLite3::query() [sqlite3.query]: Unable to prepare statement: 1, no such module:]
[Fatal error: Call to a member function fetchArray() on a non-object]

But my code looks OK. It looks like because of i could not load the extention "libspatialite.so"

I have given bellow, my code.

<?php

$db = new SQLite3('sixcommunes.sqlite');

$db->loadExtension('libspatialite.so');

$db->exec("SELECT InitSpatialMetadata()");

$rs = $db->query('SELECT sqlite_version()');

while ($row = $rs->fetchArray()) {
    print "
SpatialLite version: $row[0]
";
}

$sql = "SELECT KOM_NAMN FROM '6communes_SWEREF99TM'";

$rs = $db->query($sql);
$msg = "";
while($row = $rs->fetchArray()){
        $msg = $row[0];
    print "
$msg
";
}
$db->close();
?>


texts:
I try treat vine data to detect frost or dryness. for the moment I have results as you can see in picture, tree groups of vines, healthy (green), weak(red) and missing (black). These 3 groups are respectively coded in a field with 2, 1 and 0. But I would like to make difference between lonely weak vine and slick of weak vines.

I'm able to use QGIS, Python, and a little bit R. So all your ideas with this 3 tools is good for me.

>>Dataset<<


texts: How do I find the intersections of 2 circles on earths surface?

texts:
I have the circles' center in lat & long, as well as the radius in meters. How do I find the circles intersections?

Edit: EXAMPLE:

Circle 1: Center on Earth's surface (43.564627,-116.220524) These values are Latitude and Longitude
        Radius: 15 Meters a Length on the surface of the earth

Circle 2:  Center on Earth's surface (43.564736,-116.219741) These values are Latitude and Longitude
        Radius: 15 Meters a Length on the surface of the earth

Expressed in Latitude and Longitude, where do these circles intersect?

I am unsure of the best method to find the closest results, accuracy within 2 meters should be alright.


texts: Write in missing CRS without copying a file

texts:
The coordinate system is not specified in a GeoTiff, but I know what it is. How do I edit the file using rasterio to write in the CRS? Copying it is one way (something like the following), but it's obviously not the best way:

import rasterio
from rasterio.crs import CRS

with rasterio.open("path/to/file.tif") as src:
    src.crs = CRS.from_epsg(4326)
    with rasterio.open("path/to/file-copy.tif", "w", **src.profile) as dst:
        dst.write(src.read(1))


texts: QGIS tool to identify polygons that can fit a certain sized square within the polygon

texts:
I am trying to identify parcels with enough space for an additional building, and one of the parameters for this is: there needs to be a space of at least 9' x 10' available to fit the additional building.

I used the QGIS tool 'Difference' to remove existing buildings from the parcels shapefile. I am now trying to see if there is a tool to identify polygons with enough continuous space for the additional building. I don't want to simply find the area, since there will probably be parcels with enough area, but it's not a square.

image of the remaining parcels:


texts: Any way to clear selections from features in a map only if they have selected features?

texts:
While I know the clear selection tool exists in ArcMap, I am looking to produce a script that would only work if all selections are cleared from the start. I have added lines of code to clear selections from each of the layers in my map but that adds about a minute to my whole process. Which makes me wonder, is there a way I could say for example:

if fc has selected features:
    arcpy.SelectLayerByAttribute_management(fc, "CLEAR_SELECTION")
else:
    pass

Obviously that isn't it but something similar maybe? That iterates through the map document for layers?


texts: Lock error when converting polygon to raster in ArcGIS Desktop?

texts:
I'm trying to convert a polygon file to raster but when I execute the function I get this error message:

  clement\cdq\landuse_mrc4. May be locked by another application. Failed to execute (polygonToRaster).

I've tried closing everything and doing it again but it still doesn't work... does anyone know what to do in this situation ?


texts: A PROBLEM WITH XML Standard Layer Descriptor for GeoServer

texts:
I wrote an xml in Standard Layer Descriptor for GeoServer, with the objective to map a satellite image with discrete values. I wrote:

< ColorMap type="intervals">
  < ColorMapEntry color="#000000" quantity="0" label="b"/>
  < ColorMapEntry color="#00FF00" quantity="10" label="c"/>
  < ColorMapEntry color="#FFFF00" quantity="20" label="d"/>
< /ColorMap>

The problem is that a value corresponds to a color set in a previous line, for example the pixel value 10 corresponds to #000000 color (but this color has to corresponds to value 0.)


texts:
I am making an application in java using GMaps4JSF where the person will enter the address on the map I'll take this coordinate and consult on my postgis base regions in which region this point is inserted and return this information on the screen.
It's very simple. Google Maps Api uses the Mercator projection (EPSG: 3857), the coordinate of the queried map will be returned in this projection? I must redesign my data to it does not need to do conversions.


texts: How to perform datum transformation in ArcGIS server REST API exportmap

texts:
I have a ArcGIS server 10.0 mapcontext in one projection (swedish grid sweref99 TM) which uses its own datum, also named Sweref99 . When I use the REST API's map service export function I want to specify the coordinatesystem of the exported map to another coordinatesystem with another datum (Swedish grid rt90).

If add the imageSR argument with SRid for RT90 the returned map is offset by the amount that usually corresponds to the error induced by lack of datum transformation.

It does not help to add a transformation to the data frame in arcmap before saving the MSD-file. The MSD-file will contain a definition of the transformation, but it seems like it is not used. It seems to me the transformation is only used to transform layers within the map service.

The documentation on the REST-API is very vague on this point, if it is by design or a bug, as it doesn't mention datums at all.

Can anyone tell me if it is supposed to work or if there's some way of telling arcgis server which datum transformation to use?


texts: Mapserver + tilecache + openlayers attribute search

texts:
I'm using Mapserver + tilecache + openlayers for my web map application.
I'm using Mapserver as a WMS Server.
Now, I want to perform an attribute search, i.e. type something and the application searches for the text in the database (which is postgresql + postgis). The result should be shown in a table and also on the map with markers.
I have created a control for that, but I'm not sure how to perform the search and retrieve the results.
The solutions I'm currently thinking on:
1. Use GetFeatureInfo on Tilecache (although I'm not sure whether tilecache supports it)
2. Use GetFeatureInfo on Mapserver WMS
3. Write a Python application that performs the query and passes the answers to OpenLayers and I make the required adjustments to show it how I want.

Any idea will be greatly appreciated.


texts: Difference between raster stack and virtual raster in QGIS

texts: Is there any difference between virtual and stack raster(in QGIS). Observed features are more contrast in virtual rather stack raster. Also, while classification does it makes any difference to use one over the another


texts: Cumulative value/cost along shortest distance roads in QGIS

texts:
I have a road network linking multiple (ca 1830) agricultural production regions to several ports (ca 12). (lines in the pic below are roads, small black dots centroids for producing regions and larger dots ports)

I would like to calculate the road path of shortest distance from each production region to each port. For each road connection I would then like to calculate a cumulative "cost" (really risk in this case) for travelling that road based on spatial distribution of flood risk (I have the risk data in both raster and vector format), values ranging from 0 to 1 (low to high risk: white to dark blue in the image below).

I have tried calculating nearest way to port using QNEAT3, but it only provides me with distance, and not the pathway with the physical road travelled (and so I cant use it for calculating the cumulative risk value). and even if it did provide me with the actual physical shortest roads, I don't seem to find a great way to calculate cumulative values along  multiple lines.

Does anyone know how to solve this?


texts: Create Terrain Ruggedness Index (TRI) in QGIS

texts:
I just started to use raster files, and I want to create a Terrain Ruggedness Index (TRI), using QGIS.
Which layers must I use? Do I need to create the "Input file (DEM raster)" (in: Raster>Analysis>DEM (Terrain Models), or is it OK to use only a raster layer with elevation for each pixel?


texts: I know how to merge two polygons in ArcGis, I have tried to merge two unclassified polygons as one in eCognition for a while now and nothing is working. still remains two separate polygons. Can someone help with a video?


texts: Converting grayscale VRT to palleted VRT using GDAL tools

texts:
I have this virtual file called virtual-raster.vrt with the following gdalinfo of:
Band 1 Block=1x1 Type=Float32, ColorInterp=Gray

I just want to convert it into a palleted one like so:
Band 1 Block=1x1 Type=Byte, ColorInterp=Palette

With the following color palette (value:color):
0 : #000000
1 : #FF0000
2 : #00FF00
3 : #0000FF

How to convert a grayscale VRT to a palleted VRT using GDAL tools?