texts: Reference Items in Generated List for Multiple Record Selection and Iterate

texts:
I'm new to Python and am having trouble with a list of all things.  The data I am currently working with consists of multiple road segments (contained in 'STREETNAME' field) each of which has a measured length ('Shape_Length'), for every named road.  I am trying to sum the 'Shape_Length' values for each road and populate a new field, 'Total_Length', with the calculated values.

To do so, I have created a list of unique values for the 'STREETNAME' field and thought I could loop through the list selecting all records whose 'STREETNAME' value matched a list value (so, for example, select all records whose 'STREETNAME' = "Bob Rd", conduct calculations for those records, unselect; select all records whose 'STREETNAME' = "Bobby Rd', etc).  Problem is I haven't figured out how to pull values from the list to run the selection tool or if that is possible to begin with.  The code thus far is below.  The program returns an error stating "'module' object has no attribute 'SelectLayerbyAttribute_management'".

import arcpy
from arcpy import env
env.workspace = "C:\\Users\\Administrator\\Desktop\\NGraderNetwork"

#Define feature classes and fields

inFC = env.workspace + "\\Source.gdb\\NGraderADT_Materials"
arcpy.MakeFeatureLayer_management(inFC, "tempLayer")
outFC = env.workspace + "\\Source.gdb\\NGraderADT_Rock"

Field1 = 'STREETNAME'
Field2 = 'Shape_Length'
Field3 = 'Total_Length'

print "defined"

#Create list of all roads in North District

RoadList = []

Roads = arcpy.SearchCursor(inFC)
for row in Roads:
    if row.getValue(Field1) not in RoadList:
        RoadList.append(row.getValue(Field1))
del row, Roads
print "created roadlist"

#Select records in feature class by roads in RoadList

while RoadList[0:]
query =  "STREETNAME =" + str(RoadList[0:])
arcpy.SelectLayerbyAttributes_management("tempLayer","NEW_SELECTION", query)
Selection = arcpy.SearchCursor(inFC)
for row in Selection:
    Length = row.getValue(Field2)
    print Length
    RoadLength = sum(Length)
    arcpy.CalculateField_management("tempLayer", Field3, RoadLength)
    print Field3
    arcpy.CopyFeatures_management("tempLayer", outFC)
arcpy.SelectbyAttributes_management(inFC, "CLEAR_SELECTION")

del RoadList
arcpy.Delete_management("tempLayer")

print "Finished"


texts: Point layer draws very slowly after using ArcPy to add to mxd?

texts:
I am using an ArcPy script to add a point feature class to an mxd.  The map document will draw this layer very slowly, approximately 50 to 100 points per second.  If I remove the layer and add it manually, it draws about 20 times faster. the code I use is:

FeatureClass = "path\to\my\fc.gdb\featureclass"
layer = arcpy.mapping.Layer("FeatureClass")
arcpy.mapping.AddLayer(DataFrame, layer, "BOTTOM")

I use this same code to add a polygon layer and it draws just fine.
I've tried using this method in an unrelated mxd with an unrelated layer and it drew fine.  I've also tried different symbologies, including the Arc standard, and running this on different computers with the same result.


texts: Changing height/interpolation/shape of raster layer

texts:
I am kind of a beignner in ArcGIS and thought about and googled this problem for two days now.

I am working in ArcScene making a 3D visualization of a bedrock surface of a town. I have a polygon layer floating on the base heights of the dem (digital elevation model) for bedrock surface. I also have a raster layer (orthophoto) floating on the base heights of a dem for the ground surface in the area.

Here comes the tricky part for me: In some places, the bedrock surface is reaching above the ground surface. This means that the dem for the bedrock surface is not polated that well since it should only reach ground level (says my professor).

How can I fix this? Can I set that the dem for bedrock can not exceed the height for ground dem? Or can I change the maxmum height in some parts of the map in other ways? The two dems have the same coordinate system.

Crossing my fingers for help!

All the best


texts: Use QGIS API on standalone python program without install the entire application

texts:
I developed a standalone python program that makes use of QGIS API to create .qml files from sld files. This is a small program of about 15 lines of code that imports the following modules and uses few methods such as loadSldStyle and saveNamedStyle.

from PyQt4.QtGui import *
from PyQt4.QtCore import *
from qgis.core import *

Is there any way to avoid the installation of all QGIS application and install just the necessary modules, if I want to run a standalone python program that makes use of a simple QGIS functionality?

It seems to be too much install an entire application just to use 2 or 3 functions...


texts: How to disable ArcGIS enterprise database feature edit version

texts:
I have created a new enterprise database in PostgreSQL. But when I want to edit feature class in ArcMap, I get the error:

  sde.DEFAULT no editable layer.

When I set editor options "Edit a version of the database with the ability to undo and redo" uncheck, the problem is solved. But every time I need to select this checkbox. Can I close it?


texts: Add event listener on QGraphicsEllipseItem

texts:
I'm creating a QGis Plugin in python which has a QGraphicsView in which I draw and ellipse on which I want to detect if the user clicks.

I know the ellipse inherits QGraphicsItem which has a mouseReleaseEvent but I just don't know how to listen for an event.

self.scene = QGraphicsScene() //form.py

ellipse = self.dock.scene.addEllipse(0, 0, 100, 100, QPen(), QBrush()) //plugin.py

//now that i've got a reference to the ellipse how do I detect when someone clicks on it ?


texts: PgRouting: Driving_distance() or shootingstar_sp()?

texts:
I use OSM data imported into PgRouting database.
I developped a web application with a map to use OSM data.

I trace routes using shooting_star_sp() function.
For example, to have time cost between 2969 and 70890 nodes, I use :

SELECT sum(time_cost_car) FROM ways, (SELECT * FROM shootingstar_sp('ways', 2969, 70890, 0.1, 'time_cost_car', true, true))as rt WHERE ways.gid=rt.gid;

And the result is 861 (seconds). I think it's correct.

Now, I want to create polygon on my map to create isochron area.
I followed this tutorial : http://underdark.wordpress.com/2011/09/25/a-closer-look-at-alpha-shapes-in-pgrouting/
It uses driving_distance() function. But the produced polygon seems to be wrong.
I have performed the previous time cost calculation using the tutorial approach :

SELECT cost FROM driving_distance('SELECT gid AS id, source::int4 AS source, target::int4 AS target, time_cost_car::float8 AS cost FROM ways', 2969, 1000, false, false) WHERE vertex_id=70890;

And the result is 600 (seconds). That's wrong.

So what is the difference between shootingstar_sp() and driving_distance() ?
How can I create a correct isochron polygon ?

Best regards,

RudyWI

I think a part of the problem is resolved.
The following request returns 1337 (seconds), it seems to be correct :

SELECT cost FROM driving_distance('SELECT gid AS id, source::int4 AS source, target::int4 AS target, time_cost_car::float8 AS cost FROM ways', 2969, 100000, true, false) WHERE vertex_id=70890;

However, the polygon produced by the following request seems to be wrong :

SELECT * FROM alphashape('SELECT id, ST_X(the_geom) AS x, ST_Y(the_geom) AS y FROM nodes JOIN (SELECT * FROM driving_distance(''SELECT gid AS id, source::int4 AS source, target::int4 AS target, time_cost_car::float8 AS cost FROM ways'', 2969, 30, true, false)) AS route ON nodes.id = route.vertex_id');

Do you kwow why ?

I'm not sure about JOIN with "nodes.vertex_id". What is "vertex_id" ? Why not "edge_id" ? how to be sure "nodes.id" semantic corresponds to "vertex_id" ?

The source parameter used into "driving_distance()" ("2969" in my example) is vertex_id ? edge_id ? or another id ?

I have performed other tests to illustrate the problem :

`SELECT sum(cost) FROM (SELECT * FROM shortest_path('SELECT gid AS id, source::int4 AS source, target::int4 AS target, length::float8 AS cost FROM ways', 25069, 13530, true, false)) AS foo;

Result => 16.7790377846424

SELECT sum(length) FROM ways, (SELECT gid, the_geom AS the_geom FROM shootingstar_sp('ways', 25069, 13530, 0.1, 'length', true, false)) as rt WHERE ways.gid=rt.gid;

Result => 63.5863605213523`

The result retuned by shootingstar_sp() seems to be OK.
But to generate the polygon, I use driving_distance() which returns the same result as shortest_path(). This result seems to be wrong.

So, what is the difference between shortest_path() (or driving_distance()) and shootingstar_sp() ?


texts: Making sense of maptitude's geocoding results

texts:
I'm using maptitude to populate latitude and longitude from a dataset for further mapping.

However, after geocoding on address, i'm being given lat/lons that make no sense. See the examples below

Lat         Lon
-72576271   42256531
-73203079   42712224
-70822976   42587150
-71089458   42339990
-71127491   42382567

Can anyone explain why this is happening? I can't seem to change the format to anything I recognize. When I take these out of maptitude the rest of my software can't make sense of it.

Can anyone tell me what I'm doing wrong?


texts:
I'm novice in Geoserver. I use Version 2.15.1.

I would like to display labels. This is my SLD – made and export with QGIS:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1.0" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:se="http://www.opengis.net/se">
  <NamedLayer>
    <se:Name>Beschriftung</se:Name>
    <UserStyle>
      <se:Name>Beschriftung</se:Name>
      <se:FeatureTypeStyle>
        <se:Rule>
          <se:Name>Single symbol</se:Name>
          <se:PointSymbolizer>
            <se:Graphic>
            </se:Graphic>
          </se:PointSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:TextSymbolizer>
            <se:Label>
              <ogc:PropertyName>label_text</ogc:PropertyName>
            </se:Label>
            <se:Font>
              <se:SvgParameter name="font-family">MS Shell Dlg 2</se:SvgParameter>
              <se:SvgParameter name="font-size">6</se:SvgParameter>
            </se:Font>
            <se:LabelPlacement>
              <se:PointPlacement>
                <se:AnchorPoint>
                  <se:AnchorPointX>0</se:AnchorPointX>
                  <se:AnchorPointY>0.5</se:AnchorPointY>
                </se:AnchorPoint>
              </se:PointPlacement>
            </se:LabelPlacement>
            <se:Fill>
              <se:SvgParameter name="fill">#8b0000</se:SvgParameter>
            </se:Fill>
            <se:VendorOption name="maxDisplacement">1</se:VendorOption>
            <se:VendorOption name="conflictResolution">false</se:VendorOption>
          </se:TextSymbolizer>
        </se:Rule>
      </se:FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Everything looks nice in QGIS. On the Geoserver the texts are shifted and written in each other.

Am I doing something wrong or is it not possible to insert the SLD from QGis in the geoserver?
In addition, I would like the text in different zoom levels are displayed in different sizes. How do I realize that?

The pictures show the text layer together with another layer. First QGIS then Geoserver:


texts: Fix leaflet script in order to change coordinate projection

texts:
I have a leaflet script which using ziped shapefiles to add it on the map. The shapefiles are in epsg projection 31700 (dealul piscului 1970) and the position on the openstreet map is not correct, so I need some solution to fix the script and when I place the next zip file(epsg projection 31700 ) that would be automatically converted in wgs84 and placed on correct location.

This is my script:

    <meta charset='utf-8' />
    <title>
        Test Shapefile
    </title>
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.2/dist/leaflet.css" />

    <link rel="stylesheet" href="gh-pages.css" />


texts: Copy selected attributes from one table to another in ArcGIS

texts:
I have two SHP files, with different attribute tables.  The first is my base data, and the second is for use to import into an external modelling software package.  The base data contains a whole bunch of information not required for the model, or I need to combine data from multiple sources to generate the model files.

I want to copy data from my base data into the second SHP file, but transfer only selected attributes to the second table.  Also it would be good if I could "map" the attributes, such as:

Base Attribute "Resvr_Name" to "Description" in second SHP
Base Attribute "AssetID" to "id" in second SHP
Base Attribute "Pump_ID" is not copied to second SHP

I am a novice in GIS, and am still coming to terms with the terminology and couldn't find the correct tool to do this, likely looking at the wrong area.

Ultimately I want to set up a workflow to take my base data layers and manipulate to the new layers so I can update the models easily in the future.


texts:
Similar to one of the past questions above I am struggling to see my R script folder. Although despite restarting QGIS3.6.2 and also checking in this pathway:

Options > Processing > Providers, for the R script folder I cannot see it anywhere. I cannot understand why this might be unless it is a firewall I have on my computer that I need to alter.

Is this likely?

How do I do this if this is the case?


texts:
I am trying to create a color map overlay of sound levels from a known source using QGIS (3.8). The results of the noise calculations come out as a raster in polar coordinates (NOT rectangular), centered around the source. The raster can output as a CSV file with the format of Lat, Long, Noise level as follows:
35.59, -82.55, 45.5
35.58, -82.56, 44.5
35.60, -82.54, 55.2
...

There must be something simple I am missing because all I seem able to do is display the individual raster points. I don't want to even see those. All I want to have plotted is a color map of the levels.
I have tried using the Raster->Conversion->Vector to Raster tool, but all I get are not particularly descriptive errors.


texts: Raster generalization - buffers in rasters, expand pixels?

texts:
Is it possible to create buffers for pixels of raster files? Actually I need to expand the pixels classified as 1 (in white in the figure) with a spatial range of 1 or 2 pixels, in order to perform some generalization.
I'm using QGIS, is this possible with gdal or something?


texts: Is it possible to style a part of a label?

texts:
My label consists of two different things:

<ogc:PropertyName>user</ogc:PropertyName>
<ogc:PropertyName>room</ogc:PropertyName>

I would like to style the two parts differently, for example have the room number in bold. Is it possible?


texts: How to uninstall PostgreSQL Server on localhost and reinstall with new user and password?

texts:
On Windows 7, I'd like to install a brand new, fresh installation of PostgreSQL/PostGIS on a laptop, and wipe ALL the localhost servers, users, data and passwords clean, and then reinstall as if it had never been installed before.  I have QGIS 1.8.0 running perfectly, but I'd like to create a PostGIS database.  However, an idle and unnecessary installation already exists that I'd like to clean off or reset the password on.

I've done an 'uninstall' of Postgis, and then PostgreSQL, but that didn't remove the network service and former postgresql user.  Reinstalling requires the same password and user as before, and so I'm stuck.

If there is an easy solution, without reinstalling Windows 7 or QGIS 1.8 (osgeo4w) then I'd like to go that route.  What should I do in this situation?


texts: Extent changing in ArcGIS Pro when shapefile added to map which only had basemap?

texts:
Using ArcGIS 10.3 for Desktop:

In ArcMap:

Open a Blank Map
Add Basemap of Imagery (but any basemap will do)
Zoom to Australia (but any area will do)
Add the countries shapefile from Natural Earth (but any shapefile that covers an area much larger than where the basemap has been zoomed to will do)
Notice how the extent does not change which to me is the expected behaviour

In ArcGIS Pro:

Create a project using Map.aptx
Change the Basemap to Imagery (but any basemap will do)
Zoom to Australia (but any area will do)
Add the countries shapefile from Natural Earth (but any shapefile that covers an area much larger than where the basemap has been zoomed to will do)
Notice how the extent changes to become the extent of the shapefile that was just added

I think the software behaviour observed in the last dot point is a bug, and am wondering if anybody has already reported this and has a bug (NIM) number that can be used to track its resolution?


texts: Does QGIS support topological editing of lines?

texts:
Does QGIS support topological editing of shared vertices between two or more lines? When in editing mode, if I select a vertex at an intersection, it seems that sometimes it will move all lines connected to that vertex, and sometimes not.

I am using QGIS 2.6 and have Enable topological editing turned on in the Snapping options. These lines are all within the same layer.


texts: Snapping coordinates/points across different layers in QGIS

texts:
I'm referring to the plugin that was Numerical Vertex Edit where it selected the nearest point in one layer and allowed for a copy and paste to another layer's any given point to match its coordinates. Unfortunately, that plugin has crashed in 2.16.0 version, doesn't snap points accurately across layers anymore on older version and is no longer supported by the author. As far as I can tell, there's no replacement tool that allows for the same easiness of duplicating the same coordinates across different layers.

The problem is I have about 52,000 points to adjust from my layer to another and manually dragging with the Node tool is not time efficient.

Does anyone have any recommendations of a similar tool/plugin I can use or even some kind of code I can look into?

First picture shows what I want it to do but with the greatest accuracy and time efficiency. Second picture shows the original.


texts: Change the stylemap styles after cloning

texts:
I'm creating bearing lines with labels.

The style is set for all markup using the styleMap

I am cloning the styleMap so that the labels don't get overwritten each time the page does a redraw - which is every 3 seconds or when the map refreshes

I want to be able to have the same style as the original styleMap, however, after the clone, the lines come out black and creating another styleMap doesn't seem to work either

getBearingLabel : function(feature)
{
    feature.style = Object.clone(this.style);
    var point1 = feature.geometry.components[0];
    var point2 = feature.geometry.components[1];
    var midPoint = FindMidPoint(point1.y, point1.x, point2.y, point2.x);
    var midPosition = this.map.getPixelFromLonLat(new OpenLayers.LonLat(midPoint.lon, midPoint.lat));
    var length = GCDistance(point1.y, point1.x, point2.y, point2.x).toFixed(2);
    var point1Position = this.map.getPixelFromLonLat(new OpenLayers.LonLat(point1.x, point1.y));
    var bearing1 = GetForwardBearing(point1.y, point1.x, point2.y, point2.x);
    if (bearing1 < 0)
    {
        var fullCircle = 360;
        bearing1 += fullCircle;
    }
    feature.style.labelXOffset = -(point1Position.x - midPosition.x);
    feature.style.labelYOffset = point1Position.y - midPosition.y;
    feature.style.label = "Bearing: " + bearing1.toFixed(2) + "°\n" + "Distance: " +    length + "nmi";
}

Is it possible to set a default, select and delete style that don't affect the original styleMap?


texts:
i am beginner in mapserver and openlayers. i start with mapserver and now studying openlayers and see openlayers can render vectors directly.

my questions is :

why use mapserver inside openlayers instead of using openlayers alonely?
as i know openlayers render vectors in clientside. can this cause security problem about data that we won't share with users?
if i use mapserver inside openlayers, can i show attribute of features on user's click?


texts: Counting number of pixel identified as water from a collection of landsat image using Google Earth Engine

texts:
My objective is to count the number of pixel identified as water from a collection of landsat images. The following function masks out non-water area for each image in the image collection, it also add a new band called 'NDWI' to each image:
var landsat8= ee.ImageCollection('LANDSAT/LC8_L1T_TOA').filterBounds(geometry)
   var waterThreshold = 0;
// water function:
var waterfunction = function(image){
  //add the NDWI band to the image
  var ndwi = image.normalizedDifference(['B3', 'B6']).rename('NDWI');
  //isolate the water likelihood band
  var quality = ndwi.select('NDWI');
  //get pixels above the threshold
  var water01 = quality.gt(waterThreshold);
  //create a mask from high likelihood pixels
  var watermask = image.mask().and(water01 );
  //mask those pixels from the image
  return image.updateMask(watermask).addBands(ndwi);
};
var collection= landsat8.map(waterfunction);

Could you help me do the next steps?

Count how many pixel identified as water (band NDWI >0) in each image within the polygon called "geometry" and then calculate the water area. Pixel scale = 30 (m)
Print a time series of (1)

I know the cloud could be a problem, and we should clean it first, but leave it like this for now.


texts:
I've been working in GIS for about a year and have a functional grasp of Projections and Transformations from within ArcGIS (10.0).  Geosoft Oasis is another program we use.  In working with our data we primarily use NAD83 Zone 13 and 14 North.  Although WGS84, NAD27, and NAD83(CSRS) often join the mix.  With each of these different Coordinate Systems, there are many transformation options to go from one to the other.

I would really like to have a better understanding of how much of an error is created in each transformation.  To do that, could someone tell me the best way to test this out?

As an example, we often have data that spans Zones.  What happens when we using Zone 13 projection in our arc project in an area that should be Zone 14, but we don't want to break the data up?  How much of a penalty is there if I work in WGS84 and then transform the data into a NAD83 projection (or a NAD27 one)?  Are the errors cumulative?  If I switch back and forth 50 times will my data move?  Or if I switch between 3 Projections using 3 Transformations?

I'm not sure of a good method for finding an answer to these questions.  I would like to be able to work through it myself instead of taking someone's word for it, but that might be a more technical task than I'm able to do...

Any help is appreciated, thanks,

Thomas


texts: How can I apply the arcpy.Rename_managment as parameter for each feature class in a loop?

texts:
I have 3 Feature Classes in a gdb. I want to create a script tool to rename each Featureclass and get each newname as parameter so we just have to type the newname we want. The original name has to appear in the tool (see image below). Is there a way to have this for each featureclass?

This how it looks for one feature class when opening the tool, but I want each feature class to appear here as rename parameter.

Here is the script I'm trying to create but it might be impossible. Do you have any idea of how I could manage to do that?

# Import arcpy module
import arcpy, sys, string, os

# Set Geoprocessing environments
workspace=arcpy.env.workspace = "D:\\PATH to GDB"

# Script arguments
name1 = arcpy.GetParameterAsText(0)
name2 = arcpy.GetParameterAsText(1)
name3 = arcpy.GetParameterAsText(2)

# Local variables:

Data_type = "FeatureClass"

# Process: Rename

fcs=arcpy.ListFeatureClasses("*","All")

for fc in fcs:
    arcpy.Rename_management(fc, name1???, Data_type)


texts: How to add rasters to a mosaic from a feature class with raster attribute fields?

texts:
I want to create a mosaic from rasters stored as raster attribute fields inside a feature class.

When I run Add Rasters To Mosaic Dataset I get the following error:

2015-02-07T18:59:39.439: Error: 8004203f: Could not open source as a raster dataset. [c:\program files (x86)\arcgis\desktop10.1\bin\<msg>1;2015-02-07T18:59:39.449: Error: 80040213: Failed to open raster dataset

Does anybody know why I get this error and how to avoid it?


texts:
I want to add a loading symbol to my openlayers map, which is triggered when a layer is set to load and stopped when the layer is loaded. So I used the event listeners loadstart and loaded. Here is my code so far to load the layer:

    uf300 = new OpenLayers.Layer.Vector("UF Notfall", {
            projection: toProjection,
            styleMap: style_uf300,
            strategies: [new OpenLayers.Strategy.Fixed()],
            protocol: new OpenLayers.Protocol.HTTP({
                url: "/GeoJSON/uf_hq300.geojson",
                format: new OpenLayers.Format.GeoJSON()
            })
        });

LoadingCircle(uf300);

The event listener is in this function:

function LoadingCircle(layer) {

    layer.events.register("loadstart", layer, function o() {
        markers.clearMarkers();
        var lonlat1 = map.getCenter();
        var circle = new OpenLayers.Marker(lonlat1,icon1);
        markers.addMarker(circle);
    });
    layer.events.register("loadend", layer, function p() {
        markers.clearMarkers();
        lonlat1=null;
        circle=null;
    });

Unfortunately this only works when the layer is selected for the first time. When the user makes the layer invisible and then visible again the symbol won't show.

I tried refreshing and destroying the layer when the user makes it invisible, and also tried 3 different types of calling the event listener. Unfortunately nothing worked...

How can I start running the loading symbol every time the user decides to make the layer visible?


texts: How to select features of visible layers in QGIS

texts: In QGIS 1.8 I used plugin "Select features of visible layers by rectangle" to know the layer that owns a visible feature. In QGIS 2.0.1 this plugin is no more available. I wonder if it is possible to use another way. "Value tool" doesn't seem to be so useful for the purpose ....


texts: Interpolation without a point layer in QGIS

texts: I have a vector layer with incidence data (i.e. frequencies) and I made a graded color map from this using the above frequencies. Now I am looking forward to creating an interpolated (kriging) map from the above frequencies. Is there a method to create such interpolated map from my incidence data? (or else is it possible to create a interpolated map with out a point layer?) Thanks.


texts: Providing alternative "label" when styling vector layer with OpenLayers 2?

texts:
I'm using OpenLayers2.12 and I am styling a vector layer using your typical new OpenLayers.Style({

Now, this layer does two things.

First , renders polygons from GeoServer, so in the style I have 'label': '${p_name}'. Works fine.

The second thing the layer does is providing tools to the user to edit an already existing polygon. So when a user chooses to edit a polygon, (resize it for example) the familiar little points appear , as handlers.

Now, these points/handlers render "undefined", as name because the 'label': '${p_name}' is actually undefined. Did not came from GeoServer.

Is there a workaround? How can I set an alternative name for the handlers?


texts:
I'm hoping to overlay UK regions (East Midlands, Wales, London etc) on a Google Map. Ideally the regions could be coloured, opaque and have some form of label. There is no hover / interaction requirements for the overlays.

Q - #1 - It seems like this could be achieved with KML or fusion tables. Which do you think would be better?

Q - #2 - Do you know of a good source for the outline points of these regions? I've got access to points on other maps (SVG - see link below) but not sure if this translates. If regions are not available counties could be used and coloured the same (Counties - see link below )

SVG - http://www.guardian.co.uk/sport/datablog/interactive/2012/jul/11/olympians-map-uk-olympics
Counties - http://www.guardian.co.uk/news/datablog/interactive/2011/nov/16/youth-unemployment-map

Many thanks


texts: Do pop-ups really work in Flexviewer 2.4?

texts:
I am trying to configure pop-ups using this code:

<layer label="Lansdslide Layers" type="dynamic" visible="true" alpha=".75"
                url="http://yoururl/ArcGIS/rest/services/Hazards/SR2/MapServer/"/>
                <sublayer id="1" popupconfig="popups/PopUp_Historic_Landslide_Points.xml"/>
                <sublayer id="2" popupconfig="popups/PopUp_Scarps.xml"/>
                <sublayer id="3" popupconfig="popups/PopUp_Scarps_Flanks.xml"/>

that call simple xmls like PopUp_Demographics_BlockGroups.xml found in the sample flexviewer, but with the fields named appropriately for my layers

I've also tried following this esri forum with closing the sublayer element and get the error:

http response status: 200

Fault code: Client.CouldNotDecode

Fault info: Error #1085

Fault details: null

Does anyone have a url that shows pop-ups really working?


texts:
Same problems after uninstalling and reinstalling 2.18.3...  Have the crash report, but can't see that I can post it here so anyone can see some answers in it...

Some more information about my problems with QGIS 2.18.3.

2.18.3 is the second version I have installed on this computer, the fist was the version before 2.18.3.
I create a new project with only 2 vector features, no problem with that...
Then I saved it and try to open the new project again, and get the same problem.
My QGIS projects is saved in a folder outside QGIS folder
I have tried to open the project files from explorer with same result

I have a problem with QGIS v. 2.18.3

I start the program from desktop icon.
Program start with no problem
when I double-click on a project I get message "qgis-bin.exe has stopped to work"
the project I have is very small, just some vector and shape features
I have reinstalled 2.18.3, but the same thing happens...
I have a new laptop HP Elitebook, Windows 10.
I use an extern screen.

What is the problem?


texts:
I want to share QGIS files and maps which are made by me, to some of my friends through a server. Then I want to know:

how to establish a server and network to upload QGIS maps and files
how to upload maps and QGIS files

I refer to the QGIS server instructions, but I couldn't get any favorable result. I want simply understandable instructions.

My system is Windows 7


texts: Converting ArcSDE to CAD using FME when blockreference involved?

texts: I try to convert some lines from ArcSDE to cad by FME and I have set autocad_original_entity_type=autocad_lwpolyline and autocad_entity=autocad_line, I suppose they will be line but they have been blockreference. I find fme_geometry is fme_aggregate and fme_type is fme_line in FMEINSPECTOR, it is strange.


texts: igraph matching coordinates of map: project from lon lat to a x,y scale?

texts:
I would like to use igraph plotting a network on top of a map. For igraph nodes, I would like to use coordinates from the map (the centroid of polygons). I have now tried for hours but somehow I cannot find out how to correctly rescale the node positions of the igraph. Would it be possible to project from lon lat to a x,y scale?

Load packages.
library(rnaturalearth)
library(igraph)
library(sf)
library(tmap)
library(dplyr)

Load countries from package. Use European countries.
countries <- st_as_sf(ne_countries(scale = 110, continent = "Europe"))
countries <- countries[!countries$adm0_a3 %in% c("RUS", "FRA"),]

Populate matrix for with a three ties.
m <- matrix(0, length(countries$adm0_a3), length(countries$adm0_a3))
m[2,3] <- 1
m[3,6] <- 1
m[10,2] <- 1

Get igraph object from matrix.
g <- graph_from_adjacency_matrix(m)

Transform projection for centroid calculation to European projection.
countries <- st_transform(st_as_sf(countries), 3042)

Extract centroids from country polygons.
points <- countries %>%
  st_centroid() %>%
  unlist() %>%
  matrix(ncol=2, byrow=TRUE) %>%
  as_tibble()

Now plot first map and then igraph.
tm_shape(countries) +
  tm_polygons(col = "white")
par(new = T) # allows layering plots of all sorts
plot(g,
     layout = as.matrix(points), # feed centroid coordinates to igraph
     # xlim = c(-180, 180),
     # ylim = c(-90, 90),
     # rescale = FALSE
     )

Image shows, igraph and map coords do not match. How can best I resolve that?


texts: Use EXTENT of a LAYER in Mapserver to crop a layer?

texts:
I have two vector layers in my map file that are at very different resolutions, and overlap somewhat.  This is causing me some issues, and I would be happy if the higher resolution layer simply ended at the beginning of the lower resolution layer.

Here's the layer I'd like to crop (I've removed a bunch of class definitions):

LAYER
NAME "DEPCNT_CA276800"
TYPE LINE
DUMP true
TEMPLATE fooOnlyForWMSGetFeatureInfo
EXTENT -65.4994451 42.6667472 -65.243000 44.6667528
DATA "DEPCNT"
METADATA
  'ows_title' 'DEPCNT_CA276800'
END #metadata"
STATUS ON
CONNECTIONTYPE OGR
CONNECTION "./s57/CA276800.000"
TRANSPARENCY 100
PROJECTION
  'proj=longlat'
  'datum=WGS84'
  'no_defs'
END #projection

CLASSITEM 'VALDCO'
CLASS
  EXPRESSION ( (0 < [VALDCO]) AND ([VALDCO] <= 10) )
  NAME 'DEPCNT'
  STYLE
    WIDTH 0.91
    COLOR 0 170 255
  END #style
  LABEL
    TEXT "0"
    SIZE 10
    ANGLE FOLLOW
    POSITION AUTO
    FORCE TRUE
    ANTIALIAS TRUE
  END #label
END #class

....

    CLASS
  EXPRESSION ( (200 < [VALDCO]) AND ([VALDCO] <= 210) )
  NAME 'DEPCNT'
  STYLE
    WIDTH 0.91
    COLOR 0 170 255
  END #style
  LABEL
    TEXT "200"
    SIZE 10
    ANGLE FOLLOW
    POSITION AUTO
    FORCE TRUE
    ANTIALIAS TRUE
  END #label
END #class

END #layer DEPCNT_CA276800

No matter what I set the maxx of EXTENT to it draws the entire X range of the layer.  Is what I'm trying to do even possible, or is there some other method I could try?


texts: How to store historical versions of road (route) portions?

texts:
Part of my job is to analyze certain portions of road for our clients. A client will ask, I want to look at Road A from parcel XYZ to parcel RST and Road B from parcel RST to parcel OPQ.

The way I do this currently is:

I select the road line layer around the parcels
Save the selection as a new shp layer
edit, trim, the layer as needed
produce a new shp that matches the client's request.
We analyze the hell out of the road

The reason I do selection/save as is that, in future when road geometry changes we will still have the original requested road. The problem I find with this is that by the end of the year, i have 100+ mini layers of road segments.

What are the issues in my process, and how can I improve on them?


texts: How to create a mosaic in QGIS with cutline and feathering for Landsat-8 imagery

texts:
1 - I have two scenes Landsat-8 RGB 6/5/4 and I need to mosaic them:

2- This is my cutline in polygon format that will smooth the overlapping area:

3 - So, I need to create a mosaic with feathering like ERDAS or ENVI applications. This is my goal:

It's possible to make this in QGIS, GDAL or another opensource software?


texts: QGis server : 0 is wrote instead of "null"

texts:
I am trying to load PostGis data on QGis (client) with QGis server (WFS).

Unfortunately, missing values and NULL values for numbers appear as 0.

Here is what I tried:

specified variable QGIS_OPTIONS_PATH in file conf "httpd-qgis.conf" Apache (on Windows)

FcgidInitialEnv QGIS_OPTIONS_PATH "my\path\"

I placed a file at my\path\QGIS\QGIS2.ini

Content of the file:

[Qgis]
nullValue=NULL

It don't work !

Do you have any idea what I did wrong that NULL values still don't work
in QGIS Server ?


texts:
I have a series of layers of lines (shapefiles) in My Project. The CRS of some are different and to merge them they all must have same CRS.

When I use Processing/Toolbox/Qgis_algorithims/Reproject_layer the reprojection only works if it is allowed to save to temporary file somewhere (it will not change the CRS when I reproject if I try to save and replace it in My Project directory);

I must remove the original from the layer list and reproject the temp file (without changing the CRS) to get it into my project and name it appropriately.

Is there a better way to reproject a layer in Qgis?


texts: Zonal Statistics is returning null values in ArcGIS Desktop?

texts:
I am using Zonal Statistics as Table to obtain the Max height from a DEM for each polygon (then Joined to the polygons).  For some reason, a lot of the polygons get NULL returned.  All the polygons returning Null appear to be between 1 - 4 cells in size (given the DEM scale).  Other same sized polygons are however returning the expected result.  154 out of 3131 polygons have NULL values

I have used the Identify tool to check that I do have non-null values in the underlying DEM for a bunch of these.

The problem appears to be the FID is not being created for the Zonal Statistics table for some polygons.  I have checked a couple of other small polygons and the values obtained from Zonal Statistics appear correct.  What should I be looking for/testing? How can I correct this?

I am using ArcGIS Desktop v10.6 with Advanced License.


texts:
I have some points and I would like to plot the density map of them.

I have tried like this:

plt.figure()
xedges = np.linspace(540000, 550000, 20)
yedges = np.linspace(5200000, 5500000, 20)
H, xedges, yedges = np.histogram2d(x,y, bins=(xedges, yedges))
print(H)
H = H.T
X, Y = np.meshgrid(xedges, yedges)
plt.pcolormesh(X, Y, H)
plt.colorbar()

from scipy.stats.kde import gaussian_kde
x = np.array(x)
y = np.array(y)
k = gaussian_kde(np.vstack([x, y]))
xi, yi =
np.mgrid[x.min():x.max():x.size**0.5*1j,y.min():y.max():y.size**0.5*1j]
zi = k(np.vstack([xi.flatten(), yi.flatten()]))
fig = plt.figure(figsize=(7,8))
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212)
ax1.pcolormesh(xi, yi, zi.reshape(xi.shape))
ax1.set_xlim(x.min(), x.max())
ax1.set_ylim(y.min(), y.max())
ax2.set_xlim(x.min(), x.max())
ax2.set_ylim(y.min(), y.max())

but I don't want my density map would be blocky. I want something smoother like below.
If anybody knows what I should do, please let me know.


texts:
I want to create a python script (ArcGIS 10.1) where I loop through a GDB with several feature classes  and select all the fields which are of text type and convert them to float type. I always want to skip the first 10 and last 2 fields of each featureclass as they actually are supposed to be of text type. I am not quite sure how to do so.. I guess FeatureClassToFeatureClass_conversion does the trick but I am a bit lost.<

I asked the same Question on Geonet: https://geonet.esri.com/message/527269#527269

This is as far as I got:

# Import system modules
import arcpy
from arcpy import env
env.overwriteOutput = True

# Set environment settings
env.workspace = "D:\Test\2011_LongNames.gdb"

inFeatures = arcpy.ListFeatureClasses("*")
outLocation  = "D:\Test\FLOAT.gdb"
outName = ??? same as inFeature

field_mapping = ???? part where it converts text fields to float fields

listFCs = [f.name for f in arcpy.ListFields(env.workspace)]
listFCs = listFCs[10:len(listFCs)-2)]

for fc in listFCs:
    arcpy.FeatureClassToFeatureClass_conversion(inFeatures, outLocation, outName, field_mapping )


texts:
I tried to use:

Error = ""

vLayer.saveStyleToDatabase  ("styleName", "description", True, "", Error)

in a python-plugin for QGIS 2.6 to save the data but no success.

No error is written. First of all , where should the table be? I think it's supposed to be in the datasource-db (sqlite) but I can't find any information.

Any help?


texts:
I've already geocoded a table of address, and I know I use credits for that.  I'm wondering, when I use the Interactive Rematch Tool, am I using credits?

For example: After the initial geocode, I see an address has come up as a tied address.  So I view my address make necessary edits to the address, then match the candidate address that fits best.

Would I use credits doing that?


texts: Building a polygon over a reachable area

texts:
I am currently working in the field of isochrones and the underlying algorithms. What now causes problems is not the calculation if the isochrone itself, but the visualization of the results.
The result of my isochrone algorithm are points and edges. In fact I do have a working solution, but for 3873 edges and for 1529 nodes things seem to take forever (around 2.0 seconds on my Lenovo T440s laptop which contains a 2015 Core i7 CPU and a pretty fast SSD). Instead of seconds I want something more like msec :-).

Maybe someone can help me to reduce the calculation time needed to build the polygons which visualize the reachable areas.

But wait... first things first!
Here is a visualization of the edges that I are the calculation result of my isochrone:

These edges are stored in a PostGIS database table and are simple linestrings.

What I want to show to the user looks like this:

Note the disconnected areas in the very south and very east of the picture. These should be drawn as separate areas (so no merging allowed here :-))

Currently I am using this query:

SELECT ST_AsGeoJson(St_Transform(ST_Multi(ST_Collect(polygons)), 4326)) AS coverage FROM (
    SELECT ST_MakePolygon(ST_ExteriorRing(ST_GeometryN(segments, generate_series(1, ST_NumGeometries(segments))))) AS polygons FROM (
        SELECT ST_Union(ST_Buffer("GEOMETRY", 20, 'quad_segs=2')) AS segments FROM my_edges AS a
    ) AS b
) AS c

I already did some experimenting and I also read a lot of documentation, but I just can't find a better solution.
In my eyes the big problem is the usage of ST_Union (as stated in the docs this function can be slow). The very interesting thing is that replacing it with ST_Collect seems to slow down the ST_Buffer calculation so that all-in-all the following query takes even longer, although it does not fill the areas between the edges (it only creates a buffer around the lines):

SELECT ST_AsGeoJson(St_Transform(ST_Multi(ST_Collect(polygons)), 4326)) AS coverage FROM (
    SELECT ST_Buffer(ST_Collect(ST_LineMerge("GEOMETRY")), 20, 'quad_segs=2') AS polygons FROM my_edges AS a
) AS b

This takes around 3.8 seconds on my system (so nearly twice the time).
My first conclusion out of this little benchmark is that ST_Buffer gets unexpectedly slow when it comes to MultiLineStrings (even slower than when creating buffers for each line and merging the buffers - which in my eyes is just weird)

I also tried to use alpha-shapes (using the implementation from pgRouting), but since there is no alpha value to set (and in fact I would not really now to which value to set such a value) I just get one great polygon (so I'd lose the regions in the very south and east as separate regions which is not what I want).
Also ST_Polygonize (which was the first thing that came in my mind) did not produce any usable results, but maybe I missed something here...

Is there a better way to create the area shown in PostGIS? Maybe also by using java code (jts) or client side javascript code (jsts)? In fact I could live with loosing some detail as long as the areas shown in my result stay separated and the calculation gets (much) faster.


texts: What algorithm was used for generation of this vector layer?

texts:
The second image is a raster layer and in the third image obtained vector layer is so accurate.

What algorithm would have been employed?

Normal methods doesn't give nearly equal vectorization.

I applied Raster to polygon conversion and the output is the below image where the green=raster, red=accurate vector,black=result of raster to poly. the red and black both are vectors but are very different.

Green line original raster,
red is the accurate vector,
Black is the outcome of the raster to polygon func.


texts:
I would like to use a custom font to mark certain features on a map. It needs to be defined as an attribute as the features in question are part of a unified text layer that includes various categories.

How can I do this?


texts: Can Irish points be accurately represented by British OS Grid references?

texts: I'm currently working in a database which stores mainland British locations as their Ordinance Survey Northing/Easting values. Can points in Ireland (primarily Northern Ireland) be accurately represented via simply adding to the datum or is the curvature too much?


texts: Null values being interpolates as 0 in QGIS

texts:
I have  a file with data fields which I have imported as CSV. When I look at the Field Attribute Table, the empty fields appear clearly as NULL values. However when I interpolate the data, the NULL values are being treated as 0 (zero).

How do I get around that?


texts:
I am quite new to QGIS, so sorry about maybe to simple question.

I would like to set the GPS track line width in map units (meters). I use QGIS in hydrographic survey in a boat. Having the track line in map units, I could see if I have covered the survey area totally. Like if I have "painted" the survey area. Now the line width is in pixels (px).

So, is this possible to do by adjusting the setting or is there an "easy" way to do it? Doing this after survey is of course possible, but I would like to it in the boat.


texts: Exporting grid line nodes with ELEV attributes as data frame?

texts:
I would like to have a data frame of nrow x ncol where nrow = rows of my grid lines and ncol = col of my grid lines. The purpose is to use the ELEV data for 3D topography modeling in R.

This is what I'm looking at:

How can I export the node attributes in that same disposition?


texts: How to convert Singapore Onemap Co-ordinate to Google maps co-ordinate system

texts:
I have to fetch few 3000 co-ordinates (I am Geo-coding ) and convert it into Google map co-ordinate system.

Following is the process I am doing

I am calling Mapone.sg API for geo-coding in return it gives me x.y values (I am unable to understand the co-ordinate system ) and which needs to be converted to Google map Co-ordinate system.

If you can give me a right direction to work on it will be nice.

Mehul


texts: How do I create a map that displays only polylines that contain a particular attribute value?

texts:
We have had a consultant create 7 options for a series of remote road networks. The options share segments so Option A contains segments 1 to 6, Option B contains segments 1 to 5, 7 and 8, Option C contains segments 1 to 5, 7 and 9, Option D contains segments 4, 6, 7, 8, 10, 11 and 12, etc.

I have added an Option field in the attribute table so that segment 1 has Option "ABCFG", segment 2 has Option "ABCFG", segment 3 has Option "ABC", etc. So I can query to select Option contains "A" for all segments that are part of the "A" option.

Now, I'd like to display only those selected segments and create a printable map.

How do I do this? (Or maybe I need to do it differently)


texts: Using PostGis BBox and ST_intersects Queries?

texts:
CartoDb Recommend here that the following query is faster than an St_intersects Query

SELECT * FROM {table_name} WHERE the_geom && ST_SetSRID(ST_MakeBox2D(ST_Point(-73.9980, 40.726), ST_Point(-73.995, 40.723)), 4326)

I have the following Query that works just fine and returns GeoJson as needed,

WITH c AS (SELECT -73.976440429688, 40.743095232182, -73.970947265625, 40.738933241136, 4326 As srid)  ,
bbox AS (SELECT ST_Transform ( ST_MakeEnvelope( -73.976440429688, 40.743095232182 ,-73.970947265625 , 40.738933241136 , 4326) , 900913 ) As geom FROM c )
SELECT row_to_json(fc)
    FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features
    FROM (SELECT 'Feature' As type, osm_id As id,
        ( SELECT row_to_json(t)
         FROM (SELECT osm_id, "name" ) t )As properties,
         ST_AsGeoJSON(ST_Transform (lg.way ,4326 ) )::json As geometry
    FROM planet_osm_polygon As lg, bbox
        WHERE ( building is NOT NULL) AND ST_Intersects(lg.way, bbox.geom)
            ) As f ) fc;

I have been trying to create the same JSon result using ST_MakeBox2D in a similar fasion to the CartoDb example and failing miserably.

My objective is to have the fastest possible query for any geometry that any part of itself WITHIN the bounding box.

My Questions are:

Which method will return the fastest possible result, assuming that the Columns in the WHERE clause are indexed properly?
How do I change my query to use St_makeBox2D with the geom && syntax as per the CartoDb Example?


texts: "Relief" function from the Raster Terrain Analysis plugin in QGIS 3.0

texts:
I am using QGIS 3.0, where I can't find the Raster Terrain Analysis plugin.

I am under the impression that the plugin was embedded into the QGIS 3.0 version, as under "Raster --> Analysis" there are options for "Hillshade", "Slope" and "TRI" for no relief.

If this is the case, does anyone know how to obtain "Relief"?


texts: What algorithm should I use for wifi geolocation?

texts:
School Pickup Use Case (update)

It might be helpful to go into a more concrete use case instead of the original backyard example below.  Local law enforcement has started cracking down on use text messaging and cell phone use in school zones.  This presents a problem for parents picking up kids after  a middle school function.  Even for those who flaunt the law, the cell tower quickly becomes overloaded when hundreds of kids call their parents at once.  The campus is large, with wifi coverage.  It seems like it should be possible to write a mobile app that would allow a cell phone user to send a text message containing a list of wifi signal strengths to a webservice.  The web service would then create a location fix and push the message to the parent's on board navigation device.  The parent would then drive to the correct location on the campus.

Backyard Use Case (original)
When I take my laptop into my backyard and choose "view available networks" I see a list of my 4 neighbors.  As I walk around, the relative signal strengths from my neighbors changes.

I'd like to stand with my laptop at known locations in my back yard, click on the map and collect points with 4 different signal strengths.

After collecting a lot (but not too many) of these calibration points, I'd like to then write a program that takes 4 wifi signal strength levels and estimates a location in the form of an error ellipse. The signals might be measured using a different device than the one used to collect the original calibration points.

What algorithm should I use?

I do not want to disturb my neighbors by asking them if I can come in and survey the exact location of their router.

I can assume, however, the location of my neighbors routers does not change.


texts: Creating convex hull by expression by aggregating points

texts:
I would like to recieve the centroid of a convex hull of a group of points in a layer, grouped by its name. This needs to be done by expressions, available in QGIS 3.4. E.g. I have this list of points:

id,name
1,abc
2,abc
3,def
4,def
5,abc
6,def
7,geh
8,jkl

I want to receive the centroids of

abc
def
geh
jkl

At least the first two should work as there are minimum 3 points. I was trying this expression:

centroid(convex_hull(collect($geometry,group_by:="name")))

In preview it does not throw back any errors. It actually delivers the correct geometry. But only in preview.

If I try to use this expression as e.g. Labelposition, it does not display any labels at all. If I try to use this expression in geometry by expression tool it throws back this error:

  Traceback (most recent call last): File
  "C:/PROGRA~1/QGIS34~1.3/apps/qgis/./python/plugins\processing\algs\qgis\GeometryByExpression.py",
  line 124, in processFeature self.tr('Evaluation error:
  {0}').format(self.expression.evalErrorString()))
  _core.QgsProcessingException: Evaluation error: Cannot use aggregate function in this context

Is there a way to recieve the centroid of a convex hull of grouped points using QGIS 3.4 expressions?


texts:
In order to extract R-factor (RUSLE) from GPM data, I am trying to use this equation (calibrated for the island of Crete by Grillakis et al., 2020).
.
R10 is the total rainfall within a month (mm) and only for the days with rainfall > 10 mm (otherwise, set to zero), D10 is the number of days with rainfall > 10 mm, n is the number of days covered by the rainfall data, k is the individual erosive events of each month j, and mj is the total number of
erosive events of this month.
How can I extract R10 and D10 using GEE?


texts: How do I visualize points in a FeatureCollection based on feature properties using Google Earth Engine?

texts:
New user of Earth Engine and Javascript here. I have a FeatureCollection of points. These points are field observations where researchers have marked water sources, and noted whether or not they were dry at the time of observation. Basically, I would like to display these points in GEE with a different color for "dry" and "wet" observations. The water status is the "water_stat" property of each feature. I figure I should be able to assign a color for each status, but I haven't been able to work it out.

So far, I have tried FeatureCollection.draw(), but there doesn't seem to be an easy way to draw unique colors based on a feature property.

I have also tried Image.paint(), but I can't control the radius of the points that are displayed on the map: it only colors one pixel for each point. If I can get it to color more than one pixel, I think I can figure out how to get it to color those points uniquely - but I'm not going down that road if I can't figure out the one-pixel problem first.

So, I see two options: 1) figure out how to FeatureCollection.draw() with different colors, or 2) figure out how to control the radius of points, using Image.paint() - possibly by buffering the points somehow. Any ideas on how to work out either of these approaches? Code is linked and displayed below.

https://code.earthengine.google.com/8c9787c9a118b7661f62355f0715c9ef

    //This script adds field observations of water presence to the map.

   // Import features
   var fieldObs = ee.FeatureCollection("users/ansoncall/FieldObservations");

  // Adds the field observations to the map.
  Map.addLayer(fieldObs.draw({color: 'ff0000', pointRadius: 5}), {}, 'Field
  Observations'); //Can't add unique colors with .draw()??

  // Create an empty image into which to paint the features, cast to byte.
  var emptyObs = ee.Image().byte();

  // Paint all the polygon edges with the same number and width, display.
  var outlineObs = emptyObs.paint({
    featureCollection: fieldObs,
    color: 1, // Can enter a feature property if different colors are needed
  for different features. Not done yet but I think I can figure out that
  part
  });

  // Add custom color layer to map
  Map.addLayer(outlineObs, {palette: '#00ff00'}, 'Color-Coded
  Observations'); //Only ONE pixel is colored!

  // Prints the field observations to the console
  print(fieldObs, 'Field Observations'); //


texts: Feature layers don't appear in print result?

texts:
I have a problem when I print my map, when I display the result I find only one feauture of twenty. the result does't contain all features. I used esri/dijit/PrintTask

verifier: function(){ //verifier() is an onClick event of a button
var url= 'the way/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task';
var printTask=new PrintTask(url);
var params = new PrintParameters();
params.map =this.map;
printTask.execute(params,this.printResult);
},printResult: function(event)
{
console.log(event);
window.open(event.url, "_blank")
}

feature layers which don't appears on the result of print, are those where there URLs aren't links of map service, but a link to java servlets that they connect to the map service(one servlet for each map service).

maybe the print task desn't make the redirection, it seach the serviceMAP from the url in the definition of the feature layer and as it's the link of the servlet.

Sorry for my English because I'm more French than English.


texts: LeafletJS: How to hide legend when layer is clicked?

texts:
I am trying to show/hide a legend when a certain overlay is clicked, but can't seem to get the legend to hide when the overlay is unclicked.

Here's my sample setup:

//establish the data
var popDensity = L.geoJson(popDensity, {
    onEachFeature: onEachFeature
    style: myCustomstyle
});

//Create the legend control
var popuLegend = L.control();
popuLegend.onAdd = function(map){
    var container = L.DomUtil.create('div', 'info');
    container.innerHTML = '
Population

1000+

500+

etc..

';
    return container;
};

My layers control:

var baseMaps = {
    "Base map 1": basemapOne,
    "Base map 2": basemapTwo
};

var ethnicGroups = {
    "Pashtun": pashtun,
    "Tajik": tajik,
    "etc..": etc,
    "District Population": popDensity
};

map.fitBounds(pashtun.getBounds());
L.control.layers(baseMaps, ethnicGroups).addTo(map);

Here's my event handler:

map.on('overlayadd', function(eventLayer){
    if (eventLayer.name === 'District Population'){
        map.addControl(popuLegend);
    } else {
        map.removeControl(popuLegend);
    }
};

This setup successfully adds the legend control when the 'District Population' overlay is checked, but when it is unchecked, the legend does not remove itself. When you check it again, another copy of the legend is added on top of the previous legend. Any tips?


texts: sql query to get origins and destinations

texts:
I have a table of cities with an ID and geometry (200K rows) and a table of travels, with only  two ID: idfrom, idto (7K rows)

I'm wondering how could I select the geometries for each one in order to make a line later. What I'm finding is something like:

idfrom, geom_from, idto, geom_to

So, I can use the ST_makeline postgis function.

I've tried with this SQL expression:

select r1.idfrom, city.geom as from_geom, r2.idto,ity.geom as to_geom
from routes as r1, routes as r2, city
where r1.idfrom=city.id
and r2.idto=city.id

But it seems that it does not work, It returns the same values in 'from' and in 'to' columns.
I've tried more queries, but still have not found the solution

Any clue or suggestion?

Thanks!


texts: Query geoserver and get all the points in a radius of 500m

texts:
I'm using postgresql+postgis, openlayers(js) and geoserver. I have a table for hotels (id, name, geometry).

What I'm trying to do is, click on the map and place a point and show me all the hotels (points) in a radius of 500m or 1 km of that point.

My main problem is asking geoserver for the points in 500m or 1 km of the point I just made.

Do I have to use some function? Or create a sql query? If so where and how?

In the cql_filter, what Point is the lon and lat? and the the_geom is correct or should i have geometry? (because geometry is what I have in my table)

My code is 900 lines long, so I will just place here how I contact geoserver, but if you need the whole code just tell me.

var formatWFSPM = new ol.format.WFS();
var sourceVector_hotels = new ol.source.Vector({
    loader: function (extent) {
        "use strict";
        $.ajax('http://localhost:8080/geoserver/trabalhois/wms', {
            type: 'GET',
            data: {
                service: 'WFS',
                version: '1.1.0',
                request: 'GetFeature',
                typename: 'hotels',
                srsname: 'EPSG:3857',
                cql_filter: DWITHIN(the_geom, Point(-88 38),0.5,kilometers),
                bbox: extent.join(',') + ',EPSG:3857'
            }
        }).done(function (response) {
            formatWFSPM = new ol.format.WFS();
            sourceVector_hotels.addFeatures(formatWFSPM.readFeatures(response));
        });
    },
    strategy: ol.loadingstrategy.tile(new ol.tilegrid.XYZ({
        maxZoom: 19
    }))
});

Pictures of what I have and what I'm trying to achieve:

Sorry If I sound so noob, but that is because I'm new with this type of geographic stuff.


texts:
How do I determine the distance between points to the neighbor point that connected via the line(road)?

In QGIS 3.8.3 I have tried v.distance and v.net.distance but they do not help.

The line(roads) I extract from Quick OSM.

The intersection from Line Intersection features from QGIS

For example, I want the distance between the point
'718367168' to '428716812',
'718367168' to '718367169',and so on.

With exception '718367168' to '672464081' cause not connected via a line(road)

The layer Nearest and Distance is a fail one


texts: Using CON tool of ArcGIS Spatial Analyst?

texts:
I am doing a GIS project analyzing rooftops. I need to isolate North, Northwest, and Northeast facing rooftops.  I've had success using the CON tool for other raster layers, but whenever I try to use the CON tool on the aspect raster, it fails. I think it is because I am inputting the SQL expression incorrectly.
I have included images of the symbology menu and the error box.

I have tried multiple variations of the following SQL expression: VALUE = 'North(0-22.5)' OR VALUE = 'Northeast (22.5-67.5)' OR VALUE = 'Northwest (292.5-337.5)' OR VALUE = 'North (337.5-360)'

I have also tried writing the expression with the numerical values for example Northeast is all values between 22.5 and 67.5.


texts: How to calculate elevation angle between two GPS coordinates?

texts:
I have two gps coordinate points (longtitude,latitude, altitude). Within range of 1 or 2 km.
I would like to know if it is possible to calculate the elevation angle between these 2 points. simple tan function between the distance and the height difference is sufficient ?
As I mentioned earlier, these two angle are already not too far from each other ( within 1-2 km range) so we can keep it as simple as possible.


texts:
Can someone explain if I am doing this correctly please?

I've added some vectors to my map, now wish to zoom and centre the map based on the extends of those vectors.

I'm using the following code:

var dataExtent = borders.getDataExtent();

which, when examined in FireBug does return the following values:

CLASS_NAME    "OpenLayers.Bounds"
bottom         4187116.4740651
centerLonLat   null
left           -20037508.34
right          20037508.34
top            16852219.924326

And then I'm executing the following:

map.zoomToExtent(bounds, true);

(if it helps to determine if I'm indeed returning the correct values from the getDataExtend() function, the region should be Russia)

Do I need to convert those figures from the getDataExtent() to a different format?

I've also tried the following, which again didn't do anything:

    var dataExtent = borders.getDataExtent();
    console.log(dataExtent);

    var tl = new OpenLayers.Geometry.Point(dataExtent.top, dataExtent.left);
    tl = tl.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));

    var br = new OpenLayers.Geometry.Point(dataExtent.bottom, dataExtent.right);
    br = br.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));

    var bounds = new OpenLayers.Bounds(tl.x, tl.y, br.x, br.y);
    map.zoomToExtent(bounds, true);


texts: Python window vs Toolbox script in ArcGIS for Desktop?

texts:
My question is similar to Adding Layer in current session using ARCPY . My script works in ArcMap python window but not as a script in toolbox.  I am running ArcGIS 10.0 SP4. The script is given below, and the error says it fails at line 3, "CreateObject cannot open map document"

import arcpy
import arcpy.mapping as map
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
updateLayer = arcpy.mapping.ListLayers(mxd, "SectionClip",df)[0]
arcpy.MakeFeatureLayer_management(updateLayer,"SectionInner2")
sourceLayer = arcpy.mapping.ListLayers(mxd,"SectionInner",df)[0]
newupdateLayer = arcpy.mapping.ListLayers(mxd, "SectionInner2",df)[0]
arcpy.ApplySymbologyFromLayer_management(newupdateLayer,sourceLayer)
newupdateLayer.showLabels = True
for lyr in map.ListLayers(mxd):
    if lyr.name == "SectionInner2":
        lyr.showLabels = True
        for lblclass in lyr.labelClasses:
            lblclass.expression = '"%s" & [SECTION] & "%s"' % ("<CLR red='0' green='0' blue='0'>""<FNT size='12'>""<BOL>", "</BOL>""</FNT>""</CLR>")
            lblclass.showClassLabels = True

arcpy.RefreshActiveView()
mxd.save()

I am unable to upgrade to ArcGIS 10.1 any time soon so the option of using a python add-in is not available.


texts: Break between two raster layers (topographic maps)

texts:
I have the following problem [in QGIS].  In displaying two raster layers (topographic maps), a white area appears between the two.  If I apply transparency to one of the layers, this white area still hides the union of the contour lines.  Is there a way to see these layers together without having to apply transparency?  With orthographic layers the visibility of the fold is perfect without having to resort to transparency.
Original
El problema que tengo es el siguiente; cargo dos capas raster (planos topograficos)aparece entre la unión de ambos una zona en blanco. Si aplico la trasparencia a una de las capas dicha zona blanca deja vislumbrar la unión de las curvas topográficas. ¿ Existe la forma de ver dicha unión de capas sin tener que aplicar la transparencia?. Con capas ortograficas la visibilidad del pliege es perfecto sin tener que recurrir a la traspariencia. Gracias.


texts: KML (KMZ) generated from ArcGIS 10 open in Google Earth but fail to import into SketchUp 8

texts:
So i finally figured out how to import TIN surfaces from ArcGIS 10 into SketchUp 8.  To fully replicate the functionality of the legacy ArcGIS SketchUp 6 Extension I would also like to be able to export vector features. I though it might be relatively easy by just exporting to KML then bundelling that and the TIN export procedure in a single model but... Vector features exported to KMZ crash in import to SketchUp 8.
Any ideas?

I would also be perfectly happy if I could import shapefiles directly into SkethUp 8 Pro. Ruby Script or any other solution would be fine.


texts: Are there any mirrors for QGIS documentation?

texts:
I have tried several times today (July 30, 2012) to connect to www.qgis.org (to get the online documentation). The site seems to be down.

Do you know if there is a mirror to obtain the Lisboa (1.8) full PDF doc?


texts:
I am using ArcGIS JavaScript API and I want to show a message in console's log when I hold down "e" and click on a graphic drawn by a user.

this.map.graphics.on ("click", lang.hitch(this, function(evt){

  if (evt.keyCode == 69 ) {

      console.log("e clicked ");

  }

}));

I know that e's code is 69 but I think evt.keyCode == 69 need some changes.

anybody can help me?


texts: how do I view geotagged photos and audio points in qgis mac?

texts: How can I view geotagged photos and play audio files in qgis? For photos, HTML map tooltips used to work in qgis, but don't as of 2.18.2. For audio, I don't know of a solution.


texts: Getting unique values in a QGIS Expression

texts:
I'm using QGIS 3.4 attribute form to edit the widget type.
I'm trying to retrieve "cab_no." field values (only unique values) from 'U_Cabinet' layer to use it in "fdt#" field in the 'Distribution2' layer. as shown in the image below

I've been trying to retrieve unique values by using the expression builder.
I tried the expression  array_distinct(array("cab_no."))
where "cab_no." is the field who has the values.
but there is no result. as shown in the image below.

Am I missing something here??


texts: GDAL install on Ubuntu 12.04 works for python 2.x but not python3

texts:
I need to install gdal 1.10 or greater to be compatible with python3 on ubuntu 12.04. The machine also has python2 installed.

I followed instructions here Error While installing GDAL in Ubuntu 12.04. This successfully installed gdal for python2.x but not python3. I tried the command sudo apt-get install gdal-bin python3-gdal but am greeted with the error "Unable to locate pacage python3-gdal"

I also tried sudo pip3 install gdal

How can I install gdal successfully for python3?


texts:
I have a process that I'm trying to streamline.  On a regular basis I have to produce ArcPad base maps for low end GPS units.  The area that I need to cover is very large (ca. 7 million acres).  I've found that if I strip the attribute tables down to just the necessary fields, I can make the maps work, even with the memory limitations on Windows mobile devices.  The process currently goes like this...

I have a base map (mxd) connected to the corporate data sources.  I use xTools to export all of the data in the table of contents to shapefiles and also create a new mxd pointing to the new shape files.  This maintains any symbology, definition queries and labels.

Here's the part that I want to streamline:

I edit each shapefile and delete all fields that are not used for symbology, definition queries or labels.

I would like to be able to script this part of the process.  I know that some layer properties like definition queries can be accessed with ArcPy.  What I'd like to do is create a list of attribute fields for each shapefile to delete, but exclude any attributes that are being used for symbology, definition queries or labels.  Most of this is easy to figure out.  What I can't figure out is how to get the information about which attributes are being used.


texts: Distributing QGIS plugin which depends on certain Python packages

texts:
I developed a plugin for Qgis which depends on some Python packages. On Linux and Mac, this is not really a problem because I can easily install them with the system pip command. Windows is another story because Qgis bundles its own Python installation.

I want to distribute this plugin across the rest of our company, with minimum effort. I thought about setting up our own Qgis plugin repository, so my coworkers also get automatic updates.

But is there some automatic way to install some extra python packages in the Qgis python installation?


texts: How to intersect layers that do not completely overlap in QGIS?

texts:
I have two layers in QGIS that I want to intersect in a specific way.

On one side I have a layer of the different biotope types in the city of Berlin. On the other side I have a layer of the different land uses inside the city of Berlin.

The shape of individual biotopes does not overlap with the shape individual land uses. This makes sense because biotopes and land uses are not defined by the same parameters, so they never overlap.

I would like to know how to do the following: For each individual biotope, I would like to know what different land uses are present in it.

For instance, a specific humid grassland located at the north of the city has 25% of residential land use and 75% of brownfield land use.

Is it possible to view the results showing which proportion of land uses constitute each of the individual biotopes?


texts: Making flood layer geojson into single featurev like ST_collect in PostgreSQL in openlayers 3 with JSTS?

texts:
I have read one geojson file using JSTS now all my features in the geojson file are comming as individual features. Now I want to convert all features into one collected feature like in postgres function ST_Collect. Is there any way to treat the features into single feature by using Json.stringfy like in JSTS javascript? If any provide examples for reference sir.

<!DOCTYPE html>

    <title>JSTS Integration</title>
    <link rel="stylesheet" href="http://openlayers.org/en/v3.17.1/css/ol.css" type="text/css">

    <button  onclick=withoutaoi();></button>

Here I am trying to perform geojson1.intersects.geojson2 function in the example link https://bl.ocks.org/pgiraud/2ed05b0a9e394c5652b3 ( performed polygon intersection with the geojson file )
Now we want to perform two geojson features intersection using JSTS intersect function is it possible or not. If any other methods exist to read geojson features into single feature is also sufficient to perform intersection operation on geojson files sir.


texts: Move individual address points to closest intersection in ArcGIS

texts:
I'm working with ArcGIS 10.3 (standard license). I have approximately 3000 points that are geocoded to the exact address. I'm hoping to anonymize the point data by moving them to the closest road intersection. I have point dataset of all the road intersection in the area. I was wondering what the best way to do this would be. Is the best way to perform a spatial join between my intersection data and my address data? Also, how would I ensure that my address joins to the correct intersection (i.e. an address point is moved to an intersection that is close in proximity but not actually reachable given the layout of the street network)?
Thanks for your help.


texts: Mosaicking many rasters with large empty raster in R

texts:
Following my previous question (Subtracting rasters with different dimension, origin and extent in R), I am trying to mosaic many small glacier rasters into one large empty raster which I can then subtract from my original raster (HMA_DEM = 38GB). Sample data @ https://drive.google.com/open?id=1ERFdsqDGLH1a_FbxwawE_gPm0Au0Q9vT
Resolution and origin of the smaller ones and the large empty raster are the same. Some of the smaller rasters overlap with their NA-parts (for lack of a better word), so I'm using fun=max to overwrite the NA.

My code is this:

filelocations <- list.files(pattern="*.tif", full.names=T)
Albers_HMA <- crs("+proj=aea +lat_1=25 +lat_2=50 +lat_0=37 +lon_0=87 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs")
HMA_empty <- raster(extent(HMA_DEM), crs = Albers_HMA, res = res(HMA_DEM))

ras_mosaic <- mosaic(HMA_empty, raster(filelocations[1]), fun=max)

After running for a while, I get the following error:

Error in matrix(unlist(ini), ncol = 2, byrow = TRUE) :
  'data' must be of a vector type, was 'NULL'
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Warning messages:
1: In writeBin(v, x@file@con, size = x@file@dsize) :
  problem writing to connection
and so on

The warning messages seem to indicate that my disk space is full, but that is unlikely. Any ideas what to do?


texts: How can I get common points of different point shapefiles in ArcGIS?

texts: I have different data sets (point shapefile) and how can I get common point points of these shapefile in  ArcGIS?


texts: I have ArcGIS server and ArcGIS Viewer for Flex installed up and running. I use ArcMap 10.2 to publish my shapefiles. There is a lot of users who is using my maps. How can I provide login for them in the web page for map? Should I use it as a widget or there is another way?


texts:
I have created a layer filter Expression to get specific results query
from my layer and i add these results in list widget using pyqt.

my Expression and my add to list widget work fine(i take correct ids numbers
in the print and i see that ids in list widget).

but if i want to zoom feature using double click signal in list widget then
i take zoom
in the wrong features(features where my Expression is False).Any idea where
i have wrong in my code and to take wrong features zoom?

my code :

__init__
self.connect(self.ui.listWidget, SIGNAL("itemDoubleClicked (QListWidgetItem
*)"), self.Zoomt)

my filter :

 def myfilter(self):
    layer = QgsMapLayerRegistry.instance().mapLayersByName("mylayrt")[0]
    request = QgsFeatureRequest().setFilterExpression('"name" =\'{0}\''.format(myname))
    for feature in layer.getFeatures(request):
        print str(feature.attribute("myid"))
        self.ui.listWidget.addItem(str(feature.attribute("myid")))

result print :

1
42
43
44
45
96
111
304
458
508
579
602
606
646

that is ids added correct in list widget (14 ids).

zoom button .

def Zoomt(self):
        Vl_Gs = QgsMapLayerRegistry.instance().mapLayersByName("mylayer")[0]
        Vl_Gs.removeSelection
        Vl_Gs.setSelectedFeatures([self.ui.listWidget.currentRow()])
        self.mapCanvas.zoomToSelected(Vl_Gs)

zoom ids (take first 14 from my layer)  :

0
1
2
3
4
5
6
7
8
9
10
11
12
13

is len number is correct but the ids zoom is wrong,why?


texts:
When calling GdalUtils.version(), the returned information is

  "2010100"

While I can identify GDAL2, I´m unsure about the next version steps. It could be 2.1.1 or 2.0.1 or 2.1.1.

Currently, the newest GDAL is 2.1.2 so I assume that it means 2.1.1. Can somebody verify that?

Also, the output of GdalUtils.version() should be updated to return proper version information.

Here is the complete Python script (macOS):

import os
import sys
from qgis.core import *
from osgeo import ogr
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.gui import *
QgsApplication.setPrefixPath(r'/Applications/QGIS.app/Contents', True)
app = QgsApplication([], True)
QgsApplication.initQgis()
sys.path.append(r'/Applications/QGIS.app/Contents/Resources/python/plugins')
from processing.core.Processing import Processing
Processing.initialize()
import processing

from processing.algs.gdal.GdalUtils import GdalUtils
GdalUtils.version()


texts: FeatureClassNameClass.Open() Error, any ideas?

texts:
This code works fine on my Windows 7 64 bit machine, but fails on the target machine, Windows Server Standard SP2 64 bit.

 public List<string> GetShapeFileFieldNames(string shapeFileDirectory, string shapeFileName)
    {
        shapeFileName = shapeFileName.ToUpper().Replace(".LYR", ".SHP");

        IWorkspaceName pInShpWorkspaceName = new WorkspaceNameClass() as IWorkspaceName;
        pInShpWorkspaceName.PathName = shapeFileDirectory;
        pInShpWorkspaceName.WorkspaceFactoryProgID = "esriCore.ShapefileWorkspaceFactory";
        IFeatureClassName pFCName = new FeatureClassNameClass() as IFeatureClassName;
        IDatasetName pShpDatasetName = pFCName as IDatasetName;
        pShpDatasetName.Name = shapeFileName;//this is your input file
        pShpDatasetName.WorkspaceName = pInShpWorkspaceName;

        IName sourceName = (IName)pFCName;
        IFeatureClass sourceFeatureClass = (IFeatureClass)sourceName.Open(); //HERE IS THE ERROR
        IFields sourceFields = sourceFeatureClass.Fields;
        return GetFieldNames(sourceFields);
    }

Exception from HRESULT 0x80040351
at ESRI.ArcGIS.Geodatabase.FeatureClassNameClass.Open()

I converted the HRESULT into decimal, 2147746641, and ran it through Google

2147746641 ESRI
2147746641 Constants

No results.


texts: QGIS attribute table not opening for WFS vector layer through proxy

texts:
I am creating a WFS vector layer through PyQGIS from GeoServer. I can successfully load it and view the attribute table when directly connecting to GeoServer. However, one of our requirements is to access GeoServer through a proxy. When I try to access through the proxy, I can add the WFS as a layer to the map, view the features on the map, and even identify features, however when I attempt to open the attribute table the entire application completely hangs.
I downloaded the nightly build in order to use the message logger, but it is not actually sending out any errors.
I cannot figure out what QGIS is doing in order to debug and solve this issue.
Update: I found that if I enable "show feature count" the table will open successfully. However, if I set a filter on it after and then try to open, it hangs again.


texts: Create shapefile from data postgis / kml using java

texts: I'm working on a geographic information system project, whose products form shapefile. I am using java language, and PostGIS database. Is there a way to generate a shp file from PostGIS or kml using java language?


texts: How to correct a Raster with Vector misalignment in QGIS?

texts:
I have had a lot of trouble aligning the various layers of information. I have 3 layers, one is a raster file, the other is vector file and the last one is a base OSM file.

The project CRS is set to  EPSG:3763, ETRS89 / Portugal TM06.

The raster layer CRS is set to EPSG:102165, Lisboa_Hayford_Gauss_IPCC.

The vector layer CRS is set to EPSG:102164, Lisboa_Hayford_Gauss_IGeoE.

And the last one, Basemap layer, OSM is set to EPSG:3857, WGS84 / Pseudo Mercator.

How can I align those layers? It should be automatically done by the software or am I missing some steps?

One thing I have noticed is that I can't find a way to select the method of changing the referential. Is there a way to change it?


texts: Upgrading from QGIS 2.18 to QGIS 3.8 on Ubuntu?

texts: I have an old version of QGIS 2.4 on Laptop. I want to upgrade it to the latest version but I couldn't update it to the latest one. I tried uninstalling the old one to update it. But when I try to install it through 'sudo apt-get install' command, I ended up installing the old version again.


texts: Generating attributes in an automatic way with QGIS?

texts:
I want to autogenerate IDs while I create new features. So every time I create a new point, its ID will increase by 1 like the following:

Feature 1: id 1
Feature 2: id 2
Feature 3: id 3

How can I attack this?


texts: Download file from network using PyQGIS 2.x

texts:
I have a python plugin targeting QGIS 1.8 that uses QgsNetworkAccessManager and QNetworkRequest to issue a GetCapabilities request to WMS servers.

With 1.8 everything was working fine.  Now we are porting this plugin to QGIS 2.x (tested on 2.6 and 2.7 of 16/02/2015) and have found that some errors are being displayed.

As far as our python code can tell everything is working as expected, however 20 seconds after a network request is initiated a "Network request ... timed out" message is displayed in the messages log and in a banner at the top of the map pane.

I have created a minimal example that can be copy/pasted into the python console:

from datetime import datetime
from PyQt4.QtCore import SIGNAL, QUrl
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest

def request_download():
    global reply
    manager = QgsNetworkAccessManager.instance()
    url = QUrl("http://www.example.net")
    request = QNetworkRequest(url)
    print "Download start time: {}".format(datetime.now())
    reply = manager.createRequest(QNetworkAccessManager.GetOperation, request)
    reply.connect(reply, SIGNAL("finished()"), handle_download)

def handle_download():
    global reply
    print "Download finish time: {}".format(datetime.now())
    print "Finished: {}".format(reply.isFinished())
    print "Bytes received: {}".format(len(reply.readAll()))

request_download()

# python console:
#   Download start time: 2015-02-23 15:24:39.887000
#   Download finish time: 2015-02-23 15:24:41.077000
#   Finished: True
#   Bytes received: 1270
#
# message log:
#   2015-02-23T15:25:01    1    Network request http://www.example.com timed out

As this example shows the download appears to succeed:

The finish() signal is emitted.
The reply.isFinished() method returns True.
The reply.readAll() method returns the correct data.

However the time out error message is displayed :

Prominently on a yellow banner at the top of the map pane.
Under the Network tab on the Log Messages panel.

How do I perform a download without triggering this error?


texts: Tract FIPS code from commuter survey, missing record in Census TIGER table


texts: Sum up the points from several multiple ring buffer in ArcGIS 10.6?

texts:
I'm researching about nearest area from several area. So I used "multiple ring buffer" to know about distance from the areas.

Problem is I don't know how to sum up from these buffers.
I got different points from distance. (like in 250m : 3point, in 500m : 2point). I want to know how to sum up and become one shapefile.


texts: Image recognition between Improved vs Raw Land for city parcels from Aerial with QGIS?

texts:
Are there any tools or methods that allow QGIS analyze whether the lots/parcels have been untouched or developed, and return a "1" or "0" to a table or points layer or anything?

I was thinking more into simple shape recognition, like a driveway(2 parallel lines) or a rectangle (dwelling of sorts) or by colors: green/brownish(untouched), silver-ish (developed,) or by a differential of "most of area in one color" and a spot with a "different color".
The lots-layer has an attribute table with areas, id, etc. and overlaid with Google Maps/Bing, etc. (see attached pic)


texts: Applying unified color scale to tiles with gdal2tiles?

texts:
Background:

I have a series of about 40 small GeoTIFFs that need to be merged together to make one large image. Each GeoTIFF has 2000 bands. I've tried using both gdal_merge and gdal_retile to pull the images together. This seems to work fine when I view it in QGIS or other tools.

Problem:

When I run gdal2tiles (gdal2tiles.py --z 0-10 -w none GDD1.tif)  it doesn't seem to recolor the images on the same scale (see image below). This may be an obvious question, but is there a way to tell GDAL to recolor the tiles based on a unified color scale?


texts: How to set the QGIS Atlas page extent to the bounding box of features?

texts:
Is it possible to set the extent of each page in a QGIS atlas to the bounding box extent of the visible features in a second (non-coverage) layer?

In my case, the SCHOOLS layer is the coverage layer, which I believe the variable @atlas_geometry is pointing to.

I have a second layer of STUDENTS of which the visibility of the features is driven by the attribute / sort ID of the coverage feature - which works just fine.

I'd like to be able to set the page extents (xmin, ymin, etc.) using the bounding box of those visible STUDENTS, so as to use a dynamic scale in order to see all the students who attend the SCHOOL / current atlas feature.

But as far as I can see, there is no variable to control the features visible on the map.


texts: GeoPandas statistics of points within a multi polygon (grid)

texts:
I usually use numpy for my processing but I'm trying to make the most of the power of GeoPandas for my spatial data. I have some point data (shapefile) and a vector grid (fishnet) as a separate shapefile. I would like to get the points that fall within each vector grid and then do some basic statistics on them (e.g., average). Each point has an X co-ord, y co-ord and a Z value. I would like the mean value of each that falls within a grid cell.
All answers I have seen so far are either testing if one point is within a polygon, or does not go further and calculate statistics, only returning a boolean array.
From this answer I got this piece of code:
point = geopandas.GeoDataFrame.from_file(pointfile.shp)
poly  = geopandas.GeoDataFrame.from_file(gridfile.shp)

pointInPolys = sjoin(point, poly, how='left')
grouped = pointInPolys.groupby('index_right')

but as I'm pretty new to Pandas I'm not sure how to get at the data in this group (or really what a group is) so I can calculate the mean value of the points. How do I get the data and perform basic statistics on it?


texts:
Does anybody know a way, in VBA, to change the grid interval?

For example: if my layout´s scale is 1:2000, my grid will have 200 meters interval and my layout´s scale is 1:5000, my grid will have 500 meters interval.

Thanks,
Alex


texts: How to change a CSV layer attribute value from text to number - once again?

texts:
i have read most of the related postings and answers allready ...
(e.g. http://anitagraser.com/2011/03/07/how-to-specify-data-types-of-csv-columns-for-use-in-qgis/ and Changing CSV layer attribute value from text to number in QGIS? ... among others)

but (!) unfortunately none of them solved my problem.
as someone postet on 2012-01-04 12:27 definition of properly defined *.csvt doesn't effect field-import - they are expected to be numbers and still are string.

her is a sample of my csv
InputID,Mean,Stdev,min,max
1,334.7617168,36.87450474,294.4334857,383.5583136
2,446.3946568,207.949905,153.2494524,613.3182137
and the csvt
"Integer","Real","Real","Real","Real"

.. i have already:

checked field names (no blanks), checked separators, ... which are qgis' default because the csv is distance matrix calculation result
defined the csvt with simle "Integer","Real" and the precision-type-style
"Integer(6)","Real(8.3)"
changed country settings in win7, win8, osx 10.9 due to known decimal
separator issues
used csv as specified as well as "excel-style" csv
(";"-separated)
checked all that in qgis 2.0, 2.2, 2.3(master)

and: at the beginning this problem was related to distance matrix output
... where qgis calculates the results (and writes the csv-outputs), which of course are numbers (mean, stdev, min, max)  so, initially i was just looking for a straight forward way to use qgis' own calculation results for mapping of distance-distribution ...

is there a way to solve or completely bypass the csv-t issue in a way, i can easily communicate to gis-beginners ?


texts: Error messages are not getting logged. I have created an Add-In button. I am using log4Net library for logging.

texts: When i run Add-In button project on my machine, logging is being done successfully but as soon as i take the Add-In button and install it into different machine , no logging of messages occurs. Is it because log4net library is not being added in different machine during add-in button installation?


texts: Return total of features with ArcGIS REST API

texts: I'm trying to query an ArcGIS REST API endpoint and would like to get an added field with the count of features in the search. If I use Return Count Only as true, I will get the count, but not the features. I've also tried to add a count variable to Output Statistics but it replaces the rest of the query.


texts: How to auto-update WFST store with GeoExt/Openlayers?

texts:
I built an WFS-T with a grid panel (Ext.grid.EditorGridPanel) to edit features' attributes. Now, I want the feature store (GeoExt.data.FeatureStore) to reload/update automatically so that other users see changes committed immediately without reloading the whole webmap.

I would appreciate hints for:

Attaching such an "update store" function either to my "save"-button or to my store's "afteredit"-listener
Having the whole store updated continuously in an automatic way


texts: Extracting a DEM without low vegetation cover in a flooding area using LiDAR data

texts:
I've been struggling with this for the past few days. I want to create a DEM of a flood control area, which is covered in low/intermediate-height vegetation (pioneers and reed mostly). The point cloud data with x, y and z comes from airborne LiDAR and I've been able to load it into QGIS by conversion and translation and managed to create a DSM.
From false-colored images, I know the locations where the vegetation is present. Is there a way to get an actual DEM of the area by removing the low/intermediate-vegetation? My aim is to obtain a DEM to analyze the flooding area, so an increase in the accuracy of the elevation data would be very useful.
Part of the headerless .txt file LIDAR; so x coord, y coord and z coord / elevation;
147675.500 210500.500 10.15
etc Ln 1805277, Col 1 (Notepad)

This is how the DTM looks after I've loaded the text file via Raster>Conversion>Translation and used a IDW-interpolation:

This is de CIR image from the area, showing the vegetation cover:

I thought when using LASTools I could extract the bare ground, so first I've used txt2las to convert the .txt file to a .las file. When running the lasinfo on this newly created .las file, this is what I get:
reporting all LAS header entries:
file signature: 'LASF'
file source ID: 0
global_encoding: 0
project ID GUID data 1-4: 00000000-0000-0000-0000-000000000000
version major.minor: 1.2
system identifier: 'LAStools (c) by rapidlasso GmbH'
generating software: 'txt2las (version 200101)'
file creation day/year: 70/2021
header size: 227
offset to point data: 321
number var. length records: 1
point data format: 0
point data record length: 20
number of point records: 1805276
number of points by return: 1805276 0 0 0 0
scale factor x y z: 10 10 10
offset x y z: 0 0 0
min x y z: 147680 210500 -10
max x y z: 150000 213000 20
variable length header record 1 of 1:
reserved 0
user ID 'LASF_Projection'
record ID 34735
length after header 40
description 'by LAStools of rapidlasso GmbH'
GeoKeyDirectoryTag version 1.1.0 number of keys 4
key 1024 tiff_tag_location 0 count 1 value_offset 1 - GTModelTypeGeoKey: ModelTypeProjected
key 3072 tiff_tag_location 0 count 1 value_offset 31370 - ProjectedCSTypeGeoKey: Belge 1972 / Belgian Lambert 72
key 3076 tiff_tag_location 0 count 1 value_offset 9001 - ProjLinearUnitsGeoKey: Linear_Meter
key 4099 tiff_tag_location 0 count 1 value_offset 9001 - VerticalUnitsGeoKey: Linear_Meter
reporting minimum and maximum for all LAS point record entries ...
X 14768 15000
Y 21050 21300
Z -1 2
intensity 0 0
return_number 1 1
number_of_returns 1 1
edge_of_flight_line 0 0
scan_direction_flag 0 0
classification 0 0
scan_angle_rank 0 0
user_data 0 0
point_source_ID 0 0
number of first returns: 1805276
number of intermediate returns: 0
number of last returns: 1805276
number of single returns: 1805276
overview over number of returns of given pulse: 1805276 0 0 0 0 0 0
histogram of classification of points:
1805276 never classified (0)

So none of the points is classified as anything.
I use QGIS 3.16 and the LiDAR data I received is in headerless .txt format. I've tried LAStools and converted the LiDAR .txt into .las, but the las2dem is not giving an output file and says:

WARNING: unlicensed. over 1.5 million points. inserting black diagonal.
ERROR: cannot find triangle in first 10000 points.

As you can probably tell, I'm very much a beginner in QGIS.


texts:
Is it possible to make slope direction with QGIS 2.16.1 like in this image?

Global Mapper steps:

Made grid point
Apply slope direction.

I made point grid 100x100m and I used DEM layer. In Global Mapper software, there is a tool which make slope direction (flow direction) field, and then in QGIS I made this map. This is attribute table made with Global Mapper.

@lynxlynxlynx:This is result: Red arrows are old arrows and blue are new arrows. I think this is no what I want. Maybe red arrows are interpolated some slopes. You can see with contour lines that result is not good.

@SaultDon: There is uncovered areas on this image.

@lynxlynxlynx: it is similar

I found tool for this. That is  Saga plugin called: Gradient vector from surface.


texts: How to merge geometries in postgis if they intersect?

texts:
Basically I want to merge all the line segments that intersect into one line as shown below in orange

So each line segment would have their own id

Edit: seems this is too hard to solve with SQL, one of my colleagues came up with an answer using Python


texts: QGIS assigning accumulating numbers to field records following order of selection using @rownum

texts:
I have selected points in QGIS and they have a field (towerno).

This filed represents values in the range from 658 to 800 but I want to narrow it from 558 to 700.


texts: Speed up the shortest distance calculation using pgRouting + PostGIS

texts:
I have to calculate the shortest path and corresponding distances for 300k+ origin-destination (OD) pairs. Using the query below it takes me around 0.3 sec to calculate one distance and therefore more than 24 hours to run the full query (still need to verify the total runtime). Is there a way to speed this up? Possibly using more RAM, fast CPU, possibly parallelizing?

This is my first attempt at a spatial sql query, so mostly wondering if there are any obvious speed-up possibilities.

-- Parameterized SQL function to take the OD ID as the parameter
-- and lookup the corresponding origin and destination coordinates from
-- all_trips_non_zero table. We then find the nearest point on the road
-- network closest to our origin and destination and find the shortest
-- path using pgr_dijkstra(). **OD ID goes from 1 to 300k+**
CREATE OR REPLACE FUNCTION shortest_path_id(IN od_id int)
RETURNS TABLE (shortest_distance double precision) as
$BODY$

SELECT sum(cost) * 0.000621371 as shortest_distance
FROM pgr_dijkstra(
'SELECT id, source, target, st_length(geom, true) as cost FROM public."WA_roads"',
  (SELECT source FROM public."WA_roads" ORDER BY ST_StartPoint(geom) <->
    (select ST_SetSRID(ST_MakePoint(ocentx, ocenty), 4326) from all_trips_non_zero where id = od_id) ASC
LIMIT 1),
  (SELECT source FROM public."WA_roads"
ORDER BY ST_StartPoint(geom) <->
    (select ST_SetSRID(ST_MakePoint(dcentx, dcenty), 4326) from all_trips_non_zero where id = od_id) ASC
LIMIT 1), directed := false) as pt
JOIN public."WA_roads" rd ON pt.edge = rd.id;

$BODY$
LANGUAGE sql;

-- Create a new table containing the Origin, destination and
-- shortest path using the sql function created above.
CREATE TABLE od_shortestpath AS
SELECT origin, destination, shortest_path_id(id) from all_trips_non_zero;


texts: How to filter shapefile using definition query?

texts:
I have a point shapefile which I want to interpolate using IDW interpolation. However, I want to interpolate only those points which satisfies a certain condition. I need to do it in python and I think that I have to use definition query where only values that are not -999 should be used in the interpolation.

This is my code:

outIDW = Idw(fc, zField, cellSize, power, searchRadius)

I need to modify somehow the fc shape to take into account only values that are different from -999.

This is my query:

"P"<>-999

Thanks


texts: GDAL/OGR python: geometryType change for linear ring?

texts:
I found something unexpected when trying to create a simple polygon, following the "cookbook" example in:

https://pcjericks.github.io/py-gdalogr-cookbook/geometry.html

from osgeo import ogr

ring = ogr.Geometry(ogr.wkbLinearRing)
print(ring.GetGeometryType())
ring.AddPoint(1179091.1646903288, 712782.8838459781)
ring.AddPoint(1161053.0218226474, 667456.2684348812)
ring.AddPoint(1214704.933941905, 641092.8288590391)
ring.AddPoint(1228580.428455506, 682719.3123998424)
ring.AddPoint(1218405.0658121984, 721108.1805541387)
ring.AddPoint(1179091.1646903288, 712782.8838459781)
print(ring.GetGeometryType())

# Create polygon
poly = ogr.Geometry(ogr.wkbPolygon)
poly.AddGeometry(ring)
print(poly)
print(poly.GetGeometryType())

This gives as output:

2
-2147483646
POLYGON ((1179091.16469033 712782.883845978 0,1161053.02182265 667456.268434881 0,1214704.9339419 641092.828859039 0,1228580.42845551 682719.312399842 0,1218405.0658122 721108.180554139 0,1179091.16469033 712782.883845978 0))
-2147483645

i.e. the geometryType changes from 2 to some weird negative integer after creation, and similarly for the resulting polygon.

This matters, because later on, I want to check geometryType and the polygon is obviously no longer of type ogr.wkbPolygon (3)

As a workaround I check for GetGeometryName() instead, but this is definitely odd.

Guido Lemoine

NB. Python 3.6.9 with the latest GDAL source build (3.1.0) but also different older versions.