texts: Grouping Dynamic Map Service in WAB LayerlistWidget

texts:
I am trying to organize my layers in the layerlistwidget based on categories, like none responsive text in between different category.

Is  there a way to do so without the need to group them in ArcMap?

I also experimented the add feature collection method as in the code below in my layerlistwidget startup function(see the code ) but the groups ("myGroupLayes" and " myGroupLayes2") are not visible in the layerlistwidget, instead all layers are listed in a flat hierarchy (see the graph below).

/ ***begin*** added code in startup() of LayerList/widget.js
           // First group
        var featureLayer1 = new esri.layers.FeatureLayer("http://Feature layer URL");
        featureLayer1.title = "featureLayer1";
        var featureLayer2 = new esri.layers.FeatureLayer("http://Feature layer URL");
        featureLayer2.title = "featureLayer2";
        var featureLayers = [featureLayer1, featureLayer2];
        this.operLayerInfos.addFeatureCollection(featureLayers, "myGroupLayes");
           // Second group
           var featureLayer3 = new esri.layers.FeatureLayer("http://Feature layer URL");
        featureLayer3.title = "featureLayer3";
        var featureLayer4 = new esri.layers.FeatureLayer("http://Feature layer URL");
        featureLayer4.title = "featureLayer4";
        var featureLayersSecond = [featureLayer3, featureLayer4];
        this.operLayerInfos.addFeatureCollection(featureLayersSecond, "myGroupLayes2");
        // ***end*** added code in startup() of LayerList/widget.js

Am I missing something obvious?

Also does  the add FeatureCollection support dynamic layers too?

Or do we have another means to Group dynamic services as in the case of Feature layers?


texts: arcpy Add Join with "KEEP_ALL" Does not Keep All

texts:
Using arcpy for ArcGIS 10.5.1, I'm joining a feature layer to a table using arcpy.AddJoin_management() with the KEEP_ALL option in order to keep all features whether they have a related record in the joined table or not.  However, after running the join, the only features in the layer are those that have a related record in the joined table.

My code is:

    arcpy.MakeFeatureLayer_management(inFeatures, tmpLayer)
    arcpy.MakeTableView_management(joinTable, tmpView, "Classification = '{}'".format(seasonClassification))
    arcpy.AddJoin_management(tmpLayer, inField, tmpView, joinField, join_type="KEEP_ALL")

I know I've had this working as expected in other scripts, but not in this case.

What am I doing wrong?  How do I get it to keep all features after the join?


texts: GDAL calculation without stop python.exe error?

texts:
I want to create  a simple raster calculation using python and GDAL and specific gdal_calc.py in osgeo4w shell.

BUT any time that before finish my script python stopping I take error : python.exe stop working.

I have read to many post from users with this problem but without specific solution.

in my PATHEXT I missed '.PY' I try to add but without success.

here the first code :

gdal_calc =  'python C:/OSGeo4W64/bin/gdal_calc.py -A path/to/a.tif -B path/to/b.tif  --outfile=path/to/out.tif --calc="((4*A)+(10*B))+4.8"'

try to add pathext :

call("set PATHEXT = % PATHEXT %;.PY;.PYW")
gdal_calc =  'python C:/OSGeo4W64/bin/gdal_calc.py -A path/to/a.tif -B   path/to/b.tif  --outfile=path/to/out.tif --calc="((4*A)+(10*B))+4.8"'

in this case I get windows error 2

after I try this :

os.environ['PATHEXT'] = '.PY'
gdal_calc =  'python C:/OSGeo4W64/bin/gdal_calc.py -A path/to/a.tif -B   path/to/b.tif  --outfile=path/to/out.tif --calc="((4*A)+(10*B))+4.8"'

but in this case gdal_calc.py don't execute .

Any idea how to can work this script without error ?


texts: What are the differences between the various ArcGIS Server options?

texts: This document makes me want to stab my eyes with a fork. Can someone provide a simple summary of the differences between Enterprise vs. Workgroup, and Basic vs. Standard vs. Advanced? As a bonus, what can I expect to spend on the different options?


texts: How to interpret Nearest Neighbour Index (NNI) and Z-Score in Nearest Neighbour Analysis (QGIS)

texts:
I performed a Nearest Neighbour Analysis in QGIS (3.4) via Vector > Analysis Tools > Nearest Neighbour Analysis on two different point patterns (13 archaeological sites in each). I am struggling to understand what the values mean. Do the NNI for both patterns indicate that the points exhibit clustering, since they are <1? Does the Z-score for point pattern #1 indicate clustering, and Z-score for point pattern #2 a random process? What is then the difference between NNI and Z-score to understand the behaviour of the point patterns? Is there perhaps a better way of calculating these values in R?
Point pattern 1
Nearest neighbour index: 0.7810443299917054
Z-Score: -1.5102844644713787
Point pattern 2
Nearest neighbour index: 0.9892311178623155
Z-Score: -0.07428022024573287


texts:
As part of the MapServer polygons (district boundaries) are shown on the OpenLayers map. The script is in JavaScript. The polygons contain attributes.
Currently, a second window opens with the corresponding attributes when a polygon is selected.
What function must be used for the attributes to appear in the same window (in a selected area)?

This is my current query.

         var abfrage = new OpenLayers.Control.GetFeature({

               protocol: OpenLayers.Protocol.WFS({
                   url: GeoDataURL,
                   featureType: "VZKO",
                    featurePrefix: "ms",
                    version: "1.0.0",
                    srsName: "EPSG:31467",
                    geometryName: "msGeometry",

                   filterType: OpenLayers.Filter.Spatial.BBOX
               }),
               box: true,
               multipleKey: "shiftKey"

           });
           abfrage.events.register("featureselected", this, function(e) {
               //alert(" in fselected");
               //layerSelect.addFeatures([e.feature]);
               var feats = e.feature;
                initMapMode();
                DossierVZ(feats);

                /*var Msg = "
";
                var NL  = "
";

                for(var key in feats.attributes)
                     Msg += key + ":" + feats.attributes[key] + NL;
                Msg += "geometry:" + feats.geometry + NL;
                document.getElementById('Auswertung').innerHTML += Msg;*/
           });


texts: QGIS Convert SHP to KML keep all attributes

texts: I am trying to convert a SHP to KML in QGIS and want to keep all the attribute fields. As far as I can tell when you do this operation, you can only choose 2 fields (DescriptionField and NameField). Is there a way to do the conversion and keep all attributes?


texts: arcgis.learn show_batch() index error and lr_find() runtime error while using pointcnn for LiDAR segmentation

texts:
I am trying to segment vegetation from LiDAR point cloud using PointCNN on Jupyter notebook. But I am getting Index Error on running show_batch()  and runtime error on running lr_find() while using arcgis.learn (ArcGIS Python API)

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-15-0ef5bf68f37d> in <module>
----> 1 data.show_batch(rows=10)

~\AppData\Local\ESRI\conda\envs\my_arcgispro-py3\lib\site-packages\arcgis\learn\_utils\pointcloud_data.py in show_point_cloud_batch_TF(self, rows, color_mapping, **kwargs)
292             mask = x > -9999999
293
--> 294         color_list =  color_mapping[labels[sample_idxs]][mask].tolist()
295
296         scene=dict(aspectmode='data')

IndexError: index 5 is out of bounds for axis 0 with size 4

and on running

pcnn = PointCNN(data)
pcnn.lr_find()

RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes' failed.  at ..\aten\src\THNN/generic/ClassNLLCriterion.c:92

Any pointers that can help me in solving/debugging these error?

full code

I am open to suggestions regarding any other method of LiDAR segmentation.


texts: Set zoom extent to a certain layer failed using pyqgis

texts:
I want to make "zoom to layer" set to my layer called layer_base. This layer's datasource is postgres and I connect it using URI.I try to use this code but after I run it, I got an error. Here my code :

        sql = "(SELECT * from gis.view_bidang_all where nama_desa = '"+text+"')"
        uri = QgsDataSourceURI()
        uri.setConnection("192.168.0.153", "5432", "db_pbb", "postgres", "postgres")
        uri.setDataSource("", sql, "geom", "", "nop")
        layer_base = QgsVectorLayer(uri.uri(), "Bidang", "postgres")
        #layer_base.setLayerTransparency(50)
        mySymbol1=QgsFillSymbolV2.createSimple({'color':'#000000',
                                                'color_border':'#000000',
                                                'width_border':'0.17',
                                                'style':'no'})
        myRenderer = layer_base.rendererV2()
        myRenderer.setSymbol(mySymbol1)
        layer_base.triggerRepaint()
        #symbols = layer_base .rendererV2().symbols()
        QgsMapLayerRegistry.instance().addMapLayer(layer_base)
        self.mapCanvas = QgsMapCanvas()
        self.mapCanvas.setExtent(self.layer_base.extent())

And here errors that I've got :

2016-10-15T19:39:35 1   Traceback (most recent call last):
          File "C:/Users/septin/.qgis2/python/plugins\PBB\gis_pbb.py", line 225, in run
            self.mapCanvas.setExtent(self.layer_base.extent())
        AttributeError: PBB instance has no attribute 'layer_base'

Any ideas ?

I try to use self.iface.setActiveLayer(layer_base) and self.iface.zoomToActiveLayer() instead of use  self.mapCanvas = QgsMapCanvas() and self.mapCanvas.setExtent(self.layer_base.extent()). The result is the active layer already set to layer_base (I've more than one layers), but the zoom to layer doesn't work.

I already try to run this script using python console, and the "zoom to" works well. Still confused what's wrong, any ideas ?


texts: Is there a possibility to have a kind of home button on my Leaflet map which will zoom to my initial map view or a specific defined position, respectively?


texts: Downscaling GLDAS soil moisture data based on MODIS-Lai

texts:
I found few recent research paper that are downscaling very high resolution soil moisture/precipitation data based on MODIS-Lai using machine learning methods. However, I was not able to find the code anywhere and write the code myself in Earth Engine. But, I made a code which make 3-hourly data to daily data. What is the next step? How can I downscale GLDAS using machine learning methods?
   // Start and End Dates
    var inidate = ee.Date('2000-02-18');
    var enddate = ee.Date('2020-12-31');

    var modislai = ee.ImageCollection('MODIS/006/MCD15A3H')
        .select('Lai')
        .filterDate(inidate, enddate);

    // Difference between start and end in days
    var difdate = enddate.difference(inidate, 'day');

    //Import GLDAS data
    var imgcol = ee.ImageCollection("NASA/GLDAS/V021/NOAH/G025/T3H")
            .select('SoilMoi10_40cm_inst')
            .filterDate(inidate, enddate);

    // Time lapse
    var lapse = ee.List.sequence(0, difdate.subtract(1))
    var listdates = lapse.map(function(day){
      return inidate.advance(day, 'day')
    })

    var daily_gldas = ee.ImageCollection.fromImages(listdates.map(function(day){
      day = ee.Date(day);
      var daily_collection = imgcol.select('SoilMoi10_40cm_inst')
                                    .filter(ee.Filter.date(day, day.advance(1, 'day')));
      return daily_collection.mean().rename('daily_sm_mean')
                              .set('system:index', day.format('YYYY-MM-dd'))
                              .set('date', day.format('YYYY-MM-dd'))
                              .set('system:time_start', day.millis())
                              .set('system:time_end', day.millis())
      }));


texts:
In my map web app, I have a play pause button that show vehicle route history.I get lat lon from database and create route that vehicle traverse.
At below site go to history tab after and choose vehicle and choose play button :
http://mstrackweb.mobil-i.com

username : demo
pass : demo

for doing this i need to write javascript or openlayers can help me in animating routes of vehicle?

I create map web app with openlayers and yii php framework.
I want to show vehicle traveled route as animation like below site in my application.
http://mstrackweb.mobil-i.com
In the above site use demo/demo for login to site.In the history tab you can see traveled route of vehicles as animation.
In my app i can add markers to map after 2seconds with below code.In the history array i have lon/lat and dateTime of the vehicle as location history.

var idx = 0;
var interval = setInterval(function(){
    if(idx >= history.length)
        clearInterval(interval);
    else{
        markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(
            history[idx]['longitude'],history[idx]['latitude'] ).transform(
        new OpenLayers.Projection("EPSG:4326"),
        new OpenLayers.Projection('EPSG:900913')
            ),icon.clone()));
        idx++;
    }
},2000);

But if a marker is out of the map bound i don't know how to change the bounds of the map to showing added marker!.
how can i change bounds of the map to showing added marker?
is this approach is true? When a marker added to map create event and if this marker isn't in the map bounds change map bound to showing it.
Is there any library for showing vehicle traveled route as animation?


texts: WMS CQL Filter in GeoServer not working on adding to the layer

texts:
I draw in the init() function a WMS layer an add it to the map:

var lyr_osm = {};
var map = {};

$(document).ready(function () {
    map = new OpenLayers.Map('map',
                    {
                    numZoomLevels: 18,
                    projection: googleMercator
                    }
       );
    });

    lyr_osm =new OpenLayers.Layer.OSM("OSM");

       lyr_state = new OpenLayers.Layer.WMS("State",
           "http://54.228.241.187:80/geoserver/us_admin/wms",
           {
           'VERSION' : '1.1.0',
           layers: "us_admin:states",
//           style: style_state_polyg,
           format: "image/png",
           transparent: true
           },
               {isBaseLayer: false,
                visibility: false,
                sphericalMercator: true,
                opacity: 0.5}
           );

    map.addControl(new OpenLayers.Control.LayerSwitcher());
    map.addControl(new OpenLayers.Control.MousePosition());
    map.addLayers([lyr_osm, lyr_state]);
    var mapCenter = new OpenLayers.LonLat(-97, 40);
    mapCenter.transform(wgs84, googleMercator);
    map.setCenter(mapCenter,4);
}

Then onclick of an input button I pass a location from a Google Autocompleter, transform it to EPSG900913, and use it to filter the WMS layer:

$(document).ready(function () {
$('#search1').click(function() {
    sdata = $('#searchTextField').val();
    if( sdata == undefined || sdata == 'Enter an address...' || sdata < 4 ){
      alert('Please insert or choose an address to proceed.');
    } else {

       latlong = String(ads.d);
       longlat = latlong.split(",");
       long = String(longlat[1]);
       slong = long.replace(")", "");
       lat = String(longlat[0]);
       slat = lat.replace("(", "");
       position = new OpenLayers.LonLat(slong, slat);
       position.transform(wgs84, googleMercator);
       var mlat = String(position);
       mlatt = mlat.replace("lon=","")
       mlattt = mlatt.replace("lat=","");
       mlatttt = mlattt.replace(","," ");

  lyr_state.mergeNewParams({cql_filter: "contains(geom,POINT(-10625033.067 3488845.830))"});
  lyr_state.mergeNewParams({visibility: true});

  stbound=lyr_state.getDataExtent();
  map.zoomToExtent(stbound);
});
});

The problem is that onclick returns me an aocean area, and not what I want. The new parameters are updated in the DOM but I do not see the result.

GeoServer is 2.2 with no error showing.

Java = Oracle Corporation: 1.7.0_11 (Java HotSpot(TM) 64-Bit Server VM)

Any hint?


texts: Merge two Shapefiles with different styles

texts:
I need to create a shapefile (or merge 2 shapefiles) with different styles for both line width and label.

They represent both main river (with style A) and secondary river (with style B) and I want to save the styles on an sld file so when I open it later I can see the different styles.

How can I achieve this?

I am using QGIS 2.18


texts: PDF Export in ArcGIS Pro producing corrupt file?

texts:
When exporting an ArcGIS Pro layout containing PNG images (e.g. Logo, Photo or Chart), I cannot open the generated PDF file.

Export works fine without the image. It does also not work when using a TIFF or BMP image. However, it does work using a JPEG file.

When opening the PDF file, the following errors occur:

A drawing error occurred.
Insufficient data for an image.

The error occurs with different images from different sources.

I am using ArcGIS Pro 2.2.4. Unfortunately, I do not have admin rights on this computer to upgrade to 2.3.

My current workaround is using a JPEG image with an acceptable resolution.

Update 2019/04/13: still looking for a solution to preserve vector data. I posted the question on GeoNet as well:

https://community.esri.com/thread/231747-pdf-export-in-arcgis-pro-produces-a-corrupt-file


texts: Converting latitude and longitude to 2D cartesian (opengl)

texts:
I know this has been asked a million times in here, but I can't really understand it,

I am using OpenStreetMap (OSM) particularly Overpass API, as I only need roadway information.

I know that I need to use the Mercator projection formula stated in thread like this;

Mercator projection: formula for latitude based on pixels?

and I also found source code that uses it perfectly like;
https://github.com/Anubha-Banerjee/3d-mapLand

but I'm a little bit confused with regards to the "width" part of the formula. The forum says, its an image width, but since I am just getting information from Overpass API with a bounding box, I don't know what will be the "width" value.

In the first link it has this function.

function getPixelShift ( pxWidth, map_latitude )
{
    var pi = Math.PI;
    var pixelShift = (pxWidth / ( 2 * pi) ) * Math.log( Math.tan( pi / 4 + (map_latitude/2) * pi / 180 ) );
    return pixelShift.toFixed(2);
}

How do I know what values to supply in the pxWidth variable?

Same as that of 3d-mapLand code which has this formula for conversion

double convert_lat_to_y(double lat)
{
    double y = 0, w = 2000;
    double latRad = m3dDegToRad(lat);
    y = (w / (2 * M_PI) * log(tan(M_PI / 4 + latRad / 2)) * SCALE);
    y = y + map.shiftY;
    return y;
}

As you can see, the variable "w" was hardcoded with value 2000 without any explanation on what it is and how it was derived?
(tried to contact the author to no avail/reply yet)

Can somebody explain further how to get this value in the formula?


texts: Exporting multiple point shapefiles from one file using QGIS

texts:
I have a point shapfile of species records (about 100 species), with many georefenced ecords for each species.

I'd like to export one point shapfile for each species.
I can do it by selecting by attributes each species and export handly every single file but it is time consumig.

Is there any possibility to batch export all the files with the same operation using QGIS?

I'm a beginner not used to Python.


texts: reading many shapefiles into R and calculating area for each

texts:
I have a folder of 764 uniquely labeled shapefiles derived from utilization distributions of animals.
I would like to (1) read all shapefiles into R as a large list of shapefiles, (2) calculate the total area in hectares for all polygons within a shapefile for each shapefile, and 3) compile total area calculations into a .csv with columns "animalid", "50range", "75range", "95range".
All polygon shapefiles are uniquely named beginning with a string "poly50_", "poly75_", or "poly95_" and ending with an animal id string (e.g., "animalid.shp"). So for example, an area calculation for shapefile "poly50_animalid1" should populate the first cell under the "50range" column.
I understand my needed workflow but do not know where to start with reading in all the shapefiles at once into a list and calculating area for each (likely within a loop or lapply). I'm hoping someone can provide some helpful advice to at least get me started!


texts:
I want to dilate a polygon by a circle sector in ArcMap.

Because my python skills are not that good to figure out how I can use the R prototype of How to create an oriented buffer using arcpy? . Is there a Python version of this script ?

In this first example, the polygon is dilated by a circle sector formed between -30 to 75 degrees

    # Dilate the polygon by circle sector -30 to 75 degrees
    # system.time({   radius <- 1/3   par(mfrow=c(1,3))   q <- sector(radius, pi/12, 2*pi/3, n=120)   d.points <-
    dilate.points(polygon.the, q)   d.edges <- dilate.edges(polygon.the,q)        display(polygon.the, d.points, d.edges, main="-30 to 75 degrees")

My cirlce sector is formed between -135 and 135 degrees, so how can I rewrite this code? Can anyone help me with writing a functional pythonscript to run this dilation in Arcmap?


texts: Getting elevation at particular coordinate (lat/lon) programmatically (but offline)?

texts:
I would prefer something in python (but I would settle for any programming language) and something that I could install on my own server so the only limitations would be hardware (no throttling, no daily request limits, etc). i.e. I'm not interested in using a hosted service like Google Maps API.

What I want to be able to do is something like:

for location in locations_data_store:
  location.elevation = some_module.lookup_elevation(location.lat, location.lon)
  location.persist()

Or, it could be more involved than that. I don't mind making a REST API request, parsing some JSON, or in some other way more complex programmatically.


texts: What units are the settings in the contour extraction tool of QGIS?

texts:
I am using a DEM to develop contours for a project area. I am using Raster>Extraction>Contour to develop the contours. One of the setting relates to the interval between contours. I selected 2 in order to get two foot contours, assuming this in feet.The CRS is EPSG:2260 - NAD83 / New York East (ftUS).

I am using QGIS 2.2 on Windows 7.


texts: Where is ConnectPoints plugin on QGIS 3, or what is alternative?

texts:
I need ConnectPoints plugin in QGIS, to do as same as on this video: https://www.youtube.com/watch?v=aZTpZ_NzwN8
But I cant it find it in QGIS 3.0. Is there any alternative plugin which can do the same?


texts: How to save statistical parameters of a raster stack in a csv using R

texts:
I have a reference raster and a stack of other rasters. I wanted to perform Mean, Std Dev and Bias of the reference with respect to the remaining. So I calculated the Cell Stats of all but when I try to save it in a csv its shows me columns more than the number of stack rasters.The no of rows is the exeact number of columns while the in the next column it doubles up and so on. The values of mean and all is a num while in the stack rasters its shows as named num.

The code is as shown:

r1 <- raster("Ref.tif")
mn<-cellStats(r1, stat='mean', na.rm=TRUE, asSample=TRUE)
 sdev<-cellStats(r1, stat='sd', na.rm=TRUE, asSample=TRUE)
 min_V<-minValue(r1)
max_V<-maxValue(r1)
lt <- list.files(pattern = "\\.tif$")
st <- stack(lt)
st<-resample(st,r1)
mn1<-as.numeric(cellStats(st, stat='mean', na.rm=TRUE, asSample=TRUE))
sdev1<-as.numeric(cellStats(st, stat='sd', na.rm=TRUE, asSample=TRUE))
min_V1<-as.numeric(minValue(st))
max_V1<-as.numeric(maxValue(st))
bias_mn<-as.numeric(mn-mn1)
bias_mn2<-as.numeric(bias_mn^2)
tab <- table(min_V1,max_V1, bias_mn, bias_mn2)
write.csv(tab, file="Out.csv")


texts:
I am using the following VRT to load a Excel sheet into QGIS and I would like to perform some functions on the inputs to create new fields. Is this possible?

Ideally I would do pythagoras Field 10 and Field 11 to create a new field. It is not practical to do this in the original file.

<?xml version="1.0" encoding="UTF-8"?>
<OGRVRTDataSource>
<OGRVRTLayer name="Comparison-Data">
<SrcDataSource relativeToVRT="1">Comparison.xlsx</SrcDataSource>
<!--Header=False-->
<SrcSql dialect="sqlite">SELECT * FROM 'Data' LIMIT 60 OFFSET 5</SrcSql>
<Field name="Line" src="Field1" type="String"/>
<Field name="Point" src="Field3" type="String"/>
<Field name="1_Easting" src="Field4" type="String"/>
<Field name="1_Northing" src="Field5" type="String"/>
<Field name="2_Easting" src="Field6" type="String"/>
<Field name="2_Northing" src="Field7" type="String"/>
<Field name="Height" src="Field8" type="String"/>
<Field name="Delta_XLine" src="Field10" type="String"/>
<Field name="Delta_ILine" src="Field11" type="String"/>
<GeometryType>wkbPoint</GeometryType>
<GeometryField encoding="PointFromColumns" x="Field4" y="Field5"/>
</OGRVRTLayer>
</OGRVRTDataSource>


texts:
How do you convert from USA Contiguous Albers Equal Area Conic to meters?  Or, to latitude and longitude?

I am using ArcGIS 10.1, and within it, ArcMap.  The shapefile I have reports the coordinates as USA Contiguous Albers Equal Area Conic.  I want to take areas and distances of the polygons and they are very large due to the units.  I am wondering how to convert to meters.

In particular, I want to do distance calculations, and I worry that Albers distorts the distances.  How can get the most precise and meaningful distances when the shapefile orginated as Albers Equal Conic?

The shapefile is of United States counties.  I would like to compute its distances within it.


texts: Add ID of startpoint and endpoint to polyline layer using QGIS?

texts:
I've got two layers: A point layer and a polyline layer. Each line starts and ends at a point from the point layer.
For example: Line ID 5 from the polyline layer starts at point ID 7 from the point layer and ends at point ID 9.

Now I want to add two columns to the polyine layer and fill those with the IDs of the start point and end point. It doesn't matter which point is the start and which point is the end. I just want both IDs in two different fields.

I've tried intersect but that only adds the attributes of one of the points.

Is there a simple solution for this? I'm using QGIS.


texts:
How can I automatically join all lines that intersect into the same feature?
On the image below all three lines are different features, I would like them to all be the same feature, dissolve is not what i am trying to achieve since it joins all lines even if they don't intersect.

EDIT
When I run Field Calculator I get an error asking me to enter a field name? I'm also quite confused to why the Windows and macOS windows look so different?


texts: Data will not load into the popup using the Basic Viewer template for ArcGIS

texts:
I have downloaded the zip file for the Basic Map Viewer (https://github.com/Esri/Viewer) in ArcGIS and am trying to configure the layers to have popups.  I've reviewed some of the code behind other applications and have copied the code but have replaced the URLs with my rest services and inserted my fields as well.  However, when I launch the application, the popup remains blank.  It's showing up, but the data from our server isn't loading in the popup.

This is what I have for the code for one layer:

{
              "url": "http://giswebvm1:81/arcgis/rest/services/INTER_DP/ev_health/MapServer/0",
              "visibility": false,
              "title": "Food Establishments",
              "popupInfo": {
                  "title": "{Name}",
                  "fieldInfos": [
                  {
                      "fieldname": "Est_No",
                      "label": "Establishment Number",
                      "tooltip": "",
                      "visible": true,
                      "stringFieldOption": "textbox"
                  },
                  {
                      "fieldname": "Name",
                      "label": "Establishment Name",
                      "tooltip": "",
                      "visible": true,
                      "stringFieldOption": "textbox"
                  },
                  ],
                  "description": null,
                  "showAttachments": true,
                  "mediaInfos": []
              }
            },

Does anyone know why the popup isn't loading?


texts: Dissolving polygons by attribute within certain distance using ArcGIS Desktop?

texts:
In a FeatureClass I have a lot of polygons which contain attributes of different landuse-types.

Now I am trying to dissolve those polygons of the same landuse-type, but only if the distance between them is less than 100m.

I'm trying this with ArcGIS Desktop 10.0 (ArcInfo level license).


texts: Unable to read QGIS 3.0.2 project file (*.qgs) with blank layout

texts:
I have two *.qgs files created using QGIS 3.0.2. one of them is absolutely new (empty) project and another one is the same as empty but with blank layout.
Here you can download my *.qgs files.
I tried to open them with PyQGIS - the empty one reads fine, the one with blank layout crashes the script with an error:
 empty_project:
Clearing...OK
Create instance...OK project.fileName=
Reading project...OK project.fileName= C:/QGIS_TEST/empty_project.qgs

 project_with_empty_layout:
Clearing...OK
Create instance...OK project.fileName=

Process finished with exit code -1073741819 (0xC0000005)

What can cause the problem?
Here is the code:
import qgis.core

def main(project_path):
    print('Clearing...', end='')
    qgis.core.QgsProject.instance().clear()
    print('OK')

    print('Create instance...', end='')
    project = qgis.core.QgsProject.instance()
    print('OK ', end='')
    print('project.fileName=', project.fileName())

    print('Reading project...', end='')
    project.read(project_path)
    print('OK ', end='')
    print('project.fileName=', project.fileName())

if __name__ == "__main__":

    empty_project = r"C:\QGIS_TEST\empty_project.qgs"
    project_with_empty_layout = r"C:\QGIS_TEST\project_with_empty_layout.qgs"

    print('\n empty_project:')
    main(empty_project)

    print('\n project_with_empty_layout:')
    main(project_with_empty_layout)

    print('OK!')


texts: Errors when trying to optimize OSM Tileserver

texts:
So I followed this guide to create my (very first) tile server. While the server works and we are able to serve tiles, when zooming in tiles take a long time (30s) to render. I'm attempting to pre-render the tiles using the command below but I get the following error.

dogbert@info-osm-tile-serv:/var/www/html/osm$ render_list -f -a
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
Rendering client
Starting 1 rendering threads
Rendering all tiles from zoom 0 to zoom 20
Rendering all tiles for zoom 0 from (0, 0) to (0, 0)
Rendering all tiles for zoom 1 from (0, 0) to (1, 1)
Rendering all tiles for zoom 2 from (0, 0) to (3, 3)
Rendering all tiles for zoom 3 from (0, 0) to (7, 7)
Rendering all tiles for zoom 4 from (0, 0) to (15, 15)
Rendering all tiles for zoom 5 from (0, 0) to (31, 31)
Rendering all tiles for zoom 6 from (0, 0) to (63, 63)
rendering failed with command 4, pausing.


texts:
I am attempting to open a couple of las files in laspy, however one of them has file version 6.0 (although it does not show up as such in lasinfo - I may be missing something). Digging through the source code, it appears that laspy should handle that by simply using 6.0 on its own, but in prepending an h, the file fails. However, changing this behaviour in the source does not seem to fix it.

With that in mind, is there a way to change (las2las?) the las file so that this is not an issue? Or will I have to ignore this las file?

Here is an image of the error I get:


texts:
I'm writing a script to import shp to postgis,
using python, osgeo and psycopg2
( see my previous question:
Import shp to Postgis using Python and ogr )

I'd know if there is a way to get by osgeo library the SRID (for example 4326) of the shp.

So I can confirm the SRID or transform it using script directly.


texts: Creating quadrilaterals buffers around polygons in QGIS?

texts:
For a little map project of mine, I need to create quadrilaterals around a polygon feature based on the bisected angles of the vertices of that feature. Here is an example:

Is it possible to automate this procedure, especially regarding having equal distances? I am using QGIS 3.10.

EDIT:

I am interested in the underlying map, as I want to transform the geometry. Basically I want to recreate Daniel Huffman's linear map, but with a GIS rather than a vector program without losing the spatial information (this is part of a totally different question...). I want to draw my own polygon and then derive such a quadrilateral buffer with a unique buffer of 100km towards land and perhaps 10km towards the sea.


texts: Can someone help with an explanation and some references, in order to understand the nature of return pulses within a LiDAR system.


texts: Combining continuous and categorical symbology of a raster in ArcMap

texts:
I am trying to replicate a symbology that I created in R using ArcMap 10.5.
I have a raster showing flood depth, with float values ranging from 0.001 to some meters (e.g. 3.8). Anything that is below a threshold (e.g. 1 foot or 30cm), is shown with a continous symbology that starts at 2 inches (5 cm) - that is, anything below that is set as no color / transparent. Above a foot, the color is set as a single fill, which only changes when the maximum depth goes over 2 feet / 60cm. See image below:

Is it possible to replicate this symbology in ArcMap , without having to generate copies of the original raster and stacking them?
I know gradient bars can be created for continuous data, but I am not sure about the possibility of combining it with a categorical colour after a given threshold.


texts: merging block group data that uses 2000 geography with 2010 geography

texts:
I would like to combine data sets from 2010 which use 2000 geography with 2011 data that use 2010 census geography. The data is from the contiguous US and is either at block or block group level. I am trying to get a sense of:

How difficult that would be to do correctly
Where a simple merge using the block or BG coordinates or code would go wrong (such as Las Vegas or Phoenix).

I've tried to locate this information on the Census homepage as well as this site, but I am not sure if I am using the best terminology in my search.


texts:
I have a dataset that has the following structure:

City_Start / Lat_City_Start / Long_City_Start / City_Dest / Lat_City_Dest / Long_City_Dest

What I want to do is create a curved line between those two points. I've used several code snippets from here, here and here – still, I am not able to make it work.

Maybe there is someone who can help?

I am totally new to SQL and PostGIS.


texts:
We have a setup that contains 4 geoserver instances being hosted in JBoss across 2 machines.  We also have a load balancer machine which contains an Apache Server and a Tomcat Server.  Our environment contains a GeoWebCache instance that has all of the requested layers configured.  Each layer has 4 WMS URL’s specified (1 for each geoserver instance serving the tile).

It has never been a problem in the past but over the last month our load has greatly increased.  In doing some load testing we determined that the vast majority of the incoming requests to the GeoWebCache are going to the first configured WMS URL in the geowebcache.xml for each layer.  Is there any way to configure GeoWebCache through the geowebcache.xml to balance the requests across all 4 of the WMS URL’s that we have configured?  Also, please note that there is 1 layer that gets more traffic than all of the rest.


texts: Stretching the polygon layer into another polygon layer

texts:
Is there a possibility to stretch the blue layer into the white one?

I would like to fit the districts (the blue layer) into the city (the white layer), but I don't have any idea how to do it with such different data.


texts:
I am working with a number of raster files that suddenly appear to have duplicated records. For example, I have a raster that classifies my study area into aquatic (value = 1) and terrestrial (value = 0) habitats. Originally, the raster contained two rows: one for the terrestrial habitat, and one for the aquatic. Now, the file contains four rows: two for the terrestrial habitat and two for the aquatic. The duplicate records have the same cell count and encompass the exact same areas. This has happened to a number of files I am working with, with up to 18 duplicated records.

How could this have happened, and how do I fix it?

I am new to working with rasters.

I am working with ArcInfo 10.0, and it is the rows that are duplicated (please see screen shot).


texts: Is in_memory reused by multiple geoprocessing services (ArcGIS Server)?

texts:
I have a GP service published on ArcGIS Server 10.2.2. This GP service is going to be used by multiple users at the same time and for intermediate data storage I use in_memory workspace.

I was not able to find on the Internet though whether the datasets I save in in_memory in one GP service session will be "visible" in another one, and thus result in lock issues when trying to overwrite an existing dataset or delete a dataset that is currently being used by another GP service session.

I am hoping for having in_memory encapsulated for each GP service run (session), but wanted to check if anyone knows for sure how it works with GP services.

I know that I can use arcpy.env.scratchGDB for the intermediate data storage in a file geodatabase (which will be unique for each GP service run), but it is way slower and since I have to write many times during the run, this will negatively affect the service performance.

The same question available here on GeoNet with no answer.


texts: Getting Mathematical Representation within Layer's Attribute Table using PyQGIS?

texts:
I'v been playing around with Vector Coding and was wondering if there was
any Plugins out there that might let me represent Vectors within a layer
as it's Mathematic attributes in the Layer's Attribute Table (Degrees and
Length)

Considering there might not be one, can anyone help in Coding such a Function via Python?


texts:
I would like to know if it's possible to do ArcMap style clip with QGIS.
The operation I'd like to do is to clip overlapping polygon(s) in the same layer with the selected polygon.

For example: I have 2 polygons which overlap each other on the same layer. I want to clip all overlapping (unselected) polygons with the polygon I have selected in QGIS, just like in ArcMap. I also don't want the result of the clip to be written in a new shapefile but would like to edit the original shapefile (just like ArcMap). I can't seem to find this function in QGIS. There are many other ways to go around this problem, but is there any plugin etc. which would be able to perform this task with two clicks--> select polygon --> clip all other polygons with selected polygon?

Example images from ArcMap:


texts:
I've downloaded a few LAS files from the NOAA:

http://www.csc.noaa.gov/digitalcoast/data/coastallidar

I used lasinfo to get the coordinate system of the LAS files and it returned:

GCS_NAD_1983_NSRS2007
WKID: 4759 Authority: EPSG

Angular Unit: Degree (0.0174532925199433)
Prime Meridian: Greenwich (0.0)
Datum: D_NAD_1983_NSRS2007
  Spheroid: GRS_1980
    Semimajor Axis: 6378137.0
    Semiminor Axis: 6356752.314140356
    Inverse Flattening: 298.257222101

This is a geographic coordinate system and does not contain a linear unit.

I saw this quote in the ESRI documentation:

  It is recommended that LAS data be delivered and consumed in a
  projected coordinate system, for example, UTM or NAD83 State Plane.
  LAS data that is captured in Geographic coordinates can be displayed,
  but some functionality may fail or be suboptimal.

What type of functionality may fail or be suboptimal? I wish they said a little more here.

I'm not positive, but I think this may be the reason I'm having trouble creating a DEM from the LAS points - because it's in a geographic coordinate system? The DEM appears to be correct, but when I add it to ArcScene and set the base heights to itself, it's all messed up.

When is the best time to reproject? Do I reproject the LAS file itself, or after I create the multipoint feature? Or do I reproject the DEM itself?

Also, the website states the resolution as:

Resolution: Point density is 0.1 to 8 pts/meter2

What would this be equivalent to?


texts: What satellite imagery would help to show spring locations?

texts: I've got lots of tiny streams on a hydrography shapefile. Historic texts indicate that certain ones have headwaters at "sources" or springs, and I want to try to find these. Browsing the historical imagery on Google Earth was my first attempt, but the ground cover and tree canopies are too dense to properly identify a pool. What kinds of satellite imagery types would help to identify such features?


texts: Use selected feature in MXD as selector in python?

texts:
I am quite new to ArcPy. However, I want to write a script that:

uses an existing SELECTED FEATURE of a feature class in a data frame of an existing MXD (on an SDE Server)
for a SELECT BY LOCATION operation of multiple existing feature classes
which in the next step are being COPIED to an existing local database for editing purposes
and CLIPPED within the boundaries of the selected feature (all the outside areas have to be clipped away)

Backgroud:
I have access to a server database, on which I can't edit. Therefore I want to copy features of one FC (SDE) to another FC (local DB), but only the features which intersect the one selected feature in my MXD. Up to I only see that the feature layers contains the whole content of the FC (every feature), then ArcGIS needs around 30 minutes to create the feature layer, which then contains ALL features. The local_az FC does not have any information after the code finishes (without error message).

import arcpy

arcpy.env.workspace = r"C:\Users\KashlaBe\Desktop\Python"

sde_az = r"C:\Users\KashlaBe\Desktop\Python\db_sde.gdb\Aktenzeichenflaechen"
lokal_az = r"C:\Users\KashlaBe\Desktop\Python\db_lokal.gdb\lokal_az"

arcpy.env.overwriteOutput = True

arcpy.MakeFeatureLayer_management(sde_az, "betroffene_layer")

arcpy.SelectLayerByLocation_management("betroffene_layer", 'intersect', sde_az, '', 'NEW_SELECTION')

arcpy.Append_management("betroffene_layer", "lokal_az")


texts: Selecting some vector layer attributes as parameter in R script in QGIS 3.10

texts:
I am doing a script of R for QGIS and I need to select only some fields of one vectorial layer. I just found these option for choose several layers but not choose several attributes.

Is it possible selecting only some fields and not all of the vectorial layer?

The version of QGIS is 3.10, and I am using the plugin "Processing R provider".

Something like these...

##Clustering=group
##Shape=vector point
##Attributes=multiple Field       <-------
##output_plots_to_html
##showplots
##cluster=output vector

And that could be view these...


texts: Bug when viewing data from SQL Server in QGIS

texts:
I'm having an issue with viewing data in QGIS 2 based on a spatial query in SQL Server 2008 R2.

The data appears to load, polygons appear and I can add thematic shading based on data.

However when I view the attribute table for the layer in QGIS, it seems like the same value is being replicated over and over again.

If I add labels, only one label appears despite there being multiple features with different attributes in the original SQL Spatial query.

When I export the layer to a shapefile and open it in QGIS, all the data appears correctly and labelling works without any problem.

Why is the layer imported from SQL Server behaving so strangely?


texts:
I've set a WMS server using MapServer that pulls data from PostGIS table which is configured with source and target columns for pgRouting. I've stored a function in the database that returns the geometry of the Dijkstra's shortest path and in MapServer I've set a layer that uses Runtime Substitution to query the stored function. I'm also using OpenLayers to render the map on the browser using the

  ol.layer.Image({
        source: new ol.source.ImageWMS({
                url: 'http://localhost/cgi-bin/mapserv?map=/home/user/mapdata/mapfile.map',
                 params: {
                      'LAYERS': 'Roads,Parks,River,Railroads',
                      'FORMAT' : 'image/png'
                 }
        })
    });

Now I want to be able to click on the map and have a routing layer according to the start click and end click. So in OpenLayers I use ol.Feature and on the click on the map I set the features a geometry using  setGeometry() function. What I'm confused about is that if I want to pass these values to MapServer I'm pretty sure MapServer would not understand this since the Runtime Substitution mechanism is configured to accept source and target vertexes and OpenLayers' functions would return geometry. Do I need to write a php script that calculates the shortest vertex in of my click and pass these values to MapServer then? I'm confused about it.


texts: Convert a string field to a number field using arcpy

texts:
Accidentally posted this in the general stack overflow forum first.

I have a large (>1000) number of shape-files in which there are fields containing numbers that are defined as text fields.  I need to have a fields containing these values as numbers.  I can add the new fields, but I'm failing to when I try to populate them.

I'm using ArcGis 10.1.  Fields may have values ranging from 0-10, and including up to one decimal place, or they may be empty for a variable (actually blank, no placeholder).

Below is the python script I'm using for two of the variables (N_CT and N_CFY), and the error I get.  I think my problem is in how to transfer the text value into the Decimal conversion.

I'm new to scripting, so please excuse me if my description or word choices are unclear.

import arcpy, os, sys
from arcpy import env
from decimal import *

arcpy.env.overwriteOutput = True

env.workspace = "C:\Users\OuelletteMS\Desktop\Ice_Data_testarea"

listFCs = arcpy.ListFeatureClasses("*")
for fc in listFCs:
    print str("processing " + fc) # displays the file that is currently being handled

    strNCT = "N_CT"   # the current, text version of the field
    newNCT = "NCT"    # the new, number version I want to create
    strNCFY = "N_CFY" # the current, text version of the field
    newNCFY = "NCFY"  # the new, number version I want to create

    arcpy.AddField_management(fc,newNCT,"DOUBLE")
    arcpy.AddField_management(fc,newNCFY,"DOUBLE")

    cursor = arcpy.UpdateCursor(fc)
    for row in cursor:
        row.setValue(newNCT, row.getValue(Decimal(strNCT)))
        row.setValue(newNCFY, row.getValue(Decimal(strNCFY)))
        cursor.updateRow(row)

Error mesage:

  Runtime error  Traceback (most recent call last):   File "",
  line 23, in    File "C:\Python27\ArcGIS10.1\Lib\decimal.py",
  line 548, in new
      "Invalid literal for Decimal: %r" % value)   File "C:\Python27\ArcGIS10.1\Lib\decimal.py", line 3844, in _raise_error
      raise error(explanation) InvalidOperation: Invalid literal for Decimal: 'N_CT'


texts:
Goal: Buffering line features, where the buffer "ends" when an other buffer is about to overlap. Simply: Buffering without overlapping and creating a smooth border between the buffer.

My first Approach: buffering and working with thiesen polygons, but the boundary of thiessen is not smooth.

Is there a solution using QGIS?

This is my actual set up.


texts: Importing weather data using Google Earth Engine and visualizing them?

texts:
I am a beginner in GEE.

The area of interest is already imported and visualized on the map.

Is it possible for the precipitation, to create a histogram or another diagram out of the available weather data, for the selected area and time frame?

The level of precipitation has to be compared with another time steps, therefore, I need to have a table with the amount of precipitation.

Is it possible to visualize precipitation at the map and creating a layer of precipitation?

An example of my code:

var imageCollection = ee.ImageCollection("OREGONSTATE/PRISM/AN81m");
//Import Fusion Table - for study area
var study_area = ee.FeatureCollection('ft:1QDQ2uqIShT65d4uKcq1DJpjVne_jgnBRgDzN-RaY');

//Add study_area to the map
 Map.addLayer(study_area, {color:'green'}, 'study_area');

//To center the map at the study_area
Map.centerObject(study_area, 6 );

//To spatially filter the weather data for the study_area
 var spatialFiltered = imageCollection.filterBounds(study_area);
print('spatialFiltered', spatialFiltered);

//To temporarily filter the weather data for the study_area
var temporalFiltered = spatialFiltered.filterDate('1899-01-01', '1904-12-31');
print('temporalFiltered', temporalFiltered);

Here is the link with the weather data:

https://explorer.earthengine.google.com/#detail/OREGONSTATE%2FPRISM%2FAN81m


texts: Losing information when using views in PostGIS/QGIS?

texts:
I have a layer defined by a complex chunk of SQL which builds a multiline string from a bunch of single lines.  This works fine.  I now need to join this to a table that has all the meta data for these new lines but I could not figure out how to do the SQL.

I ended up creating a view with the name and the multigeom and performed the join on this.  That works fine in PostGIS but when I try and load them in QGIS I get errors on the views because QGIS can not figure out which was the geometry column.  These I can 'fix' temporarily in the 'load PostGIS layer' dialogue which tells me exactly what is wrong but I have to do this every time I attach to the data base.  The DB Manager just flags the table as bad.

Is there a way to fix this once in the view?  I rather like using the view as it makes it much clearer what is going on with the SQL.

For the record here is the SQL that defines the view:

SELECT f.part_of, st_multi(st_collect(f.the_geom)) AS multigeom
  FROM (SELECT line_master.part_of, line_master.type,
          (st_dump(line_master.the_geom)).geom AS the_geom FROM base.line_master) f
  WHERE ((f.part_of IS NOT NULL) AND ((f.type)::text = 'track seg'::text))
  GROUP BY f.part_of;

Alternatively I need to define the layer in one query by joining this to a table of meta data with columns like name, description, etc by matching part_of and name.


texts: Why shouldn't you edit in a replicated database

texts: Say you replicate a database to another database. Are there any reasons you wouldn't want to edit your replicated data other than having different data in the replica database than in the database you replicated from?


texts: Pass an attribute to the find widget using a URL string

texts:
Is there a way to pass an attribute to the cmv through a URL?

Here's an example from my current site of what I want to do.. https://ags2.scgov.net/SCPAparcels/?esearch=2027070041&slayer=0&exprnum=0&showdatagrid=false

I need to be able to pass a parcel ID number from our property website through a URL (got that part covered), so that the map will open at the selected parcel.


texts:
I do not understand why the markers disappear,  zoom 6, only in this area map.

Do you have an idea?

Map


texts:
Is there a QGIS plugin or other method that simplifies parcels to share a common line(border)? I'm pretty sure I read about this some time ago. Couldn't find anything here or elsewhere.

I'd like to reduce a parcel shapefile in size to be rendered as a WMS via GeoServer.

If someone could point me in the right direction I'd appreciate it

I'm using:
PostGIS 1.5
GeoServer 2.3
QGIS master(dev)
Leaflet 0.6.4


texts: Relating text buffer to text size in QGIS?

texts: I'm working with QGIS 2.16. When I create a map, I often use a white buffer around text of various size. The thing not evolving is the buffer size : the rendered text is sometimes a bit strange visually and the buffer is looking like it's not the same size on every text (even if it is if you mesure it). How to avoid this visual effect ?


texts: Appropriate resolution of images for image classification?

texts:
I am attempting to perform image classification on some maps that I have in PNG format.  This classification is failing due to there being too many many pixels in the training samples (I appear to be having the same problem as this user: Failed to create signature file).

As you can see in the picture, a relatively small training area contains a huge number of pixels as shown in the count column.  The PNG image that I imported to GIS is ~4000 x ~4000 pixels.  The number of pixels in this sample is larger than the number of pixels in the entire .png image!

Is there a setting I need to change to get ArcGIS to recognize the resolution of the image for the sake of classification?


texts: Calculate actual Landsat image corner coordinates to derive azimuth (heading)

texts:
This is the continuation of an unsolved problem I had (see this thread if you like).
I have a Landsat image and I would like to estimate the satellite azimuth for my location. As the satellite follows a near-polar orbit (see Landsat Handboook), the satellite must have an azimuth angle different than 0°, getting bigger as it moves poleward. If I have the coordinates of the corners of my image, I can estimate how the image is tilted against North direction (estimate the azimuth).
So, the idea is:

to choose one of the two sides of my image (wether the left or right) to get the angle of the normalized direction (see also How to calculate orientation of line segments using open source GIS?)
to use the coordinates of the chosen corners (e.g. lower and upper left, as a and b variables, see below) in the following MATLAB function (inspired gist.github.com/604912)

function d = line_dir( ax, ay, bx, by )

dx= bx - ax;
dy= by - ay;
m= sqrt((dx^2)+(dy^2));
r= atan2(dx/m, dy/m);
d= (-r*180)/(pi);

if d<0
    d=-d
end
end

However, the coordinates of the corners in the metadata file refers to the background image, not the real image (see the figure below to understand), so can I find now the real corners of the image, to then find the azimuth angle?


texts: Display by highest value in multiple fields?

texts:
I am categorizing parcels based on the highest value across three fields (which represent 3 questions from a survey). So :

if you answered field/question A: 1, field/question B: 3, and field/question C: 4, then I want to categorize/display "4";

if you answered 5,1,1 then I want to display "5".

Working in QGIS and am admittedly not experienced, and have no clue how to make that work.


texts: Where are the 3d analyst tools available in QGIS?

texts: I want to know whether we can perform 3d analyst in Q-Gis? If yes, means where is that option present?


texts: I am trying to calculate the least cost path between a point and a polygon using the tool "least cost path" from SAGA. This tool works fine with the exception that it calculates the least cost path between the point dataset and the middle of the polygon. I need to calculcate the cost path between the point and the edges of the polygon. Any idea how I can work around this problem?


texts: Using REST API to update feature class that is not a published layer

texts:
Let me give a bit of a background on what I have:
I have 3 published layers using a SQL view as a DataSource. The reason for this is because I have a layer for points, lines, and polygons that all share the same "attributes". So I created one master feature table that contains all the shared properties, with an objectId and layerType field. I then created views for all 3 layers, joining on the objectId and the LayerType fields.
This displays wonderfully as I would like it to, and using the MapServer REST API works as it should.

Now here is what I am trying to do: I would like to use the FeatureService REST API to add features (Add Features/Apply edits) on the main feature class which is not the layers dataSource. The layers are using the SQL view as DataSource so adding features are not supported, because it is not a table it is a SQL view.

The FeatureService works perfectly when I use the feature class as DataSource instead of the view, but this then forces me to duplicate all the properties on all my feature classes.

So is there a way to use the FeatureService or any other REST API to add an entry to the feature class table, when the table is not directly linked to published layer? Maybe using the ObjectClassId?


texts: OSM Problems with Identifying and Extracting Islands

texts:
From OSM, I'm trying to extract a dataset that includes islands of the Caribbean region. The trick is that as many of the physical individual islands as possible need to be listed individual features in the data table. In other words, I want the data set up so that it is easy to select particular islands (not countries) and style them individually.

I've tried the Quick OSM plugin in QGIS (using the Overpass API), and chose the place:island tag. That works OK, but there are a not-insignificant number of islands missing from the extraction (e.g. most of the bigger Florida Keys, the main island of Cuba (though the smaller islands of Cuba are included), some of the main islands of the Bahamas, and others).

Question 1. I'm not sure why these islands aren't included in my extraction. Is it because they haven't been tagged "place:island"?
Is there some other extraction I can do that would get the data I need?

Question 2. Assuming the problem is the lack of "island" tagging, how can I add the correct tags using the OSM Editor? I don't have a ton of editing experience, but I went over to the ID Editor and tried to figure how to add an island tag to the islands. The problem was that I couldn't identify any "island" features to edit. I don't see any outlines around the physical islands that I could click and access tags for.
How can I add island tags to the islands that don't seem to have already been tagged?


texts: Returning data based on clicked marker using Leaflet?

texts:
How do I get the data according to the marker I clicked on?

for(i in data) {
    var title = data[i].title,
    id = data[i].id,
    position = data[i].position,
    kriteria = data[i].data.kriteria,
    iconUrl =  data[i].icon.url,
    pa_judul = data[i].data.pa_judul,
    marker = new L.Marker(new L.latLng(position),
    {

        icon:  L.icon({
            iconUrl:   iconUrl,
        })

    },
    {title: title},

    ).addTo(map);

    marker.bindPopup('ID: '+ id ).on('click', function(e) {
        console.log(data);
        $('#ModalDetail').modal('show').on('shown.bs.modal', function(e) {
        });
    });
    markersLayer.addLayer(marker);
}

console.log(data) returns the whole array:

When I change to console.log(data[i]); I get undefined message:

If I change to console.log(data[0]) or data[1] and data[2] the results is not error and I can get the data:

Only for marker.bindpopup this working fine, but for on click it's not working.


texts: ArcGIS "Merge" tool is slower on arcpy than when starts it with ArcGIS interface

texts:
I am writing python script on ArcGIS 10.2.2 and found some strange bug.
I use merge tool to process 498 shape files (they are located on a hard drive). Using arcpy script it takes 6 minutes, but when I run the same tool with the same shape files it takes 6 seconds to complete the task in ArcMAP interface!
The output of the tool goes to in_memory workspace in both situations.
I tried to use copy feature tool to put all shape files into memory before I run merge tool - no luck.
Also I tried to use make feature layer tool and use output files as input to merge tool - no luck again.
How to make this tool works same fast as in ArcMAP interface?
UPGRADE 1:
I use standart ArcGIS 10.2.2 python installation: IDLE 2.7.5, Python version 2.7.5, Tk version  8.5.2.
When I run PolyGeo's script from IDLE interface, it gives:

ArcPy import took 3.96323227335 seconds
Merge took 316.568876475 seconds

Runnig PolyGeo's script from ArcMap's python interface, it gives:

ArcPy import took 9.65935383235e-06 seconds
Merge took 364.072804059 seconds

Running Merge tool with same shapefiles from ArcMAP's interface gives:

Elapsed Time: 6,39 seconds


texts: Improving performance of Clip using OGR?

texts:
I have a set of points which I am trying to clip to a set of polygons. The files have many features (150,000 polys, 8,000 points). I'd like to automate this process carry it out once a day, hence I am using python/gdal/ogr to script the operation. However, it is prohibitively slow. Performing the same operation using the Clip tool in ArcGIS gives results in mere minutes! Here is one ogr call I've tried:

ogr2ogr -clipsrc polygon.shp clipped_output.shp points.shp

and it has been running for 5 hours. I've also tried using a VRT file in combination with an SQL statement to count the number of points falling inside polygons using:

'ogrinfo -dialect SQLITE -sql "SELECT COUNT(*) FROM polygons, points WHERE ST_Intersects(polygon.geometry,points.geometry)" input.vrt'

This has also taken ~ 5 hours so far on a virtual machine with plenty of RAM and processing power. Are there other techniques or methods that I do not know about that could reduce computation time? Or am I just missing something?


texts: Postgis Functional Index on st_pointonsurface() Ignored

texts:
If I define the following table...

CREATE TABLE tbl_vast_importance(
  id bigserial PRIMARY KEY,
  geom geometry(MultiPolygon,4326)
);
CREATE INDEX ON tbl_vast_importance USING GIST (geom);
CREATE INDEX ON tbl_vast_importance USING GIST (st_pointonsurface(geom));

...and run the following query

SELECT

  id,
  geom

FROM

  tbl_vast_importance a
  JOIN tbl_vast_importance b ON (st_intersects(st_pointonsurface(a.geom),b.geom))

WHERE

  a.id != b.id

...the spatial index is not used; yet using st_intersects() on the geometry directly results in the geometry index being used properly. How do I force Postgres to use the proper index for st_pointonsurface()? It would be wasteful to create an explicit centroid column for this purpose.

Explain Results:

Nested Loop  (cost=0.00..1034058179737.31 rows=609220605748 width=784)
  Join Filter: ((a.id <> b.id) AND st_intersects(st_pointonsurface(a.geom), b.geom))
  ->  Seq Scan on tbl_vast_importance a  (cost=0.00..78073.11 rows=1351911 width=392)
  ->  Materialize  (cost=0.00..153484.67 rows=1351911 width=392)
        ->  Seq Scan on tbl_vast_importance b  (cost=0.00..78073.11 rows=1351911 width=392)
Planning time: 0.188 ms

postgis_full_version = "POSTGIS="2.2.0dev r12887" GEOS="3.5.0dev-CAPI-1.9.0 r3995" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.0, released 2014/04/16" LIBXML="2.9.1" LIBJSON="0.11.99" TOPOLOGY RASTER"


texts: How to Load a Record Set Parameter in a tool dialog

texts:
I am trying to create a tool that allows a user to update a table row without starting an edit session. I have a script tool set up with a record set parameter and I use this set up to add new rows to the table. It works well. What I would like to do now is load the record set parameter with the rows that will be edited. I am trying to do this in the updateParameters() method. However, when I load the parameter nothing happens in the dialog. I can see the record set in table of contents and its getting loaded but its as though the parameter is not updating.

Anyone had any success with something like this?

I have tried several ways to load the record set. My latest attempt is with a cursor. Here is the tool validation code for this latest attempt. I have three parameters, an input table view, an input record set, and an input string that I use for printing debug statements.  The input record set has the schema imported from the table view I am trying to load.

import arcpy

def rows_as_dicts(cursor):
    colnames = cursor.fields
    for row in cursor:
        yield dict(zip(colnames, row))

def newRowFromDict(cursorFieldsTuple, inDict):
    newRow = []
    for field in cursorFieldsTuple:
        newRow.append(None)

    for item in inDict:
        newRowIndex = cursorFieldsTuple.index(item)
        newRow[newRowIndex] = inDict[item]
    return newRow

class ToolValidator(object):
  """Class for validating a tool's parameter values and controlling
  the behavior of the tool's dialog."""

  def __init__(self):
    """Setup arcpy and the list of tool parameters."""
    self.params = arcpy.GetParameterInfo()

  def initializeParameters(self):
    """Refine the properties of a tool's parameters.  This method is
    called when the tool is opened."""
    return

  def updateParameters(self):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a parmater
    has been changed."""
    pymsg,msgs = " No "," Problems"
    if self.params[0].altered and not self.params[0].hasBeenValidated:
        if not self.params[0].value == None:

            thetable = self.params[0].value
            recordSet = self.params[1].value
            try:
                inCur = arcpy.da.InsertCursor(recordSet, "*")
                inDict = dict.fromkeys(inCur.fields)
                inFields = inCur.fields

                searhcur = arcpy.da.SearchCursor(thetable, "*")
                searchDict = rows_as_dicts(searhcur)

                for row in searchDict:
                    for item in row:
                        if item in inFields:
                            inDict[item] = row[item]
                    newRow = newRowFromDict(inCur.fields, inDict)
                    inCur.insertRow(newRow)

                del inCur
                self.params[1].value.load(arcpy.RecordSet(recordSet))

            except:
                import sys
                import os
                import traceback
                tb = sys.exc_info()[2]
                tbinfo = traceback.format_tb(tb)[0]
                pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
                msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages(2) + "\n"

            self.params[2].value = "Validation" + pymsg + msgs + " end"
    return

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


texts: Preserving data types when publishing to ArcGIS Online using ArcGIS Python API?

texts:
I have a Python script which does some data manipulation using Pandas dataframes, then outputs to CSV. The CSVs are then published to AGOL using the ArcGIS Python API, overwriting the existing services. This workflow is similiar to the one demonstrated here:

from arcgis.features import FeatureLayerCollection
cities_flayer_collection = FeatureLayerCollection.fromitem(cities_item)
df.to_csv('data.csv')
cities_flayer_collection.manager.overwrite('data.csv') # data types in csv are unknown here

The problem I encounter is that occasionally some of the services fields have their data types changed upon publishing. Usually its a integer getting changed to a string, causing a breaking change to the application using the services.

It seems one approach to preserving the data types is to directly publish the data frame to ArcGIS Online (with column data types specified).

If this is not possible, is there another approach to preserving the datatypes when publishing?

My data consist of 3 non-spatial tables and 1 spatial table.


texts: Not able to load any Raster File using QGIS Python

texts:
I am trying to run an elementary piece of Python code, that simply loads a dem file as a raster accessing the QGIS Python API.

On the embedded console (within the QGIS application GUI), it runs fine and the raster loads. However, it does not load work when I run it outside of the embedded console, from a standard windows prompt AFTER setting up QGIS_PREFIX_HOME and PYTHONPATH using a batch file.

The code I am running is as follows:

import os

from PyQt4.QtCore import QFileInfo, QSettings
from qgis.core import *

# load providers
QgsApplication.initQgis()

# Load an input dem
rasterFile = "E:\\data\\43j11\\43J11.dt2"
fileInfo = QFileInfo(rasterFile)
fileName=fileInfo.fileName()
baseName = fileInfo.baseName()
print "Loading raster layer:" + fileName

if fileInfo.exists():
    print "Raster file specified exists."
else:
    print "File does not exist"
    exit(1)

errorStr = "Unknown"
if QgsRasterLayer.isValidRasterFileName(rasterFile, errorStr):
    print "File is a valid raster"
    rlayer = QgsRasterLayer(rasterFile, baseName)
    if not rlayer.isValid():
        print "Layer failed to load!"
    else:
        print "Successfully loaded dem: " + fileName
else:
    print "File is not a valid raster. Error: " + errorStr

QgsApplication.exitQgis()

Within the embedded console, the output I get is:

Loading raster layer:43J11.dt2
Raster file specified exists.
File is a valid raster
Successfully loaded dem: 43J11.dt2

Outside the embedded console, the output I get is:

Loading raster layer:43J11.dt2
Raster file specified exists.
File is not a valid raster. Error: Unknown

I suspect this is a path/initialization problem, so I am also including the .bat file I am using here:

set QGIS_PREFIX_PATH=C:\Program Files\QGIS Wien
set PYTHONHOME=%QGIS_PREFIX_PATH%\apps\Python27
set PYTHONPATH=%QGIS_PREFIX_PATH%;^
%QGIS_PREFIX_PATH%\lib;^
%QGIS_PREFIX_PATH%\bin;^
%QGIS_PREFIX_PATH%\apps\qgis\python\plugins;^
%QGIS_PREFIX_PATH%\apps\Python27;^
%QGIS_PREFIX_PATH%\apps\Python27\Lib;^
%QGIS_PREFIX_PATH%\apps\Python27\Lib\site-packages;^
%QGIS_PREFIX_PATH%\apps\qgis\python;^
%QGIS_PREFIX_PATH%\apps\Python27\DLLs;^
%QGIS_PREFIX_PATH%\apps\qgis\bin;^
%QGIS_PREFIX_PATH%\apps\qgis\plugins;^
%QGIS_PREFIX_PATH%\bin\gdalplugins;^
%QGIS_PREFIX_PATH%\apps\saga\modules;^
%QGIS_PREFIX_PATH%\apps\Qt4\plugins;^
%QGIS_PREFIX_PATH%\apps\grass\grass-6.4.3\lib;^
%QGIS_PREFIX_PATH%\apps\grass\grass-6.4.3\bin
set PATH=%PYTHONPATH%;%PATH%

I need it to work outside of the embedded console since I need to package QGis as part of my application. My eventual plan is to include a .bat file where I will set the QGIS_PREFIX_HOME from my application's installer.


texts: Loading spatialite with python3's module under Windows

texts:
I installed spatialite's Python module using pip:

pip install spatialite

I copied the mod_spatialite.dll found on https://www.gaia-gis.it/gaia-sins/index.html into my windows/system32 folder (I have Python 3 32bits)

I have the error message

spatialite.connection.LoadExtensionError: Failed to load SpatiaLite extension. Verify that your python module sqlite3 has load_extension support and check that libspatialite is installed. Tried extension names: mod_spatialite, mod_spatialite.so, mod_spatialite.dylib


texts: Creating two rasters with the coordinates as cell values

texts:
I have data that is related to its latitude and longitude (Northing/Easting). I am trying to create two rasters where the cell values are the UTM northings and UTM Eastings.

I am unsure how to populate those values to the cells in a raster.

Any ideas on how this could be accomplished?


texts: Autopopulating text field with string and number combination

texts:
I have an attribute table with a text field which indicates a unique identifier for each row. The identifier includes a combination of text and numbers, sequentially increasing, as follows: PHOTO_0001.jpg, PHOTO_0002.jpg, PHOTO_0003.jpg, etc.

Some rows have been added to the table and this field is left blank, as you can see in the screenshot ("Name" field). How can I autopopulate this field to include the text and have the numbers sequentially increase in order to fill in these blanks? In other words, I'd like the first blank space to be filled with PHOTO_0005.jpg, and so on.

I'm familiar with ArcMap but very new to Python.


texts: Update Existing Field Editing Changes Don't Persist in QGIS

texts:
I toggle editing on a layer, open the attribute table -> Field Calculator -> Check 'Update Existing Field' -> Select 'myfield' in dropdown -> type...

myfield / 60

-> Hit 'Ok' -> Save Edits -> Stop Editing

The changes seem to appear in the attribute table, but when I close the attribute table and re-open, the changes are gone. When I export the result to geojson, the changes aren't there either.

Any ideas on how to persist these edits short of making a new field? This is on QGIS 3.4 Madeira, Windows 10.

EDIT:
I cannot even persist changes in a new field: the result is all null


texts: How to avoid this corrupted world render?

texts:
I have this weird render everytime I process world data in software like FME, QGIS and ArcGIS. I noticed these rectangles crossing the world are related to lands areas between -180 and 180 longitudes. Does anyone know what is the reason of this and how to avoid it?

Edited: I noticed that this happen only when FME creates the polygons. If ArcGIS creates it, the rendering is correct in ArcGIS.


texts: Refreshing ArcGIS Feature Server Layer Data

texts: I'm trying to refresh a layer's data every 30 seconds from an ArcGIS Feature Server.  I toggled on this option which I thought would accomplish this; however, it doesn't update the data - it just redraws the layer. How do I force QGIS to re-request the data from the server?


texts: How to draw a line between markers in openlayers

texts:
how to draw the line between markers, coordinates of markers undertake from a DB. whether it is possible to draw in general lines between markers, I saw examples only with points.

    markers = new OpenLayers.Layer.Markers("Marcadores");
    map.addLayer(markers);

    if (b == 2)
    {

            //=================  =========
            var size = new OpenLayers.Size(30, 30);
            var offset = new OpenLayers.Pixel(-(size.w / 2), -size.h);

            var location = new OpenLayers.LonLat(kor_1,kor_2).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
            var icon = new OpenLayers.Icon('http://icons.iconarchive.com/icons/icons-land/vista-map-markers/256/Map-Marker-Ball-Pink-icon.png', size, offset);
            markers.addMarker(new OpenLayers.Marker(location, icon.clone()));
            var line = new OpenLayers.Geometry.LineString([kor_1, kor_2]);
        //================= ==============

    }


texts:
I have a problem in QGIS. I want to find overlapping polygons but not only which polygon overlap with another but the exact node(vertex) that intersect or overlap. The error marker doesn't show you this exact point. It marks the whole polygon.

Do you have any ideas?


texts:
Is there any option to SAGA to calculate the Topographic Wetness Index ?
I have a big area and I tried many times with SAGA, the last time I thought the results was ok (before SAGA would crash or give me a empty raster), however I just noticed that for a small part of my study area the TWI raster is empty.
For the last TWI created in SAGA I decided to calculate the slope also in SAGA, but I still have problems with the file. The area with empty cells is near the right margin of the raster.This is how it looks like (black cells are NODATA cells):

I need to recalculate this asap but I can't find any another solution (in arcgis or qgis).
Edit/Update
I've just saw that I have the same problem in other small areas of the image, that are +/- flat. After overlaying with the SRTM, I can see that when the SRTM value is negative that the TWI cells have NODATA values. I guess this is the reason for the error.


texts:
I am working in QGIS 3.4.11 on macOS 10.14.6.

For a polygonal vector layer, I have a simple autogenerated attributes form in QGIS. Every time I add a new feature in the layer, the attributes form that appears is so small, so I need to resize it. Any ideas on how to change it?

Here is how it looks when I press right mouse button after creating a feature:

And here is the resized form that I'd like to have by default.


texts: Feature Class to Geodatabase (multiple) in ModelBuilder => ERROR 000210: Cannot create output

texts:
I used modelbuilder, and the last step is to collect feature classes after iteration results to geodatabase using conversion tools of feature class to geodatabase(multiple). However, I met an error: ERROR 000210: Cannot create output.
How can I deal with that?

I also found some discussions in ESRI forum and StackExchange, but still I can not find the answer which works for me.

http://forums.esri.com/Thread.asp?c=93&f=1728&t=279556

http://forums.esri.com/Thread.asp?c=93&f=985&t=266871

Trouble importing Feature Classes into Feature Datasets


texts: Making QGIS buttons and my Plugin button mutually exclusive

texts:
I've added a toolbar to the QGIS main window and I've added some checkable buttons to the toolbar.

How can I make my checkable buttons untoggle QGIS default toolbars' checkable buttons? That is, when I activate my button by clicking on it, I want QGIS default buttons to be deactivated.

Is there a way to get the QGIS main window's QButtonGroup?


texts: cannot install phpPgAdmin - postgis and osgeo apache issues

texts:
i installed mapserver from osgeo and all went smooth

then, i wanted to install postgis, and the easiest way is with EnterpriseDB installation
http://www.enterprisedb.com/products-services-training/pgdownload
(as said in this forum in another thread)

but i get an error saying that i need to have EnterpriseDB's apache installation in order to install phppgadmin.

in the FAQ of osgeo they have a section about this situation (say i install EnterpriseDB apache first)
https://trac.osgeo.org/osgeo4w/wiki/FAQ#WhatifyouwanttowebenableOSGeo4WbutApacheisalreadyinstalledie:notbyOSGeo4W

but it is missing the main explenation! :-\

can any one fill in the gap?

thanks!


texts: How can I conduct Geographically Weighted Analysis using an exponential decay function?

texts:
I have some points (representing 30 study sites) and I want to calculate the weighted mean of several variables (landscape layers) using a negative exponential decay (weights function) to give more weight to the landscape features closer to the points (study sites) than the features (grid cells) further away. (The series of underlying grid layers represent landscape features such as roads; habitat etc.)

Also, how can I use spatial statistics to find the optimal distance (bandwidth) for my distance-decay function? In the literature everyone resorts to creating buffers (vector) at different distances (say 1km, 3km & 5km) to quantify the variables and then uses statistics to determine which buffer distance is significant. Other ecologists (Rhodes et al. 2006) have used the “negative exponential distance weighted density” of each variable and provided a scale parameter (L) which controls how rapidly the influence (ie weighting) of the variable declines with distance, eg L = EXP(-0.002*Distance)

I’m using ArcGIS spatial statistics; grid (raster) spatial analysis tools; and investigating GWmodel for R-stats from an earlier post.


texts: Loading existing datasets into empty geodatabase (with schema) in ModelBuilder with iterator and append?

texts:
I'd like to load existing feature classes within a dataset in one geodatabase into a new, empty geodatabase with schema already set up.  Both geodatabases, the one containing the data and the one containing the schema are .mdb and were acquired from the ESRI page for downloading data models . This is step 4 of a process. https://desktop.arcgis.com/en/desktop/latest/manage-data/geodatabases/using-arcgis-data-model-designs.htm

I have tried unsuccessfully to load the data using the append and iterator in ModelBuilder.  I have no experience with Python, but feel that somehow this could be accomplished through ModelBuilder. I've combed through the iterator tool information to no avail.

What are non-programmer options for loading this data?


texts: how to customise toolbar in Leaflet.Draw plugin?

texts: I downloaded the Draw.js and one ccs file to use the Leaflet.Draw plugin, but now I need to customise the toolbar (i.e want only polygon and marker).


texts: How to filter points in one go by setting extent area around line?

texts:
I have a large set of data points which are falling away from my study area(Which is not required)Pls see image attached. I need to filter points which are falling within a radius of say 2km from the red line (POINT A AND B). How should I do in one command? As I have lot more files with a similar problem.

After I enter:

layer = iface.activeLayer()
for line in layer.selectedFeatures():
    print line.geometry().exportToWkt()

in python console, nothing is seen.

Where do i see the output?

Here is a link to the data.


texts: Is a master's degree needed for a GIS career?

texts:
Currently I'm on the 5th year of education at the university (Dept. of geography, specialisation - "GIS"). In my country (Belarus) we have a system of education that differs from the majority of the other states. So after these five years "bachelor degree" is not written in a diploma (but it is implied). And there is a possibility to have a master's degree (one year more) that is (as far as I know) treated in other countries.

I have an intention to leave the country as there isn't any possibility to find a GIS-related job here. Is the point of view, that in this case, it's much better to be a master than a bachelor?


texts: QGIS expression with overlay-fuction: filter-condition based on comparison of attributes from two layers

texts:
In QGIS 3.18, I have two point layers: layer_1 with attribute id_1 and layer_2 with id_2. I want to use the overlay_nearest function: overlay_nearest(layer[,expression][,filter][,limit=1][,max_distance][,cache=false])
Applied on layer_1, I want to get for each point on layer_1 all points on layer_2 where id_2 has a different value from id_1 (to connect them by a line). However, I can't find out how the syntax of the filter-argument works, how to refer to attribute values of two different layers for comparison.
The basic expression is: overlay_nearest( 'layer_2', $geometry, [filter])
How is the syntax of the [filter] part? filter:="id1" <> "id2" obviously doesn't work. $id <> "id2" and  $id <> "id1" don't work either.

Edit: see this example here to make the idea clearer.

Red dots = layer1, labeled with id1
White dots = layer2, labeled with id2

Each red point should be connected to it's nearest white point, except when their id is the same. However, on the upper left (red arrows), you see that 12 is connected to 12, 17 to 17:

The expression used in geometry generator on layer1 for this is as follows (the filter condition is on lines 6 to 18):
collect_geometries (
    array_foreach (
        overlay_nearest(
            'layer2',
            $geometry,
            filter:=attribute (
                get_feature_by_id (
                    'layer1',
                    $id
                ),
                'id1'
            ) <> attribute (
                get_feature_by_id (
                    'layer2',
                    $id
                ),
                'id2'
            ) ,
            limit:=1
        ),
        make_line (
            $geometry,
            @element
        )
    )
)

*Edit
See more here in the responses to the feature request, especially:

The purpose of the filter parameter is to reduce the dataset (layer2)
to use for research, so it's applied before it proceeds to any overlay
test

https://github.com/qgis/QGIS/issues/43146


texts: Adding Facebook and Twitter sharing to CartoDB infowindows?

texts:
Trying to add share buttons to output something like:

{{region}} text {{region_variable}} text www.google.com

The below works very intermittently for Twitter, but when I share the URL, the map won't load.

Tweet

Not even sure where to start with doing the same with Facebook.


texts:
In AcrMap 10.2 I'm trying to add a field and run this script in Field Calc:

!shape.isMultipart!

to see if I have any multipart lines. I keep getting geoprocessing failures. I am clicking the "python"  and "String" buttons. Is there something I'm doing wrong? Maybe my field type is wrong? I've tried double and float.


texts: Using Carto's "Static Maps" API from Python

texts:
I want to download a static image of a map to my local PC via a Python script.

I'm using carto-print: carto-print

I have tried this method:

from xlwings import Book, Range
from carto.auth import APIKeyAuthClient
from carto.exceptions import CartoException
from carto.datasets import DatasetManager
from carto.export import ExportJob
from carto.maps import NamedMapManager, NamedMap
from carto.resources import AsyncResource
from carto.print import Printer

import json
import os
import urllib
import urllib.parse
import urllib.request as urllib2
import base64
import sys
import argparse
from _ast import If
try:
    import requests
except ImportError:
    print('The requests package is required: http://docs.python-requests.org/en/latest/user/install/#install')
    sys.exit()

user = "{username}"
key = "{api key}"
map_id = '{map id}'
width = 30
hight = 20

############ GET TEMPLATE NAME and BOUNDS ############
img_url = 'https://%s.carto.com/api/v2/viz/%s/viz.json/?api_key=%s' %(user, map_id, key)
r = requests.get(img_url)
#print(json.dumps(r.json(), indent=2)) # Prints json response

#center = r.json()['center']
#lat, long = center.replace(']','').replace('[','').split(",")
zoom = r.json()['zoom']
tpl_name = r.json()['layers'][1]['options']['named_map']['name']
bounds_temp = r.json()['bounds']
bounds = bounds_temp[0]
bounds.append(bounds_temp[1][0])
bounds.append(bounds_temp[1][1])
bounds = str(bounds).replace(' ','').replace('[','').replace(']','')

print(bounds)

############ GET IMAGE ###########
printer = Printer(user, tpl_name, key, width, hight, zoom, bounds, 300, 'CMYK')
printer.export("D:/{folder}/{other_folder}")

print('done')

UPDATE: I fixed the error but the image I get is a background with no map or visualization layers.

Any idea how to get the visualizations and map layers? Perhaps I am getting the wrong template id?


texts: Seeking free or low cost GIS platform(s)/tools for generation and serving of raster map tiles

texts:
My aim is setting a self-hosted server that is able to generate map raster tiles of Europe and visualize them in the popular JavaScript library Leaflet. I need a zoom precision up to the names of small streets. All I need is countries borders, cities and streets and their labels. All information apart from that is not essential. It would be great if the generated tiles are going to be packed in .mbtiles format.
So far I've tried OpenMapTiles. It's promising platform but I cannot manage to render the tiles because of some issues that I'm currently communicating with the development team. I've tried also these steps, but Renderd doesn't want to start because some of the many steps before seem to have failed and I don't know which. None of the steps has exited with an error.
Has any of you successfully generated tiles with these or another platforms for a such big area as Europe?
The server that is going to host the tiles has the following params.
RAM - 4GB
Hard drive - 360GB
CPU Cores - 8
OS - Ubuntu 18.04

I've already tried that same configuration with pregenerated .mbtiles for a smaller region in klokantech/openmaptiles-server and it works well.
I'm going to use another more powerful server to process the tiles.


texts:
Yahoo stopped their Yahoo! maps web services (link1 : We are shutting down this service on September 13, 2011. We suggest using maps from our partner Nokia. Please visit the Ovi Maps API for more information). How can I use Ovi map as a layer of my OpenLayers map?
I came through this page where it seems they've managed to use OpenLayers with Ovi : link 2


texts:
When I try to install gdal (on OSX 10.11.6) with pip install gdal (or easy_install) the installation fails with following error

extensions/gdal_wrap.cpp:3085:10: fatal error: 'cpl_port.h' file not found
#include "cpl_port.h"

According to this thread https://stackoverflow.com/questions/37700484/python-gdal-does-not-install-on-mac-osx-el-capitan I added the location of the header file to my path variable.
My .bash_profile now looks like this

export PATH=$PATH:/Library/Frameworks/GDAL.framework/Programs
export PATH=$PATH:/Library/Frameworks/GDAL.framework/Headers

The error remains the same.

Then I tried following this solution: Python GDAL package missing header file when installing via pip although I do not want to install it in a virtualenv.

After setting CPLUS_INCLUDE_PATH and C_INCLUDE_PATH I ran into following error:

    clang++ -bundle -undefined dynamic_lookup -Wno-error=unused-command-line-argument-hard-error-in-future build/temp.macosx-10.11-x86_64-2.7/extensions/gdal_wrap.o -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -L/Library/Frameworks/GDAL.framework/Versions/2.1/lib -lgdal -o build/lib.macosx-10.11-x86_64-2.7/osgeo/_gdal.so
ld: warning: directory not found for option '-L/Library/Frameworks/GDAL.framework/Versions/2.1/lib'
ld: library not found for -lgdal
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang++' failed with exit status 1

Any idea how to fix the errors and get a working installation?


texts: Updating field with layer name on multiple layers with PyQGIS script?

texts:
Introduction : I  created (with GIS.SE help) a script to batch edit many layers to add one or many fields. The initial aim was to easily add 3 fields to many layers to quicken my labelling process. Example below :

Below the initial code to start the script

##Perso=group
##Add_Labelling_Fields=name

##layer=multiple vector
##Field_ETIKT_X=string ETIKT_X
##Field_ETIKT_Y=string ETIKT_Y
##Field_ETIKT_ROT=string ETIKT_ROTATE

from osgeo import ogr

layers= layer.split(";")

for i in layers:
    driver = ogr.GetDriverByName('ESRI Shapefile')
    dataSource = driver.Open(i, 1) #1 is read/write

Actual problem : I'm now trying to find a way to create another similar script to batch update a field on many layers  with the following expression :  @layer_name to keep a track on where my data comes from, prior to merging multiple layers. It should also be a good way to add various calculations to many fields at once.

My problem here is similar as before : batch processing on editing a field does work with QGIS (through the processing toolboxes), but it creates new layers. I'd like to find the same type of script where you select many layers and it updates a field on all layers without creating new layers.

I tried a few things but I'm not really good with pyqgis yet and I get mixed up with the ways of updating fields depending on where the layer is declared from. There seems to be lots of different ways to do the same thing. No hurry for me, i can manage with other softwares (ex : FME) to do the trick but I think this could be useful for the many people that don't have those expensive softwares.

A this point, I don't exactly know how to call my layer and edit the attributes. I found this topic, but I don't exactly know how to fit them in my code...

it = layer.getFeatures()

layer.startEditing()
for feat in it:
  layer.changeAttributeValue(feat.id(), 2, 30)

layer.commitChanges()


texts: Openlayers 3 heatmap with weight function

texts:
I have created an OpenLayers 3 heatmap. Because my weight column is not in the range 0-1, I need to use a function to divide it by the maximum value (which I know). I am doing the following:

var lyr_airports = new ol.layer.Heatmap({
    source:jsonSource_airports,
    radius: 20,
    weight: function(){'ELEV'/1569},
    title: "airports"
});

Is that correct? In other words, does it recognize column names like that in the function, or do I need to reference the column fully? If the latter (in this example), how?

Edit
Just spotted a horribly basic error: no return. Will fix that and retest.


texts: Using PostGIS, GeoServer & OpenLayers for simple web mapping application?

texts:
I'm very new to web-mapping and I develop a simple web mapping application for a small city called Berrechid in Morocco has a latitude 4099485 and longitude -14.2884 in Google Maps...

For that I already created 12 layers with GeoServer using the projection EPSG:26191 and it's work fine the problem is when I want to display my data on OSM map (or Google Maps... etc.) the data is to small and the zoom is focused always in center of Africa not on the my city !!!

Here is my code:

var extents = new OpenLayers.Bounds(293,460.544281415, 294,831.25, 299,954.8125,304,268.46875);
   var map = new OpenLayers.Map("map", {
controls: [
new OpenLayers.Control.Navigation(),
        new OpenLayers.Control.ArgParser(),
        new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('dropdown-content')}),
        new OpenLayers.Control.MousePosition(),
        new OpenLayers.Control.PanZoomBar(),
        new OpenLayers.Control.KeyboardDefaults()
    ],
maxExtent: extents,
    minExtent: "auto",
    restrictedExtent: extents
},
    {projection: new OpenLayers.Projection("EPSG:26191")},
    {units: 'm'},
    {allOverlays: true}
    );

var OSM = new OpenLayers.Layer.OSM("OpenStreetMap");

 var geoportail_lyrs = new OpenLayers.Layer.WMS (
        "Geoportail Lyrs",
        "http://localhost:8080/geoserver/geoportail/wms",
        {layers:"geoportail:geoportail_lyrs",transparent: true, format: "image/gif"},
        {visibility: true},
        {'displayInLayerSwitcher':true}
);

map.addLayers([OSM,geoportail_lyrs]);

map.setCenter(new OpenLayers.LonLat(4099485, -14.2884),11);

here is the result :

I don't know why it's always focusing on Sao Tome and my data is too small.


texts: Batch creating maps using arcpy.mapping?

texts:
I'm trying to create .mxd and PDF outputs for a series of feature classes in an SDE. I'll need to match 2 feature classes (one original, one buffered) in the SDE based on similar file names. The buffered FC will simply be prefaced with 'Buffer_' prior to sharing the original file path name. I'm trying to bring both feature classes into a new mxd, zoom to the extent of the buffered feature class as it will naturally occupy more area, symbolize the 2 layers and create a saved mxd and pdf based on the features and repeat this process for subsequent buffered feature classes and original feature classes.

I'm stuck trying to get the buffered and original feature classes to match and as a result be added to the map as a layer. So far I am able to create the new mxd and set the zoom extent. The code I'm stuck on is as follows:

arcpy.env.workspace = "SDE"
fcList = sorted(arcpy.ListFeatureClasses('Buffer_*'))

matchFClist = arcpy.ListFeatureClasses()

for fc in fcList:
    print fc

    fcclean = fc.replace('Buffer_','')
    copymxd = templatemxd.saveACopy(r"Folder\\" + fcclean + ".mxd")
    mxd = arcpy.mapping.MapDocument(r"Q:\outputFolder\TMaps\\" + fcclean + ".mxd")
    df = arcpy.mapping.ListDataFrames(mxd,"*")[0]
    for fcclean in matchFClist:
        if fnmatch.fnmatch(fcclean, matchFClist):
            newlayer = arcpy.mapping.Layer(fcclean)
            newMatchlayer = arcpy.mapping.Layer(matchFClist)

I know this is probably way off however, but I'm not sure how to get the match to work. I could always try using an array as well however, I'm pretty confused at this point.


texts:
I can't find an answer and it's probably because I don't know the terminology, so if you could include terminology in the answer that would be swell.

I have an image of some sort. I bring it into QGIS as a layer.
I have a non-geo-referenced layer that can't really be seen.

This image is actually a copy of another layer that IS geo-referenced.

How do I copy the settings/headers from the one that exists to the one that is not being displayed due to the lack of spatial information?


texts:
I have a longitude and latitude values and need to convert Oracle SDO function to PostGIS. My Oracle query is below:
SELECT geoid
FROM   tract
WHERE  SDO_Contains(
            'GEOM',SDO_GEOMETRY(
                    2001,4326,SDO_POINT_TYPE (
                            '38.841873', '-77.448135',NULL)
                    NULL,NULL)) = 'TRUE';

How can I convert it to PostGIS?


texts: Assigning land cover type (in shapefile) to hydrologic soil shapefile in QGIS?

texts:
I have a land cover and a hydrologic soil group shapefiles which cover my watershed. They have different polygons. For example, a forest type land cover (one polygon in land cover shapefile) may correspond to three different soil types (three polygons in soil type shapefile). What make things worse is these three polygons are having other land cover types for the areas outside the boundary of the forest type land polygon, which I need to assign these areas to another land cover type. So I need to:

create a new shapefile which is the combination of the two shapefiles I mentioned above. A bigger polygon in one shapefile will need to be split to smaller ones by the polygons in another file.
I need to assign the soil type and land cover attributes to the new features in the new shapefile accordingly.


texts: Display two layers with OpenLayers at once

texts: How can i display two layers with diferent projections at once? For example i have layer with EPSG:70076 and OSM layer.


texts:
How do I make the url link on my pop up window open up in a different tab?:
see map below for reference:

Map


texts: ArcGIS Pro geocoding problem - unexplained error

texts:
I have the following addresses (csv format) to be geocoded for approximately 600 addresses.

Brand
Address
Suburb
Postcode
Combined Address

xyv
123
abc
6000
123 abc 6000

I tried to geocode them from add data-> geocode table but I have been getting an unexplained error. I have tried to geocode from both the multiple fields and single field method and neither has worked. I have the latest version as I only downloaded yesterday.
What can I do to fix it?
.


texts: Export to a Shapefile and maintain Domain Coded Values

texts:
I maintain a complex parcel fabric that uses coded value domains for a few fields. These are short integer fields with values from 1 - 6. These values represent say 1:Integrated Registered Survey Plan, 2:Survey Plan, 3:Geo-Referenced Air Photography, 4:Government Provided, 5:Expert Knowledge, 6:Unknown.

So I have several data requests and they need to be provided in Shapefile's. When I export my parcel fabric the fields obviously make no sense since they are numeric values representing accuracy codes from domains.

Is there any way to convert this field from a coded numeric field to its domain value? I know I can do this with some python programming, but I wonder if ESRI already has a solution for this.

Also I am managing the Parcel Fabric in a File Geodatabase.