texts: Python Field Calculating for Document Hyperlink?

texts:
I am trying to create a script that will hyperlink to a .tiff or .pdf. These files are stored in one folder on a shared server.

I want the script to look in a field: 'PLAT_IMAGE', which has the plat number (ex: 12048-001-01) and find it's match in the folder on the shared server and then write for example:

\\server\engineering\Asbuilts\Plats\12048-001-01.tif

Making the document hyperlink active in ArcMap when using Identify

My problem is that the calculation is going through and not giving me any errors but yet it's not calculating the field, so I don't know what I'm doing wrong!

import os, arcpy, fnmatch

def  x(PLAT_IMAGE):
    path = "J:\\engineering\\Asbuilts\\Plats"
    plat = PLAT_IMAGE
for file in os.listdir(path):
    if os.path.isdir(os.path.join(path, file)):
        for file in os.listdir(os.path.join(path, file)):
            if fnmatch.fnmatch(file,plat + '.*'):
                return "\\" + "\\mercury\gisdata$\engineering\Asbuilts\Plats" + "\\" + file

x( !PLAT_IMAGE! )


texts:
I'm new to postgresql/postgis and trying to measure a distance. So st_distance() may be the most accurate, it's the slowest too (as I've read). I read that one can use geometric (instead of geographic) measuring with less accuracy, but the numbers I get don't make sense. This is what I've got:

(all points are geography(Point,4326))

select
  st_astext(point),
  st_astext(point2),
  round(st_distance(point, point2)),
  round(point::geometry <#> point2::geometry) -- cast to geometry and use distance operator
from testgeo2 limit 50

"POINT(53.887 54.043)","POINT(70.764 80.922)","3053406","32" -- ok
"POINT(93.262 59.546)","POINT(84.331 84.334)","2774883","26" -- ok
"POINT(99.624 67.098)","POINT(95.718 85.252)","2027908","19" -- ok
"POINT(54.406 84.531)","POINT(80.27  83.385)", "326308","26" -- hm?!

So I don't get how this can be right. Any suggestions?

One more example

-- new york, tokyo
insert into testgeo2(point, point2) values (
   st_geographyfromtext('point(-74.007873 40.717602)'),
   st_geographyfromtext('point(139.754333 35.675853)'))

-- get distance
select
  st_astext(point),
  st_astext(point2),
  -- km, most accuracy
  round(st_distance(point, point2)) / 1000,
  -- km, with less accuracy
  round(st_distance(point, point2, false)) / 1000,
  -- km, Lambert
  round(st_distance(
    st_transform(point::geometry, 3587),
    st_transform(point2::geometry, 3587))) / 1000,
  -- km, from degree
  round(point::geometry <#> point2::geometry) * 111
from testgeo2

-- results
POINT(-74.007873 40.717602) POINT(139.754333 35.675853),
   10871, 10847, 11224, 23754

is geometry just not working on a larger scale?


texts: Changing kilometer to lat/long in roads using QGIS?

texts: I have accident data that I take them from the police station, unfortunately, they save accident point as a kilometer from that police station instead of lat/long. also, I am working with QGIS, now I cannot change them to lat/long because as far as I know the software and webs provide euclidean distance and roads as you know is not a direct path


texts:
I have a set of points in QGIS and I am trying to create drive time buffers around them, how do you do that?

I am using QGIS 3.6.3.


texts: Setting label settings in PyQGIS 3 to mapUnits?

texts:
I am converting several Plugins from QGIS 3 and I am struggling heavily with symbology and labeling. The straightforwart QGIS 2 approach seems to be totally gone. I found some help here:

Reading and setting label settings in PyQGIS 3?

But I can't figure out how to set the label-size to map Units, the QGIS2 approach was:

layer_loaded.setCustomProperty("labeling/fontFamily", "Arial")
layer_loaded.setCustomProperty("labeling/fontSize", "100")
layer_loaded.setCustomProperty("labeling/fontSizeInMapUnits", "true")

The new approach seems to be

layer_settings  = QgsPalLayerSettings()
text_format = QgsTextFormat()

text_format.setFont(QFont("Arial", 10))
text_format.setSize(100)
text_format.setSizeMapUnitScale(True) <-- wants a "QgsMapUnitScale"

layer_settings.setFormat(text_format)

layer_settings = QgsVectorLayerSimpleLabeling(layer_settings)
layer_loaded.setLabeling(layer_settings)

Is this the right approach?


texts: Create Esri File GDB from DataTable .Net Core?

texts:
I have data stored in a database in PostgreSQL created and handled via EF with dbContext in .Net Core. I need to export some tables into FileGDB using opensource libraries (I don't want to restrict users to use ESRI licence). Ideally, I would like to do it programmatically, without a need of having extra dependencies eg. storing/calling ogr2ogr.exe via cmd.
Things I tried:

NetTopologySuite.IO.GDB - I saw that NetTopologySuite have some support for GDB, but when I tried to access it, it seems like is missing for .Net Core.
var test = new NetTopologySuite.IO.GDB();

Esri.ArcGISRuntime - it seems like this SDK is missing create functionality. You can only read existing GDB from path or portal, but I need to create a new one.

file-geodatabase-api - It looks like is for .NetFramework only, I am not sure if it's supported in .Net Core 3.1. There is no NuGet package available and I couldn't find a good example or documentation of how I can use it.

Is there any opensource support for .Net Core DataTable and ESRI Geodatabase?


texts: How do I convert a GPX to SHP with extended properties?

texts:
I have a GPX file containing trackpoints, similiar to the following:

<trkpt lat="12.34567890" lon="-12.34567890">
        <ele>250.100000</ele>
        <time>2016-06-03T13:09:47Z</time>
        <course>140.300003</course>
        <speed>15.639112</speed>
        <geoidheight>-34.6</geoidheight>
        <fix>3d</fix>
        <sat>5</sat>
        <hdop>2.800000</hdop>
        <vdop>1.600000</vdop>
        <pdop>4.600000</pdop>
</trkpt>

How do I convert the GPX file to a SHP file and include all the extended fields, like hdop, vdop, pdop, etc.? This will eventually be imported into GIS software like QGIS or ArcMap but I prefer SHP over a database for portability.

I tried using OGR2OGR with -dsco GPX_USE_EXTENSIONS=YES but that doesn't bring the extended properties along to the SHP file.

I prefer a command line approach to doing this. I will be trying to automate the process.


texts: script convert coordinates ETRS89 to WGS 84

texts:
i am using proj4js 2.4.3 and programming a script to convert coordinates etrs89 to wgs84 can someone give me an opinion on whether it is correct? do not know if i am using proj4js well? I have imported the files proj4.js and proj4-src.js and estouy using it in visual studio. my script is:

 <script src="~/Scripts/proj4.js"></script>

 <script type="text/javascript">
     alert("ok!");
     convertir('723544', '4347185', '0')

     function convertir (x, y, z){
         var head1 = document.getElementsByTagName("head")[0];
         var s = document.createElement('script');
         s.type = '/text/javascript';
         s.src = '~/Scripts/proj4.js';
         head1.appendChild(s);

         Systeme1 = new proj4.Proj("EPSG:25830");
         Systeme2 = new proj4.Proj("EPSG:4326");   Coordenadas Geográficas WGS84"
         alert("ok!");
         var Point = new proj4.toPoint('723544', '4347185', '0');
         Point =  proj4(Systeme1, Systeme2 ).forward(Point);
         alert("punto= " & Point);
         return Point;

     }
 </script>


texts:
I'm looking to batch convert a number of ascii files to tiff (float 64) using the GDAL translate tool. If I translate a single tile with the tool and choose float 64 the output is a float 64. If I choose float 64 on the parameters then open the batch processing window the resulting tiffs are 8-bit unsigned integer files with a 0-255 range. Where am I going wrong?

The files are Environment agency lidar (DTM):

Driver
GDAL provider
AAIGrid
Arc/Info ASCII Grid
Dataset Description
C:\G1\data\NT\NT6203.asc
Band 1
STATISTICS_MAXIMUM=355.612
STATISTICS_MEAN=354.32436956522
STATISTICS_MINIMUM=352.647
STATISTICS_STDDEV=0.94020942067497
Dimensions
X: 500 Y: 500 Bands: 1
Origin
362000,604000
Pixel Size
2,-2
No Data Value
-9999
Data Type
Float64 - Sixty four bit floating point
Pyramid overviews
Layer Spatial Reference System
+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs
Layer Extent (layer original source projection)
362000.0000000000000000,603000.0000000000000000 :     363000.0000000000000000,604000.0000000000000000
Band
Band 1
Band No
1
Min Val
352.6470000000
Max Val
355.6120000000
Range
2.9650000000
Mean
354.3243695652
Sum of squares
40.6637127174
Standard Deviation
0.9505987904
Sum of all cells
16298.9210000000
Cell Count
46

Console code:

gdal_translate -of GTiff -ot Float64 -outsize 100% 100% -expand rgba -projwin 362000.0 604000.0 363000.0 603000.0 -co COMPRESS=DEFLATE -co PREDICTOR=1 -co ZLEVEL=6 C:\G1\data\NT\NT6203.asc "[temporary file]"


texts:
In ArcMap, when I zoom out (or in) a single mouse-click (not dragging a rectangle, just a click), what is the change to the ratio?

If it is different between coordinate systems please explain it on GCS_WGS_1984.


texts: Performing Viewshed Analysis for Transmission Line returns general error 999999?

texts:
I have a scenario where a transmission line is designed and placed with heights for each structure.  With that being said, it is to be proposed to the forest service who is more concerned with how much of each structure can be seen from key observation points coupled with existing vegetation on the surface.

I do not have all of the data yet, but have been attempting to play around with the tools using a DEM and drawing in fictitious transmission lines.  I choose and observer point and am able to plug that and the raster in it, but no where do I see the third spot for the actual structures.  Not sure what I am missing and I have been combing through articles for quite a bit today.

I am using ArcGIS for desktop and have used the viewshed analysis and put in a DEM of the area as my input raster and an observation point for the input point. It returns back a "general error 99999" in the geoprocessing results table


texts: Statistically testing spatial correlations between two spatial categorical variables in R?

texts:
For example, each Census Tract has two categorical variables derived from two different methods.  I'd like to figure out how similar those two methods are.

The software I will be using is R.

I have tried looking up answers online, but they do not quite answer my question.  The answers online either involve auto-correlation of one variable or testing of spatial correlation between two continuous variables.


texts:
I have almost 100 of single band grayscale rasters. Importing all of them one by one to QGIS and changing the color ramp seems laborious. Is there any PyQgis codes/function that can apply predefined color ramp to a raster? I found multiple solutions where python defines the color ramp first then apply it to the raster. Here is a great example of creating a color ramp and assigning it to raster. The CookBook has a similar example, which is -

>>> fcn = QgsColorRampShader()
>>> fcn.setColorRampType(QgsColorRampShader.INTERPOLATED)
>>> lst = [ QgsColorRampShader.ColorRampItem(0, QColor(0,255,0)), \
QgsColorRampShader.ColorRampItem(255, QColor(255,255,0)) ]
>>> fcn.setColorRampItemList(lst)
>>> shader = QgsRasterShader()
>>> shader.setRasterShaderFunction(fcn)

However, I don't want to define the color ramp. My choice of color ramp is in predefined, which is  "RdBu" (Red to Blue) on a raster layer. Is there any way to do it?


texts:
I am trying to plot a scatter plot in the Process Algorithm on a data frame to show the relation between custom data and used under the K-means algorithm. But every time I try to run it. QGIS gets hung.
import matplotlib.pyplot as plt
for cluster in clusters:
        row_ix = where(yhat == cluster)
        plt.scatter(X[row_ix, 0], X[row_ix, 1])
        plt.title('KMEANS')
        plt.legend(clusters)
        plt.show()

How do I go around this problem? I was able to do it in Python script but unable to do so in Python Processing Toolbox script.


texts: Reconciling version in ArcGIS for Desktop?

texts:
When I try to reconcile using ArcGIS for Desktop I got this message:

  the version could not be reconciled.the number of points is less than
  required for feature.

What should I do?

I checked the details before and I didn't find less than 2 vertexes for line and less then 3 for polygon.


texts:
Is there an ArcObjects equivalent to the CQL filter when working with WMS layers?  I have reviewed the documentation, but can't identify any way of filtering a WMS service.  Can anyone point me in the right direction?

EDIT: I have seen this, but the solution points to ArcIMS and is rather dated.

EDIT 2: This is essentially my approach, except that I wish to filter the WMS layers (i.e. by ID, or other attribute).

EDIT 3: The WMS does support CQL filtering, and many other OGC specifications.

EDIT 4: This may warrant another separate question on the SE. However, if creating a filtered WMS service connection is not possible, would it be possible to make a HTML GetMap request, with the desired parameters, and load the requested image into ArcMap?


texts: What is the unit of measurement for buffer calculation?

texts:
What is the unit of measurement used by Geometry class for it's buffer calculation ?
Api doc currently defines it as " distance - the width of the buffer (may be positive, negative or 0)"

I need to draw polygons around a given Geometry with X miles away. Wondering if there is an easy way to do it with current set of GeoTools API.

Api :  http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html#buffer(double)


texts: How to change the default color used by OpenLayers2?

texts:
I am very, very new to web mapping.. I have an OpenLayers map made from shape file from PostGIS database, have a vector layer and it has default style, but I want to change the style of vector layer.  I was searching online, and I did not find simple and clear examples for this... Is there anyone who can help me, or maybe someone who wanted to do the same and found simple tutorial for this? Any help greatly appreciated..

var map;

        function init()
        {

            var bounds = new OpenLayers.Bounds
            (
                    68.089442, 6.752729,
                    97.407576, 37.072537
                );
                var options = {
                controls: [ new OpenLayers.Control.Navigation(),
                            new OpenLayers.Control.PanZoom()
                    ],
                    maxExtent: bounds,
                    maxResolution: 0.11843675,
                    projection: "EPSG:4326",
                    units: 'degrees'
                };

             map = new OpenLayers.Map ("map", options );

            var india = new OpenLayers.Layer.WMS(
                "cite:india_state - Tiled", "http://localhost:8080/geoserver/cite/wms",
                {
                    LAYERS: 'cite:india_state',
                    STYLES: 'style',
                    //format: format,
                    tiled: true,
                    tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom
                },
                {
                    buffer: 0,
                    displayOutsideMaxExtent: true,
                    isBaseLayer: true,
                    yx : {'EPSG:4326' : true}
                }
            );

var style = new OpenLayers.Style();
//rule used for all polygons
var rule_fsa = new OpenLayers.Rule({
symbolizer: {

fillColor: "#ff9a9a",
fillOpacity: 0.5,
strokeColor: "#000000",
strokeWidth: 1,
strokeDashstyle: "dash",
label: "${name}",
labelAlign: "cc",
fontColor: "#333333",
fontOpacity: 0.9,
fontFamily: "Arial",
fontSize: 14}
});
var rule_highlight = new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "classification",
value: "1",
}),
symbolizer: {
fillColor: "#FF7144",
fillOpacity: 0.6,
strokeColor: "#FF0000",
strokeWidth: 2,
strokeDashstyle: "solid",
label: " ${name}",
labelAlign: "cc",
fontColor: "#000000",
fontOpacity: 1,
fontFamily: "Arial",
fontSize: 16,
fontWeight: "600"}
});
style.addRules([rule_fsa, rule_highlight]);

var polygon = new OpenLayers.Layer.Vector("Polygon", {
            Style: 'style',
            rendererOptions: {zIndexing: true}
        });

            map.addLayers([india,polygon]);

             map.zoomToMaxExtent();
               }


texts: Creating calculation that uses data from same field, but from different survey submission, using Survey123

texts:
I need to create a survey for a Field Technician to use during a groundwater sampling event, but I can't figure out if the one section of it is at all possible using Survey123.
Every day for a few weeks, a field tech will be taking readings of discharge through a well and converting it into the average discharge per day. We normally just use a field notebook and do it by hand, but my boss wants me to create a form to do all the work and calculations for us.
The first part of the form would be the Discharge Flow Meter Totalizer (gallons) which would just be a simple integer input taken directly from the Totalizer reading. The next step would be inputting the Days Since Last Flow Meter Reading, which is another simple input integer.
The next step is where I am having issues. The next step is a calculation to figure out Average Discharge Flow Rate (GDP). This is found by taking your Discharge Flow Meter Totalizer (gal) reading, subtracting the previous Discharge Flow meter Totalizer (gal) reading from it, and then dividing that number by the Days Since Last Flow Meter Reading.
How do I set-up a form so the techs do not have to do the math on their own?
Can I pull the previous submission from Discharge Flow Meter Totalizer?
Would I have to edit the form every day to add the previous Discharge Flow Meter Totalizer so the equation works?
This form could make things a lot easier if I can figure it out, instead of writing dozens of submissions in a field notebook and then creating an Excel file out of those submissions.


texts:
I would like to print computed values in a side bar using a Google Earth Engine app.

Currently the output is a dictionary for example if I want the feature name that has been clicked on:

var computeValues = function (coords) {

  // select built-up area from map
  var point = ee.Geometry.Point(coords.lon, coords.lat);

  // select the polygon and colour red
  var selected = bu.filterBounds(point);
  var id = ee.String(selected.first().get('bua11cd'));

  // display in side panel
  bu_name.setValue(['location:', id]);

// Create panels to print values.
var inspectorPanel = ui.Panel({style: {width: '30%'}});
var bu_name = ui.Label();
inspectorPanel.add(ui.Panel([bu_name], ui.Panel.Layout.flow('vertical')));

Returns this is the side panel:

  location:,ee.String({ "type": "Invocation", "arguments": { "input": {
  "type": "Invocation", "arguments": { "object": { "type": "Invocation",
  "arguments": { "collection": { "type": "Invocation", "arguments": {
  "collection": { "type": "Invocation", "arguments": { "tableId":
  "users/philtown81/Builtup_Areas" }, "functionName":
  "Collection.loadTable" }, "filter": { "type": "Invocation",
  "arguments": { "leftField": ".all", "rightValue": { "type":
  "Invocation", "arguments": { "geometry": { "type": "Point",
  "coordinates": [ -0.4458729125976788, 51.7557470078457 ] } },
  "functionName": "Feature" } }, "functionName": "Filter.intersects" }
  }, "functionName": "Collection.filter" } }, "functionName":
  "Collection.first" }, "property": "bua11cd" }, "functionName":
  "Element.get" } }, "functionName": "String" })

Here is a link to a working example.


texts: "XY to Line" not converting all 58,000 records

texts:
I have a dbf (and xls) that contains ~58,000 records of latitude and longitude for both start and end points. I would like to connect each XY coordinate pair using the XY to Line tool found inside the Data Management toolbox. I will be using the Great Circle method fyi.

The resultant shapefile contains ~16,000 records/polylines. As far as I can tell, there is no difference between processing the table inside or outside a file geodatabase.

Anyone have any thoughts as to why it may not be processing the entire table? This issue persists with both the dBaseIV and XLS file.


texts: Automatic calculation field based on line modification within QGIS

texts:
I have a polygon layer with every cities in my region. One of the field of this layer is the population of the city.

I also have a line layer which represents some bus route

I would like to automaticaly calculate the population concerned by the bus route (which means the sum of population of the polygon intersect by each bus line).

First of all how to calculate this in a new field on the line layer?

Second how to get this result to be update if the route change?


texts: Creating a new vector by aggregating another vector's value with a specific criterion in QGIS

texts:
I have a vector polygon layer in which each polygon represents an olive grove, each polygon has the data of harvestable biomass in that specific olive grove.

Now I have to estimate transport costs from the olive groves to a collection point by using a 17 tons truck. The problem is that the biomass value in each polygon are lower than 17 tons so I need to aggregate my polygons in a new shapefile in which there are more or less 17 tons.

How is it possible to perform this using QGIS?


texts: Calculating the number of days between two dates as number

texts:
For some expression in QGIS I need to get the number of days between two dates as numeric value.

If I substract two dates I get an interval back:

to_date('2019-12-31') - to_date('2019-01-01')

gives

<interval: 364 days>

I get the same return type from the age() function.

Is there a straightforward approach to get the number of days as numeric value?

I am not looking for solutions that involve converting to epoch and doing my own math nor for solutions that rely on string parsing. I am looking for an built-in approach that I might be overlooking.


texts: ArcGIS Image Service: Multiband raster in LERC tiles

texts:
Is it possible to encode a multi-band raster using LERC tiles generated by ArcGIS Server 10.3?

I currently use the Composite Bands raster function to combine three rasters (16 bit unsigned integer, 4 bit integer, and 32 bit float). These are combined in a mosaic dataset.

I can successfully share this (Share as Image Service) without caching the data. When I connect to the server in ArcMap and Identify the image service, I get all three raster values for the location of interest. I then modify the service properties however, selecting Caching >> Using tiles from Cache,  Update cache manually and Caching >> Advanced Settings >> tile format: LERC, Create tiles on demand.

I can view the tiles in the example viewer (source here, my implementation here). However, when I log the results to the console, I'm only seeing values from the first raster (ranging from 15000 to 17000).

Looking at the LERC documentation, they do suggest that multiple bands are possible:

  One more comment about multiple bands. You can either store each band into its own Lerc byte blob which allows you to access / decode each band individually. Lerc also allows to stack bands together into one single Lerc byte blob. This can be useful if the bands are always used together anyway.

Is it possible to implement this using ArcGIS server out of the box? Or do I need to create tiles for three image services, then combine them in the browser?


texts: After ArcGIS 10.2.1 update, Arcpy 64 bit import Error

texts:
I've updated my ArcGIS desktop version from 10.2 to 10.2.1 and have noticed that when I run the 64 bit version of IDLE I now get an error when trying to import arcpy:

Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import arcpy

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import arcpy
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\__init__.py", line 24, in <module>
    from arcpy.toolbox import *
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\toolbox.py", line 656, in <module>
    from na import AddFieldToAnalysisLayer as AddFieldToAnalysisLayer_na
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\na.py", line 26, in <module>
    import _na
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\_na.py", line 46, in <module>
    class StreetDirectionsProperties(na.StreetDirectionsProperties):
AttributeError: 'module' object has no attribute 'StreetDirectionsProperties'

So the error seems to come from failing to find a module for the Network Analyst extension, which I see is listed as one of the updated Python features in 10.2.1: (http://resources.arcgis.com/en/help/main/10.2/#/What_s_new_in_ArcGIS_10_2_1/016w0000005v000000/). I'm guessing the 10.2.1 release didn't update both the 32 AND 64 bit versions of Arcpy when installing Python 2.7.5. The version I still have in C:\Python27\ArcGISx6410.2 is 2.7.3, but this seems to now be in conflict with the new install.

Can someone please help me figure out how to correct this issue with IDLE? I really need to be able to run stand-alone 64 bit Arcpy scripts. I'm aware of 64 bit background geoprocessing in ArcMap/ArcCatalog, but this is different. I run heavy lifting stand-alone scripts that must be in the 64 bit version.


texts: How to calculate average distance from points to points?

texts:
I have a point layer of 400,000 voter residencies and a point layer of 500 polling places. I am trying to find the average distance it takes voters to get to their polling location. Distance by road would be optimal, but I would settle for as the crow flies as well. I have ArcGIS Basic with Network Analyst. I just got NA last week, so I have no experience with it. I have a related field that can match individual voters to a polling location.

I appreciate any ideas. Thanks!


texts: Delete "children" feature, if "father" feature is deleted, inheritance

texts:
I am developing a dimensioning tool, and I would like that the "son" feature been deleted, when the father is deleteted, (on the fly). How can I do this?

It can be done via application or PyQGIS.

The code:
(Note that the dimensioning layer is setted as this:Digitizing dimensioning and annotations)

##User need to select polygon features and run this code
import processing

id_pai_dict={}

#### Save feature in temporary layer, convert polygon to line and explode lines
layer = iface.activeLayer()
selected = processing.run("qgis:saveselectedfeatures", {'INPUT':layer, 'OUTPUT':'memory:'})["OUTPUT"]
temp_lines = processing.run("qgis:polygonstolines", {'INPUT':selected,'OUTPUT':'memory:'})["OUTPUT"]
result = processing.run("qgis:explodelines", {'INPUT':temp_lines,'OUTPUT':'memory:'})["OUTPUT"]

####Save feature in temporary layer, apply buffer, convert polygon to line and explode lines
selected2 = processing.run("qgis:saveselectedfeatures", {'INPUT':layer, 'OUTPUT':'memory:'})["OUTPUT"]
buffered2 = processing.run("qgis:buffer", {'INPUT':selected,'DISTANCE':-10000,'SEGMENTS':5,'END_CAP_STYLE':2,'JOIN_STYLE':1,'MITER_LIMIT':2,'DISSOLVE':False,"OUTPUT":"memory:"})["OUTPUT"]
temp_lines2 = processing.run("qgis:polygonstolines", {'INPUT':buffered2,'OUTPUT':'memory:'})["OUTPUT"]
result2 = processing.run("qgis:explodelines", {'INPUT':temp_lines,'OUTPUT':'memory:'})["OUTPUT"]

#### Calculate the length of each exploded line and save in
d = QgsDistanceArea()
d.setSourceCrs(layer.crs(), QgsProject.instance().transformContext())
d.setEllipsoid(QgsProject.instance().ellipsoid())
feature = result2.getFeatures()
result2.startEditing()
for i,feat in enumerate(feature):
    dimension = (d.convertLengthMeasurement(d.measureLength(feat.geometry()),1))*1000
    result2.changeAttributeValue(i+1, 2, dimension)
layer.commitChanges()

    ###Add gid field, from polygonlayer, to id_pai field, from dimensioning
result_selected_feature = result2.selectedFeatures()
layer.startEditing()
for feature in result_selected_feature:
    gid = feature["gid"]
    id_pai_dict.update({i:gid})
    result2.updateFeature(feature)

####Start editing dimensioning layer and add the result layer features
layer_dimensioning = QgsProject.instance().mapLayersByName("dimensioning")[0]
layer_dimensioning.startEditing()
provider_layer_dimensioning = layer_dimensioning.dataProvider()
for i,feature in enumerate(result2.getFeatures()):
    provider_layer_dimensioning.addFeature(feature)
layer_dimensioning .commitChanges()


texts: Display a control (zoom bar) outside map container in Leaflet?

texts:
I need to extend a zoom control so that it is functional outside of the leaflet map container.  Can this be done?

Essentially,the same idea as what is accomplished with this item here but under the leaflet context and not openlayers.
How to display a control (zoom bar) outside map container in openlayers?

Thanks,


texts: Exported feature class attribute table fields containing data read as NULL or 0 length vectors in R

texts:
I have encountered some odd behaviour trying to work with data exported from feature classes using the Export Feature Attributes to ASCII tool in ArcDesktop 10.4.1 (advanced licence).  The data looks like this with up to ~3000 rows:

I'm doing some further processing in R using the following for loop:

 for (row in 1:nrow(input_angles_t$`030918`)){
  S_tmpX <- input_angles_t$`030918`[row, "START_X"]
  S_tmpY <- input_angles_t$`030918`[row, "START_Y"]
  FID <- input_angles_t$`030918`[row, "FID"]
  for (row in 1:nrow(input_angles_t$`030918`)){
    if (input_angles_t$`030918`[row, "FID"] != FID & input_angles_t$`030918`[row, "START_X"] == S_tmpX & input_angles_t$`030918`[row, "START_Y"] == S_tmpY & input_angles_t$`030918`[row, "BEARING"] == 0){
      input_angles_t$`030918`[row, "BEARING"] <- 359
    }
  }
}

the input_angles_t$030918`` input is a data frame like that shown above.  When I run this loop on data exported from a shapefile, it works fine.  However, when I run the same loop on the same data but exported from a feature class in geodatabase, R throws the following error:

Error in if (input_angles_t$`030918`[row, "FID"] != FID & input_angles_t$`030918`[row,  :  argument is of length zero

I've looked into what this error means and it is to do with NULL or 0 length vector arguments that stop the if statement from evaluating.  I've checked for NULLs in the data and there aren't any.  What is weirder is that it runs the line S_tmpX <- input_angles_t$030918[row, "START_X"] and I get S_tmpX as an output before it throws an error saying that essentially the same line of code produces a zero length argument.  And as stated above, this ONLY happens on .csv exports from feature classes, not on exactly the same data from a shapefile.

Has anyone else ever come across similar problems and found a solution?  At the moment my solution will be to just work with shapefiles for this task, but I prefer file management with geodatabases, so if I could go back to using feature classes in GDBs, that would be preferable.


texts: Doing Accuracy Assessment using test data from shapefile in ENVI?

texts:
ENVI 5.2.1. From a .tiff image (4 bands) I created a Supervised Classification Maximum Likelihood .dat file. Now I want to perform an Accuracy Assessment using test data from a shapefile. I've tried using the tool -> Confusion Matrix Using Ground Truth ROIs. When the Classification Input File window appears, I select my MaxlikeSupervised.dat file and I get an error "There are no available ROIs or EVFs associated with this input file"

Do I have to create and ROI file?

How do I do this?

Do I need to use Ground Truth image and how do I get this?

All the files I have is that one image file which I created a supervised classification .dat file and I have test data points from a shapefile to match it up to the .dat file.


texts: Python add-in button tool giving saying missing toolbar when I add it onto my map?

texts:
I am looking to create a button that when clicked, clears feature classes and tables created from another tool. I set up the button and installed it but every time I add it to the map with a toolbar it will come up as "missing" and I don't know why. Does it have something to do with needing to define more in the code? This is the first part of what I have:

import arcpy
import pythonaddins

arcpy.env.workspace = "E:/GIS/File_Organization/Data/Sinks/Sinks.gdb"
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd,"*")[0]

class ClicktoClearAll(object):
    """Implementation for ClearButton2_addin.button (Button)"""
    def __init__(self):
        self.enabled = True
        self.checked = False
    def onClick(self):
        if arcpy.Exists("E:/GIS/File_Organization/Data/Sources/Sources.gdb/Selected_Source1"):
            arcpy.Delete_management("E:/GIS/INTEK_File_Organization/Data/Sources/Sources.gdb/Selected_Source1")
            arcpy.AddMessage("First selection has been removed.")
        else:
            pass
        if arcpy.Exists("E:/GIS/File_Organization/Data/Sources/Sources.gdb/Selected_Source2"):
            arcpy.Delete_management("E:/GIS/File_Organization/Data/Sources/Sources.gdb/Selected_Source2")
            arcpy.AddMessage("Second selection has been removed.")
        else:
        pass
        if arcpy.Exists("E:/GIS/File_Organization/Data/Sources/Sources.gdb/Selected_Source3"):
            arcpy.Delete_management("E:/GIS/File_Organization/Data/Sources/Sources.gdb/Selected_Source3")
            arcpy.AddMessage("Third selection has been removed.")
        else:
            pass


texts: Looping through two raster folders to perform raster calculation?

texts:
I have two geodatabases with rasters containing information about "treecover" and "loss". The file names are slightly different but can be matched based on the last 8 characters (the coordinates of each raster granule).See image

I can perform this simple conditional statement using either CON or RASTER CALCULATOR to retrieve all "Loss" data situated on pixels which have a value for "treecover" greater than or equal to 50, with 9999 being assigned as the output value if the statement is FALSE. The output raster is exactly what I want. I just need to do it for 137 pairs of rasters

RASTER CALC STATEMENT: con("treecover raster" >= 50, "Loss raster", 9999)

I'm very much a beginner at using Python, but this is what I've managed to do so far based on similar questions posted here. Fair warning, I don't really know what some parts of the script do.

import arcpy, os, math

arcpy.CheckOutExtension("Spatial")

CVR =
r"C:\Aquifer_recalc\Aquifer_recalc_NA\Treecover_NA\Treecover_Inputs.gdb"

LSS = r"C:\Aquifer_recalc\Aquifer_recalc_NA\Lossyear_NA\Lossyear_Inputs.gdb"

outws = r"C:\Aquifer_recalc\Aquifer_recalc_NA\ras_calc_con"

arcpy.env.workspace = CVR

rasterlist  = arcpy.ListRasters()

for r in rasterlist:
    r1 = arcpy.sa.Raster(r)
    r2 = arcpy.sa.Raster(os.path.join(LSS,r))

    result =  con(r1 >=50,r2,999)

    result.save(os.path.join(outws, r))


texts: Highlighting Link in OpenLayers Map dynamically

texts:
I'm having a map which is rendered through OpenLayers using GeoServer. The map contains various attribute data field like link_no, X_coord, Y_coord etc.

I want to highlight the link using link_no. I internally use WMS layer to render the map.

I got the following code from this wiki for highlighting purpose:

// define a blank Vector layer and add it to the map
var highlight_style = { fillColor:'#99CCFF', strokeColor:'#3399FF', fillOpacity:0.7 };
hilites = new OpenLayers.Layer.Vector("Highlighted",
            {isBaseLayer:false, features:[], visibility:true, style:highlight_style}
        );
map.addLayer(hilites);

// define the WFS server which will fill requests
var wfs_url = '/cgi-bin/mapserv?map=/maps/spraywatch2/wms/mapfile.map&SERVICE=WFS&VERSION=1.0.0';
/* highlightFeatures() makes the WFS request, then highlight_them() callback does the real work
* Args for WFS filter: typename, attribute, value
*/
function highlightFeatures(typename,attribute,value) {
var wfsurl = wfs_url + '&REQUEST=getfeature&typename=' + typename +
       '&Filter=<Filter><PropertyIsEqualTo><PropertyName>'+attribute+'</PropertyName><Literal>'+value+'</Literal></PropertyIsEqualTo></Filter>';
OpenLayers.loadURL(wfsurl,'',null,highlight_them);
}
function highlight_them(response) {
                      // use the GML parser to turn the XML into a list of Feature objects
                      var features = new OpenLayers.Format.GML().read(response.responseText);
                      // have the Vector layer purge its feature list, replace them with the new ones
                      hilites.destroyFeatures();
                      hilites.addFeatures(features);
                      hilites.setVisibility(true);
                   }

Now what exactly is the typename, attribute and value parameters in the function highlightFeatures ? My aim is to highlight a particular link using a function call like this as explained in the wiki:

highlightFeatures('parcels','parcel_id','123456')

The above function call was an example given in the wiki link.


texts: S57/ENC QgsVectorLayer with stand-alone python script

texts:
I'm running the OSGeo4W64 Qgis 3.2.0.

In the gui I can add a vector-layer using the same data as in the example below without any problems. Adding the layer using the python console works too.

When trying to do the same from a stand-alone script I get
"ERROR 4: S57 Driver doesn't support update."

Adding other kml files works, but not S57/ENC

Looking in the code where the error is written, it looks like the difference may be the file mode used. I don't want or need to edit, so read-only/update=False is fine.

import os
from qgis.core import *

regi = QgsProviderRegistry.instance('C:\\OSGeo4W64\\apps\\qgis\\plugins')

QgsApplication.setPrefixPath(r'C:\OSGeo4W64\apps\qgis')
app = QgsApplication([],False)
app.initQgis()

l1=QgsVectorLayer(r"D:\ENC_NOAA\All_ENCs\ENC_ROOT\US1AK90M\US1AK90M.000|layername=M_COVR","COVR1","ogr")
print("Valid" if l1.isValid() else "Not Valid")

I have set CPL_DEBUG=ON and the output shows

  ERROR 4: S57 Driver doesn't support update.

  GDAL: GDALOpen(D:\ENC_NOAA\All_ENCs\ENC_ROOT\US1AK90M\US1AK90M.000,
  this=0000018CCEB33550) succeeds as S57.

  GDAL: GDALClose(D:\ENC_NOAA\All_ENCs\ENC_ROOT\US1AK90M\US1AK90M.000,
  this=0000018CCEB33550)

  Not Valid

Can I control the open mode via the uri?

Why the difference between interactive and stand-alone?


texts: QGIS - From a point along a line (centreline), find the longest line to the centreline, without crossing a polygon boundary

texts:
https://onedrive.live.com/embed?cid=AEC7953479B58DC0&resid=AEC7953479B58DC0%218329&authkey=AKHlm_SovPNQOYw
I have a series of points (ObservationPoints.shp) along a line (Centreline.shp). I am looking to find the longest line from these ObservationPoints to the Centreline without crossing the boundary of a polygon (PolygonBoundary.shp).
The image below shows 3 examples, the first two are correct examples (cyan - polygon, magenta - points and dark blue - centreline) where the longest lines (LongestLines.shp) do not cross the polygon boundary. The third example is incorrect as the longest line crosses the polygon boundary.

The only thing I can think of is to write a bit of code so that:

for every point, draw radial lines at a given bearing spacing and length then,
clip those lines to the polygon boundary then,
remove all but the longest of those radial lines then,
clip this longest line to the centreline.

Am I over-complicating this? Is there an easier way? Or a tool out there that already exists?


texts: Organization and tidiness of multiple copies of layers?

texts:
Back in the days when I was in the university I had a "Organization and tidiness" problem – I was unorganized and kept my layers in different folders without distinct names and hence had multiple copies of each layer.

Ever since I  started working, I've improved a lot – I keep special folders with special subfolders. I name my layers according to  a system which lets me be a bit more neat, but as I still have to manage multiple copies of layers (As Autocad and ArcGIS have their differences when dealing with non-Latin languages, I have to keep a copy adjusted for each program), I'd like to hear from your experiences and maybe learn a few tips from you:

How do you organize your layers? How do name them? By name, date, contents, customer?
How do you organize or deal with multiple copies (more acute: how do you update several copies at once)?

Note: I'm talking from the analyst/DBA POV and not from a web-developer's/web-manager's POV (I'm talking about organizing the layers for myself and maybe two more GIS workers, not more).


texts:
I have a large Postgres/PostGIS database table with ~100 million points that I need to have available for editing (mainly, removing points).  Currently, I'm trying to use a QueryLayer in QGIS using this query:

SELECT x.id, x.geom, m.data_tag
FROM xyz_master as x INNER JOIN raw_tile_metadata as m on x.fid = m.id
WHERE x.fid in (
    select n.id from raw_tile_metadata as n
    where n.tile_path like '%50E40N_%'
)

Where xyz_master is my point data table and m.data_tag refers to a data attribute necessary for editing, which comes from a metadata table (hence, the join).  The where clause is just selecting a confined area so we're not editing the entire data set at a given time.

When loaded into QGIS as a query layer, feature editing is disabled (the "toggle editing" button is disabled).  I double checked user permissions and write permissions are granted.  I even connected as the database superuser and still could not edit.

How can I enable editing on a QGIS query layer?


texts: Converting vertical coordinate system of LAS dataset?

texts:
I want to overlap both LiDAR data and SRTM data but they use different vertical coordinate systems.

I am using ArcMap 10.2 and I firstly created a LAS dataset and original vertical coordinate system of LAS dataset was Unknown VCS from ArcInfo Workstation (I didn't choose any vertical coordinate system. And this one appeared). And then, I created a new LAS dataset and chose vertical coordinate system as EGM96 which SRTM data and Google Earth have. But elevation values of LiDAR points did not change. Still have different values from Google Earth and SRTM data. I need LiDAR to have same elevation values with SRTM for the same region.

Is there a way to make LiDAR and SRTM data the same vertical values for the same point on the map?


texts: How does shapefile 2GB limit equate to 70 million points?

texts:
Reading Geoprocessing considerations for shapefile output by Esri, it says that the 2GB limit translates roughly to 70 million Points.
When looking at the ESRI Shapefile Technical Description, the header has a field at Byte 24 representing file length in 16-bit words that is a signed integer of 4-bytes, thus the maximum positive value it can represent is 2,147,483,647. This number is the total number of 16-bit words in the file, including the 50 16-bit words in the header.
If we start with the maximum number and remove the header, we get 2,147,483,597. This means that the number of Point features in 16-bit words should equal that number (at max).
Per the spec, a record is 8-bytes and is thus 4 16-bit words. The content length field of a record represents the length of a record's content in 16-bit words. A Point feature takes a maximum of 20 bytes and is thus 10 16-bit words. Therefore, each Point feature takes a total of 14 16-bit words (4 from the record header, 10 from the Point record).
From this, how is a rough maximum of 70 million Point features derived?
It would appear the 2GB limit was Esri imposed. If we assume the following:
limit = (1024^3) * 2 = 2147483648 bytes
limit - 100 = 2147483548 bytes (header removed)
limit / 28 bytes = 76695841 Points

So it actually has nothing to do with Byte 24 but namely the .SHX 32-bit offsets.
However, Byte 24 in the main file and the .SHX offsets represent the number of 16-bit words in the file. Assuming our was all points, and Byte 24 was maxed at 2,147,483,647 then that implies that there are 2*((2^31)-1) bytes in the files for addressing. This would put the physical limit of the file in terms of memory addressing at 4GB.  That is to say:
byte_24 = (2^31) - 1 = 2147483647 total 16-bit words
byte_24 - 50 = 2147483597 total 16-bit records
byte_24 * 2 = 4294967194 total 32-bit (4-byte word) file size
(byte_24 * 2) / 1024^3 = 3.99GB

So there is nothing preventing a file (other than conformance) from growing beyond the 2GB limit in terms of the .SHP or .SHX files; the .DBF (dBase) may have a different impact. This could even be increased to 8GB if unsigned integers were used (replace byte_24 with (2^32) - 1).


texts:
I have everything working on my geoserver except for the labeling. I have searched and I cannot find any solution. I am by no means an expert.

I can modify the look/symbology of my polygons, lines, etc... but when I add a style that utilizes a label, nothing shows up on my map. I have created new labels with the sld files I downloaded directly from geoserver docs. I also changed the attribute field name that I want to use in my shapefile as the label. When I open the layer on the map, nothing shows up, not even the polygon.

I am sure I have not enabled something. Any help would be appreciated...

geoserver 2.4.1

Here is the sld I have recently tried:

http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/polygons.html#label-halo

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
    xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
    xmlns="http://www.opengis.net/sld"
    xmlns:ogc="http://www.opengis.net/ogc"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NamedLayer>
    <Name>Label halo</Name>
    <UserStyle>
      <Title>SLD Cook Book: Label halo</Title>
      <FeatureTypeStyle>
        <Rule>
          <PolygonSymbolizer>
            <Fill>
              <CssParameter name="fill">#40FF40</CssParameter>
            </Fill>
            <Stroke>
              <CssParameter name="stroke">#FFFFFF</CssParameter>
              <CssParameter name="stroke-width">2</CssParameter>
            </Stroke>
          </PolygonSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>name</ogc:PropertyName>
            </Label>
            <Halo>
              <Radius>3</Radius>
              <Fill>
                <CssParameter name="fill">#FFFFFF</CssParameter>
              </Fill>
            </Halo>
          </TextSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>


texts: Get set of 250x250 pixel tiles from an image

texts:
I am trying to split the Hansen dataset https://developers.google.com/earth-engine/datasets/catalog/UMD_hansen_global_forest_change_2018_v1_6?hl=fr
into 250x250 pixel tiles within a region.

For that I think I can use image.clip(geometry), but I am not sure how I can split a region in rectangles (how to map the rectangle coordinates to the pixels) so that each of them have the desired 250x250 pixel size.


texts: Why are Shapefiles limited to 2GB in size?

texts:
I'm hoping somebody can clarify for me why .shp are limited to a 2GB file size? Having read through the ESRI considerations and technical description, I cannot understand why it exists.

Since they use dBASE for the .dbf component of the multifile format, it must abide by dBASE limits which have a maximum file size of 2GB. Although, that points to the same question, why does that limit exist? Does it have something to do with these formats being created when 32-bit OS' were widely used? If so, how does that influence the limit? I've seen posts regarding this as 2^(31-1) which is ~2.1GB but that just means 32-bit addressing is used, but I am not sure how it fits here. Other posts mention that these formats use 32-bit offsets, specifically "32-bit offsets to 16-bit words", but I don't follow that either.


texts: How to cut (grey value) out of range colors on a raster image color ramp?

texts:
I am working on a raster file on which I applied a color ramp ("bcyr") in continuous mode and linear color interpolation to have a smooth effect.
This works nicely.

But if a reduce the [min max] interval to something else than the [min max] of the data, there is huge amount of red and blue for values out of my new range.

For example, if data are ranged from 0 to 100 and I want the color ramp to be applied only on data from 0 to 5, every out of interest data above 5 will have the maximum color value (red here).

How to make every data strictly higher than 5 being greyed, thus fitting the color ramp only to data of interest ?


texts: Is it possble to set a PostgreSQL schema and table name as a variable in Mapserver?

texts:
In Mapserver it is possible to set a variable when connecting to postGIS. This way I have created an fill-in form where you can enter a postcode and then you get a result.

How can do this with putting a runtime variable in the Mapserver. Like this:

DATA "geom from (select t1.geom from schemaname.tablename t1 where t1.code = '%code%') as selectie using unique code using srid=28992"

In the html / openlayers script you can refer to what is between the % %.

Now I want to make a selection tool for querying a different schema and table. So you have an input where you fill in a schemaname and tablename and then you get a result from that table.

I thought that it would be something like this:

DATA "geom from (select t1.geom, from %schemaname%.%tablename%) as selectie using unique code using srid=28992"

Unfortunately this is not working. Does someone know whether this is possible and how I can make this work.


texts: Exporting digital elevation data from SketchUp

texts:
I have a SketchUp terrain which I imported from Google and used to create contours and eventually a sandbox terrain. I have edited the terrain in SketchUp and now I want to export the sandbox as a geo-referenced digital elevation model (DEM) that can be imported in ArcGIS.

Is there a SketchUp plugin that I can use to export the terrain as a geo-referenced digital elevation model (DEM). My SketchUp model has a geo-location.

Here is a link to my SketchUp model


texts: Bug using Leaflet.awesome-markers plugin and print

texts:
I'm using Leaflet awesome marker icons and was almost all right, but when I try print, the icons doesn't show. Why?

I tried:

var redMarker = L.AwesomeMarkers.icon({
    icon: 'coffee',
    markerColor: 'red',
    extraClasses: 'PrintOnly'
  });

And my CSS:

@media print {
    .PrintOnly {
        display:block;
    }
}

But it still did not work :(
I am sending the two images to see the error, I have already done everything for the icons to appear, but to no success.

 and


texts: PostGIS or SQL 2008 ? (For the newbie GIS programmer but familiar with .Net)

texts:
I've been using MS SQL for years. Starting now to develop GIS application and it is required to do queries and store vectors created in OpenLayers in DB.
Assuming I'm developing over .Net , What will be the most convenient way to use a DB in GIS app? MS SQL 2008 or PostGIS ? (I'm using the express edition of 2008) and will be using open source WMS , probably MS4W (or GeoServer).
If there is any tutorial for beginners combing DB with GIS based APP I'll be happy to see.
Thank you.


texts: Get folder path to QGIS processing scripts from PyQGIS

texts:
Where is stored path to processing scripts folder in PyQGIS?
Version of QGIS is 3.16.
I want to get this path by Python script.

I suppose then, is stored in processing object:
from qgis import processing


texts: Displaying polygon feature as point symbol in ArcMap

texts:
I am working with a layer where a feature comprises rectangles and circles and has been created as polygons by tracing aerial imagery.  The size of the feature is defined in the attributes.

Is it possible to display the feature as a point symbol in ArcMap (with attributes defining its size and shape) instead of the polygon shape.

The traced polygons contain minor errors or issues, such as incorrect size, a circle is shown as a series of lines or rectangles dont have right angles.


texts: Finding Distances in Spatial Query - ArcGIS Javascript

texts:
I am running a spatial query based on a buffered location (e.g. user clicks map, point is buffered and points from feature layer are queried within buffer).  Has anyone run something similar but also been able to calculate the distance between the clicked point and each queried location?

I can use the Distance Params to get the distances but they are ordered differently than the query output which defeats the purpose.

I need an output which has each point within the buffer and the distance to each point from the click point.


texts: Inactive remove duplicate labels function, what's up with that?

texts: I am using arc 10 and I am having a heck of a time getting duplicate labels to not appear.  The remove duplicate labels in the conflict detection tab is checked but inactive or non selectable.  I don't think I have ever seen it selectable and i can't find another solution to limiting the labelling to one of the grouped points with the same name.  It looks messy and is very frustrating, does anyone have any suggestions.  thanks


texts: Wrong min value from ArcGIS 10.4 zonal statistics as table

texts: I used the zonal statistics as table tool in ArcGIS10.4 to calculate SRTM, the in_zone is a gridded shapefile, the in_value_Raster is the SRTM extracted for the region as in the image (90m x90m). The result table gave me min values of 1 and 0, which does not match the input raster at all. I would like to know what might be causing this problem and how to solve it. Ignore NoData option was checked. Both input shapefile and raster have the same spatial reference system:WGS84. I also converted them into UTM but the min value still didnt make any sense.


texts: Modifying tables based on title (MapInfo)

texts:
I have a query regarding the Mapbasic feature of MapInfo, I want to change the line style of an item depending on name (e.g if the .tab name contains the world group). I think I can work this out with a few bits of syntax help. So for example if I change one tab this appears in the MapBasic window

Set Window 376609128 Front
Set Map Window 376609128  Layer 10 Display Global    Global Line (2,2,16711680)    Arrows On

Would I need to write a statement similar to if contains "xx" then do that? I have a very basic knowledge of scripts syntax but is my basic understanding correct, would this be the way to do it?

Thanks,
Alan


texts: Mapping a function to an image collection, then displaying specific images from new collection Google Earth Engine

texts:
I'm trying to extract fires from a collection of Landsat images. I have this function that can process a single image, but when I try to use the Map function to map it onto a collection it doesn't seem to work. I think I'm also limited in my understanding of what the function is actually doing when I get the map function to work. After passing the collection through the function, is the collection just a new set of altered images? Or are the altered images stored somewhere else?
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
  .filter(ee.Filter.eq('WRS_PATH', 100))
  .filter(ee.Filter.eq('WRS_ROW', 49));

var point = ee.Geometry.Point([145.74720448921903,15.185623803783308]);

var image = ee.Image(
  l8.filterBounds(point)
    .filterDate('2019-05-01', '2019-05-30')
    .sort('CLOUD_COVER')
    .first()
    );

var fullfunction = function(image){
  var nir = image.select('B5');
  var red = image.select('B7');
  var burnindex = nir.subtract(red).divide(nir.add(red));

  var saipan = burnindex.clip(boundary);
  var impervious2 = impervious.multiply(500);
  var saipan1 = saipan.subtract(impervious2);

  var mask2 = saipan1.gte(-1).and(saipan1.lt(0.15));
  var secondmask = saipan1.updateMask(mask2);

  return secondmask;

};

var finalimage = fullfunction(image);

Map.addLayer(finalimage,{},'asdf');
//this works

collection.map(fullfunction);
//this doesn't


texts: Populating all city names from WFS file of a state in a drop down using OpenLayers 6

texts:
How can I populate all cities' names from a WFS file of a state in a drop down? I am using OpenLayers 6 as mapping Libraries.
Here is my code to add a GeoJSON WFS layer.
//Adding vector source layers
  var vectorSource = new ol.source.Vector({
    format: new ol.format.GeoJSON(),
    url: function (extent) {
      return (
        'http://localhost:8081/geoserver/wfs?service=WFS&' +
        'version=1.0.0&request=GetFeature&typename= election:Rajasthan_constituency_Joined&' +
        'outputFormat=application/json&srsname=EPSG:4326&' +
        'bbox=' +
        extent.join(',') +
        ',EPSG:3857'
      );
    },
    strategy: ol.loadingstrategy.bbox,
  });
  var vector = new ol.layer.Vector({
    source: vectorSource,
    name: 'feature_vector',
    visible: false,
    title: 'vector',
    style: new ol.style.Style({
      stroke: new ol.style.Stroke({
        color: 'rgba(0, 0, 255, 0.4)',
        width: 1.5
      }),
  fill:new ol.style.Fill({
     color: 'rgba(0,0,0,0)'
   })
    })
})


texts: Running ArcView Avenue scripting files in ArcGIS?

texts:
Is there any way possible to run ArcView 3.3 Avenue Scripting files (.ave and .avx files) into the newer versions of ArcGIS 10.x?

I am aware that ESRI has stopped supporting ArcView 3.x, but I am still interested to run these scripts. I can view the files using Notepad


texts: How to setup proxy and use "POST" method when executing Geoprocessing Service in ArcGIS Server Javascript API

texts:
I am passing five featuresets to a ArcGIS Server Javascript API. When I do that I get 'Deferred Object not defined error'. Then I tried to use dojo.Deferred(). At that point the error goes away. But nothing happens. In Fidller, no request information is logged.
Then I removed some of the records from the featureset and I can see the request is logged in the fiddler and the request reaches the server. Processing fails, because all required data is not available.
Can some one help understand how to setup proxy server in ArcGIS Server 10.1 and use POST request it in JS API for Synchronous and Asynchronous Geoprocessing? Also I can someone show me how to use dojo.deferred() when using GP Service.

Thanks
Cyril


texts:
I am working with SAGA-GIS and need to create an euclidean allocation raster. For this, I need to first create an integer raster with values for certain areas. This integer raster shall be based on a vector for which a table exists. However, in this table, the value field contains only ones (=1). Now, I want to fill the value column with values from 1 to number of rows, in my case 98.

After reading the description of the field calculator tool, I could not imagine how to do that as there is no sequence command or any way to access the previous or next row value.

It would be helpful if one could copy the rownames but how?


texts: Categorizing by attribute using custom QGIS plugin via python programming?

texts:
I'd like to ask on how can I categorize by attribute using my shapefile via python / custom plugin.

I have a Municipality and field name of "Land_Classification" with values "Residential, Commercial and Industrial". I would like to create a plugin that if i click it the layer will automatically categorize the shapefile by Land Classification and will be have colors by Residential, Commercial and Industrial.


texts: Extract Mean Raster Value from multiple raster files into Excel

texts:
I have a series of non-orthorectified raster files containing NDVI information.  I would like to extract the mean value from each raster so I can see a summary of each raster image name and the corresponding mean NDVI pixel value for each one.  I can achieve this for each raster individually using the raster layer statistics to html function but can't figure out how to achieve this so I can see the results for all of the raster files in one table.

I am not experienced with coding.


texts: Exporting multiple featureclasses to shapefiles using ArcGIS Desktop?

texts:
I have many feature classes in a geodatabase and I need to save/export them into shapefiles.

Any Ideas?

Click on every single layer -> export is not a good option, due to the number of feature classes in that geodatabase.


texts: Converting Mapbox Vector Tiles To GeoJSON

texts:
I'm working on a project that needs to do some simple turf.js work on the client. I am using Mapbox to host my GeoJSON data. Mapbox serves the client this data as a vector tile set, which saves a lot on bandwidth and load times on the client for large datasets. Unfortunately turf.js only works with GeoJSON, not Mapbox Vector Tiles. As far as I know, there are two libraries that can convert vector tiles into GeoJSON: vt-geojson, and vector-tile-js. The problem with these libraries is that they are Node.js libraries, not browser javascript.

At this point it seems I have four options:

Convert one of these libraries to normal javascript (and spend time doing it)
Add Browserify to my project to convert it for me (and messy up my project)
Find some other javascript library that can do it for me (and maybe not find one)
Write my own library (and spend lots of time and effort)

I'm hoping that someone on here can help me with the third option, finding a JS library.


texts: Why is my XY Event Source layer only displaying at full extent?

texts:
My XY Event Source layer is only displaying at full extent and when I zoom in, the features disappear.  If I select a feature in the attribute table, the feature is highlighted.

When I see this for a normal featureclass, it usually is a problem with spatial index.

I first experienced this issue in early Oct. and I did open a ticket with ESRI Tech Support. While on the phone with the analyst, I fired up my MXD and no longer had the problem. I've since created several of these XY layers and all have worked perfectly.

Some details: the X,Y theme is created from a query layer (new to ArcGIS 10), which is a SQL Server query to an external SQL Server 2005 database (not SDE and a DB that I'm only a read-only user on).  The X,Y values are character values casted to numeric (not efficient, but this will only be used occasionally by a few key users).

Is anyone else having this issue?  I had this problem once and I did unknowingly fix it, but I have no clue as to how.

My current workaround is to export to a local file/personal geodatabase--the exported featureclass displays just fine.  But I would rather have live access to  the data.

Update:
I found a layer file from back in Oct which is working (I must have saved one out).  When I add the layer to the map, it works.  I'm thinking that there's something in the query that ArcMap isn't liking.  However, I'm not sure how to access that query.  When I add the layer They query layer, from which the x,y event theme was originally created, isn't in the new MXD.  I'll have to dig into this further, but I'm in meetings this afternoon.

Update #2:
On a hunch, I thought the issue might have something to do with the number of rows (71847). So in the query layer, I added TOP 5  my select statement. I do a Display X, Y Data... and I can zoom in or out with no trouble--everything works as expected.

So I kept increasing the TOP N and each time it worked. Then I put in a TOP 71847 (the total number of records) into my Select statement.  And that works!!  That still doesn't answer my question, but it does me get where I want to be (I have to put a SELECT TOP (SELECT COUNT(*) FROM TABLE) field1,field2,... FROM TABLE which is messy.


texts: Inserting viewshed module into Terrset MacroModeller

texts: How do I insert the viewshed module into Terrset's Macro modeller, or is there a way to run the command individually but not to insert it as a module?


texts:
I am trying to execute a query but I am stuck. I have two tables A and B. The a table has columns gid, geometry(line-string) and value which cells is empty , the B table has got 3 columns gid, geometry(Point) and km. I want to find from the A table the start and end point of every line-string and compare with the points of table B if the start and end points of line-string is match with points from table B then i want to compare the values of points start and end which match with one point for start and one for the end and save the bigger value in the empty column of table A.

This is the query I am using.

SELECT * FROM r ,e where ST_Equals(ST_Startpoint(r.geom),.geo) LIMIT 10;

But i didnt take a result the query running


texts:
I used to know how to do this, but I must have lost the code.  I tried this:

IMxdContents mxdcontents = mapControl.Map as IMxdContents;
IMapDocument doc = new MapDocumentClass();
doc.ReplaceContents(mxdcontents);
doc.SaveAs("C:\\test.mxd");

But I got a "data is not ready to complete operation".

How can I save my ArcEngine mapcontrol map as an .mxd?


texts: Syntax error running AssignDomainToField_management function for ArcMap

texts:
I'm trying to set a domain for a feature class field using the below syntax and IDLE keeps giving me an invalid syntax error with no specifics. I can't find which line it's rejecting to even begin troubleshooting. Can you guys spot what's wrong with the code? Thanks!
import arcpy

try:
    # Set the workspace (to avoid having to type in the full path to the data every time). Update foe each new file.
    arcpy.env.workspace = "C:\Program Files (x86)\ArcGIS\Desktop10.8\ROBERT FILES\EXTRACTION WORKING FOLDER\ROBERT_WORKING_EXTRACTION.gdb\TransportationGroundCrv_AddFieldTest"

    # Set parameters
    domName = "Road_Class_Types"
    gdb = "ROBERT_WORKING_EXTRACTION.gdb"
    inFeatures = "ROBERT_WORKING_EXTRACTION.gdb\TransportationGroundCrv_AddFieldTest"
    inField = "AP030_Road_Class"

    # Process: Create the coded value domain
    arcpy.CreateDomain_management("ROBERT_WORKING_EXTRACTION.gdb", Road_Class_Types, "Road Class types per LTDS schema", "TEXT", "CODED")

    #Store all the domain values in a dictionary with the domain code as the "key" and the
    #domain description as the "value" (domDict[code])
    domDict = {"Class 5 Road": "Class 5 Road - Unimproved (ZI016_ROC = 1), Fair Weather (ZI016_WTC = 2), one (1) or two lanes (2) or less, (LTN = 1 or 2, FCO =7", \
               "Class 4 Road": "Class 4 Road - Flexible Pavement (ZI016_ROC = 3), Limited All-weather (ZI016_WTC = 4), one (1) or two lanes (2) or less, (LTN = 2), FCO =7", \
               "Class 1 Highway": "Class 1 Highway - Rigid Pavement (ZI016_ROC = 7), Divided Highway, All Weather (ZI016_WTC = 1), three lanes (3), (LTN = 3), FCO = 5 or 6", \
               "Class 2 Highway": "Class 2 Highway - Rigid Pavement (ZI016_ROC = 7), Divided Highway, All Weather (ZI016_WTC = 1), two lanes (2), (LTN = 2), FCO = 5 or 6", \
               "Class 3 Highway": "Class 3 Highway - Rigid Pavement (ZI016_ROC = 7), Undivided Highway, All Weather (ZI016_WTC = 1), one (1) or two (2) or less, (LTN = 2), FCO = 7", \
               "Superhighway": "Superhighway - Rigid Pavement (ZI016_ROC = 7), Divided Highway, All Weather (ZI016_WTC = 1), four or more lanes (4), (LTN>=4),FCO = 5 or 6", \
               "noInformation" : "noInformation"}

    # Process: Add valid types to the domain
    #use a for loop to cycle through all the domain codes in the dictionary
    for code in domDict:
        arcpy.AddCodedValueToDomain_management(gdb, domName, code, domDict[code])

    # Process: Constrain the material value of distribution mains
    arcpy.AssignDomainToField_management(inFeatures, inField, domName)


texts: How to change line thickness of multiple symbols without altering other properties?

texts: I want to change all of my line thicknesses in of my symbology to a 2 within the same feature class.  I have about 30 lines.  Right now, I have to change it separately with each line.  Is there a way to select them all to change them?


texts: Error when loading shapefiles into IBM Bluemix dashDB

texts:
I am running into the following error when loading my shapefiles data locally into dashDB

The shapefiles in my zipped file are the following:

Anyone has experience doing this with dashDB?

UPDATE

I downloaded a separate dataset with the following files:

and I am still running into the same error message...


texts: Random Selection using Select By Attributes tool in ArcMap?

texts:
How I can make a SQL syntax to generate "RANDOM SELECTION" in Select by attributes tool in ArcMap?.

E.g. We have two kind of sample: Quantitative an Qualitative data.

Quantitative (seven cases):
1,2,5,8,23,76,99,567,34,596,36,28,11
Qualitative (four cases):
"dogs","parrots","lions","cats","turtles","tigers","pigs" and "ducks".

My aim is generate a random selection in quantitative cases, just seven cases of the whole sample (e.g. 34,5, 28, 596 and 2). And qualitative cases, just four cases of the whole sample (e.g. "pigs", "cats","tigers" and "dogs").

How I can make it?

Is it the same to mix quantitative(Double Type) and qualitative (String Type) cases?

I don't know how to use arcgis.rand() and pythons random.

Can you teach me step by step thoguh Field Calculator or Select by attributes?

Like this picture...

I think this in vbscript

The idea is to do random selections in COD_MOD variable (0515012, 4789512, 4563728, etc). In addition, I want to have a random selection with 1000 features as maximum.


texts: Reporting distances to polygon features along river network using QGIS?

texts:
I am using QGIS 3.6 on windows 10.

I am trying to work out a way of reporting on the distances to polygon features (ecological sites) located along a river network. I have extracted the shortest path along a river network, from a study area to the river's mouth, using the QNEAT3 Plugin. I have tried using v.distance to calculate the distance to ecological sites that the shortest path intersects but it appears to only provide the distance to the nearest feature and I would like distances to all features intersected.


texts: Organizing large numbers of vector layers with GeoServer

texts:
I have a large number (100,000+) of vehicle GPS paths in a PostGIS database. I need access to all of them on my web page, however, I don't usually need to view more than a handful on the map at any one time.

Should I be making all of these paths into layers, or is there a better way to go about it? (Possible example: I'd love it if my JS client could request data for certain location and time frames, and GeoServer could dynamically make layers from the database data, serve those layers, and maybe get rid of them when finished.)

If I am making each path into a layer, is there a way to organize that many layers on the GeoServer admin page, rather than just a gigantic list?

Additionally, is there a way to organize how these layers are sent to my web page? The most helpful way would be to only receive the names of layers that could be viewable currently on the map, but I don't know if that is possible.


texts: How to set up a base station without known coordinates

texts: I am new to surveying, but need to set up a Topcon controller with Pocket 3-D to run 2 receivers and a grader running off the base receiver for my new job. It sounds stupid, because I can't seem to find an answer anywhere, but how do I set up my base station? If the area has never been surveyed before, then there are no known coordinates to use. I've considered setting up the base receiver and telling it to log data for a couple hours (using a GR-5 model receiver), sucking the data off the internal disk and putting it on the computer. Then I could use something like OPUS to get differential corrections, giving me some sort of accurate point to use for base coordinates. I have no idea if this would work, and have barely any access to the equipment. I'm trying to make a game plan for when I have a chance to tinker with the system. Does this make sense or is there a better way to do this?


texts: Getting file paths of loaded layers in QGIS plugin?

texts:
I am very new to GIS, QGIS and Python.
I am using QGIS 2.0 and I would like to develop a QGIS plugin that would display the raster layers of the main window in order to allow for some specific interaction. I have a very hard time getting this to work!
I generated the skeleton of my plugin through plugin builder, and changed the [moduleName]2dialog.py file to try to display the main window layers.

I have two questions :

Is it possible to get the layers?
Can I draw it inside a GqsMapCanvas inside my plugin GUI, or do I need another object?

This is the code I have for now, which generates an error :

from PyQt4 import QtCore, QtGui
from qgis import core, gui, utils
from qgis.gui import QgsMapCanvasLayer

mc = iface.mapCanvas()
layers = mc.mapRenderer().layerSet()
if not layers:
    self.ui.displayFileNameTextEdit.setText("No layer to display.")
else:
    for layer in layers: #layer is one id
        self.ui.qgsMapCanvas.setExtent(layer.extent())
        self.ui.qgsMapCanvas.setLayerSet( [ QgsMapCanvasLayer(layer) ] )
        self.ui.qgsMapCanvas.refresh()


texts: R lidR clip_roi() boundary problems in OCAD

texts:
I would like to clip a .las file so that the output only contains data for the shape of my particular map.
I can clip a .las object using an irregular polygon in R easily enough, but in the resultant .las file, I find some undesirable behavior at the boundary of the clipped .las file once imported into OCAD.

Rather than terminating at the boundary, all of the contours that intersect the boundary sort of flow into and overlap at the boundary.  I.e., it's impossible to delete (by selection) this new weird boundary formed by the contour lines without also deleting the contours inside the map themselves.

Also, the las intensity image generated does not simply end at the boundary, but sort of smears off from the boundary to the edges of a rectangle enclosing the boundary. Weird looking, but not really a problem.

Has anyone who has experienced this please suggest what I need to do differently so that the map components generated in OCAD (especially the contours) simply end at the boundary?
clip_roi() is handy to reduce the size of the las file for processing in R, but I may just have to do a second clip in OCAD to get rid of the contour overlap at the boundary (partially defeating the purpose of clipping the las file in the first place).
Thank you.


texts: NAs not allowed error message in attempt to plot raster object in R

texts:
I have imported a clipped raster (performed in ArcGIS 10.1) from the National Landcover Dataset into R, but when I try to plot I get the following error message.

Error in .readCellsGDAL(x, uniquecells, layers) :
NAs are not allowed in subscripted assignments
In addition: Warning message:
In .readCells(x, cells, 1) : NAs introduced by coercion

I am relatively new to using rasters in R, but I cannot locate the NAs. levels(nlcd) yields the following:

ID  objectID    Value   Count   Red Green   Blue    Land_Cover_Class    opacity
0   1   0   4   0   0   0   Unclassified    1
1   12  11  584837  0.2784314   0.4196078   0.627451    Open Water  1
2   22  21  2247379 0.8666667   0.7882353   0.7882353   Developed, Open Space   1
3   23  22  954664  0.8470588   0.5764706   0.5098039   Developed, Low Intensity    1
4   24  23  647735  0.9294118   0   0   Developed, Medium Intensity 1
5   25  24  333254  0.6666667   0   0   Developed, High Intensity   1
6   32  31  12173780    0.6980392   0.6784314   0.6392157   Barren Land 1
7   42  41  5640937 0.4078431   0.6666667   0.3882353   Deciduous Forest    1
8   43  42  6987282 0.1098039   0.3882353   0.1882353   Evergreen Forest    1
9   44  43  957021  0.7098039   0.7882353   0.5568627   Mixed Forest    1
10  53  52  56354805    0.8 0.7294118   0.4862745   Shrub/Scrub 1
11  72  71  9100560 0.8862745   0.8862745   0.7568627   Herbaceuous 1
12  82  81  477862  0.8588235   0.8470588   0.2352941   Hay/Pasture 1
13  83  82  453351  0.6666667   0.4392157   0.1568627   Cultivated Crops    1
14  91  90  2671979 0.7294118   0.8470588   0.9176471   Woody Wetlands  1
15  96  95  495808  0.4392157   0.6392157   0.7294118   Herbaceuous wetlands    1

The only issue I can see being the problem is the first row.

Below is the code that I used.

library(rgdal) ## spatial
library(raster) ## spatial
library (rgeos) ## spatial
nlcd = raster("C:/Extract_img11.tif")
plot(nlcd)

I can't post Extract_img11.tif because it is too large.

Sorry for the vagueness of this question. My guess is that the clipping created the problem, but I haven't ever seen this before.

Thanks for any information.


texts:
Is there a way to add the datum information to a layout using dynamic text in ArcMap. I am aware that the properties of the CRS can be added, including the datum name using  but I am looking for the properties of the datum itself, ie the spheroid, semimajor axis, semiminor axis, and flattening. This information is provided in the coordinate system tab of the data frame properties but I cannot work out how to extract it using dynamic text.

The help topic (http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Working_with_dynamic_text/00s900000013000000/) shows the necessary text for lots of information about the CRS but not this

EDIT: I am using version 10.5 (10.5.0.6491)


texts: Automatically add points geometry while GPS logging?

texts:
I have a PostgreSQL 10 Server (x64) running on my Windows 8 (x64 based) machine. On the top of my Postgres database, there is PostgREST API running that receives GPS data (5 seconds interval) from a GPS sensor, and stores it into database. The sample data looks like this:

id  datetime             lon        lat
1   2015-06-17 15:31:02  -1.123456  36.123456
2   2015-06-17 15:36:05  -1.123654  36.123533
3   2016-06-17 15:41:08  -1.123788  36.123623
...

Now, I would like to add points geometry to the above data based on latitude and longitude. I have created a new column geom in the above table my_tbl.

Alter my_tbl add column geom geometry;

Instead of doing:

Update my_tbl SET geom = ST_SetSRID(ST_MakePoint(lon, lat), 4326);

I would like to automate this task. That is, I would like to automatically add point geometry to my_tble each time GPS record is inserted. I came across these (e.g. Adding additional geometry column in PostGIS? and Automatically calculating geometry area when adding polygon in ArcMap?) relevant questions already, which point out towards PostgreSQL triggers. However, my scenario (continuous GPS logging at 5 seconds interval) is a bit different, and I would still like to receive some suggestions.

Would someone like to help/explain a bit on my scenario, and the task I want to achieve?


texts:
I want to upload a jpeg or some raster image into a C# form and then on entering the latitude and longitudes I need to be able to create an GEOTIFF file of the same image.
How can this be done in C#.NET?


texts:
The following two scripts are very similar in that they both make use of the interpolate method to create a point along the line, and then attempt to split the line based on that point. The variable r represents the geometry collections object that is returned after the split. Logically speaking, and in both cases the length should equal 2 corresponding to each split segment however the following script

from shapely.geometry import Point,LineString
from shapely import ops
A = Point(0,0)
B = Point(1,1)
C = Point(2,1.5)
ABC = LineString([A,B,C])
point = ABC.interpolate(1.973)
r = ops.split(ABC,point)
print(len(r))

returns 2 which means that it succeeded in splitting the linestring object and the following script

from shapely import ops,wkt
linestring = wkt.loads('LINESTRING (2156463.403842391 5163459.650219071, 2156468.97841872 5163460.757960646, 2156479.958830318 5163465.350633934)')
point = linestring.interpolate(7.000000000)
r = ops.split(linestring,point)
print(len(r))

returns a 1 which means it didn't.

Why does the first script work and the other not?


texts: How to access Shapefile metadata using OGR?

texts:
I'm trying to use ogrinfo to get some details on a shapefile I downloaded.  Currently, the only way I know how to do this is to load it into QGIS and manually click around to find any information on it, like opening the attribute table.

I just want to be able to see any metadata is tagged along with the features.  If I do:

ogrinfo -al USA_adm0.shp

I can see at the beginning there is a lot of useful information, but then it flies past with all the feature data.

Can someone help me out?

EDIT

This is what I get on my mac using the -ro and -so flag, doesn't seem to be much help.

->ogrinfo -ro -so USA_adm0.shp
INFO: Open of `USA_adm0.shp'
      using driver `ESRI Shapefile' successful.
1: USA_adm0 (Polygon)


texts: Default unit in qgis and how to change it

texts:
I have a polygon layer in qgis and I want to know that

what is the default unit of scale of the layer?
Either it is in inches or meters?
How can i change it?
If it is in inches and i convert it to meter then will this
automatically scale the polygon to meters?


texts: How to rectify rioxarray dimensions missing coordinates

texts:
I'm currently using the Python module rioxarray to clip an Xarray dataset based on a specific geometry to produce a latitude/longitude grid of coordinates. My data is below:

obs_dataset_full

xarray.Dataset

Dimensions:
Lat: 451 Lon: 350 lat: 450 lon: 350

Coordinates:
Lon
(Lon)
int64
0 1 2 3 4 5 ... 345 346 347 348 349
Lat
(Lat)
int64
0 1 2 3 4 5 ... 446 447 448 449 450
Longitude
(lon)
float64
-105.7 -105.7 ... -78.34 -78.26
Latitude
(lat)
float64
35.04 35.08 35.11 ... 51.52 51.56
spatial_ref
()
int64
0
Data variables:
precip_var
(lon, lat, Lon, Lat)
float64
0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 nan

Attributes:
grid_mapping :
spatial_ref

Note: The Lon/Lat dimensions are irrelevant; I'm trying to utilize the lon/lat, which have the actual coordinates.

obs_dataset_full.rio.write_crs('EPSG:4326',inplace = True)
obs_dataset_cropped = obs_dataset_full.rio.clip(geometries=cropping_geometries, crs='EPSG:4326')

When I run this code, I get the following error:

DimensionMissingCoordinateError: lon missing coordinates.

Both the obs_dataset_full dataset and the precip_var data array have the appropriate coordinates assigned to them, the lat/lon grid is filled with evenly spaced values, and the dimensions exist. Unfortunately, the rioxarray documentation page is not particularly clear as to what this exception entails.


texts:
After days of solving errors and various issues I finally have code that runs in ArcMap... but the shapefile that shows up does not show any points on the map. I checked the attribute table and all fields are showing up there. Zoom to layer doesn't change anything.

Can anyone help me see why this is happening and how to fix it?

Here is the relevant code that I think is having an issue:
EDIT: adding more code as requested
The name variable is a dictionary from a read/loaded CSV.

# Create shapefile
arcpy.CreateFeatureclass_management(arcpy.env.workspace, outputClass, "POINT", "", "", "", coordsys)
# List variables
xCoord = []
yCoord = []
status = []
names = []
pid = 1
# Add fields to new shapefile
arcpy.AddField_management(outputClass, "Name", "TEXT")
arcpy.AddField_management(outputClass, "Status", "TEXT")

offenseField = ["ID", "Name", "Status", "SHAPE@"]
with arcpy.da.InsertCursor(outputClass, offenseField) as isCursor:
    for key, values in name.iteritems():
        xCoord.append(values[0][0])
        xCoord = filter(None, xCoord)
        xCoord = map(float, xCoord)
        yCoord.append(values[0][1])
        yCoord = filter(None, yCoord)
        yCoord = map(float, yCoord)
        status.append(values[0][2])
        names.append(key)
    for x, y, z, a in zip(xCoord, yCoord, names, status):
        newPoint = arcpy.point(x,y)
        arcpy.AddMessage("New point saved at {0}".format(newPoint))
        pid = pid + 1
        isCursor.insertRow([pid, z, a, newPoint])


texts: OpenLayers Point Feature Vanish on Zoom-In

texts:
I use OpenLayers to animate a point moving along a line. To do this I use several map layers and one vector layer to contain one LineString feature and one Point feature. Currently, the animation is working but I have one issue where every time I zoom in the map, the Point feature vanish even though the LineString is still shown. When I zoom out, the Point feature is shown again but when I try to zoom in again, the Point vanished.

These are screenshots of what happen

This is a portion of source code I use to animate the Point:

/* == Fitur Simulasi Gerak di Rute */
var themarker = new OpenLayers.Feature.Vector(
    new OpenLayers.Geometry.Point(map.getCenter().lon, map.getCenter().lat),
    null,
    {externalGraphic: imgUrl+"symbol/perusak kawal.png", pointRadius: 10, rotation: -90}
);
var linePath;
var indexPoint = 0;
var bergeraklah = function() {
    var pindah = function(dari, ke, asal) {
        var jumlah = 10; // hardcoded
        var xmove = Math.abs(asal.x - ke.x)/jumlah;
        var ymove = Math.abs(asal.y - ke.y)/jumlah;
        // x-axis
        if (dari.x < ke.x) {
            if (dari.x + xmove < ke.x) {
                dari.x += xmove;
            } else {
                dari.x = ke.x;
            }
        } else {
            if (dari.x - xmove > ke.x) {
                dari.x -= xmove;
            } else {
                dari.x = ke.x;
            }
        }
        // y-axis
        if (dari.y < ke.y) {
            if (dari.y + ymove < ke.y) {
                dari.y += ymove;
            } else {
                dari.y = ke.y;
            }
        } else {
            if (dari.y - ymove > ke.y) {
                dari.y -= ymove;
            } else {
                dari.y = ke.y;
            }
        }
    };

    var interval = 100; // hardcoded
    if (themarker.isMoving) {
        var tujuan = linePath.geometry.components[indexPoint];
        if (themarker.geometry.x != tujuan.x || themarker.geometry.y != tujuan.y) {
            pindah(themarker.geometry, tujuan, linePath.geometry.components[indexPoint-1]);
            g.ruteLayer.drawFeature(themarker);
            window.setTimeout(bergeraklah, interval);
        } else {
            themarker.isMoving = false;
            bergeraklah();
        }
    } else if (indexPoint < (linePath.geometry.components.length-1)) {
        var prev = linePath.geometry.components[indexPoint];
        // fetch next point
        var tujuan = linePath.geometry.components[++indexPoint];
        // hitung kemiringan
        var bearing = tc1(prev.x, prev.y, tujuan.x, tujuan.y);
        themarker.isMoving = true;
        themarker.style.rotation = bearing - 90; // gambarnya hadap kanan 90 derajat
        pindah(themarker.geometry, tujuan, linePath.geometry.components[indexPoint-1]);
        g.ruteLayer.drawFeature(themarker);
        window.setTimeout(bergeraklah, interval);
    } else {
        // selesai
        g.simulating = false;
        g.ruteLayer.removeFeatures([themarker]);
    }
};

$('#button-simulasi').bind('click', function(e) {
    if (!g.simulating) {
        g.simulating = true;
        indexPoint = 0;
        linePath = g.ruteVector.clone();
        themarker.geometry.x = linePath.geometry.components[0].x;
        themarker.geometry.y = linePath.geometry.components[0].y;
        g.ruteLayer.addFeatures([themarker]);
        themarker.isMoving = false;
        bergeraklah();
    }
});
/* == End of Fitur Simulasi Gerak di Rute */

Does anybody know what cause the vanishing Point? Because I tried to google it but still don't find any solution.


texts: ValueError when setting symbology.valueField on a layer after a join

texts:
I know a similar question has been asked elsewhere, but I'm not sure whether the problem I'm having relates to the fact that I'm trying to apply symbology to a layer after a join, or that I'm trying to import it from an external file. Anyway, the section of code looks like this:

arcpy.AddJoin_management(bLyr, "ONSCD", engIMD, "utlacd13", 'KEEP_ALL')
    arcpy.SaveToLayerFile_management(bLyr, "C:\\My Documents\\ArcGISmaps\\postJoin.lyr",\
                                                                         "ABSOLUTE")
    postJoin = arcpy.mapping.Layer("C:\\My Documents\\ArcGISmaps\\postJoin.lyr")
    arcpy.mapping.AddLayer(eng, postJoin, "TOP")

arcpy.ApplySymbologyFromLayer_management(postJoin, os.path.join(outputDir, "symbENG.lyr"))
# ^ this is a layer I defined and saved outside this map file, to
# basically be a template for the symbology

if postJoin.symbologyType == "GRADUATED_COLORS":
    print postJoin.symbologyType
    attr = 'avscor_utla'
   #Now according to IDLE, the error occurs at this next line:
    postJoin.symbology.valueField = attr
    postJoin.symbology.addAllValues()
    postJoin.symbology.numClasses = 5
else:
    print postJoin.symbologyType

The error I receive is

ValueError: avscor_utla

avscor_utla is the same field used in symbENG.lyr where I define the symbology. In both cases, the values for this field are Doubles, and I've checked to make sure there are no null values.


texts: Trying to use a QGIS plugin - getting classFactory error

texts:
I've had to create a GIS for the company I work for, choosing QGIS over ArcGIS due to price (company doesn't want to buy another copy of ArcMap). In any case, it's not a HUGE GIS but it would be good to be able to search for features quickly and easily - just by typing in. It seems QGIS doesn't support this as easily as the users want to use it, so I've tried downloading the Quickfinder plugin.

In any case, after eventually finding out how to install it (as it will be offline when in use, so had to download the zip and extract to the correct place), QGIS has found it but can't install it, saying it's broken and can't call it's classFactory() method. The full code (with my project name removed due to confidentiality issues) is below:

Couldn't load plugin quickfinder due an error when calling its classFactory() method

Traceback (most recent call last):
File "C:/PROGRA~1/QGISDU~1/apps/qgis/./python\qgis\utils.py", line 204, in startPlugin
plugins[packageName] = package.classFactory(iface)
AttributeError: 'module' object has no attribute 'classFactory'

Python version:
2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]

QGIS version:
2.0.1-Dufour Dufour, ebebdf3

Python path: ['C:/PROGRA~1/QGISDU~1/apps/qgis/./python/plugins\\processing',
'C:/PROGRA~1/QGISDU~1/apps/qgis/./python',
'C:\\Documents and Settings\\my.name/.qgis2/python',
'C:\\Documents and Settings\\my.name/.qgis2/python/plugins',
'C:/PROGRA~1/QGISDU~1/apps/qgis/./python/plugins',
'C:\\PROGRA~1\\QGISDU~1\\bin\\python27.zip',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27\\DLLs',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27\\lib',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27\\lib\\plat-win',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27\\lib\\lib-tk',
'C:\\PROGRA~1\\QGISDU~1\\bin',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27\\lib\\site-packages',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27\\lib\\site-packages\\PIL',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27\\lib\\site-packages\\win32',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27\\lib\\site-packages\\win32\\lib',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27\\lib\\site-packages\\Pythonwin',
'C:\\PROGRA~1\\QGISDU~1\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode',
'C:\\PROGRA~1\\QGISDU~1\\apps\\qgis\\python\\plugins\\fTools\\tools',
'C:/map stuff/MyProject']

Does anybody have any ideas?


texts: Plotting a time series of positions on a map

texts:
Is there a good way of displaying a series of timestamps on a map, in a way that highlights the temporal aspect, as the points are in order of appearance?
Basically I am trying to track an object throughout the city. I have the respective coordinates of the current point and the point, where the object was previously spotted, and the respective timestamps along with some other related features.
Ideally in python, but I can see myself picking up a more cartography specific tool for it.
What I have tried: I created n (tested with 3 and 5) points in addition to current and previous position and plotted a heatmap with those points, but that doesn't really capture the "Ordered", time-series, aspect of it all.


texts:
qgis2web is working well with the default styles

However when a style file is used the qgis2web preview does not load,

Can you please help me to fix this?


texts: Alternative to nested Con statements in python

texts:
I have  a nested con statement that I'd like to put into a script, as it's hard to follow in its current form. The raster it produces is incorrect, so it'd be easier to debug in a script.

The current set of statements looks like this:

EWR_2015 = Con("ministerial_wetlands">0," ministerial_wetlands ",
(Con("non_ministerial_wetlands ">0,("WTE_using_2001_min"-0.25),
(Con(("nat_veg_raster" >0) & ("dtgw_2001_min" <= 3) ,
("WTE_using_2001_min"-0.75),
(Con(("nat_veg_raster ">0) & (("dtgw_2001_min ")>3 & ("dtgw_2001_min " <= 6)) , ("WTE_using_2001_min"-1.0),
(Con(("nat_veg_raster ">0) & (("dtgw_2001_min " > 6) & ("dtgw_2001_min "<= 10)),(" WTE_using_2001_min "-1.25)
)))))))))

I would like to use a series of if/ elif statements in Python to do a similar thing.

I tried this for the first statement:

ministerial_wetlands = Raster("ministerial_wetlands")
if ministerial_wetlands>0:
    outRaster = Raster(ministerial_wetlands)

This gives the following error message:
ValueError: The truth value of a raster is ambiguous. Invalid use of raster with Boolean operator or function. Check the use of parentheses where applicable.

Not sure where to go from here.


texts: Breaking a continuous contour shapefile into smaller parts?

texts:
I created this contour shapefile and I need to break it into smaller parts so its better to manage. I also have a line shapefile of where I want the breaks. Is there a way to intersect and break them? I have tried everything I have available, maybe its something very simple that I'm missing. Thanks in advance!

I'm using ArcMap 10.1


texts: Georeference a polyygon within a pdf file

texts:
I have this pdf file that contains a specific borough of my city, Montreal, with a polygon inside it. Link to pdf file: PDF FILE

The jpeg image once exported from the pdf file is the following

I am trying to extract the red polygon and georeference it.

I have tried using QGIS to open the image file and then manually add coordinate points to specific portion, but it seems tedious and long as I have around 90 different pdf file that I aim to georeference.

Is there an easier way such as taking an actual map of montreal and overlay this map on top of the previous one, and then automatically georeference it?

I don't know if it can help you but the actual pdf file is a vector, when I opened it using illustrator I was able to check or uncheck the red portion.

The ultimate goal is to transform this red polygon into a geojson file. I don't mind doing it manually if theres an efficient way but I would be even happier If there's was some way to automate this through a script.

I have been looking over the past week on the internet for georeference tutorials but most of them are for raster images and do not take in account pdf file (vectorized), I mean in theory, in my opinion it seems possible to compare 2 vector file, mine and lets say the whole vector file of montreal and then georeference it automatically.


texts: Showing only the external boundary of a GeoPandas DataFrame

texts:
I have a GeoPandas DataFrame I collected from a shapefile. The shapefile is the Mexico City boundary from here

import geopandas as gpd
gdf = gpd.read_file(fname)
gdf.plot()

I would like to create a GeoPandas DataFrame with one row that contains only the external boundaries of such geometry.


texts: I am looking for a point cloud source of laser scanned building. I have found Laser scans of Earth surface, but there is no open archive of scanned cities / buildings. Or is there something?


texts: How to check the resolution of converted raster file

texts:
I have a raster file whose resolution I need to change to 0.5. I do this using this:

g.region rast=my_raster res=0.5

After running this command, how do I verify whether the resolution has actually changed to 0.5?


texts:
I am using Fw tools. And I am writting cmd screen:

ogr2ogr -f \"GeoJSON\" -t_srs WGS84  D:\\electric_Data1\\direk.json  D:\\electric_Data1\\ag_direk.TAB

tried.

And I have a error.

error code:

unable to find driver '"GeoJSON"'
The following drivers are avaible:

esri shape file
mapinfo file
bla bla bla
GeoJSON
bla bla bla


texts: GeoDjango: Insert geography coordinates and filter the nearest points, step by step

texts:
I would like to:

Save pairs of srid 4326 (latitude, longitude) points in a PostGIS Geodjango 1.8 Database. (Maximum distance between the edge points: 2.000km)
Given a srid 4326 (latitude, longitude) point, filter the closer entries in a radius of 500m.

My approach:

models.py:

    class PointModel(geomodels.Model):
        point = geomodels.PointField(
            srid=4326,
            geography=True,
        )

        geoobjects = geomodels.GeoManager()
        objects = models.Manager()

Entering the data

>>> from django.contrib.gis.geos import Point
>>> latitude = float(...)
>>> longitude = float (...)
>>> entry_one = PointModel(point=Point(longitude, latitude))
>>> entry_one.save()
...
>>> entry_ten.save()

Performing the query:

>>> from django.contrib.gis.measure import D
>>> from django.contrib.gis.geos import GEOSGeometry
>>> pnt = GEOSGeometry('POINT(longitude latitude)', srid=4326)
>>> result = PointModel.geoobjects.filter(point__distance_lte=(pnt, D(m=500)))

Questions:

Since the coordinates provided are geographic, I have set geography=True. Considering that this application can quickly get thousands of entries and queries, is this a good choice in terms of performance? Is there a more robust approach?
Entering the data, the given (latitude, longitude) point is entered as Point(longitude, latitude). If I entered all points as Point(latitude, longitude) would I have taken wrong results?


texts:
I am working with vectorized greyscale images converted into polygon layers by the QGIS vetorize tool. Currently I am using a rather long way to get rid of small polygones.

I convert the polygons into lines, run the Generalizer Tool (Plugin) with the Alghorithm "Remove small object" and a Threshold of 2.0 and convert the hole thing back into polygons.

Is there a way to do the same thing without converting the polygons into lines? I tried the v.generalize, but it does not seem to have the same Alghorithm for small object removal.