texts:
I tried to create a QGIS action in order to refresh several materialized views at once.
for that I wanted to execute a simple loop in my action in order to recover the database where the view will be refreshed at each iteration.
I then did an if / else because the path is not the same depending on the database.
However, n executing the code in the python console nothing happens, the code is read well, without errors, but it looks like the loop is not executed.
when I run a simpler refresh, from a single view the code works, but at the slightest loop nothing, even with a very simple code in the loop.
I would like to understand what mistakes I made in this action.
Here is the full action:
import psycopg2

databases = ['RIP_FTTH_17', 'RIP_FTTH_24', 'RIP_FTTH_33', 'RIP_FTTH_40', 'RIP_FTTH_47', 'RIP_FTTH_79', 'CEM_ORANGE', 'AMEL_47']

for db in databases:
     conn = psycopg2.connect(dbname=db,user="postgres",password="INEO_Infracom_33",host="bordeaux04")
     cur = conn.cursor()
     if db not in ['CEM_ORANGE', 'AMEL_47']:
          sql = "REFRESH MATERIALIZED VIEW genie_civil.vm_appui_avancement;"
     else:
          sql = "REFRESH MATERIALIZED VIEW geofibre_cem.vm_appui_avancement;"
     cur.execute(sql)
     iface.messageBar().pushMessage("Success ", " Mise à jour reussie !")
     conn.commit()
     cur.close()
     conn.close()

here's the action with a simpler loop that doesn't work either:
    import psycopg2

    databases = ["RIP_FTTH_17", "RIP_FTTH_24", "RIP_FTTH_33", "RIP_FTTH_40", "RIP_FTTH_47", "RIP_FTTH_79", "CEM_ORANGE", "AMEL_47"]

    for db in databases:
         conn = psycopg2.connect(dbname="RIP_FTTH_17",user="postgres",password="INEO_Infracom_33",host="bordeaux04")
         cur = conn.cursor()
         sql = "REFRESH MATERIALIZED VIEW genie_civil.vm_appui_avancement;"
         cur.execute(sql)
         iface.messageBar().pushMessage("Success ", " Mise à jour reussie !")
         conn.commit()
         cur.close()
         conn.close()


texts: getting Intersections and streets from map

texts: Am new to GIS and maps , but am working on a research concerning traffic analysis and I want to get the Intersections as nodes and the connecting streets as edges , what source could I find these data as csv at ?


texts: How to convert negative field values to positive?

texts: I have an xyz file that I want to convert negative field values in the z column to positive values. How do I do this with field calculator?


texts:
i am working with geoserver to publish some wms services. One of them is a temperature overview. With the help of my styling file (SLD) i am coloring up each tile of the map depending on its value. This works fine, but the legend does not show up as expected. I can't find the issue in my SLD file.

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" 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" xmlns:gml="http://www.opengis.net/gml"
 xsi:schemaLocation="http://www.opengis.net/sld">
  <NamedLayer>
    <Name>temp_overview</Name>
    <UserStyle>
      <Title>Temperature Overview</Title>
      <FeatureTypeStyle>
        <Rule>
          <Title>temperature overview</Title>
          <RasterSymbolizer>
            <Opacity>1.0</Opacity>
            <ColorMap>
              <ColorMapEntry color="#2F32EA" quantity="0.0" label="0&#176;C" />
              <ColorMapEntry color="#956C80" quantity="7.5" />
              <ColorMapEntry color="#FAA615" quantity="15.0" label="15&#176;C" />
              <ColorMapEntry color="#FA540C" quantity="22.5" />
              <ColorMapEntry color="#FA0202" quantity="30.0" label="30&#176;C" />
            </ColorMap>
          </RasterSymbolizer>
        </Rule>
        <Rule>
            <PolygonSymbolizer>
               <Fill>
                 <CssParameter name="fill">
                   <ogc:Function name="Interpolate">
                     <ogc:PropertyName>dTa</ogc:PropertyName>
                     <ogc:Literal>0</ogc:Literal>
                     <ogc:Literal>#2F32EA</ogc:Literal>

                     <ogc:Literal>7.5</ogc:Literal>
                     <ogc:Literal>#956C80</ogc:Literal>

                     <ogc:Literal>15</ogc:Literal>
                     <ogc:Literal>#FAA615</ogc:Literal>

                     <ogc:Literal>22.5</ogc:Literal>
                     <ogc:Literal>#FA540C</ogc:Literal>

                     <ogc:Literal>30</ogc:Literal>
                     <ogc:Literal>#FA0202</ogc:Literal>

                     <ogc:Literal>color</ogc:Literal>
                   </ogc:Function>
                 </CssParameter>
               </Fill>
            </PolygonSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
   </NamedLayer>
</StyledLayerDescriptor>

The corresponding getLegendGraphic call shows up the following graphic:


texts: Can't specify OID field in arcpy.MakeQueryLayer_management

texts:
I manage a library of query layers and have recently had the need to apply the same update to a bunch of them at once.  Seems the only way to do that in python is to create new ones and apply symbology from the old ones and that's fine.  But in creating new ones, one of the important bits is specifying the field(s) that provide a unique identifier. There is a parameter for this in arcpy.MakeQueryLayer_management but the layers that come out of my script have the first field in the list checked rather than the one that I specified near the bottom.  What am I missing?

Below is the business end of the script I wrote that contains commented examples of things I've tried to specify that parameter successfully.

arcpy.MakeQueryLayer_management(
    input_database = self._environment.DatabaseConnections["Database"],
    out_layer_name = self.LayerName,
    query =          self.Query,  # SELECT * FROM Database.Schema.View
    # None of these work--first field in layer gets auto-selected every time
    oid_fields =     "FieldName",
    #oid_fields =     "View.FieldName",
    #oid_fields =     "Schema.View.FieldName",
    #oid_fields =     "Database.Schema.View.FieldName",
    #oid_fields =     "Instance.Database.Schema.View.FieldName",
    #oid_fields =     ["FieldName"],
    #oid_fields =     ["Instance.Database.Schema.View.FieldName"],
    #oid_fields =     "FieldName;SecondFieldNameJustToMakeAList",
    #oid_fields =     ["FieldName","SecondFieldNameJustToMakeAList"],
    #oid_fields =     "YouCanBeSureThisNameAppearsNowhereInTheDatabase",
    shape_type =     "POINT",
    spatial_reference = arcpy.SpatialReference(102605)
    )

I've also tried (to no effect):

Running the associated tool in ArcMap produces the desired results
Adding that tool to ModelBuilder and exporting python from there.  That parameter was specified by sequence simply as "FieldName" in the exported python, but that script contained dozens of lines of python specifying seemingly every Arcpy environment setting possible and then immediately resetting them to their old values afterward.  I dumped all that into my script immediately above and below the tool reference.
Specifying the parameters by position rather than by keyword
Source queries in the query layers in our library have always been  SELECT * FROM VIEW... and I tried specifying field names instead

The obvious hack I'd like to avoid:

Arcpy doesn't throw a "Field Not Found" sort of exception but rather just picks the first field that it encounters and keeps trucking (as if that doesn't have great potential to hose things up down the road).  Consequently one might hack a solution by re-wiring the views these layers query to put the primary key first, but then there'd have to be other rigmarole to reorder fields in the layer so that users are presented info in the order they expect.


texts: GeoPandas fill polygon gap according to gap area

texts:
I have several polygons with holes and I would like to fill the gaps with sizes smaller than a certain area

import geopandas as gpd
from shapely.geometry import Polygon

# Initializing a polygon with two holes
# See: https://stackoverflow.com/questions/48770822/how-to-make-holes-in-a-polygon-in-shapely-python-having-polygons
outer = Polygon(((0,0),(20,0),(20,20),(0,20),(0,0)))
inners = (Polygon(((4,4),(4,6),(6,6),(6,4),(4,4))), Polygon(((7,7),(7,8),(8,8),(8,7),(7,7))))
p = Polygon(outer.exterior.coords, [inner.exterior.coords for inner in inners])
gs = gpd.GeoSeries({0: p})

For example in this example I would like to eliminate the gaps with an area less than 2


texts:
I would like to add a WMTS tile endpoint to Mapbox-GL-JS, which only supports "XYZ" or TMS tiling schemes. According to what I understand of the WMTS specification the two seem to have the same zoom scheme, so perhaps it's possible to apply some kind of maths to the X and Y-coordinates to get the right WMTS coordinates.

But I can't figure out what that formula would be - I can't seem to find the right definition.

What is the formular to convert an XYZ tile specifier to WMTS?


texts: Arcgis 10.1 Archydro tools, converting RasterToPolygon How can I solve: ERROR 000732: Input Table:

texts:
I´m using arcgis 10.1 and Archydro tools. During the Catchment Polygon Processing, one of the steps used to define the watershed limits, I get the folowing error:

Executing: CatchmentPolyProcessing Cat "C:\Users\ja007\Desktop\Catchment Polygon Processing\Catchment"
Start Time: Mon Jul 06 12:28:54 2015
Converting grid to polygons...
Executing: RasterToPolygon "C:\Users\ja007\Desktop\catchment grid delineation\cat" C:\Users\ja007\AppData\Local\Temp\arcB34\AH20150706122854\AHTemp.gdb\tmpFB3B NO_SIMPLIFY VALUE
Start Time: Mon Jul 06 12:28:56 2015
Succeeded at Mon Jul 06 12:35:29 2015 (Elapsed Time: 6 minutes 32 seconds)
Dissolving catchments...
Executing: Dissolve C:\Users\ja007\AppData\Local\Temp\arcB34\AH20150706122854\AHTemp.gdb\tmpFB3B "C:\Users\ja007\Desktop\Catchment Polygon Processing\Catchment.shp" gridcode # MULTI_PART DISSOLVE_LINES
Start Time: Mon Jul 06 12:35:29 2015
Sorting Attributes...
Dissolving...
Succeeded at Mon Jul 06 13:20:08 2015 (Elapsed Time: 44 minutes 38 seconds)
Executing: AddField "C:\Users\ja007\Desktop\Catchment Polygon Processing\Catchment" HydroID LONG # # # HydroID NULLABLE NON_REQUIRED #
Start Time: Mon Jul 06 13:21:25 2015
Failed to execute. Parameters are not valid.
ERROR 000732: Input Table: Dataset C:\Users\ja007\Desktop\Catchment Polygon Processing\Catchment does not exist or is not supported
Failed to execute (AddField).
Failed at Mon Jul 06 13:21:25 2015 (Elapsed Time: 0,00 seconds)
AddFieldGPerror : System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
   at ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.Execute(String Name, IVariantArray ipValues, ITrackCancel pTrackCancel)
   at ESRI.APWR.ApHydro.GDBHelper.AddFieldGP(ApLayer apLayer, String fieldTag, String& exMessage) in C:\Builds\HydroSolutions\10.3_ArcHydro\Sources\ArcHydroTools\src\ApHydro\GDBHelper.vb:line 1339
Failed to execute (CatchmentPolyProcessing).
Failed at Mon Jul 06 13:21:25 2015 (Elapsed Time: 52 minutes 30 seconds)

How can I can solve this? Is this a processing limitation? I´m considering a huge área 1.246.700 km².


texts: Why is my animation exported from ArcGlobe not playing?

texts:
The exporting process has finished and an avi file was created. When I try playing it, it raises an error in WMP as well as VLC. VLC gives me some information: "audio or video format not supported "undf"

I am exporting with no compression to avi.

Oh yeah, and unfortunately there is no way to fix this....

Any ideas?


texts:
Using ArcGIS 10.3 I have a table with different categories and would like to summarise each of them. I want it to work as well when these data are selected inside a polygon.

Below is an example of what I want to do. The blue lines represent the data selected inside the polygon. I want to create the column summarize in ArcMap.


texts: Visualizing GeoTIFF containing multiple GeoTIFF data sources (APPEND_SUBDATASET) in QGIS

texts:
I have a GeoTIFF that I have created in the following manner:
gdal_translate first_grid supergrid.tif

gdal_translate second_grid supergrid.tif -co APPEND_SUBDATASET=YES

Dragging this into QGIS appears to only allow me to visualize the first dataset used.  Is there some option to allow me to view all added datasets?  This does seem to work if I use a GeoPackage instead of a GeoTIFF.
I can use software like Teledyne Caris BASE Editor to successfully view the datasets within the supergrid GeoTIFF, so I'm wondering if I am just missing something in QGIS.


texts: Convert list of coordinates to LineString within a dataframe

texts:
I have a dataframe where one of the columns contains a list of x and y points and I would like to convert it to a spatial data frame but I am having trouble and not sure what to try next. My data frame looks something like this:

df['Location']
0     [(-80.58954, 44.60728), (-80.58942, 44.6073), ...
1        [(-81.09047, 44.74311), (-81.09004, 44.73771)]
2     [(-81.09004, 44.73771), (-81.09102, 44.75006),...
3     [(-81.09061, 44.7503), (-81.09036, 44.75045), ...
4        [(-81.08738, 44.75144), (-81.08759, 44.75657)]
                            ...
60    [(-80.48456, 44.35474), (-80.48454, 44.355), (...
61    [(-80.53522, 44.20374), (-80.53284, 44.20422),...
62    [(-80.52965, 44.20488), (-80.52937, 44.20494),...
63    [(-80.51611, 44.20489), (-80.51624, 44.2049), ...
64    [(-80.60715, 44.21462), (-80.60723, 44.21471),...

I have no problem when I take a single cell and convert it to LineString:

LineString(df['Location'][0])
<shapely.geometry.linestring.LineString object at 0x000001DBD35D0128>

However when I try and try and use the apply function I get some errors that I cant seem to figure out.

df['Location'].apply(lambda x: LineString(df['Location']))

or

df['Location'].apply(lambda x: LineString(x), axis=1)

Here is the error:

Traceback (most recent call last):
  File "shapely/speedups/_speedups.pyx", line 86, in shapely.speedups._speedups.geos_linestring_from_py
    array = ob.__array_interface__
  File "D:\Python36\Python36\lib\site-packages\pandas\core\generic.py", line 5175, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute '__array_interface__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Python36\Python36\lib\site-packages\pandas\core\series.py", line 4042, in apply
    mapped = lib.map_infer(values, f, convert=convert_dtype)
  File "pandas\_libs\lib.pyx", line 2228, in pandas._libs.lib.map_infer
  File "<stdin>", line 1, in <lambda>
  File "D:\Python36\Python36\lib\site-packages\shapely\geometry\linestring.py", line 48, in __init__
    self._set_coords(coordinates)
  File "D:\Python36\Python36\lib\site-packages\shapely\geometry\linestring.py", line 97, in _set_coords
    ret = geos_linestring_from_py(coordinates)
  File "shapely/speedups/_speedups.pyx", line 166, in shapely.speedups._speedups.geos_linestring_from_py
    assert n == 2 or n == 3
AssertionError


texts: Any conversion calculations for WGS84 to EPSG:27700?

texts:
I'm trying to get some OSM data to overlay correctly over Lidar data. The OSM  data according to their wiki is WGS84. The lidar is [EPSG:27700][1]. So as you can imagine they don't line up/overlay properly as there is a relative warping effect going off.

If I could just acquire the conversion equation to convert WGS84 to EPSG:27700 I can write a small C++ file to parse the OSM files and convert all the lat and lon values.

Anyone know what the conversion calculation is?

I explored vector reprojection of the Osm data in QGIS, and Reprojecting the OSM wgs84 data to epsg 27700. The match the the Lidar is close enough for what I need. Unfortunately it isn't possible to save the change back to the Osm which contains other data I want to retain alongside. If I've understood some the information on this correctly, QGIS uses Proj4 for the reprojection calculations. Attempting to decipher the C++ code to extract the exact calculation used is proving tricky due to the sparse pseudocode comments within it.


texts: Importing points from a DXF file into ArcMap 10.2

texts:
I can import LineStrings, polygons, annotations from a DXF file into ArcMap (and arcpy) but I can't import Points from the same DXF file (neither with arcpy).

No error is reported, simply no features are loaded.

I am simply using the 'Add data' button in the GUI, then I select the layer in the DXF file. When I do it this way, I can 'Zoom to layer' to the correct extent of the layer, but nothing is displayed.

The DXF file version seems to be R12

And with arcpy:

arcpy.FeatureClassToShapefile_conversion(file + os.sep + "Point", self.temp_folder)

Everything works fine in QGIS 2.16.

Any idea how to make this possible?


texts:
I have a set of shapes drawn in Leaflet (using Leaflet.draw). I need to rasterize these into a tileset and export it because I need to use the images elsewhere.

My initial idea was to go through each polygon and create matching tiles for each tile it intersects across all zoom levels. However, if there is a library or function that exists that can do this, I'd rather use that.


texts: Finding distance from center of polygon to its furthest edge/point?

texts:
I have thousands of 2D irregular contours a shown. They are tree and other vegetation contours. I would like to come up with a representative radius from their centroid to their further edge/point with arcgis. I have spatial and 3d analyst licenses just don't see a way. I have already generated their centroids in a separate file.

Any advice on how I can proceed?


texts: PyQGIS: Lines to polygons conversion - Attributes not transferred

texts:
I am trying to polygonize a line vector layer using "Polygonize" QGIS Geoalgorithm tool in PyQGIS. The polygon geometries are created successfully from the line features. But attributes of the line layer are not adopted to the created polygon layer upon polygonization. However, I have managed to adopt the attribute table's column headers from the input line layer to the polygonized layer using this command.

processing.runandload("qgis:polygonize",line_path,True,False,polygon_path)

How to transfer the attribute values of the input line layer to the created polygon layer during polygonization process using the 'Polygonize' tool?


texts: Are there any work-arounds for WMS width and height limit when printing?

texts:
I get the following error when trying to export in QGIS to PDF: "Some WMS servers (e.g. UMN mapserver) have a limit for the WIDTH and HEIGHT parameter. Printing layers from such servers may exceed this limit. If this is the case, the WMS layer will not be printed"

I am utilizing an WMS for my aerial imagery in the map and can't export it to a PDF or image.  Does anyone know what is going on and whether there is a fix or work around?

Thanks,
Mickey


texts: Convert image boundary to polygon geometry in earth engine

texts:
I have imported Hansen image for global forest change and clipped it for a specific region(India). Then using the code below I extracted the areas where tree cover is greater then 25%.

var treeCanopyCover = hansen.clip(india).select('treecover2000');
var greater25 = treeCanopyCover.gte(25);
var treeCover_greater25 = treeCanopyCover.updateMask(greater25);

var treeCanopyCoverVis = {
  min: 25.0,
 max: 100.0,
palette:
  ['3d3d3d', '080a02', '080a02', '080a02', '106e12', '37a930', '03ff17'],

};

Map.setCenter(82.5, 23.5);
 Map.addLayer(treeCover_greater25, treeCanopyCoverVis, 'Tree Canopy Cover');

Since the output is an image I can't appply 'filterBounds' to filter an image Collection over this area.Is there any way that I can convert this to polygon geometry so that I can filter my image collection over these forest areas?


texts: How to ensure screenshot from Bing Aerial matches QGIS Bing Satellite?

texts:
I am looking to work from a screenshot of Bing Aerial that is georeferenced in relation to Bing Satellite from the QuickMapServices plugin in QGIS 3.4.3.

I have matched the scale from the Bing Aerial image in QGIS and, as far as I am aware, both maps should otherwise be identical.

However (please see attachment), Bing Aerial and Bing Satellite do not align (without further adjustment of the image). Why might this be?


texts: osmosis 'unable to execute statement' error

texts:
I'm trying to use osmosis to import data to PostgreSQL, got an error:

and, I executed the following command successfully:


texts:
I was mapping an area in Namibia and also tracked a lot of paths on my way with my Garmin device... so I thought it would be nice to see height differences in my area (esp. interesting in the raining-season... where is the water going to be?)... but then I came to notice, that QGIS does not support the Z-Coordinate when using Shape-Files. I have currently all the data stored as a GPX file, how can I get QGIS (1.8) to recognize the Z-Coordinate?

And yes my device supports the tracking of height, that's for sure :)


texts: Google Earth Engine: clip image into multiple regions defined by a shapefile and name the output by value in a column

texts:
In Google Earth Engine I can clip the image using a shape drawn on the map canvas or by supplying a vector through Fusion table. This basically take the form.

var boundary = ee.FeatureCollection('ft:1W78nK9f3rkXBG3iuDdBidFHVGVnzvAqh7UEjRbeq');
var cliped = median_L8_2016.clip(boundary);
Export.image(median_L8_2016,'filename',

Suppose I have a vector file upload to Fusion table that contain three polygons and an attribute field called "district" with value as A, B, C for each polygon.

Is there any method in Google Earth Engine to clip the image output into different area and name the output file using the attribute. In this case I my expected output is three images named A, B, C.

The use case for this is plenty, for example, clip the study area into different province and district for further processing.

Currently I finish the image processing in GEE then download the result and do the clipping in FME which is working fine. But having the whole process in GEE would add much advantages to the workflow.


texts: Leaflet subdomains: if subdomain is down, attempt another

texts:
When giving leaflet an array of subdomains for a tile layer, how can I cause it to try a different subdomain if the attempted subdomain is down?

For instance, adding this layer:

var map = L.map( 'map', {
    center: [20.0, 5.0],
    minZoom: 2,
    zoom: 2
});

L.tileLayer( 'http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
    attribution: '&copy; OpenStreetMap contributors | Tiles Courtesy of MapQuest ',
    subdomains: ['otile1','otile2','otile3','otile4','otile5','otile6']
}).addTo( map );

This causes some of the tiles to fail to load because subdomains otile5 and oltile6 don't exist.

Of course in this case, I would just not include the oltile5 and oltile6 subdomains (because they don't exist): but what if, hypothetically, otile1 was down? Perhaps because the service is unreliable. Does Leaflet handle this case by attempting another subdomain? If not, is it possible to get Leaflet to switch subdomains if it encounters an issue?


texts: Generate neighbor (adjacent polygon) grid cell label in 4 sides in QGis Atlas!

texts:
I have created a coverage layer in QGis, and i compose the map in print composer and set up the Atlas, everything is ok.

But the only thing i am missing is to do in print composer is to add labels in 4 sides of the current grid cell that shows 4 grid cell neighbor(adjacent polygon) as a text like a dynamic text for example.


texts: Basemap in EPSG 32651 doesn't align with point layer in same CRS (red) but aligns with point layer in EPSG 4326 (yellow). What gives?

texts:
I have tried running the CSVtoPoint script in 4326 and 32651 project CRS but the results are the same.

I can just use the point layer in 4326 but it is not a projection so it uses degrees instead of meters which makes super big 10-meter buffers (what the bufferPoint2 script does). Reprojecting the 4326 point to 32651 works: aligns and produces the right buffer. But I want to know why this happens.


texts: Updating hosted feature layers on AGOL using the ArcGIS Python API?

texts:
I previously asked Adding data to a feature layer on ArcGIS Online using arcrest and arcresthelper.featureservicetools? regarding the most current process for establishing and then automating feature updates on ArcGIS Online using the ArcGIS Python API.  I can successfully add shapefiles to my portal content and publish them as a feature layers.  However, I would like to get into the details of constructing the "publish_parameters" argument for the publish method described here: arcgis.gis.GIS content.publish() I'm not sure if the docs are incomplete, but using the supplied link for understanding the publish parameters dictionary leads you to the ArcGIS REST API which describes using JSON objects for the publish parameters.  This seems to be misguided as this is not a Python API and nowhere else can I find how to construct the publish_parameters dictionary for Python.

The reason this is an issue is because some of my field types need to be specified in the published data.  I have some UID fields that are all numbers but for a reason I won't get into here, I need them to be treated as text, which seems possible if able to leverage the publish_parameters argument.  This is one example of many of how I would like to take more control of how the publishing action gets handled.

Does anyone know of a resource that explicitly describes the publishing process for CSV and/or zipped Shapefiles that details the publish_parameters argument of the publish method or am I missing something else that allows control over this (besides manually changing the way fields are displayed in the portal)?

Edit: My original question regarding the publish_parameters argument was not the correct approach at all.  There is no need to construct the publish_parameters argument.  Local features can be converted to JSON and then pushed to AGOL using the ArcGIS Python API.  This allows for local features to take the place of hosted features. This guide helped me a lot in ironing out this process.


texts: Import georeferenced dwg-files to SketchUP

texts:
I have a georeferenced DWG-file in a national projection and want to import it into SketchUp pro 2015 without loosing the georeference. My workflow so far was to import it into QGIS, check it's location using OpenLayers and save it again with the projection EPSG:3857 (Web Mercator), open a new SketchUP-file, set the geo location for the project and import the DWG file. This dosn't work.

The DWG import is placed somewhere. I don't want to georeference it again with the Google image, because this would cause a big lack in precision.

Does anyone know a solution, maybe a file format that works, or any workaround?


texts: Get a raster domain as a shapefile without considering zeros (from all bands)?

texts:
I have a raster file, and I want to check how much of my area is covered by the raster image - for this task I have generated RasterDomains, but it's considering the values (Zeros from all bands) for the conversion process. How to get the desired output with out considering the zeros?

 arcpy.RasterDomain_3d(inputraster, outputPoly, "POLYGON")

Here there is no option for avoiding zeros for not considering in the process of RasterDomians.


texts: Why do I have text of attribute table on my view in ArcMap 10?

texts: Can anyone tell me why do I have attribute table text on my layers in ArcMap 10 and how I can get rid of those texts? I have no idea when the texts appeared into my workspace. I have been digitizing and copying and pasting polygons from layer to another. However, the texts seems not to be part of any layer because they stay on the screen even I chance the visibility of all my layers.


texts: Using QGIS projects in a multi-OS environment

texts:
I am using QGIS on a variety of systems all of which access various file systems in my network, one of which contains my files, another contains my QGIS projects. Unfortunately, depending on the OS, these are not always mounted in the same manner/directory.

The problem I have encountered is that if the project is saved on a system where data is in A:// and the QGIS project in B://, and if that same project is opened on for example a Unix system where data is mounted in /mnt/data and qgis is mounted in /mnt/documents those file links in the QGIS project will break. If they are saved as absolute paths, those are not correct anymore, and if they are saved as relative paths the location of the files relative to the project will have changed.

Two simple solutions to this problem would be either 1) to store the files and projects on the same drive as in this GIS.SE question or 2) use different projects for each system. I would prefer not having to resort to 1) as there are other reasons why the files and projects are separated. 2) is also not particularly practical given that this is also a multi-user environment and it would add complications.

Has anyone encountered a similar situation and how did you solve it? Are there any QGIS plugins that might help in this situation? I had a quick search through the plugin manager but could not find anything obvious.

Is it possible to have some sort of OS-dependent variable that defines where drives are mounted? - eg. if Ubunutu data-head=/mnt/data else data-head=A://


texts: Passing parameters from QGIS to a SQL Server stored procedure and link this as new layer?

texts:
I'm new to QGIS and may not have understood the principle properly yet. I'm coming from database development.

Question: I have a stored procedure in SQL Server that uses a date range as a parameter. The result is a list of georeferenced points. I would like to add this list in QGIS 3.8 as a layer. Is that possible? From a stored procedure? If not, how could I do that?

Background: In the stored procedure, complex calculations occur that depend on the entered date range. Therefore, you cannot output the list as a view and filter it in QGIS. The result would be different.


texts: How to apply smoothing filter only to way bigger than specified number of nodes, length, area?

texts:
I am try to smooth data obtained by vectorization of a raster image by applying a series of filters in GRASS GIS. Once of steps involves using the Douglas-Peucker filter. However, I need to apply it only to selected objects in a vector layer, specifically "big" ones. The notion of size if not defined fully yet, it may be number of nodes, areas covered by the way, length of the way.

I cannot figure out how to specify this in GRASS, neither in command-line or GUI. Reading the manual page for v.generalize gives me an impression that where <sql_syntax> is my best option for adding such a condition. However, I cannot find a good example for it.

I use SQLite as a backend, if that is important.


texts: Edit Attributes and geometry of Carto layers from leaflet map

texts:
I want to create a webmap application which should be able to update attributes of CARTO layers.

I've Googled it, but the sites I've consulted do not help very much.

https://carto.com/blog/read-and-write-to-cartodb-with-the-leaflet-draw-plugin/

http://duspviz.mit.edu/web-map-workshop/cartodb-data-collection/

What I need basically is to take some attributes of the CARTO layers and be able to edit it.

What I've get is this:

Get the CARTO tables.
Get the properties I want.
Create a input box inside the popup.

What I need now is to submit the data inserted in the input box to the CARTO layer.

I don't know how to reach this.This is the code I'm writing.

var map = L.map('map').setView([41.64087,-0.89802], 13);

//CAPAS BASE
var capaBase1 = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
            attribution: '&copy; OpenStreetMap contributors, CC-BY-SA',
            maxZoom: 18
        }).addTo(map);

//Funcion PopUp
function onEachFeature(feature, layer) {

    // Create an input
    var input = L.DomUtil.create('input', 'my-input');
    // Set a feature property as value
    input.value = feature.properties.name;
    // Add a listener to watch for change on input
    L.DomEvent.addListener(input, 'change', function () {
        // Input changed, change property value
        feature.properties.name = input.value;
    });
    // Bind popup to layer with input
    layer.bindPopup(input);
}

//CAPAS CARTO

var suc = $.getJSON("https://luismi.carto.com/api/v2/sql?format=GEOJSON&q=SELECT * FROM suc_zgz", function(data) {geojson = L.geoJson(data, {
    onEachFeature:onEachFeature

}).addTo(map)});
var crs = $.getJSON("https://luismi.carto.com/api/v2/sql?format=GEOJSON&q=SELECT * FROM cr_s", function(data) {geojson = L.geoJson(data, {
    onEachFeature:onEachFeature,
    pointToLayer: function (feature, latlng) {return L.circleMarker(latlng, geojsonMarkerOptions);}
}).addTo(map)});

//ESTILOS
    //puntos
var geojsonMarkerOptions = {
    radius: 6,
    fillColor: "red",
    color: "#fff",
    weight: 1,
    opacity: 1,
    fillOpacity: 1
  };


texts: Splitting raster pixels by a polygon's edge?

texts: I have a a polygon shapefile of different regions, and a raster grid of precip data.  I want to take the polygon and add up all the raster precip data in each zone.  I could use zonal statistics to do this, however the tool does not split pixels exactly where the polygon edge cuts through the a pixel, it instead takes either the whole pixel value or not at all.  I could convert the raster data to polygons, but I was wondering if there was a way to do this without going to polygons.


texts: Accumulating values on edges on network dataset?

texts:
I work in ArcGIS 10.3
I have a network consisting of 2 sets of polylines:

"pair" shapefiles (polylines) connecting two points (different line for each pair), these polylines have an attribute "value"
"edge" shapefiles (polylines) which correspond with the "pair" polylines, e.g. polyline A-C goes along edge1 and edge2

I made a scheme which displays a simplified situation I'm solving:

What I need to do is to accumulate values on each of the edges. So, for example let's take a look at edge2. Edge2 should have value of 18: pairs A-C, A-D, A-E, B-C, B-D, B-E are all "going through" edge2, so all the values of each pair should accumulate on the edge, therefore the value of edge2 = 18.

Is there any method I could use to do this? There are 42 edges and 171 pairs in my project. I don't need to know which or how many of the pairs are going through an edge, just the acummulated value on it.


texts:
I want to create a button in a toolbar in PyQGIS/QGIS 2.18  which allows to start or stop the editing mode and the identifying mode at the same time. I can't figure out how to stop the editing mode. I tried to use stopEditing(), to no avail. Here's my code :

def run(self):
    if not self.iface.activeLayer():
        self.iface.messageBar().pushCritical(u'Whoops', u'Please select a layer')
    else:
        if not self.iface.activeLayer().isEditable():
            self.iface.actionPan().trigger()
            self.iface.activeLayer().startEditing()
        else:
            self.iface.actionIdentify().trigger()
            self.iface.activeLayer().stopEditing()

Besides stopEditing(), everything works as it's supposed to.


texts: What's the difference between sample, sampleRegions, and stratifiedSample in Google Earth Engine?

texts:
According to the documentation of GEE,

ee.Image.sample() samples the pixels of an image and returns them as a FeatureCollection, in which each feature has 1 property per band in the input image. You can provide a region parameter, which defines the region to sample from, or a factor parameter, which subsamples the image, or a numPixels parameter, which approximates the number of pixels to be sampled. I figure that either all pixels from the region are becoming features, or a randomized subset of pixels. Is that correct?
ee.Image.SampleRegions() samples the pixels of an image in one or more region and puts them into a FeatureCollection with 1 property per band of the input image. It requires a FeatureCollection as input, which defines the regions to sample over. Geometries will be snapped to pixel centers, thus I understand that there will be one sample per feature in the FeatureCollection, even if the FeatureCollection contains many extended polygons. Is that correct?
ee.Image.stratifiedSample() extracts stratified random sample points from an image and returns a FeatureCollection of 1 feature per extracted point with each feature having 1 property per band of the input image. It requires a numPoints parameter that defines how many points to sample. Also you can provide a classBand parameter, which tells you the classes to be used for stratification, and a region parameter, which tells you the region to sample from. Thus, other than for the other two sampling operations, you don't need a FeatureCollection as input, but rather a raster band that contains information about the classes. Is that correct?

I am just wondering: When should which of these strategies be used? ee.Image.sample() seems most straight-forward. But can it be used if you have a FeatureCollection of training samples, e.g. containing polygon labels?
ee.Image.SampleRegions() seems to be able to do just that, but shrinks all geometries to the centers, if I am not mistaken. And ee.Image.stratifiedSample() will need a raster image containing your classes. Is this possible for sparse label images, i.e. classBands that do not contain a class for every pixel?

I am really confused a little and would be happy to see a set of comparable examples to gain a better understanding...


texts:
Using ArcMap 10.1, since there is not a way to control portrait or landscape of the layout view through python, is there a way to switch layout templates without opening a new mxd through python?

Since there is a change layout template button it would be nice to have a python function to do the same.


texts: Raster to Vector: Displaying classes in Vector Layer - GRASS GIS

texts: I use Maximum Likelihood classification to classify Landsat image into two landuse classes - one of my interest and rest including all others. Inorder to assess the accuracy I export it in vector format using r.to.vect with feature type as area. But I find no option to export it in such a way that I can differentiate between two classes. Is there any way to do that?


texts: Is it possible to download GPX another coordinate system except WGS(GCS) with GPS Tool on QGIS1.8.0?

texts:
I got GPS data with using bessel1841 as coordinate system.
When I download GPX data on GPS tool, it is automatically treated as WGS84.

Can I use another coordinate system when I download GPX on GPS tool.

It is impossible to convert data from WGS84 to Bessel1841 on QGIS as far as I know - but I asked here: Is it possible to convert data from WGS84 to Bessel1841?


texts: Classifying raw LAS data as bare earth in ArcGIS for Desktop?

texts: I have a raw LAS data that has only one return (no second/ third.. return) and not classified yet. The only information I have is intensity and elevation. Is there any way that I can classify bare earth in ArcGIS? (vendor does not have more info than that). I tried classifying by selection from the profile view, but I know it is impossible to apply to all data.


texts: Creating custom geographic transformation with GDAL for use in ArcGIS Desktop?

texts:
I've used GDAL Python binding to create a geographic transformation between two geographic coordinate systems for Mercury (they differ only in the semi-major axis used in the datum).

import ogr, osr

inSpatialRef = osr.SpatialReference()
inSpatialRef.ImportFromWkt('source wkt string here')

outSpatialRef = osr.SpatialReference()
outSpatialRef.ImportFromWkt('target wkt string here')

coordTransform = osr.CoordinateTransformation(inSpatialRef, outSpatialRef)

My question is, how do I output the transformation parameters from osr.CoordinateTransformation so I can use them to create a custom geographic transformation in ArcGIS?

I'm assuming it's creating a 3 or 7-parameter transform, is this correct?


texts: i am looking for ward Boundary of major city of India Like Jhansi, i have try some sites where ward boundary is available like urban master plan and sildeshere but not found


texts: Adding a WMTS layer with a source projection of EPSG:31259 in OpenLayers results in invalid tiles being requested

texts:
I'm trying to visualize a publicly accessible WTMS layer in OpenLayers.
The GetCapabilities URL is: https://gis.bgld.gv.at/gisbgld/rest/services/Public/Nur_Flaechenwidmung/MapServer/WMTS/1.0.0/WMTSCapabilities.xml.
One of the source projection listed is EPSG:31259. So I registered this projection manually using proj4.defs(). However, OpenLayers 6.4.3 still requests incorrect tiles.
import 'ol/ol.css';
import Map from 'ol/Map';
import OSM from 'ol/source/OSM';
import Projection from 'ol/proj/Projection';
import TileLayer from 'ol/layer/Tile';
import View from 'ol/View';
import WMTS, {optionsFromCapabilities} from 'ol/source/WMTS';
import WMTSCapabilities from 'ol/format/WMTSCapabilities';
import proj4 from 'proj4';
import {register} from 'ol/proj/proj4';

var parser = new WMTSCapabilities();
var map;

proj4.defs("EPSG:31259","+proj=tmerc +lat_0=0 +lon_0=16.33333333333333 +k=1 +x_0=750000 +y_0=-5000000 +ellps=bessel +towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232 +units=m +no_defs");
register(proj4);

fetch('https://gis.bgld.gv.at/gisbgld/rest/services/Public/Nur_Flaechenwidmung/MapServer/WMTS/1.0.0/WMTSCapabilities.xml')
    .then(function (response) {
      return response.text();
    })
    .then(function (text) {

      var result = parser.read(text);
      var options = optionsFromCapabilities(result, {
        layer: 'Public_Nur_Flaechenwidmung',
        matrixSet: 'default028mm',
      });

      map = new Map({
        layers: [
          new TileLayer({
            source: new OSM(),  // <--- Loads correctly
            opacity: 0.7,
          }),
          new TileLayer({
            opacity: 1,
            source: new WMTS(options), // <--- Does not load
          }) ],
        target: 'map',
        view: new View({
          center: [1759898.89, 5992878.82],
          zoom: 9,
        }),
      });
    });


texts: Change Field Type using Field Mapping for List of Tables using Python

texts:
I have a collection of about 200 tables, and I would like to make sure that all the fields are text before merging them into a single table using python.  There is at least one field ("Number_of") which I know for sure is integer.  All the tables have the exact same schema.

This Geonet thread has been really helpful, but I still can't get it.

Here is my code:

fieldList = ['Feature','Number_of','Water_Type','GlobalID']

fieldMappings = arcpy.FieldMappings()

for field in fieldList:
    vars()[field] = arcpy.FieldMap()

    outField = vars()[field].outputField
    vars()[field].type = "Text"
    vars()[field].outputField = outField

    fieldMappings.addFieldMap([field])

This current code returns an error saying, "NameError: The attribute 'outputField' is not supported on this instance of FieldMap."

Essentially, all I need to do is create a Field Map that I can use in the python Merge tool which will convert the "Number_of" field to text.


texts: Using raster calculator in the graphical modeler of QGIS

texts:
I have a raster with slope values and want to calculate a raster, which only shows values under and over a certain threshold for example 50. In the raster calculator I can do this manually by the expression

"Slope@1"  >= 50

As I want to do this for several rasters and it is only one step in a chain, I would like to include it as a step in the graphical modeller of QGIS.This provides the GDAL Raster Calculator, the modeler only tool Calculator and the Saga Raster Calculator, but in none of these I can find out, what to type in to get the desired result.


texts:
I want to calculate NDVI for 50 Landsat 7-TM images . I have done a stack layer for each band of 50 images using envi software and then calculate NDVI for the stack of two bands demanded in NDVI equation.
Is this correct?
Or is there an other method?


texts: How do I import a PNG as a TileMill layer?

texts:
I want to use the NASA "Blue Marble" images as the basis of a map tile set for a Leaflet.js map.  It seems like using TileMill is the easiest way of building up my tiles, and opens a lot of options down the road.  However, it doesn't appear that I can import a plain "PNG" file as a layer.  PNG files don't normally apper as a file data source, and when I force it, I get the following error:

---------------------------
TileMill Error
---------------------------
[tilemill] [tilemill] problem loading datasource
Error: Unable to determine SRS for layer  "world" at C:\Users\jklemmack\Desktop\world.200412.3x21600x10800.png
[tilemill]     at Function.resolved.srs (C:\Program Files (x86)\TileMill-v0.10.1\tilemill\node_modules\millstone\lib\millstone.js:785:37)
[tilemill]     at next (C:\Program Files (x86)\TileMill-v0.10.1\tilemill\node_modules\step\lib\step.js:51:23)
[tilemill]     at Function.resolved.Layer.forEach.name (C:\Program Files (x86)\TileMill-v0.10.1\tilemill\node_modules\millstone\lib\millstone.js:716:29)
[tilemill]     at next (C:\Program Files (x86)\TileMill-v0.10.1\tilemill\node_modules\step\lib\step.js:51:23)
[tilemill]     at Step (C:\Program Files (x86)\TileMill-v0.10.1\tilemill\node_modules\step\lib\step.js:122:3)
[tilemill]     at resolved.srs (C:\Program Files (x86)\TileMill-v0.10.1\tilemill\node_modules\millstone\lib\millstone.js:712:21)
[tilemill]     at Object.fs.exists [as oncomplete] (fs.js:91:19)

Please report this to https://github.com/mapbox/tilemill/issues

I attempt to specify the SRS as WGS84 (per NASA's readme) and I get:

Could not create datasource. No plugin found for type 'undefined' (searched in: C:\Program Files (x86)\TileMill-v0.10.1\tilemill\node_modules\mapnik\lib\mapnik\lib\mapnik\input)

Any help?  Is this even possible?  Do I have to slice up the PNG with some other tool?


texts:
I'm trying to code a conditional sentence in QGIS to calculate a vector field.

I have 5 variables. I'd like to calculate the simple average if all variables are >= 3.
If all variables are not >=3, the result should be the lowest value of all of them.


texts: Choosing projected coordinate system for mapping all US states?

texts:
I'm on a project requires integrating data for all states in the US. It means I have two roadway datasets and I'm going to assign the attributes of roadways in one dataset to the same roadways in the other dataset (similar to spatial join). Each state is an independent shapefile and I need to merge them all at the end to generate the final product.

I'm wondering which projected coordinate system should I use in this case? Or it doesn't matter at all since it won't affect the result of geoprocessing? For my past work, I only mapped small area so I chose state plane NAD 83 of specific area as projected system.


texts: Merging rasters orthophoto overlapped with different resolutions using QGIS

texts:
I use 2 rasters orthophotos .TIFF :
1) the low resolution covering a large area.
2) the high resolution covering a small area and using an alpha band around the point of interest.

My aim is to merge this 2 files to deliver only one file that used the best of each image (full area in low resolution , and point of interest in high resolution ).
That's why I've tried:

Raster -> Miscellaneous -> Building Visual Raster : it merged both orthophoto using the right resolution for both parts, but the Alpha channel of the High resolution orthophoto (around the point of interest area) overwrites the other orthophoto: this solution doesn't work.

Do you have any idea how could I reach my aim?
I use QGIS 3.10 but can use 3.4 or any other version.

Solution ==>

1) Warp lowest resolution image in order to reach the same resolution for both rasters.

2) Raster -> Miscellaneous -> Merge : it merged both orthophotos, at the good resolution, but the color of the part overlapped with data is not the same as the original image (high rez one).

3) Extend the histogram


texts: Reconciling to a non-parent version in ArcGIS

texts: I am trying to find a neat way to clone a GDB version in ArcGIS and as suggested in Cloning a transactional version in ArcGIS, it seems reconciling from the source to the clone is the way to go. However, my tests with both ArcMap and Arcpy suggest that the system will basically ignore reconciliation to a non-parent. Is there anyway to reconcile a version to some other or basically copy changes associated with it to another version?


texts: How to access/manipulate a feature class/dataset in a personal database by using cursor via ArcPy?

texts:
I wrote an ArcPy script which uses cursors and it works fine with shapefiles. However, it does not work if I execute the same thing in a personal geodatabase. Should I use different format for a personal geodatabase such as regular parenthesis, single quote etc.

Here is the code:

import arcpy
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'C:\P2P\DMP_GeoDB_EXP.mdb\Featuredataset'
workspace = arcpy.env.workspace

with arcpy.da.UpdateCursor('featureclass', ["PermitNo", "AppType", "FeatCLS",
  "Contact", "National_ID", "Source","Type_Flag", "Calc"]) as cursor:
    for row in cursor:
        cursor.deleteRow()

then error I am getting:

for row in cursor:
RuntimeError: Too few parameters. Expected 3.

I am using ArcMap 10.6


texts: Extracting coordinates from mapinfo map window

texts: I didn't have time to go the field to collect GPS coordinates but I have knowledge from the map where the boundary of the land of nearly 20000 hectares will follow and therefore I wish to extract coordinates for the new GPS ID or field survey stations that I will propose.


texts: I've created a map in Carto.com with two layers and two widgets. In the builder everything looks fine but somehow this map is not showing anything after I published the map. Find a link: https://wash-liberia.carto.com/builder/d358cebe-2f32-4fc1-bd96-feb0acec15e7/embed


texts: How to check overlap between two sets of linestrings using PostGIS

texts: I have two sets of LINESTRINGS, each set containing around 50 LINESTRINGS (which form a road), using PostGIS how do I check whether these two sets overlap or not?


texts: Map single layer from list in Earth Engine

texts:
I'm trying to map an isolated month of imagery reduced with a median reducer in Earth Engine. However, when I try to incorporate code from this approach (also tried using the listOfImages[2] approach in the other answer to that question) I can't map the resulting object. It's confusing because when I print the object, it shows that I have an image, but I get the error:

  Cannot add an object of type ComputedObject to the map.

I looked into this solution to a similar error, but I don't think my code is mapping a list object, based on the fact that print("March LS8",Mar); returns a 3-band Image. Ultimately I want to maintain my 12-image imageCollection ("monthVis") for exporting purposes.

Reproducible code:

// Define (example) region of interest
var ROI = ee.FeatureCollection('TIGER/2016/Counties')
  .filter(ee.Filter.eq('NAME', 'Waldo'));
Map.centerObject(ROI, 9);
Map.addLayer(ROI);

//// Image manipulation
// Create clipping function so we're just dealing with the ROI
var clipper = function(image){
  return image.clip(ROI);
};

// Visualization function for median imageCollections
var vizzer = function(x){
  return x.visualize({bands: ['B4_median', 'B3_median', 'B2_median'], min: 0, max: 7000});
};

//// Load imagery
// Load a raw Landsat scene and display it.
var raw = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
  .filterDate("2013-01-01", "2018-12-31")
  .map(clipper);

//// Rearrange imagery
// Based on code by Nicholas Clinton https://gis.stackexchange.com/a/258379/67264
var months = ee.List.sequence(1, 12);
var byMonth = ee.ImageCollection.fromImages(
      months.map(function (m) {
        return raw.filter(ee.Filter.calendarRange(m, m, 'month'))
                    .reduce(ee.Reducer.median())
                    .set('month', m);
}));

//// Look at imagery
print("monthlyAggs", byMonth);
var monthVis = byMonth.map(vizzer);
print("monthVis", monthVis);

// Map specified layer using a List.
var listOfImages = monthVis.toList(monthVis.size());
print("listOfImages", listOfImages);
var Mar = listOfImages.get(2);
print("March LS8",Mar); // Returns an image
Map.addLayer(Mar, {}, "March LS8"); // Returns an error


texts: Call QGIS geoprocessing tools from command line (terminal, bash-script)

texts:
Is there any possibility to call tools found in the QGIS processing toolbox  from the command line, other than using python?
It is my understanding that if you use any GDAL tools, the QGIS gui is just creaing and sending off the shell command for you. Is there any possibility to vice versa start QGIS tools directly to the command line?
As an example one could use the Raster Analysis -> Zonal statistics tool.
A similar question (Geoprocessing tool Difference from the Terminal?) was answered with an ogr command. With this question I want to address this issue in general.
I am looking for a solution which will also work on Linux, since I seek for ways of using the power of QGIS on a cluster. OSgeo4W is therefore not an option.


texts:
osm2po library does a great job in creating the data required by pgRouting to calculate theshortest paths. But I need the shape (Geometry - LineString 4326) to be extracted when osm2po generates the sql file for postgresql out of the .osm file.

Is there anyway to do this? Or maybe external library?
 I want the shape to be Geometry(LineString,4326) to fit into my database.


texts: QGIS shapefile to 3D visualization in unity

texts:
I have a shapefile that I would like to import to Unity.

The shapefile is in 2D and I also have access to the data that it has through PostgreSQL.

My question is this: "Is there a way to transform this shapefile to a unity 3D visualization with latitude/longitude/height (these already exist as well but i can also input them one by one) in order to then add game objects on top of it? Obviously not use any code. Even if it is done with another program.


texts: Sequential numbers in a field using Python in the Field Calculator on a based on Sorted Column not FID/OID

texts:
This code below auto-increments based on the FID/OID in the attribute table. How can I auto-increment a column based on a sort of another column? I don't want it to follow the FID/OID. Please advise.

rec=0
def autoIncrement():
 global rec
 pStart = 1 #adjust start value, if req'd
 pInterval = 1 #adjust interval value, if req'd
 if (rec == 0):
  rec = pStart
 else:
  rec = rec + pInterval
 return rec


texts:
I know there Have been a lot of similar questions asked but none address this issue as I far as I can tell. When I am trying to install the sextante plugin, or run PostGIS Manager in QGIS I receive the same message:

"Couldn't import Python module 'psycopg2' for communication with PostgreSQL database. Without it you won't be able to run PostGIS manager."

I have installed macports and successfully installed psycopg2 using the "sudo port install py26-psycopg2" command, even rebooted for good measure but no luck.

I have also gone through and installed it on every version of python on my machine which appears after entering "port select --list python"

How can I install port psycopg2 properly?

Please let me know what I am missing here, I am sure it is simple but it is confounding me so far.


texts: Hyperlinking multiple PDF's to multiple points

texts:
I am kinda new to all of this and appreciate any help, (no criticism please, questions welcomed)!

I would like to hyperlink a PDF to a point. Each point will have a link to a different PDF. So far it seems that I can do it one by one. Is there a quicker way of doing it?

We're using ESRI ArcMap


texts: Points to polygons transform, inserting columns

texts:
In this task I'am transforming points to polygons. I have table POINTStbl with four columns: ID, YEAR, CODE, POINT and i need to create table POLYGONStbl, where will be three same columns(with same values): ID, YEAR, CODE and one new: GEOMETRY.    I stuck here - with this code I'am able to create POLYGONStbl with only one column GEOMETRY. Is there any option how can I copy others columns in this new column? Is this command INSERT_INTO able to insert others(ID,YEAR..) columns?
 INSERT INTO polygonstbl (geometry) (
   SELECT ST_Buffer(point, 300, 'quad_segs=8')
   FROM pointstbl
);

POINTStbl

ID|   CODE |YEAR|POINT                   |
1 |1332A138|2010|01010000208A150000C3D3..|
2 |1234A010|2010|01010000208A1500003E7.. |
3 |1223A009|2010|01010000208A150000002.. |
4 |1221A237|2011|01010000208A150000ED9...|

POLYGONStbl - I'am able to create with that code

|GEOMETRY                |
|1616545645645641328456..|
|FDDSFD5SF4DS56F4DS56F.. |
|1FD351SD32F1DS32F1SD3.. |
|48DFD7SF89D7SF98DS8DF...|

POLYGONStbl - I need to create

ID|   CODE |YEAR|GEOMETRY                |
1 |1332A138|2010|1616545645645641328456..|
2 |1234A010|2010|FDDSFD5SF4DS56F4DS56F.. |
3 |1223A009|2010|1FD351SD32F1DS32F1SD3.. |
4 |1221A237|2011|48DFD7SF89D7SF98DS8DF...|


texts: Can't update map after first layer deletion on OpenLayers 6

texts:
So, I have a set of roads that have two configurations, a straight line, and a "snap to road" line, where the user can change between them by clicking the road icon on the toolbar. In order to make it performative, I'm deleting the existing layer to then render the next one.
At first, I tried to hide it with CSS (which worked), but it made the map pretty slow, so I wanted to move on in this path where only the needed info is displayed on the map. The problem is, even though the layers are being updated behind the scene, the map is still displaying the old information, not changing after the first successful render.
So here is how the map is first rendered:

And here is after the first time you press the "straight line" switcher:

So far it works great, but after that, no map manipulations work, the depot (green marker) can't be hidden and the routes can't go back to "snap to road" mode. I've logged the layers from the map, after the changes, and they are all updated to the supposed state, but the map on its own is not being updated.
This is the code to delete the layers:
let straightRoutes = [...map.getLayers().getArray()].filter((layer: any) => layer.getClassName() === 'straight')
let snapRoutes = [...map.getLayers().getArray()].filter((layer: any) => layer.getClassName() === 'snap')

async function clearLayer() {
  straightRoutes.forEach(async (layer: any) => {
    await map.removeLayer(layer)
  })

  snapRoutes.forEach(async (layer: any) => {
    await map.removeLayer(layer)
  })
}

And this is the code for the route rendering. Please note that there are two functions, one that renders the straight lines and one for the snap to road lines. The below code is run after all the layers have been removed.
function renderStraightRoutes() {
  markers.forEach((route: any) => {
    const vectorSource = new VectorSource()

    const selectedStopPaths = showDepot
      ? route.routes
      : route.routes.slice(1, route.routes.length - 1);

    selectedStopPaths.forEach((polyline: any) => {
      let straight = [olProj.fromLonLat([polyline.from_lng, polyline.from_lat]), olProj.fromLonLat([polyline.to_lng, polyline.to_lat])]

      var straightFeature = new Feature({
        geometry: new LineString(straight),
        name: 'Line',
      })

      vectorSource.addFeature(straightFeature)
    })

    const vectorLayer = new VectorLayer({
      source: vectorSource,
      style: getStyle(route.color),
      className: 'straight'
    });

    vectorLayer.setZIndex( 0 )
    map.addLayer(vectorLayer)
  })
}


texts: Merging polygons without losing area using ArcGIS Pro?

texts:
I have a shapefile with 23 polygons,I want to merge them and get the total area of this big polygon.

But when I used "merge"tool, it only merge polygons but area.

Any ideas about what I should do?


texts:
I would like to move my created layer across the map canvas.

I found some solution here. And next tried to achieve something similar in QGIS 3.10.

Unfortunately, this step couldn't be achieved, as I am getting an error:

  This algorithm cannot be run :-(  The specified GRASS 7 folder
  "C:\PROGRA~1\QGIS3~1.10\bin\bin" does not contain a valid set of GRASS
  7 modules. Please, go to the Processing settings dialog, and check
  that the GRASS 7 folder is correctly configured

Is there any way to move the layer at the specified distance across the map canvas?

UPDATE:

I toggled to edit mode of the layer and selected it in the vertex tool. Now I have all nodes active:

Is there a way to move them all at once?


texts: 6s atmospheric correction for hyper spectral data

texts: I am trying to customize atmospheric correction for hyper-spectral data. Presently for Landsat I am using the i.atcorr GRASS GIS module. I want to know whether 6S atmospheric correction can be used for hyper spectral data or 6sv1 (vector version) only has to be used for Hyper-spectral data?


texts: Get a popup instead of an iframe when using getElementById

texts:
I have a map (openlayers) that gives me an iframe of attribute data when a pixel is clicked/ queried. How would I go about having a nice popup window instead of an iframe? My code for the query is:

map.on('singleclick', function(evt) {
        document.getElementById('info').innerHTML = '';
        var viewResolution = /** @type {number} */ (view.getResolution());
        var url = towns.getGetFeatureInfoUrl(
            evt.coordinate, viewResolution, 'EPSG:3857',
            {'INFO_FORMAT': 'text/html'});
        if (url) {
          document.getElementById('info').innerHTML =
              '';
        }
      });

The 'info' is from

&nbsp;


texts: Crash QGis 2.16 by defining a memory vector layer with python

texts:
With a python plugin for QGis 2.16, i try to define a new temporary layer:

vl = QgsVectorLayer("Polygon", "temporary_lay", "memory")

as shown here:
http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/vector.html

but executing this line, QGis crash with a segmentation error message. Same error with any string for the uri.
Then i tried to define the uri with:

uri = QgsDataSourceURI()
uri.setParam("url", "polygon")
uri.setParam('crs', "EPSG:32632")
vl = QgsVectorLayer(uri.uri(), "temporary_lay", "memory")
print memoryLayer.isValid()

but the print command return "False" (layer non valid).

Anyone knows the correct syntax for defining a temporary memory layer with QGis 2.16?


texts: How can I export to Drive an ee.List in GEE?

texts:
Following GEE code was used for producing an ee.List of [year, month, day, daily precipitation] for CHIRPS/DAILY images filtered by date ('2015-01-01', '2016-01-01') and by using a point ee.Reducer (location of my weather station).

//Selecting Image Collection of dayly precipitation
var chirps = ee.ImageCollection("UCSB-CHG/CHIRPS/DAILY");

var precip = chirps
  .filterDate('2015-01-01', '2016-01-01'); //366 days (leap year)

var count = precip.size();

// Print the filtered precipitation ImageCollection.
print('precipitation series:', precip);

var getDatePrecip = function(image) {
  // weather station place: Valle de la Pascua
  var p = ee.Geometry.Point(-66.00, 9.22);

  // Reducing region and getting value
  var value = ee.Image(image)
    .reduceRegion(ee.Reducer.first(), p).get('precipitation');

  var time = ee.Image(image).get('system:time_start');

  // Return the time (in milliseconds since Jan 1, 1970) as a Date
  var precipit_list = ee.Date(time)
    .format()
    .slice(0,10)
    .split('-')
    .add(value);

  return precipit_list;
};

var precipit_list = precip.toList(count).map(getDatePrecip);

print(precipit_list);

Result, as expected, it is an ee.List with following structure:

.
.
.
132:
["2015","05","13",1.8483211994171143]
133:
["2015","05","14",0]
134:
["2015","05","15",0]
135:
["2015","05","16",0]
136:
["2015","05","17",0]
137:
["2015","05","18",5.3127264976501465]
138:
["2015","05","19",10.625452995300293]
139:
["2015","05","20",5.3127264976501465]
140:
["2015","05","21",5.391742706298828]
141:
["2015","05","22",0]
142:
["2015","05","23",0]
143:
["2015","05","24",0]
144:
.
.
.

and it can be also flattened to following structure by using flatten ee.List method:

.
.
.
551:
5.3127264976501465
552:
2015
553:
05
554:
19
555:
10.625452995300293
556:
2015
557:
05
558:
20
559:
5.3127264976501465
560:
2015
561:
05
562:
21
563:
5.391742706298828

.
.
.

My question is how can I export to Drive whatever of these ee.Lists in GEE? I tried out several approach (by using Export.table.toDrive) without any succeed. I could not find out any method to convert an ee.List in a FeatureCollection.


texts: QGIS: Creating contours at a certain elevation from DEM that match a value from a polygon layer

texts:
Trying to create contours from a 1m DEM at certain levels only when the contours fall inside a polygon with an field containing the desired contour elevation value.
See images below. For example in the western area I only want to show a -11.8m contour. The polygon has a field 'Critical_Depth' and value of -11.8. I've already used the aggregate function to colour the soundings related to a 'Critical_Depth' value. Is it possible to do something similar for contouring? Ideally if I need to adjust the critical depth of an area I would like the label colours and red contour lines to automatically update. I have the labels working, just need to figure out a solution for the contours.


texts: Labelling polygons intersecting another polygon file

texts:
I have a series of polygons representing land packages and another shapefile representing contour polygons of flood elevations in steps i.e 2-5m 5-10m >10m. I am wanting to label a polygon with the highest it intersects with i.e if there if there is a threshold change across the one asset it is labelled with the highest.

I have tried using an identity but that splits my land packages up into two if there is a threshold change going across it. I want to keep the same number of packages with whatever check I do it with.

I have also looked at turning my land packages to points and then joining back after the identity but given the placement of the point, it may not get the highest threshold for that package of land.

I need to do this with minimal manipulation as I need to be able to automate this process as there is lots of land packages with lots of flood scenarios I need to do this against.

I am using ArcGIS 10.2 for Desktop.


texts: How can I create a portable script for coordinate conversions to run from USB?

texts:
I would like to be able to convert Lat long values in wgs84 to the swedish RT90, the values are in CSV files under headings X and Y. I would like to have this portable, an eg runned in a script in python idle or something similar. I have a python script today on USB that uses the pyshp module to convert csv files to shapefiles, but some of the csv are in wgs84 which would be nice to have converted in the same process.

Can gdal be used, and can it be made portable?


texts: Installing plugin for Time Manage Error Manage

texts:
I've tried installing different versions and have now reinstalled both Python and QGIS to see if that made a difference however, I still can't resolve the problem. This is the error message I still get appearing for TimeManager..
"Couldn't load plugin 'timemanager' due to an error when calling its classFactory() method

ModuleNotFoundError: No module named 'future'

I am using Macintosh Captain and have the Python 3.6 and QGIS 3.8 +GDAL in the package.
Is it something simple?
I have downloaded it properly on and Windows computer so wonder if I have got like a button ticked that I'm not supposed to get stuff via Python (IDK)
(I know there is a newer version of using TimeManager or eq)

*It does actually install, but comes up with this error message and does not appear for me to use


texts: Passing values for a geojson filter in Leaflet

texts: I have a situation where I have a geojson layer in leaflet and I want to create a subset of this layer as a separate geojson to highlight specific features.  What I am doing right now is passing in the subset manually as form a separate javascript file (the main feature is loaded as a topojson via omnivore).  What I want to be able to, however, is pass the features to be included in the "highlight" geojson as an array of key values (or something similar) so that I can define the features to be included from within the script instead of having to manually pass it in externally.


texts: QGIS 2.14 standalone GRASS provider missing Msys folder, can't execute tools

texts:
In QGIS 2.12 and down, when one went about manually setting the GRASS provider folder paths, this was the way to do it

In GIS 2.14 there is no Msys folder in the same path (...\apps\msys) or any other folder in the QGIS installation.

So even though QGIS standalone needs to have it set correctly in order for GRASS tools to work, it can't be done.

So how do you make GRASS tools work in QGIS 2.14?


texts: Registering "events" for linear referencing in pyqgis?

texts:
Is there an easy solution for recording events for a line crossing borders of zones in a polygon layer?

I need to implement this in python using QGIS, thus pyqgis. The image attached illustrates what I am looking for. The red line is a linestring geometry with start and end point. Whenever the line enters a zone (i.e. crosses the polygon border) an event is recorded being the reference of the zone (A to D) and the distance from the start of the line, measured along the linestring's geometry (distances in the image are estimates only). I can get by the first "event", where the line already starts inside zone A. But is there an easy way to get the other events? I could cut up the line in segments using the zones, but my goal is to record events to prepare for linear referencing, so I try to avoid cutting up the line.


texts: Spectral signatures chart in Google Earth Engine

texts:
I have been reading the documentation and some related questions online, but I cannot seem to make it work.
I use Google Earth Engine to access an old Landsat 5 image, and classify later on.

I want to plot the spectral signatures on a chart in earth engine, but I cannot seem to make it work.

This is the error code I keep getting:

  Error generating chart: Data column(s) for axis #0 cannot be of type string

As far as I know, all the properties in the FeatureCollection are numeric. I don't know where the strings might come from.

Can anyone explain what is exactly going wrong?

The code:

// Query satellite image  26.996813, 14.395989
var aoi = ee.Geometry.Rectangle([14.38, 26.98, 14.49, 27.87]);
var collection = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR').filterDate('1995-01-01', '1995-01-30').filterBounds(aoi).filterMetadata('IMAGE_QUALITY', 'equals', 9).select(['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7']);

//var rgbImage = collection.sort('CLOUD_COVER').first().select(['B3', 'B2', 'B1']);
var image_ = collection.sort('CLOUD_COVER').first();

// Load training data
var trainData = ee.FeatureCollection('users/jneujens/trainData');

// Property containing land cover labels
var label = 'classname';

// Get training from polygons on image
var training = image_.sampleRegions({
  collection: trainData,
  properties: ['classvalue'],
  scale: 30
});

print(training)

// Graph of spectral signatures training data
var options = {
  title: 'Landsat 5 surface reflectance spectral signatures',
  hAxis: {title: 'Wavelength (micrometers)'},
  vAxis: {title: 'Reflectance'},
  lineWidth: 1,
  pointSize: 4,
  series: {
    0: {color: 'grey'}, // impervious
    1: {color: 'green'}, // vegetation
    2: {color: 'red'}, // soil
}};

// Define a list of Landsat 8 wavelengths for X-axis labels.
var wavelengths = [0.47, 0.56, 0.66, 0.83, 1.56, 2.2, 11.4];

// Create the chart and set options.
var spectraChart = new ui.Chart.image.regions(
    image_, training, ee.Reducer.mean(), 30, 'classvalue', wavelengths)
        .setChartType('ScatterChart')
        .setOptions(options);

print(spectraChart)


texts:
The QGIS Intersection tool is not working for two shapefiles in Version 2.2 or 2.4 (haven't tried earlier versions). I get a new shapefile with all the attributes, but no features. However, when I use ArcMap with the two shapefiles, the intersection happens correctly. The shapefiles are both in the same coordinate system. I have used the QGIS tool with success with other shapefiles that I got from a QGIS tutorial.

The shapefiles that I'm using are all from the Data BC website. I've uploaded two samples to http://vulnerablevancouver.ca/qgis_intersection/ if anyone wants to have a look. I put the zip files there that include the metadata.


texts: validating the calculation of slope from DEM

texts:
my purpose is to calculate and validate slope in percentage of southern california using DEM and landsat data.

step 1)i used a DEM file and changed with the float type file to integer type
step 2) i then change the projection from degree to meter. what does the value signify?

step 3) i calculated the slope in percentage and changed the float type into integer type. the value calculated using spatial analyst tool> surface>slope ranges from 0-420!!!. is it possible that the percentage rise in slope is 420% ?
step 4) using landsat data i tried to see at what percentage slope the land is getting developed. i find that it is getting developed at more than 50% slope also!! is that logically possible or my calculation of percentage slope is wrong?

is there any way i can calculate the distribution of developed land based on the % slope for the entire study area using arcgis?


texts: Run QGIS Model on selected features only?

texts:
Would it be possible to run a script in a QGIS model so that it only runs on selected features from an input layer? I don't want to use the option in the toolbox options as I have other models that require to run without selections.

I just a model to only run on selected features in the input layer and return an error if no feature is selected. I'm thinking a script added immediately after the input in the model?


texts: gdal_grid does not work in cron but works in terminal

texts:
I use the gdal_grid interpolation command. When I work in the terminal everything works perfectly. However, when I try to run the command in the bash script from cron then it does not work.

Bash script (/root/interpolation/interpolation.sh):

#!/bin/bash

gdal_grid -ot Float64 -of GTiff -outsize 750 750 -a invdist:power=2.0:smoothing=0.0:radius1=0.08:radius2=0.08:angle=0.0:max_points=0:min_points=0 /root/interpolation/today.vrt /root/interpolation/out/today.tif

I also tried the path to gdal_grid

#!/bin/bash

/usr/bin/gdal_grid -ot Float64 -of GTiff -outsize 750 750 -a invdist:power=2.0:smoothing=0.0:radius1=0.08:radius2=0.08:angle=0.0:max_points=0:min_points=0 /root/interpolation/today.vrt /root/interpolation/out/today.tif

Virtual file (/root/interpolation/today.vrt)

<OGRVRTDataSource>
<OGRVRTLayer name="today">
    <SrcDataSource>/root/interpolation/today.csv</SrcDataSource>
    <GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
    <GeometryField encoding="PointFromColumns" x="X" y="Y" z="eto"/>
</OGRVRTLayer>

CSV (/root/interpolation/today.csv)

id,X,Y,eto
1,17.11400986,43.59461212,5.284
2,16.01515388,44.38002777,5.636
3,19.3653698,44.19543839,6.823
4,17.25690269,44.1989975,6.041
5,18.53639221,43.60323715,6.452
6,16.9213295,45.12902069,6.95
...

CRON

PATH='/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin'

39 10 * * * /root/interpolation/interpolation.sh

Error

Usage: gdal_grid [--help-general] [--formats]
[-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
      CInt16/CInt32/CFloat32/CFloat64}]
[-of format] [-co "NAME=VALUE"]
[-zfield field_name]
[-a_srs srs_def] [-spat xmin ymin xmax ymax]
[-clipsrc <xmin ymin xmax ymax>|WKT|datasource|spat_extent]
[-clipsrcsql sql_statement] [-clipsrclayer layer]
[-clipsrcwhere expression]
[-l layername]* [-where expression] [-sql select_statement]
[-txe xmin xmax] [-tye ymin ymax] [-outsize xsize ysize]
[-a algorithm[:parameter1=value1]*]    [-q]
<src_datasource> <dst_filename>

Available algorithms and parameters with their's defaults:
Inverse distance to a power (default)
    invdist:power=2.0:smoothing=0.0:radius1=0.0:radius2=0.0:angle=0.0:max_points=0:min_points=0:nodata=0.0
Moving average
    average:radius1=0.0:radius2=0.0:angle=0.0:min_points=0:nodata=0.0
Nearest neighbor
    nearest:radius1=0.0:radius2=0.0:angle=0.0:nodata=0.0
Various data metrics
    <metric name>:radius1=0.0:radius2=0.0:angle=0.0:min_points=0:nodata=0.0
    possible metrics are:
        minimum
        maximum
        range
        count
        average_distance
        average_distance_pts

FAILURE: Neither -sql nor -l are specified

Note that it works in the terminal but it does not work in cron.
Does anyone know what the problem is?


texts: I have a point inside a polygon. I want to copy the attributes from the point to the polygon. Is there a way to do it in QGIS?


texts: Error in Graphical Modeler when converting raster to vector

texts:
I'm building a model where, among other things, I use r.watershed, from which I only keep the "stream segments" output.

In addition I would like to convert that raster to vector lines. When I do that manually, I normally use the r.to.vect algorithm and it works fine. But when I try adding that last algorithm to my model, I get the following error:

  Traceback (most recent call last): File
  "C:/PROGRA~1/QGIS3~1.2/apps/qgis/./python/plugins\processing\algs\grass7\Grass7Algorithm.py",
  line 400, in processAlgorithm getattr(self, fullName)(parameters,
  context, feedback) File
  "C:/PROGRA~1/QGIS3~1.2/apps/qgis/./python/plugins\processing\algs\grass7\Grass7Algorithm.py",
  line 452, in processInputs paramName, parameters, context) File
  "C:/PROGRA~1/QGIS3~1.2/apps/qgis/./python/plugins\processing\algs\grass7\Grass7Algorithm.py",
  line 690, in loadRasterLayerFromParameter self.loadRasterLayer(name,
  layer, external, band) File
  "C:/PROGRA~1/QGIS3~1.2/apps/qgis/./python/plugins\processing\algs\grass7\Grass7Algorithm.py",
  line 709, in loadRasterLayer os.path.normpath(layer.source()),
  AttributeError: 'NoneType' object has no attribute 'source'

What's wrong with this code?


texts: Help with Routing..RouteEventArgs cannot be serialized

texts:
I created a routing service in ArcGIS Server that allows the Service Area task.  I've hit the REST service for this routing service and passed in a single facility XY and it works perfectly fine.  The trouble I'm having is in the Silverlight Geocortex application.  I'm using the RouteTask activity which simply ask for the Routing service URL (I provided: http://server/ArcGIS/rest/services/Water/WaterRoadNWwithService/NAServer/ServiceArea/solveServiceArea), route parameters (I provided multiple variables like facilities, out spatialreference, etc), and lastly a result (which should be of RouteEventArgs).  Whenever I run the task, I keep getting the below error and I'm not sure why or what to do next...

Type ESRI.ArcGIS.Client.Tasks.RouteEventArgs cannot be serialized.  Consider making it with the DataContractAttribute attribute and marking all of its members you want serialized with DataMemberAttribute attribute


texts:
I'm having trouble printing a map with a desired scale. I set the scale to 1:100,000. The page size is 30x30 cm, therefore the real world map extent should be 30x30 km. However, as one can see with the scalebar, my real world extent is about 20x20 km. The scalebar is correct, I also checked the map extent on some web maps, the extent really is too small. Since the paper size (30x30cm) is also correct, something must be going wrong with the scale.

I'm using qgis 2.16.3 on Mac os X 10.9.5. Projection of the project is EPSG:3857 (on the fly enabled), projection of the layer is WGS84. It's OSM data from geofabrik.


texts:
I am trying to populate Field B based on the value in Field A and the next value in Field A. I'm having trouble with the syntax for getting the "next" value in Field A. Here is my current code:

with arcpy.da.UpdateCursor(copyFile, ['OID@', 'FieldA', 'FieldB']) as cursor:
    counter = 1
    for row in cursor:
        row[2] = counter
        fieldA = row[1]
        # get next fieldA
        if fieldA == fieldA_next:
            counter += 1
        else:
            counter = 1
        cursor.updateRow(row)

And here's what I'm trying to produce (FieldA is known):


texts: Calculating shortest route in Geopackage/SQLite

texts: Are there any graph analysis tools written for a SQLite database? What I'm looking for is something akin to pgRouting but for SQLite. I can't find anything with a significant user base, which is surprising to me.


texts: Clustering latitude longitude data based on distance

texts:
I have a large dataset of latitude and longitude. I want to cluster the data into groups based on distance such that the distance between two points in a cluster is not greater than a minimum specified value. Also the number of clusters are not fixed. But there must be a minimum specified number of points to make a cluster. If the number of point are less than a specified minimum, they wont be considered as a cluster.
I am trying to find out what library and packages in python can help me cluster this.


texts:
Is it possible to convert Points into Polygons in QGIS 2.10 Pisa? I just want to create a 1x1m Polygon based on the centroid of each Point.
I tried Vector > Geometry Tools > Voronoi Polygons but that is not what I want at all.


texts: Limiting flow direction to D4 instead of using D8 in ArcMap?

texts:
Is there a way that I can limit flow direction to D4 instead of having it use D8?

Preferably looking for a way to do it within ArcMap.


texts: Anybody know of a public WMS out there that serves a solar terminator?

texts:
I've just updated an app I made a few years back from OpenLayers 2 to OpenLayers 3... and I thought it'd be cool if I added in an Overlay for the solar terminator (day-night boundary).

I can't seem to locate any public WMS providers out there who offer that layer.  Anybody know of any?


texts: Interpolate smoothly nodata values in QGIS

texts:
I have a DEM raster where all the buildings have been extruded and now contain "nodata" values. I'd like fill the holes and get a nice and continuous surface (which would approximately correspond to the natural terrain). I tried the Fill Nodata function in QGIS (Rater -> Analysis -> Fill Nodata) without changing the parameters. The holes are filled but strange lines appear (probably due to the near topography characteristics).

Is there another way to fill the missing values by getting a smooth and continuous ground and without changing the rest of the DEM? I tried to use the r.fillnulls function (GRASS) but it always crashes for an unknown reason.


texts: Problem with polygon overlay in raster stats using gdal

texts:
I am using the raster_stats module in python to calculate the mean carbon value for different sets of polygons. Here is the code that I am using:

africa_sat = 'E:/Research_Work/data/processing_data/carbon_satcchi/data/raw_data/africa_carbon_1km.tif'
name_clipshp = 'data/grid_clipped/' + name_hol + '_grid_cl.shp' # create object to point to clipped grid file

africa_stats = raster_stats(name_clipshp, africa_sat,stats=['mean'])

I have approximately 260 grid surface areas that I am employing. The grid areas have between ~10,000 polygons and ~40,000 polygons in them. Here is the error message I get for some of grids:

 Traceback (most recent call last):
 File "<stdin>", line 16, in <module>
 File "C:\Python27\lib\site-packages\rasterstats\main.py", line 153, in raster_stats
 rvds.SetGeoTransform(new_gt)
 AttributeError: 'NoneType' object has no attribute 'SetGeoTransform'

I do not get this error message, if the polygon overlaps completely with the raster image (tiff file) or if the polygon does not at all overlap with the polygon. However, if only a part of the polygon overlaps with the raster I get the error that is above. See picture below:

Does anyone know how to force gdal to create null / NA value in the polygons that don't overlap? Does anyone know a create solution to this issue?


texts:
I used to run the extract function from raster package without any problem. However, recently I receive an error message and it does not work for me. When I run the extract function to extract stacked rasters along with my data points I receive the following error.

EHFextract <- extract(Stack_Rasters, Points_data, sp = 1, method = "simple")

  Error in .doExtract(x, i, ..., drop = drop) :
  unused arguments (sp = TRUE, method = "simple")


texts: Unexpected error while RSAGA raster calculations

texts:
I want to use RSAGA package in R to calculate the topographical wetness index. However, while applying the rsaga.wetness.index() function, R gives me an error message (see below).

My question is, where should I look for the problem. In the DEM, perhaps in the installation files of the package?

The input raster is originally saved as .grd file, it is of LAEA Europe projection and it has 100 per 100 m resolution.

projection(dem)
> "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"

res(dem)
> [1] 100 100

SagaEnv = rsaga.env(modules = 'C:\\SAGA-GIS')
rsaga.wetness.index(in.dem = dem, sagaEnv = SagaEnv)
> Error in nchar(filename) :
>     no method for coercing this S4 class to a vector


texts: Making linestrings with adjacent lines in Postgis

texts:
I have a Linestrings layer with all the horizontal signage (lines in the floor) in my town.

I need to calculate the area of the closed linestrings. The thing here is that every side of each closed square is a different linestring. I mean, in the image's sidewalk every rectangle/square is composed of 4 linetrings, instead of being a single linestring the whole rectangle, it is composed of 4 linestrings.

Due to this, when I convert the layer to polygon using ST_MakePolygon I am getting 0 when calculting the st_area of the sidewalk and other elements..

I guess I need to create first a single linestring for every square(rectangle but I don't know how to do it...

EDIT:
I am currently using this query to get the area of closed linestrings with very bad result:

SELECT sub.id, st_area(st_makepolygon(ST_ForceClosed(sub.the_geom))) as area
    FROM
    sh_lineas sub
     where ST_NPoints(sub.the_geom)>3

My approach would be to create a subquery first and do ST_MakeLine with all the lines that are less than 1 cm from one to the other. Is it right?


texts: Update vector layer with server vector source

texts:
I am using Openlayers 3.0 , I have created a vector layer where the source for the vector layer is a server vector. Now I want to update this layer on checkbox click.So I created the function below however , no changes are dispatched. Can someone help please ?

function update(layerName , layerSource) {
               var formatWFS = new ol.format.WFS({
                    featureNS: featureNS,
                    featureType: layerName
                });
                $.ajax({
                    url: layerURL,
                    dataType: 'xml',
                    jsonp: false,
                    jsonpCallback: 'getJson',
                    type: 'POST',
                    async: false,
                    success: function(data){
                        layerSource.clear();
                        layerSource.loadedExtents_.clear();
                        var features = formatWFS.readFeatures(data);
                        layerSource.addFeatures(features);
                        layerSource.dispatchChangeEvent();
                    }
                });
    }

This is the solution I have found for my problem stated above :

function update (layerName , layerSource) {
       var staticVector = new ol.source.StaticVector({
                format: new ol.format.WFS({
                    featureNS: featureNS,
                    featureType: layerName
                }),
                projection: layerProjection
            });
       $.ajax({
                url: url,
                dataType: 'xml',
                jsonp: false,
                jsonpCallback: 'getJson',
                type: 'POST',
                async: true,
                success: function(data){
                    layerSource.clear();
                    layerSource.addFeatures(staticVector.readFeatures(data));
                    layerSource.dispatchChangeEvent();
                }
            });
}

I had to use the solution above and not use the layer source as source.Vector for example as the projection was not correct otherwise. Please note that the solution listed is for Openlayers 3.0.0


texts: QGIS 3.4 Layout manager, attribute table, scale of map

texts:
I am trying to produce maps faster than I currently do. I was thinking to use the "show only features visible within a map" option. I already use it for the coordinates table and I am trying to add more attribute tables in it such as the map's information.

In the attribute table, I can not store the Map 1 scale. Of course I can use the scale bar option, style>numeric which is automatically changing the scale number, but I hope to find out something...I don't know, something in order with my map style.

If I use the scale bar I have to customize it to look like it is in order with the information's attribute table, or I have to place it somewhere else within my map. I have uploaded a picture of my project, the only thing that is missing is the scale number.

Is there any expression that autofills the map scale value? The result will be, when I have to draw 5,10,100 polygons, while I finish the polygon creation I will fill the attributes table and later use the layout manager to export maps faster, or use atlas.


texts: What is the minimal data necessary to reconstruct GPS location?

texts:
Imagine that a minimal GPS device is attached to a moving object (animal, shipping container, geocache object, etc).  Every few months, data from the device is downloaded for post-processing.

What is the minimal set of data the device must collect so that post-processing can ascertain the device's position history?

Could the device simply store demodulated L1 signals with a timestamp?  Would that be enough to calculate the latitude, longitude and elevation during post-processing?

I'm interested in understanding how much GPS processing must be done on the receiver and how much can be postponed to post-processing.


texts: Getting random values from geometryType() in a standalone PyQGIS script

texts:
I am asking this question based on the result I received from this earlier post. The following script only works if I set geometryType() == 3 as that is what is being printed out in the Python console even though @nickves from the previous post mentioned that 0, 1 and 2 are for points, lines and polygons respectively.

Could someone point out my mistake please? Feel free to cross this post over to Stack Overflow, I only posted it here as the script is based on geometry data.

##Test=name
import os
import glob
from qgis.core import *
from os.path import expanduser
home = expanduser("~")

#   Folder path of the Results for shapefiles
path_dir = home + "\Desktop\Test\\"
path_res = path_dir + "Results\\"

def run():
#   Set directory and search for all polygon .shp files
    os.chdir(path_dir + "Shapefiles\\")
    for fname in glob.glob("*.shp"):
        shapefile = QgsVectorLayer( os.chdir(path_dir + "Shapefiles\\"), fname, "ogr" )
#      print shapefile.geometryType()
        print shapefile.wkbType()

#   Clip .shp files with the polygon shapefile "Grid.shp" and save files to Result folder
#        if shapefile.wkbType() == 2:
#            polygon_output=processing.runalg("qgis:clip", path_dir + "Grid.shp", fname, path_res  + "/"+ fname)

#   Use Distance to nearest hub function on point.shp files with the polygon shapefile "Grid.shp" as Hub layer and save files to Result folder
        if shapefile.wkbType() == 0:
            point_output=processing.runalg("qgis:distancetonearesthub", path_dir + "Grid.shp", fname, 'HubName', 0, 0, path_res  + "/"+ fname)
run()


texts: Map not get updated when Dataset get updated using CartoDB

texts: I created a dataset in CartoDb using a CSV and created  a map . After that i updated one record's latitude and longitude using carto api. On Info window i print lat and long and it shows updated value. But marker shows in prvious lat and long position not in updated lat and long position.


texts: Routing consecutive set of points on network

texts:
I need to generate routes based on a consecutive set of points exactly as given in this routing script by Anita Graser.

As given in this image, I have a layer of consecutive points as well as a network layer. I need to generate a path along the network using these points.

I tried using her script modifying the lines of code so that it may work in QGIS 3.x

However I get an error indicating that the Network Analysis library couldn't be found.

Is there any method I could use to achieve routing as mentioned here or a way I could edit this script so that it will function in QGIS 3.x?


texts: Chorpleth Data visualization in Mapbox Leaflet API

texts:
I am using Mapbox Leaflet API. I have followed the following tutorial of Mapbox.

https://www.mapbox.com/mapbox.js/

(Please change to Data visualization Tab)

Onclick its zooming on state and hover its showing popup. I am trying to get the state name on click to show more data from database in another div. If I can get the state name on click with zooming then my problem can be solved. How can I do this?

I used the following code. In which the hover data shows in top right corner. Can I show it in a fixed div?

            var info = L.control();

        info.onAdd = function (map) {
            this._div = L.DomUtil.create('div', 'info');
            this.update();
            return this._div;
        };

        info.update = function (props) {
            this._div.innerHTML = (props ?
                '<b>' + props.NAME + '</b>'
                : 'Hover over');
        };

        info.addTo(map);


texts: How to present statistics for QGIS plugin?

texts:
I'm developing a plugin for QGIS 2.18 where a user can obtain some statistics from a layer, something similar to this:

The above tool can be accessed from the menubar:

Raster > Miscellaneous > Information

What kind of Qt object is the box above and how can I print information not only in a similar format but also in an efficient manner?

At the moment, I'm sending text to a QTextBrowser using something like:

self.dockwidget.textBrowser.setText(str('Layer name: ' + str(layer.name()) +
                            '\nDate: 20/02/2017' +
                            '\nSize: 5 Mb' +
                            ...))


texts:
In ArcGIS I have a 3 Landsat NDVI datasets for 3 consecutive months and would like to calculate the mean bare soil (in hectares) for which I have manually worked out to be between the values of 105 and 126 for my AOI.

I have tried using the raster calculator, however when I go back to validate the results for say value 105, the count values across the 3 datasets are 5,40 and 35 respectively, shouldn't the mean count be 26.6 (5+40+35/3)? However in the output dataset, I get a count value of 2.

What are I doing wrong or maybe I have missed a step in ArcGIS?


texts: Unable to open feature class - Failed to execute (Raster to Polyline)

texts:
I'm working in ArcGIS 10.4.1 in the ModelBuilder with the iterate feature selection iterator. Everything works out just fine. But in the end I would like to convert my raster-output via "Raster to Polyline" to a shapefile.

This leads to the following error:

Executing (Raster to Polyline): RasterToPolyline "P:\path\Scratch.gdb\CostPat_Ziel_1" "P:\path\Scratch.gdb\RasterT_CostPat_1.shp" NODATA 0 SIMPLIFY Value

Start Time: Thu Apr 05 07:59:41 2018
ERROR 999999: Error executing function.
The table was not found. [RasterT_CostPat_1.shp]
ERROR 010157: Unable to open feature class P:\path\Scratch.gdb\RasterT_CostPat_1.shp.
Failed to execute (Raster to Polyline).
Failed at Thu Apr 05 07:59:41 2018 (Elapsed Time: 0,38 seconds)

Does anyone have an idea what could cause the error and how to solve it?
I checked the other questions about this issue but couldn't really understand what lead to it's success in the end, since I'm not working in arcpy but in the ModelBuilder and my understanding of python isn't that good.


texts:
I am using Mapnik v2.2.0 for Python 2.7 (32 bit - Anaconda distribution) at the moment and I wanted to use it in a rudimentary CGI script. The mapnik is definitely installed correctly as it runs without errors if launched straight from Python. However, when I launch one script through another, it gives an

ImportError: No module named mapnik

In other words, consider code:

Script 1:

import CGIHTTPServer, BaseHTTPServer
address = ('', 8000)
handler = CGIHTTPServer.CGIHTTPRequestHandler
server = BaseHTTPServer.HTTPServer(address, handler)
server.serve_forever()

Script 2:

 print '<form method="POST" action="Script3.py">'

Script 3:

import mapnik

Then, accessing 127.0.0.1:8000/Script2.py launches Script3, which then gives an ImportError.

Is there some compatibility issue about external Python modules being called through CGI?

Is that a problem with Anaconda in particular?

I have partially resolved the issue - copying mapnik to Anaconda directory solved it. HOWEVER, now when the CGI script tries to create a postgis datasource, it returns a Runtime Error. Now, I don't know if PostgreSQL and Postgis somehow bootstrap themselves to the mapnik installation/its original location and trying to call it from what they deem to be a 'different' mapnik fails... Creating the postgis datasource works fine if I do it straight from Python. Thus the problem persists:

Does Anaconda introduce any compatibility/package visibility problems in running its Python scripts as CGI scripts?