texts: Finding the layer in a QGIS Custom dialog

texts:
I have a custom form that calculates some area values, I'd like to automatically fill the base field using the geometry of the feature if the user hasn't set some value specifically. So I have the following code:

def formOpen(dialog,layerid,featureid):
    global sqMField
    sqMField = dialog.findChild(QLineEdit,"property_area_m2")
    global sqFtField
    sqFtField = dialog.findChild(QLineEdit,"property_area_ft2")
    global haField
    haField = dialog.findChild(QLineEdit,"area_area_ha")
    global acreField
    acreField = dialog.findChild(QLineEdit,"property_area_acres")
    sqMField.textChanged.connect( sqMChanged )
    #if sqMField.text().strip() is None:
    layer = QgsMapLayerRegistry.instance().mapLayers()[layerid]
    feature = layer.getFeature(featureid)
    if feature.hasGeometry():
        area = feature.geometry().area()
        sqMField.setText(str(area))

This is called when I use the identify tool on a layer, having set this function as the Python init function on the fields tab of the layer properties. Thus I'm assuming the QGIS fills the parameters in for me?

But I get a KeyError error and on further checking it seems like I get a different layerid parameter each time the dialog opens, e.g:

An error occurred during execution of following code:
formOpen( _qgis_featureform_50_31, _qgis_layer_register20150529183519760_31, _qgis_feature_20170214103800202)

An error occurred during execution of following code:
formOpen( _qgis_featureform_51_32, _qgis_layer_register20150529183519760_32, _qgis_feature_20170214103829234)

So I could probably fix it by stripping some stuff off the layerid but that seems wrong. Can anyone show me what I'm missing?


texts: How do I change the polygon fill color and border color for SpatialPolygons objects?

texts:
I have SpatialPolygons or SpatialPolygonsDataFrames which I'd like to plot.  How do I change the color using the three plotting systems in R (base graphics, lattice graphics, and ggplot2)?

Example data:

library(sp)
Srs1 = Polygons(list(Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2)))), "s1")
Srs2 = Polygons(list(Polygon(cbind(c(5,4,2,5),c(2,3,2,2)))), "s2")

SpDF <- SpatialPolygonsDataFrame( SpatialPolygons(list(Srs1,Srs2)),
            data.frame( z=1:2, row.names=c("s1","s2") ) )
spplot(SpDF, zcol="z")


texts:
I have a project where I have to download DEMs from USGS and mosaic them. So I downloaded them from EarthExplorer and imported them into GRASS.

When I start the GUI version of r.patch using the command console, the raster generated is blank and is not able to show / compute any raster. The GUI based raster query command generates an asterisk *.

On linux, I switch to the command window and type the following commands:

MAPS=`g.mlist type=rast sep=, pat="map_*"`
g.region rast=$MAPS
r.patch in=$MAPS out=mosaic

and owing to the property of the BASH shell, the mosaic happens. However, the Windows version of GRASS does not have any command window (as in MS-Command Prompt Shell). How do I have the same output on Windows? (since the GUI version of r.patch does not seem to work at all).


texts: Using if else syntax in field calculator with Python?

texts:
I want to calculate a field in the field calculator that are dependent on the values in 4 other columns.

My columns are "A", "B", "C" and "D"

Now I want to fill the column "X" with:

if "A" and "B" are equal "0" I want to do "calculation_1_(A,B,C,D)"

if only "A" equals "0" I want to do "calculation_2_(A,B,C,D)"

if only "B" equals "0" I want to do "calculation 3_(A,B,C,D)"

else I want to do "calculation_4_(A,B,C,D)"

Can somebody give me the code for this? I am struggling with syntax and if/else structure...


texts: Understanding polygonize tool- QGIS 2.14

texts:
I tried to convert all the roads (red) from this raster into vector:

but when i use the convert tool- Polygonize, i get this result:

whereas, i expect to  get all the roads with single clear DN/ RGB.
 How can i solve this issue?


texts: Self written polygon tool is not creating output

texts:
I have written a script with the aim of producing a rectangular buffer from two sets of coordinates that denote the ends of a line. The aim is to create an array of points from the end points of the line and create a polygon from them.

My tool is reporting as working but is not creating an ouput (I have checked the output folder):

import arcpy
import math
import sys

def getBearing(x0,y0,x1,y1):

    deltaX = x1 - x0
    deltaY = y1 - y0
    return ((math.atan2(deltaY, deltaX)/math.pi*180)+360) % 360

def createRectpoints(x0,y0,x1,y1,displacement,bearing):

    #Bottom left corner.
    xr_1 = x0 - (displacement*math.cos(math.radians(90-bearing)))
    yr_1 = y0 + (displacement*math.cos(math.radians(bearing)))
    #Bottom right corner.
    xr_2 = x0 + (displacement*math.cos(math.radians(90-bearing)))
    yr_2 = y0 - (displacement*math.cos(math.radians(bearing)))
    #Top left corner.
    xr_3 = x1 - (displacement*math.cos(math.radians(90-bearing)))
    yr_3 = y1 + (displacement*math.cos(math.radians(bearing)))
    #Top right corner.
    xr_4 = x1 + (displacement*math.cos(math.radians(90-bearing)))
    yr_4 = y1 - (displacement*math.cos(math.radians(bearing)))

    bl_corner = (xr_1, yr_1)
    br_corner = (xr_2, yr_2)
    tl_corner = (xr_3, yr_3)
    tr_corner = (xr_4, yr_4)

    rectangle_points = [bl_corner, br_corner, tl_corner, tr_corner]

    return rectangle_points

if __name__ == '__main__':

    # Take in Arguments
    # Arguments are optional
    outFC_location = arcpy.GetParameterAsText(0)
    end1_Easting = float(arcpy.GetParameterAsText(1))
    end1_Northing = float(arcpy.GetParameterAsText(2))
    end2_Easting = float(arcpy.GetParameterAsText(3))
    end2_Northing = float(arcpy.GetParameterAsText(4))
    fcName = (arcpy.GetParameterAsText(5))
    fcPath = outFC_location.rpartition("\\")[0]

    outFC = arcpy.CreateFeatureclass_management(fcPath, fcName)

    x0 = 500138
    y0 = 348941
    x1 = 502291
    y1 = 349303
    thickness = 180
    displacement = thickness/2
    bearing = getBearing(x0,y0,x1,y1)
    ext_r_points = createRectpoints(x0,y0,x1,y1, displacement, bearing)

    polygon_array = arcpy.Array([arcpy.Point(ext_r_points[0][0],     ext_r_points[0][1]),arcpy.Point(ext_r_points[1][0], ext_r_points[1][1]), arcpy.Point(ext_r_points[2][0], ext_r_points[2][1]),arcpy.Point(ext_r_points[3][0], ext_r_points[3][1])])

    mypolygon = arcpy.Polygon(polygon_array)

    cursor = arcpy.da.InsertCursor(outFC, ['SHAPE@'])
    cursor.insertRow([mypolygon])

What is the error in my code or my approach?


texts:
Can I download a layer from ArcGIS online?

Such as:  the World Urban Areas layer ! I could download the layer with the .pitem extension that opens the layer in ArcGIS desktop when online. But I wanted to download the shapefile to use it offline.


texts:
Is there a way of retrieving the attributes of a WMS layer that can be used to construct a filter?

Unless I'm mistaken GetCapabilities does not do this and GetFeatureInfo requires a feature to be selected via x/y or i/j

Other thought was to use GeoNetwork for playing back attribute metadata but this then requires a maintenance step


texts:
I’ve been using GDAL with python to manipulate shapefiles. When opening a source file I first set the driver to “ESRI Shapefile” before calling the driver’s "Open" method with the required shapefile.

I have had no issues with this; however I am curious what the difference is between the Driver instance method “Open” and the ogr function “Open”. For example, what is the difference between:

driver = ogr.GetDriverByName("ESRI Shapefile")
source = driver.Open(“O:\myshp.shp”,0)

and

source = ogr.Open(“O:\myshp.shp”,0)

Is there a particular scenario where you would use one over the other?


texts: PostgreSQL trouble editing points / lines / polygons in QGIS

texts:
I have a problem with postgresql and QGIS :

I can add points/lines/polygons and fillup field

But I can't :

delete points/lines/polygons
modify points/lines/polygons (move or modify field)

ex : dbname='Europe' host=localhost port=5432 user='postgres' sslmode=disable key='tid' estimatedmetadata=true srid=900913 type=Point table="public"."planet_osm_point" (way) sql=

QGIS is connected as admin level into database.
With pdAdmin III I can do all (create, delete, modify...)

The postgresql database is imported from OSM with osm2pgsql.

On other layer, like .shp, I don't have this issue.

Any idea ?

Config : Ubuntu 14.04 / Posgresql 9.4 / QGIS 2.10


texts: Getting email addresses of pointers after selection with JSON or array and ArcGIS API for JavaScript?

texts:
I am trying to create a map where I can create a selection area, and get info of all graphic pointers under it, I tried to modify with following example, but they are using web service and queries, and I want it with json or array.

Thats the example I am following

I want to get email addresses of pointers after selection. Here is a fiddle to start with.

Code Snippet from the fiddle:

 var map;

  require([
    "esri/map",
    "esri/geometry/Point",
    "esri/symbols/SimpleMarkerSymbol",
    "esri/graphic",
    "esri/layers/GraphicsLayer",
    "dojo/domReady!"
  ], function(
    Map, Point, SimpleMarkerSymbol, Graphic, GraphicsLayer
  ) {
    map = new Map("map", {
      basemap: "streets",
      center: [-88.21,42.21],
      zoom: 10
    });
    map.on("load", function() {
      var content = 'email@address.com';
      var gl = new GraphicsLayer();
      var p = new Point(-88.380801, 42.10560);
      var s = new SimpleMarkerSymbol().setSize(20);
      var g = new Graphic(p, s,{ 'title': 'Title', 'content': content }, new esri.InfoTemplate('${title}', '${content}'));
      gl.add(g);
      map.addLayer(gl);
    });
  });


texts: QGIS 2.10 Unable to add features to a memory layer

texts:
I'm trying to add features to a memory layer.
This is the layer creation :

memlayer=QgsVectorLayer("{zr_typegeom}?crs=epsg:4326".format(zr_typegeom = typegeom), "memlayer", "memory")
QgsMapLayerRegistry.instance().addMapLayer(memlayer, False)
root = QgsProject.instance().layerTreeRoot()
memlayerNode = QgsLayerTreeLayer(memlayer)
root.insertChildNode(0, memlayerNode)
self.iface.setActiveLayer(memlayer)
memlayer.startEditing()

Then I create the "new_feature" list of features. Users have selected features in an active layer.
Each feature is split if it is multipart, or just pasted in "new_features" if it is single part.

Then I copy all the features in the memory layer with the "addFeatures()" property.

new_features = []
for feature in coucheactive.selectedFeatures() :
    geom = feature.geometry()
    # check if feature geometry is multipart
    if geom.isMultipart():
        temp_feature = QgsFeature(feature)
        # create a new feature using the geometry of each part
        for part in geom.asGeometryCollection ():
            temp_feature.setGeometry(part)
            new_features.append(QgsFeature(temp_feature))
    else :
        new_features.append(feature)
memlayer.addFeatures(new_features, True)
memlayer.commitChanges()
print "memlayercount="+str(memlayer.featureCount())

The "new_feature" list contains features, I've checked that with

    new = [QgsGeometry(feature.geometry()) for feature in new_features]
    print "new="+str(new)

But the memory layer (memlayer) stays desesperately empty. (memlayercount = 0)

Is it possible to use the "addFeatures()" property on a memory layer?
If so, what am I doing wrong?


texts: Accept multiple input types in ArcGIS Script Tools UI

texts:
I'm working on a python script that calculates aggregations of ACS Variables (i.e. adding "Renters who spend more than 30% of Annual Income on Rent", "...40%...", "...50%...", etc.).  The tool tracks margin of error and also calculates normalized values for the aggregate total. I am using the script tool interface in ArcMap (right click a toolbox > add script > configure properties) to make a tool that has a GUI so that students who don't have scripting experience can use it with ease.

Which data type I can choose for Input Dataset value so that the field accepts tables, shapefiles, or feature classes? The ACS data they will be using can come in all three formats, and I don't want them to have to struggle with converting between data types or making joins (it's a very low-level GIS class).

NOTES:

"Dataset" does not work because then the "Combine Fields" and "Normalize Field" boxes don't automatically populate with options for field types.
I'm not even sure that what I want to accomplish is possible.


texts: How to select random adjacent census tract

texts: I have set of census tracts spaced out across a city and I would like to randomly choose an adjacent census tract to explore nearby demographic data. I'm not sure if there is an easy process for getting adjacent census tracts for selected census tracts.


texts:
Encountered another roadblock. I have a working FME script that I want to automatically run using a console app.

I created a simple batch file which accepts a MDB file path as parameter:

  fme.exe E:\sample.fmw --SourceDataset_GEODATABASE_MDB "%1"

when I run this batch file, everything works well.

But when I try to do the same thing only in my console application using the following  code:

processInfo = New ProcessStartInfo("cmd.exe", "/c C:\executeFME.bat C:\sampleFile.mdb")
processInfo.CreateNoWindow = True
processInfo.UseShellExecute = False
processInfo.RedirectStandardError = True
processInfo.RedirectStandardOutput = True

process__1 = Process.Start(processInfo)
process__1.WaitForExit()

Dim output As String = process__1.StandardOutput.ReadToEnd()
Dim [error] As String = process__1.StandardError.ReadToEnd()

Dim exitCode = process__1.ExitCode
Console.WriteLine("ExitCode: " & exitCode.ToString(), "ExecuteCommand"
process__1.Close()

I get the error "Python Exception : No module named arcgisscripting"

I have a Startup python script that will check the geometries of the supplied mdb file and this is where it errors out.

Do I still need to configure something to make it to work?

Thanks.

EDIT

I noticed in the log files that the manually executed batch file using the correct Python Interpreter: C:\Windows\SysWOW64\python27.dll while the batch file executed by the console app uses a different one: C:\apps\FME\fmepython27\python27.dll. I tried modifying the Interpreter settings by using:

fme.exe APPLY_SETTINGS SYSTEM "Python/Python Interpreter" c:/windows/SysWOW64/python27.dll

Ran it again and it was still using the old interpreter. I think this is the cause of this but I'm out of ideas on how to fix it. Please help!


texts: How to slice a reduced gaussian gridded grib with xarray?

texts:
I want:
to get list of coordinates of points within the specified area (ideal would be geopandas from shapefile or something like this)
I don't want to interpolate the grib, just extract points by coordinates x,y
The GRIB is ECMWF reduced gaussian, so it is not a regular grid.

How can I do this from xarray dataarray (opened with cfgrib)?
How can I just get a list of lats and longs?

Here is the grib_var info:

<xarray.DataArray 'tp' (values: 1252347)>
dask.array<open_dataset-4b0a50a5721767d0c4be8de49d37aaa8tp, shape=
(1252347,), dtype=float32, chunksize=(1252347,), chunktype=numpy.ndarray>
Coordinates:
   number      int64 ...
   time        datetime64[ns] ...
   step        timedelta64[ns] ...
   surface     int64 ...
   latitude    (values) float64 dask.array<chunksize=(1252347,),
    meta=np.ndarray>
   longitude   (values) float64 dask.array<chunksize=(1252347,),
    meta=np.ndarray>
   valid_time  datetime64[ns] ...
Dimensions without coordinates: values
Attributes:
   GRIB_paramId:                    228
   GRIB_shortName:                  tp
   GRIB_units:                      m
   GRIB_name:                       Total precipitation
   GRIB_cfVarName:                  tp
   GRIB_dataType:                   fc
   GRIB_missingValue:               9999
   GRIB_numberOfPoints:             1252347
   GRIB_totalNumber:                0
   GRIB_typeOfLevel:                surface
   GRIB_NV:                         0
   GRIB_stepUnits:                  1
   GRIB_stepType:                   instant
   GRIB_gridType:                   reduced_gg
   GRIB_gridDefinitionDescription:  Gaussian Latitude/Longitude Grid
   GRIB_N:                          1280
   GRIB_pl:                         (588, 592, 596, 600, 604, 608, 612,
        616,...
   long_name:                       Total precipitation
   units:                           m


texts: How can I iterate Selection by Attributes?

texts:
I have a large data shapefile for the state of New York. Each shape has a code corresponding to each county, so I want to iterate "Selection by Attribute" for each code, create a layer from all the parcels with the same county code, and export that into a separate shapefile.

How would I go about doing this? I am using Arcmap 10.1


texts: Geoprocessing Service Failed: Could not service request

texts:
I have a geoprocessing service that gives a very basic general error:

 esriJobMessageTypeInformative: Submitted.
 esriJobMessageTypeInformative: Executing...
 esriJobMessageTypeInformative: Executing (ReportWilliamsTest2):
 ReportWilliamsTest2
 esriJobMessageTypeInformative: Start Time: Thu Feb 08 10:44:21 2018
 esriJobMessageTypeInformative: Executing (ReportWilliamsTest2):
 ReportWilliamsTest2
 esriJobMessageTypeInformative: Start Time: Thu Feb 08 10:44:21 2018
 esriJobMessageTypeInformative: Running script ReportWilliamsTest2...
 esriJobMessageTypeInformative: Processing: 1
 esriJobMessageTypeError: Failed.
 esriJobMessageTypeInformative: Could not service request.

Is there any way for me to prompt a better error message from Esri Job Messages?

(I realize I can print messages to deduce the place my code is failing, but I want to receive more info from ArcGIS Server as to why it could not service the request)

Also, my service runs fine when testing locally.


texts: I would like to make 10 maps over the exact same area. How can I lock the view in QGIS so I don't accidentally change it.


texts: How to enter metes and bounds descriptions in ArcMap with only a Basic license?

texts:
I am using ArcGIS for Desktop 10.1 Basic without extensions. How can I convert a metes and bounds description such as below?

For example, 47 degrees, is there a way you can convert the degrees minutes seconds while using CONTROL G (Direction / Length)? I switched in the Editing Options the direction type to Quadrant Bearing and Direction Units to DMS.

SW, SOUTH 0 DEGREES 02' WEST, 110.51 FEET;
SOUTH 47 DEGREES 52' WEST, 246 FEET;
SOUTH 74 DEGREES 41' WEST, 167.25 FEET;
NORTH 75 DEGREES 19' WEST, 274.85 FEET;
NORTH 41 DEGREES 49' WEST, 339.45 FEET;
NORTH 89 DEGREES 14' WEST, 42.60 FEET;
AND EAST 876.75 FEET TO BEGINNING, CONTAINING APPROXIMATELY 4 ACRES,LESS 4 ACRES IN THE NE CORNER OF SAID SW/4


texts: Loop through folder and join pairs of files with the same prefix

texts:
I have two sets of shapefiles that I would like to join based on a similar field. They are all stored in a path folder which is stored as the variable "steps".
One group of shapefiles are polygon shapefiles named something like "polygonA_footprints.shp", "polygonB_footprints.shp" , "polygonC_footprints.shp"
The other group are a set of points shapefile named something like "polygonA_points.shp" "polygonB_points.shp", "polygonC_points.shp"
Both groups have the same field "PID".
I'd like to join the .dbf table from the points.shp layer to their matched polygon.shp.
The following is my code:
arcpy.env.workspace = steps
arcpy.env.overwriteOutput = True
shplist = arcpy.ListFiles("*footprints.shp")
tablelist = arcpy.ListFiles("*points.dbf")
for shp in shplist:
    sprefix = shp.rsplit("*footprints.shp")[0]
for t in tablelist:
        tprefix = t.rsplit("*points.dbf")[0]
if sprefix == tprefix:
        arcpy.AddJoin_management(shp,"PID",t,"PID")

Running the code in PyCharm does not produce any error messages, however when I open the polygon.shp in ArcMap the join is not complete. I've tried using "*footprints.dbf" and "*footprints.shp" in Line 3 and experimented with my indentations of the 'for' lines to no avail.
Can someone tell me what's wrong with my code? I have also tried:
        arcpy.env.workspace = steps
        arcpy.env.overwriteOutput = True
        shplist = arcpy.ListFiles("*footprints.shp")
        tablelist = arcpy.ListFiles("*geotagswBearings.dbf")
        for shp in shplist:
          sprefix = shp.rsplit("*footprints.shp")[0]
             for t in tablelist:
                    tprefix = t.rsplit("*geotagswBearings.dbf")[0]
            if sprefix == tprefix:
                arcpy.AddJoin_management(shp,"PID",t,"PID")

and:
        arcpy.env.workspace = steps
        arcpy.env.overwriteOutput = True
        shplist = arcpy.ListFiles("*footprints.shp")
        tablelist = arcpy.ListFiles("*geotagswBearings.dbf")
        for shp in shplist:
            for t in tablelist:
                    sprefix = shp.rsplit("*footprints.shp")[0]
                    tprefix = t.rsplit("*geotagswBearings.dbf")[0]
                    if sprefix == tprefix:
                        arcpy.AddJoin_management(shp,"PID",t,"PID")

and I've also tried substituting "*footprints.dbf" for "*footprints.shp" as I thought it might need the input_layer table instead of feature class based on the Desktop help section (https://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/add-join.htm)


texts: How to download map data of a specific country part?

texts:
For my project, I have to download the OpenStreetMap data of canton Zurich in Switzerland. I found osm files, but only for the whole country of Switzerland.

I already tried the export function of OpenStreetMap, but it did not work, because the area is to big.

I also tried http://export.hotosm.org, but the country is not supported.

Is there a way to download the map data for this specific part? The Switzerland package is quite big..


texts: Map gear's OL3-Google-Maps not showing the google layer even after adding google layer

texts:
I am using Map Gear's OL3-Google-Maps in order to load the google base map in OL3,
I am adding like this

//Before adding this i am removing the OSM base map tile layer and adding it.
var googleLayer = new olgm.layer.Google();
this._map.addLayer(googleLayer);
var olGM = new olgm.OLGoogleMaps({
                map: this._map
            });
olGM.activate();

But after adding this i am getting empty white screen,In network the request is also not going to bring the tiles.


texts:
What is the easiest possibility to create a geofence and to track if subjects  cross the fence?

I assume the fence is a simple polygon vector?

What do I need for the cars? GPS data set? GPS layer?


texts: Requirements for BaseCustomLayer in ArcScene?

texts:
What must be implemented/included to add a layer deriving from BaseCustomLayer to ArcScene?

I have had success adding a BaseCustomLayer to ArcMap by implementing Draw, AreaOfInterest, Cached, MaximumScale, MinimumScale, SpatialReference, Visible, and Name. However, when I attempt to add this layer to ArcScene it gives me the error "ArcScene cannot add this layer".


texts: Converting GPX data stored in CSV into geography data type (WKB or WKT)?

texts:
I have a CSV that contains some data relating to hikes undertaken by various people. For each hike, there is an ID, max_elevation, length, start_time, end_time, and GPX field (along with some other data - see image below).

The XML that makes up a GPX-file is stored for each hike under the GPX column in the CSV.

Essentially, my goal is to bring this CSV into SQL Server and conduct spatial operations on it. In order to do so, I would like to convert each GPX for each row to a geography data type (WKB or WKT)

Is there any way I can convert each GPX into a WKT or WKB as a line geometry?

Open to solutions in Python, SQL, or anything else you guys can think of.

Essentially, I'd like the output to look something like this:

Here is a link to the complete dataset i am using (found on Kaggle).


texts:
I simply download a map from here http://neo.sci.gsfc.nasa.gov/view.php?datasetId=MCD12C1_T1. this map is a tiff file.

  mapd <- raster("C:\\MCD12C1_T1_2011-01-01_rgb_1440x720.TIFF")
  plot(mapd)

you can see there is no legend at all, any help


texts: How to dissolve inner polygons in a multipolygon

texts:
I'm trying to get the boundary of a collection of zip codes. Here is my current sql:

SELECT ST_AsText(ST_SimplifyPreserveTopology((ST_Union(geom)), .003)) as poly
FROM zcta5_data
WHERE zcta5 IN ('zipcodes')

Here, is what my result looks like. How do I get rid of the inner polygons?


texts: Unable to match a shapefile to a TIFF with different CRS

texts:
I have a shapefile in EPSG:27700 with the linestring coordinates of locations in Scotland and trying to match them with a satellite image provided as a TIFF file with EPSG:4326 that has been taken from a satellite.
When I try to overlay the two layers on QGIS by setting the project CRS to EPSG:27700, the two layers don't exactly match as you see on the image, they are actually off by a bit.
I've tried using both EPSG:4326 and EPSG:27700 as the project default CRS but no matter which one I used, the layers still did not match.
Datum transformation used:
Inverse of OSGB 1936 to WGS 84 (9) + British National Grid +proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +inv +proj=hgridshift +grids=OSTN15_NTv2_OSGBtoETRS.gsb +step +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy –

Would the solution be trying to use a custom projection instead?


texts: Transforming Robinson to Equirectangular

texts: I need convert this http://bioval.jrc.ec.europa.eu/products/gam/images/large/access-map.png (is it robinson?) to Equirectangular (ESPG:32662) How can i get this using gdalwarp?


texts: ArcGIS Pro removes layer from project if data source is deleted

texts:
I have a script that deletes a feature class and then recreates it.  I've noticed that in ArcGIS Pro 2.0, as soon as a feature class is deleted, if there are any map layers that have that feature class as a data source, if they are visible, a schema lock error occurs.  If they are turned off, they are automatically removed from the map (rather than simply remaining in the map with a broken data source).

It seems to happen both if I delete a data source while running a script, or if I do it in the python window.  For example, in an ArcGIS Pro project, using the Python window, try:

arcpy.Delete_management(any feature class that is represented by a corresponding layer in the TOC)

If the layer is visible, you will get:

ExecuteError: ERROR 000464: Cannot get exclusive schema lock.  Either being edited or in use by another application.
Failed to execute (Delete).

If the layer is not visible, it is removed from the map.  Is there a way to prevent this from happening?  I would prefer an option to have a layer remain with a broken data source rather than be automatically removed.


texts: how to pass value like 100,102,103 to view params

texts:
I am trying to zoom plot numbers.Plot numbers like
1
10-12
13/P
road
20(A)
100&102
and etc.I am able to zoom to all combination plot numbers except 1,2,3.when I pass such value its trowing error:

1 feature types requested, but found 2 view params specified

geoserver sql view is:

select * from plotboundary where nmindar='%nmindar%' and plno='%plno%'

default values and validation are

Name  | Default Value   | validation

nmidar| Hanagawadi I A  | ^[\w\d\s]+$

plno  |  100,102&103    | ^[ A-Za-z0-9_ *@.\/#&+-\,()-_]*$

ajax function:

 $.ajax({
            url: 'http://XX.168.1.XX:8089/geoserver/XX/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=XX:vwplot&maxFeatures=5000&outputFormat=text/javascript',
            contentType: 'application/json',
            dataType: 'jsonp',
            jsonpCallback: "parseResponse",
            data: {
                viewparams: "nmindar:" + nmindar + ";plno:" + plno
            }

Can any one tell me how to pass value to viewparams in geoserver, value includes comma. For example as mentioned above "100,102&103" is a single value(plot number).Here   comma is not a separator.


texts: Shifting .dwg file to align with a shapefile

texts:
I'm trying to integrate data in a .dwg file collected by surveyors  into an ArcView 10.2 project I have projected as NAD83 UTM Zone 10 N.  The survey data is in an undefined coordinate system but I have values for the translation parameters, which are below as described by the surveyors.

Which utilities can perform this transformation?

Our surveys were based on a local assumed coordinate system.
To translate our local coordinates to UTM, you will have to (1) apply a scale factor to your UTM mapping coordinates of 0.99960196 and (2) apply the following shifts in northings and eastings : ΔN = 5 441 341.306 & ΔE = 491 604.143.  After going thru this procedure, you will have a list of UTM mapping coordinates.


texts: I am working with a project that resulted in the composition of five(5) Map composers, then suddenly when I transfer my whole project in a different computer all the Map Composers made was lost. what went wrong?  and how can I retrieve those missing map composers ?


texts: Rule-Based Symbology Label disappers from Layers Panel

texts: Attached is a screenshot of my project.  As you can see from the 'Layer Styling' panel I have labels for my 'sensor.udl' symbols.  However, they are only visible on the 'Layers' panel when I re-start QGIS or when I double click the layer.  They are visible, then disappear when I click somewhere else. Is this a bug?


texts: Cannot catch click event on FeatureLayer in ArcGIS API for JavaScript 4?

texts:
I've got a SceneView with a FeatureLayer, and I'm trying to catch every click on a PictureMarkerSymbol to display additional data under the map.

The map works well, so do symbols and popups, but I never catch any event, am I missing something?

require([
    "esri/Map",
    "esri/views/SceneView",
    "esri/layers/FeatureLayer",
    "esri/renderers/UniqueValueRenderer",
    "esri/symbols/PictureMarkerSymbol",
    "dojo/on"
], function(
    Map, SceneView, FeatureLayer, UniqueValueRenderer, PictureMarkerSymbol, on
) {

    var map = new Map({ ... });
    var view = new SceneView({ ... });

    view.then(function() {

        var renderer = new UniqueValueRenderer({ ... });
        var pins = [...];
        pins.forEach(function (element) {
          renderer.addUniqueValueInfo(element,
            new PictureMarkerSymbol({ ... })
          );
        });

        layerMarkers = new FeatureLayer({
            title: "Labels Layer",
            url: "...",
            definitionExpression: "...",
            renderer: renderer,
            outFields: ["*"],
            popupTemplate: { ... }
        });

        layerMarkers.on("click", function (evt) {
            console.log(evt.graphic.attributes);  // No output??
        });

        map.add(layerMarkers);

    });
});


texts: How do you add North Arrow which adjusts to the map rotation in QGIS?

texts:
How do you add a working North Arrow into QGIS. One that will rotate if the map is rotated?

I'm aware that in QGIS the North Arrow icon is just an image (Layout->Add Image/Arrow), what I need to know is how to lock it to the map's rotation. The answer to this question states it's possible, but not how.

Googling is failing to bring up any useable answers; the tutorials I'm finding indicate not many people bother with this step.


texts: GEE create chart for the area of classified image

texts:
In Google Earth Engine I have classified a mosaic image using Random Forest, and using reducer the area of each class classified was determined by the code below.
var area_classified = ee.Image.pixelArea().divide(1e4).addBands(classified).reduceRegion({
  reducer: ee.Reducer.sum().group(1, 'group'),
  geometry: district.geometry(),
  scale: 50,
  tileScale: 16,
  maxPixels: 10e10
});
var outputReducers = ee.List(area_classified.get('groups'));
print('area of each class',outputReducers);

This output is a List of objects containing group:number, sum:area
group:number - say number 0 is for vegetation and sum:area is corresponding area
How can I create a chart from this output?
I have tried datatable chart and some others from the GEE guide and none of them works.


texts: OpenLayers Projection and Datum Question

texts: I had a conversation with a co worker that was asking about an OL map I am developing. She asked me what the 'projection' was and I said EPSG:4326. She didn't know what that means, so I said it's based on WGS84, to which she replied: that is a mercator, what is the projection? Can someone clear this up for me please?


texts: Also can't see WFS-T layer with OpenLayers and GeoServer (Windows)

texts:
I am in the process of learning for doing WFST - OpenLayers in web. I followed this tutorial in the GisTutor.

But I am stuck with two problems:

the WFS-T layer is not appearing
the feature created in client cannot be saved (no response when save button is clicked, and accordingly there is no additional row in the PostGIS table of WFST_TEST)

I followed this GIS.SE question and I also do not configured the Proxypass as instructed here (also because I do not have Apache running the GeoServer).

In the latter part of the discussion between Janne Mattila with Iant, Iant suggests that:

  don't run from file://somefolder/mytestpage.html always use localhost:28080/geoserver/www/mytestpage.html this should fix your problem. – iant

and then Janne seems to be happy:

  Nice and simple, that fixed it! I don't fully understand why it works like that, though. Can you explain what happens in OpenLayers when I access the page using file:// and when I use localhost:28080 instead? – Janne Mattila

I finally able to call my hHTML by localhost:8080/geoserver/www/rinotestpage.html in my browser, by putting my rinotestpage.html and the THEME folder (for bringing button PNG files to the app) into the C:\Program Files\GeoServer 2.3.2\data_dir\www. But my 2 problems in the above are persisting (WFS-T layer not appeared and feature created in client is not saved)

My question:

Janne and Iant, how did you crack this? How to solve the problem (WFS-T layer not appearing)?
Janne, did you put your testpage.html in the same folder as i did ? (C:\Program Files\GeoServer 2.3.2\data_dir\www).

For additional infos:

I am using : PostgreSQL 9.1.9.1 Windows 32-bit + PostGIS 2.0.3.1 + GeoServer 2.3.2 + Windows Server 2003 in VMWare Player 5.0.2
I can see in my firebug that there is "POST wfs" request to my http://localhost:8080/geoserver/wfs, but the request took forever and no response. I am guessing this is why my WFS-T layer is not shown.


texts: Image service and Copying Data to ArcGIS Server

texts: My aim to publish a raster layer as an Image Service from our ArcGIS server and consume it in our web application. I exported raster data that was residing on my workstation to our SQL Server from ArcMap (ArcSDE). Subsequently I am working on publishing it directly from the database. However, the last step of the Share As an Image Service process is copying the raster data to our ArcGIS Server. I am unable to find a way to eliminate it, wondering whether or not I could publish an image service from the database without having to create a copy of it in the server?


texts:
It is possible to know the CRS from an ascii file?

The information I have about it in the heading of the ascii file is the x and y corners:

xllcorner     -10,000416206603
yllcorner     34,999583430181


texts:
I am using geoExt and OpenLayers to plot some map. Everything worked well until I had to add some styling. To display it on the webpage, I need to use the CSS of my university and once I do that, I have some horizontal white lines between each tile (but not vertically though). The lines have always the same height. The problem seems to come only from the CSS, since if I remove it in the html (it is the first thing invoked in <head>), everything looks correct.

Searching here and on the web, I found than some people proposed to create a CSS after everything else which sets:

.openlayers-map img {max-width: none;}

But it didn't solve anything. Is there a way to tell to a div that it needs to load no styles but the one used by OpenLayers?

Here is a sample of the code I have:

 var osm = new OpenLayers.Layer.OSM(
            "Open Street Map"
    );
 bwms = new OpenLayers.Layer.WMS(
                    "usa:states - Tiled", "http://128.178.82.176:8080/geoserver/usa/wms",
            {
                    layers: "usa:states",
                    tiled: true,
                    transparent: true
            },{
                    singleTile: true,
                    projection: new OpenLayers.Projection("EPSG:4326") // specified because it is different than OSM's
            }
    );

   mapPanel = new GeoExt.MapPanel({
            renderTo: "mapPanel",
            map: new OpenLayers.Map({
                    projection: epsg900913,
                    displayProjection: epsg4326,
                    units: "m",
                    center: new OpenLayers.LonLat(6.59,46.39).transform(epsg4326,epsg900913)
            }),
            layers: [osm,bwms],
            // height/width in pixels
            height: 450,

            zoom: 10,
            border: false
    });


texts: Is there any working example for pgr_trsp ?

texts:
I'm trying to use pgrouting pgr_trsp function but result is useless. Exactly same code with pgr_dijkstra working OK and find shortest path between start and stop but with pgr_trsp it is look like random jumps around map.

I'm using this code

SELECT a.seq, a.id1 AS node, a.id2 AS to, a.cost, cr_2po_4pgr.osm_name,
ST_AsText(ST_GeomFromEWKB(decode(cr_2po_4pgr.the_geom,'hex'))) as geodata FROM pgr_dijkstra ('SELECT gid as id, source, target, cost FROM cr_2po_4pgr', $start,$end,false, false) as a left join cr_2po_4pgr on a.id2 = cr_2po_4pgr.gid

Based on documentation trsp should be almost same as dijkstra but i can use turn restriction code. But even basic is not working. What i'm doing wrong ?


texts: MapServer: Symbol color is set in mapfile. Is there a way to change it using javascript (ie not in mapfile)?

texts:
I have a mapfile where the symbol color is set to blue. In my html I have a hover event that brings a popup when the user puts their cursor over the symbol. Working as intended.

Now on that same hover, I'd like to change that blue to another color.

This seems tricky as the color is set in the mapfile.

I added a class to my html  tag, but can only modify content within the popup div...or so it seems.

map_body.html. Apologies for the lack of formatting but I tried to format it nicely within vim and got an unexpected token error, so I guess it has to be like this.

<! -- MapServer Template -->
<area shape="circle" class="map_circle" coords="[shpxy precision=0 proj=image yf=",7"
xf=","]" title="" alt="" onmouseover='displayCityInfoHover("

[Name],
[ICAO]

", [shpxy precision=0 proj=image yf=",7" xf=","],
[shpxy precision=0 proj=image yf=",7" xf=","])' onmouseout="hideCityInfoHover()"
onclick='displayCityInfo("

Name:	[Name]

Airport Code:	[ICAO]

Lat:	[LAT]

Long:	[LONG]

")' ">


texts: QGIS - Calculate area : different results between script and expression builder

texts:
When I run a script to calculate an area with PyQGIS I don't get the same result as when I calculate it with the Expression Builder.
Here is my script:
myLayer.startEditing()
myIndex = myLayer.fields().indexFromName("pyqgis")
for feature in myLayer.getFeatures():
    myLayer.changeAttributeValue(feature.id(), myIndex, round(feature.geometry().area()/10000, 4))
myLayer.commitChanges()

Here is my expression :
 $area /10000

Both fields are in the same type and have the same precision

But result isn't the same.

I'm uing QGIS 3.10.2 (LTR)


texts: GeoProcessing Tool Parameter: CoordinateSystem vs SpatialReference

texts:
So I'm adding a couple tools to my python toolbox. Most of the time I just used CoordinateSystem and leave good enough alone. Today I tried SpatialReference and noticed the result is the same. The the dialog box comes up asking user to select a coordinate system.

I see the explanation of the data types in the docs are a bit different but it seems the result is the same. Is this just some left over quirk or is there some really nuanced difference?

Below is my PYT for clarity.

class Toolbox(object):
def __init__(self):
    """Define the toolbox (the name of the toolbox is the name of the
    .pyt file)."""
    self.label = "Custom Python Tools"
    self.alias = "CustomPythonTools"

    # List of tool classes associated with this toolbox
    self.tools = [batchCAD2GDB]

class batchCAD2GDB (object):
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.category = "Data Processing"
        self.label = "Batch Cad to GDB Converter"
        self.description = "Creates a file gdb named CAD2FGDB.gdb at source folder, and converts any dgn/dwg files in source folder to a feature class datasets in CAD2FGDB."
        self.canRunInBackground = False

def getParameterInfo(self):
    """Define parameter definitions"""
    # parameter0
    param0 = arcpy.Parameter(
        displayName="Source Folder",
        name="source",
        datatype="DEFolder",
        parameterType="Required",
        direction="Input")
    # parameter1
    param1 = arcpy.Parameter(
        displayName="Reference Scale",
        name="referenceScale",
        datatype="GPDouble",
        parameterType="Required",
        direction="Input")
    # parameter2
    param2 = arcpy.Parameter(
        displayName="Coordinate System",
        name="coordinateSystem",
        datatype="GPCoordinateSystem",
        parameterType="Required",
        direction="Input")
    params = [param0, param1, param2]
    return params

def isLicensed(self):
    """Set whether tool is licensed to execute."""
    return True  # or False

def updateParameters(self, parameters):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a parameter
    has been changed."""
    return

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

def execute(self, parameters, messages):
    """The source code of the tool."""
    source = parameters[0].valueAsText
    referenceScale = parameters[1].value
    coordinateSystem = parameters[2].valueAsText
    import os
    # make a file gdb in source
    arcpy.CreateFileGDB_management(source, "CAD2FGDB.gdb")
    for root, dirs, files in os.walk(source):
        for fname in files:
            if fname[-3:] in ['dgn', 'dwg']:
                for i in ["-", " ", "(", ")"]:  # check for illegal characters in name
                    if i in fname:
                        oldName = root+"\\"+fname
                        newName = root+"\\"+fname.replace(i, "_")
                        os.rename(oldName, newName)  # rename file if illegal characters found
                        cadFile = newName
                        outName = newName[:-4]
                    else:
                        cadFile = root+"\\"+fname
                        outName = fname[:-4]
                outGDB = source+"\\CAD2FGDB.gdb"
                arcpy.CADToGeodatabase_conversion(cadFile, outGDB, outName, referenceScale, coordinateSystem)


texts: Publish a 'flattened' WMS in ArcGIS Server

texts:
we have a WMS which contains several layers, published using ArcGIS Server/WIN 10.2.  I am attempting to determine how we could 'flatten' the service to only contain 1 or 2 layers instead of several - which makes it easier for implementation into openlayers, etc - but still maintain all data.  identify capability does not need to be available, nor does the option to turn on and off layers.

Example:

'flatten' the WMS to look like:

-or-

Thanks Mucho


texts: What are the arguments for QgsDistanceArea().setSourceCrs()

texts:
I am really struggling with migrating a custom plugin from QGIS 2.x to 3.x. Below is a code snippet that seems very straightforward, but I can't find documentation that I understand for setSourceCrs().

  # First, make sure the point is not within a half meter of the start
  # or end points.
  da = QgsDistanceArea()

  # Function call in API 2.x
  # da.setSourceCrs(lyrDb.lyr.crs().srsid())

  # My attempt is missing the second argument
  da.setSourceCrs(lyrDb.lyr.sourceCrs())

  line = parent.geometry().asPolyline()
  n = len(line)
  d = da.measureLine(line[0], p1)
  if d < 0.5:
    return 0
  d = da.measureLine(line[n - 1], p1)
  if d < 0.5:
    return 0

As you can see, previously the only argument required for the function was an integer for SRID. The new API wants two arguments as shown below, but very little explanation. Taken from https://qgis.org/pyqgis/3.0/index.html

void QgsDistanceArea::setSourceCrs (const QgsCoordinateReferenceSystem & crs, const QgsCoordinateTransformContext & context)

I think I have the first argument correct, but I have no idea about the second. What do I need to send for the context argument?

Are there any other sources for documentation for the API?

This solution worked for me. It essentially passes an empty parameter into context, but that's okay because I'm not doing a transformation. I tested and it works as expected.

  # First, make sure the point is not within a half meter of the start
  # or end points.
  da = QgsDistanceArea()
  context = QgsCoordinateTransformContext()
  da.setSourceCrs(lyrDb.lyr.crs(), context)
  line = parent.geometry().asPolyline()
  n = len(line)
  d = da.measureLine(line[0], p1)
  if d < 0.5:
    return -1
  d = da.measureLine(line[n - 1], p1)
  if d < 0.5:
    return -1

For the record, though it helped, my question was not solved by Calculate ellipsoidal area for a projected layer in PyQGIS 3, nor is it a duplicate IMO.

That question was specifically concerned with calculating an ellipsoidal area which requires a transformation. The code that I am migrating concerns only a projected layer, which does not involve a transformation.

I came here after spending hours searching for an answer, and in my opinion it is because the documentation for pyQGIS API is sparse at best. However, I fully admit that the post above helped me figure out my solution, assuming it is a solution. It appears to work, and that is all I can say. Surely, there must be a proper way to call setSourceCrs when no transformation is required.

That said, I am happy so feel free to do whatever is appropriate with this question. This is my first foray into StackExchange, and I'm not familiar with protocol.


texts: Layer symbology not displaying in ArcMap?

texts:
This screenshot is when world imagery layer is turned on but my shapefile is only displaying the YSUBuildings layer.

I'm creating a shapefile by outlining buildings on a base map, I've outlined several buildings now I am labeling other types of buildings but the symbology won't display for them. Yet when you click on them it displays the outline I drew and the information.


texts: Displaying Shapefiles in map in browser and not using Google Maps

texts:
I have a series of shapefiles that I need to render as a map on a webpage. I have an ASP.Net server, although I would prefer something that will work on Linux servers. I would like to find an easy to set up opensource or freeware solution if at all possible. This cannot be overlaid over Google maps. It is just a map of the county I live in and that is all that needs to be shown. The shapefiles consist of the streets, boundary lines, street names, etc. Each one is a separate shapefile. This map will need to be zoomable as well.

I do not have a copy of ArcGIS so I cannot do any conversions with it. Although I have QGIS installed. It's server is giving me issues though.


texts: GeoServer with printing plugin, scale too low


texts: Error when importing merged osm.pbf files into nominatim's PostgreSQL database

texts:
Im using Nominatim 3.3 (https://github.com/mediagis/nominatim-docker/tree/master/3.3) within docker. I already imported succesfully 2 regions (not together, my PostgreSQL database contained one region at a time).

I need to import multiple regions, I merged my osm.pbf files from GEOFABRIK (https://download.geofabrik.de/europe/france/alsace.html and https://download.geofabrik.de/europe/monaco.html).

I have merged the files with the following command:

osmium cat alsace-latest.osm.pbf monaco-latest.osm.pbf -o alsace-monaco.osm.pbf

The merged file (alsace-monaco.osm.pbf) seems correct (it's size is the sum of my files) but when i'm trying to import it with the init.sh script I have the following error :

Reading in file: /data/alsace-monaco.osm.pbf
Using PBF parser.
Processing: Node(10622k 196.7k/s) Way(1728k 50.82k/s) Relation(33999 3399.90/s)2019-06-18 15:20:25.035 UTC [207] ERROR:  duplicate key value violates unique constraint "planet_osm_rels_pkey"
2019-06-18 15:20:25.035 UTC [207] DETAIL:  Key (id)=(11980) already exists.
2019-06-18 15:20:25.035 UTC [207] CONTEXT:  COPY planet_osm_rels, line 34002
2019-06-18 15:20:25.035 UTC [207] STATEMENT:  COPY planet_osm_rels FROM STDIN
Processing: Node(10622k 196.7k/s) Way(1729k 50.88k/s) Relation(34010 3091.82/s)  parse time: 100s
Node stats: total(10622020), max(6553775687) in 54s
Way stats: total(1729949), max(697847840) in 34s
Relation stats: total(34208), max(9698494) in 12s
COPY_END for planet_osm_rels failed: ERROR:  duplicate key value violates unique constraint "planet_osm_rels_pkey"
DETAIL:  Key (id)=(11980) already exists.
CONTEXT:  COPY planet_osm_rels, line 34002

Error occurred, cleaning up
2019-06-18 15:20:26.034 UTC [94] ERROR:  relation "place" does not exist at character 15
2019-06-18 15:20:26.034 UTC [94] STATEMENT:  select * from place limit 1
PHP Fatal error:  Uncaught Nominatim\DatabaseError: [500]: Database query failed

  thrown in /app/src/lib/DB.php on line 187
2019-06-18 15:20:26.045 UTC [204] LOG:  incomplete message from client
2019-06-18 15:20:26.045 UTC [204] CONTEXT:  COPY place, line 707521
2019-06-18 15:20:26.045 UTC [204] STATEMENT:  COPY place (osm_type, osm_id, class, type, name, admin_level, address, extratags, geometry) FROM STDIN
2019-06-18 15:20:26.045 UTC [204] ERROR:  unexpected EOF on client connection with an open transaction
2019-06-18 15:20:26.045 UTC [204] CONTEXT:  COPY place, line 707521
2019-06-18 15:20:26.045 UTC [204] STATEMENT:  COPY place (osm_type, osm_id, class, type, name, admin_level, address, extratags, geometry) FROM STDIN
2019-06-18 15:20:26.045 UTC [204] LOG:  could not send data to client: Broken pipe
2019-06-18 15:20:26.045 UTC [204] STATEMENT:  COPY place (osm_type, osm_id, class, type, name, admin_level, address, extratags, geometry) FROM STDIN

I'm new with docker and nominatim, I've already succesfully imported my first file (alsace.osm.pbf) and then I removed the existing postgre base and I sucessfully imported the second one (monaco.osm.pbf). So i don't know why it wouldn't work witht the merged file. I never worked with PostgreSQL.


texts: Raster to vector -> vector to mean line with one attribute

texts:
I am using QGIS and I need to calculate the minimum distance from points to line.
I have the points in .txt format and this is ok, but I have to extract the line from the raster file showed the following figure:

So I made "raster to vector" and I have this situation

The vector file contains, of course, a lot of id values.
My purpose is to have only 1 id value, that is having only a line shapefile.

I tried also to convert the vector file in lines, but the output was the following:

I would like to have only 1 line (like a "mean" line) which has only 1 attribute so that I can calculate the minimum distance from points.

Of course, if you know a different procedure to calculate the minimum distance between points and a raster, it is welcome.


texts: Does anyone know of a good software package for processing full-waveform lidar? Also, does anyone know of a good tutorial on processing full-waveform lidar?


texts: how to get max and min from a raster using arcpy?

texts:
I have a land surface temperature raster file and I want the max and min of it.

minLSTresult = arcpy.GetRasterProperties_management(raster_result, "MINIMUM")

minLST = minLSTresult.getOutput(0)

minLST returns u'261.22'. How could I only get the number of it?


texts: Calculating perpendicular distance from centroid of polygon to multiple lines in QGIS

texts:
In QGIS 3.10.4, I have two shapefiles (polyline and polygon, layer name 'boundaries', 'lines' respectively), look like below:

My goal is to calculate the perpendicular distance from the centroid of each region to each of the lines. I've tried the two methods in this thread: Creating dummy variables between layers based on their geometries in QGIS, which are: using NNJoin, or using query in a Virtual Layer.
However, I met some problems with both of the methods:

NNJoin (I selected the option "Approximate geometries by centroids"): the distances are in decimal degrees because the join layer (polyline layer) uses Geographic CRS. It's hard to interpret the distances and I wasn't able to figure out how to convert Geographic CRS to Projected CRS. Any idea how can I solve this problem?
Then I tried the following query (provided by @Taras) in Add Layer -> Add/Edit Virtual Layer, it successfully generates a Virtual Layer with a "distance" column, with one distance associated with one region:

SELECT "boundaries".*,
        ROUND(ST_Length(ST_ShortestLine("boundaries".geometry, "lines".geometry)),2) AS distance
FROM "boundaries", "lines"
GROUP BY "boundaries".id
ORDER BY MIN(ST_Length(ST_ShortestLine("boundaries".geometry, "lines".geometry)))

So my ultimate question is: how can I calculate the perpendicular distance (in km or mile) from the centroids of each region on the polygon to each line of the polyline?


texts: Methods to determine if traffic accidents happen more frequently along sections of a highway with poor pavement?

texts: I have a shapefile with highway pavement conditions and a point file with accidents. If I wanted to see if traffic accidents happen more frequently along sections of a highway with poor pavement conditions, what methods would I use? I was thinking spatial analysis but not exactly sure.


texts:
We have been given a DXF that contains a Elevation attribute but we would like to generate a 3D DXF.  I know I can generate a 3D dxf from a shapefile using:

ogr2ogr -f "DXF" out.dxf in.shp -zfield Elev

But the ogr driver doesn't seem to pick up the attributes as fields in the dxf.

Does anyone know if this is possible.

I would like a free solution if possible.  We do have FME but I'm looking around for other options.


texts: Add Attribute and merge .shp's from multiple folders/directories

texts:
I would like to run a process to:

1) find all shapefiles in muliple folders/directories (i.e., the directory for each differen folder is "G:\Projects\"variable project #"\GIS\Shapefiles)

2) Add a field for inserting "variable project #" from the file path name(i.e., truncate the file path name to only include "variable project #")

3)Then export and merge these features into a temporary folder.

...if I could even do stpes 1-2 above, it would be a tremendous help.  This files are in a couple hundred folders and, due to the length of the file path, it is a bit onerous to try to batch process these manually...

Any help would be greatly apprecited,

Thanks!


texts: Generating Shapefiles from PostGIS as a Plugin

texts:
I used to generate shapefile from PostgreSQL database that is installed with PostGIS tables as  templates (geometry_columns and spatial_ref_sys)

Shapefiles generated just fine using the following command:

 $pgsql2shp -f <path to new shapefile> -g <geometry column name> \   -h <hostname> -U <username> "<query>"

No I have a new database with PostGIS 2.0 which installed as a plugin. There is no PostGIS templates. So when I tried generating shapefiles using the above command I got the following error:

Any idea how can i export shapefiles in this case?


texts: Multiparts and Multigeometries: checking for multigeometries with PyQGIS?

texts:
I have been working with PyQGIS and writing a small script to check whether the layers I have in the MapCanvas have geometries of type "MultiXX" because I want to run the "Multipart to Singleparts" processing algorithm on the layers that need to be processed (but not on the others because it would be too long). I need simple geometries because I am using the SPIT plugin to load them to a PostGIS database in a further step.

If I used this:

for feature in layer.getFeatures():
        geom = feature.geometry()
        if geom.isMultipart():
          print (layer.name(), ": Warning: Multipart", feature.id())
...

I get whether every single feature is multipart or not. But I would like to determine the type of geometry on the layer itself, because I do not want to call the algorithm on the layer every time there is one feature multipart. So I tried this:

for layer in allLayers:
   if layer.wkbType() > '4':
      print "Warning Multigeometry in "+layer.name()
    ...

But somehow my layer, in which the multipart geometries would pop up with the first test, gets a wkbType of 3 (meaning Polygon).
So I am a bit confused: especially because QGIS tells me, the layer is a POLYGON layer, but the SPIT plugin tells me it is a MULTIPOLYGON layer (and indeed, there is a feature which is multipart and running the above mentionned processing algorithm resolve the problem).

Could someone explain to me how the relation between the geometry type and the multiparts aspect is working (I thought it was pretty simple: polygon => singleparts and multipolygons => multiparts) or suggest to me an alternative way to reach the same result, meaning:
checking accurately for layers with multigeometries in order to process them selectively.


texts: Assigning variables into a API text string postgis

texts:
I am trying to assign values to variable in PostGIS.

I have a API similar to: example

I want to create a trigger that parse the x,y coordinates from my geometry column to a field containing the link to the map in my table

create table foo
(
id serial,
link text,
geom geometry(point)
);

This query give me the x, y in text.

SELECT ROUND(ST_X(geom)::NUMERIC,0)::TEXT, ROUND(ST_Y(geom)::numeric,0)::TEXT FROM foo

Asign the X,Y somehow to the link column:

UPDATE foo
set link=http://www.openstreetmap.org/#map=17/$x/$y

I want the update to result in something like http://www.openstreetmap.org/#map=13/-27.1274/-109.3370


texts:
I'm trying to improve a script and to that I have to get points coordinates. I found a way to do this with these few lines:

layer = processing.getObject(point)
iter1 = layer.getFeatures()
for feature1 in iter1:
        x = feature1.geometry().asPoint().x()
        y = feature1.geometry().asPoint().y()
        print "X Coord : %d" %x
        print "Y Coord : %d" %y
        print

But it returns coordinates without decimals, like this (Lambert 93):

X Coord : 694752
Y Coord : 6244790

Somebody have an idea to get decimals ?


texts: Which type of file geodatabase format to use in FME?

texts: What is the practical difference between the fgdb API format and fdgb ArcObjects in FME? When to use each of them in FME?


texts:
My DEM comes in TIN-format so that i will have to convert it to GRID to be able to analyse it with Spatial Analyst.

Will there be any inaccuracies to my data from converting TIN to GRID?


texts: Problem installing OTB-contrib on Ubuntu Xenial

texts:
I am trying to install OTB-contrib package in Ubuntu Xenial. I did the following:

Download it and move it to /opt
Run the script
Added the following paths to my .bashrc file:

export PATH="$PATH:/opt/OTB-contrib-6.0.0-Linux64/bin"
export PYTHONPATH="$PYTHONPATH:/opt/OTB-contrib-6.0.0-Linux64/lib/python"
export OTB_APPLICATION_PATH="/opt/OTB-contrib-6.0.0-Linux64/lib/otb/applications"

After that, I have tried to run the applications from the command line, but I get a error message. For example:

ignacio@ignacio-Athena:~$ otbcli_OrthoRectification
/opt/OTB-contrib-6.0.0-Linux64/bin/otbcli: 34: .: Can't open /opt/OTB-contrib-6.0.0-Linux64/bin/../otbenv.profile

Does anybody know how to solve this?


texts: Google Earth Engine: cumulative iteration of weekly mean anomaly

texts:
Using the link here I've managed to calculate a weekly mean anomaly for several regions of interest.

I'm hoping to calculate a cumulative mean anomaly, then work out how many consecutive weeks have been over a specific value (say 1) in the past 12 weeks from a specific date.

I attempted to calculate the cumulative anomaly using the tutorial on the GEE pages (here). However I'm having a few issues.

I calculated a mean for sea surface temperature and calculated daily anomaly using this code

var collection = ee.ImageCollection('NASA/OCEANDATA/MODIS-Aqua/L3SMI')
 .select('sst')

var reference = collection.filterDate('2002-01-01', '2012-12-31')
   .sort('system:time_start', false);

print('reference', reference)

// Compute the mean of the first 10 years.
var mean = reference.mean();

var series = collection.filterDate('2018-01-01', '2018-12-
31').map(function(image) {
return image.subtract(mean).set('system:time_start',
image.get('system:time_start'));
});

I then calculated an average weekly anomaly using this code

var startDate = '2018-01-01';
var endDate = '2018-12-31';
var weekDifference = ee.Date(startDate).advance(1,
'week').millis().subtract(ee.Date(startDate).millis());
var listMap = ee.List.sequence(ee.Date(startDate).millis(),
 ee.Date(endDate).millis(), weekDifference);

 //function to get a weekly composite
 function getWeeklysstComposite(date) {
   // Only include sst for consistent compositing.
   var sstWeekly = ee.ImageCollection(series)
                  .filterBounds(PB)
                  .filterDate(date, date.advance(1, 'week'))
                  .select('sst');
   var composite = sstWeekly.mean()
                  .set('system:time_start', date.millis(), 'dateYMD',
 date.format('YYYY-MM-dd'),
                  'numbImages', sstWeekly.size());
  return composite;
 }

  var sstWeeklyANMLY =
  ee.ImageCollection.fromImages(listMap.map(function(dateMillis){
   var date = ee.Date(dateMillis);
   return getWeeklysstComposite(date);
   }));

Using the iterate function tutorial I tried to calculate a cumulative mean weekly anomaly

var time0 = reference.first().get('system:time_start');

var first = ee.List([
  ee.Image(0).set('system:time_start', time0).select([0], ['sst'])
]);

 var accumulate = function(image, list) {
 var previous = ee.Image(ee.List(list).get(-1));
 var added = image.add(previous)
    .set('system:time_start', image.get('system:time_start'));
  return ee.List(list).add(added);
};

 var cumulative = ee.ImageCollection(ee.List(sstWeeklyANMLY.iterate(accumulate, first)));

However I'm getting this error

 ImageCollection (Error)
Image.add: If one image has no bands, the other must also have no bands. Got
0 and 1.

What is going wrong here and how can I then, once I have a cumulative anomaly, calculate how many of the weeks in the preceding 12 preceding a certain date were over a specific threshold (say 4)?

The link to all my code in google earth engine is here


texts: QGIS 2.2.0-Valmiera 64bit on windows 8.1 displays error while creating ROI in SAC plugin

texts:
I don't know what happened while creating ROI during Classification using Semi automatic Classification Plugin 3.1.0 "Rome" installed on hp Pavillion i7 with windows 8.1
When i started to generate ROI on virtual raster.

  It appears that SciPy is not correctly installed. Please, see this page for information about SciPy installation  http://semiautomaticclassificationmanual.readthedocs.org/en/latest/installation_win64.html#scipy-installation

To cope with the above mentioned error, I downloaded the updated scipy scipy-0.14.0.win-amd64-py3.4 from the mentioned website and place the files in the below mentioned path.
C:\OSGeo4W64\apps\Python27\Lib\site-packages
But still it failed and generate the same message. The second attempt to cope with the problem is that i have removed the QGIS and install it again without giving space in name of path directory but still the problem is there.


texts:
I want to build a .gpx file and was hoping to use gpxpy.  I can see how to build such a file in memory, but I can't see how to write it out to disk.

Is it possible for gpxpy to write files?


texts: How to find out polygon types inside buffer?

texts:
I have two polygon layers, one buffer of 20 meters from apartment point data and then urban green area layer with columns like "type of green area" and "attributes of green area".

How can I find out how many of a certain type of green area are within the buffer? I.e. there are 1 forest green area and 2 wetland areas in buffer A etc.


texts: Calculation of the base area in the legend

texts:
I have classified my data into a set of classes. I want to be able to create a legend like this in the QGIS print composer:

Notice that the legend includes not only my category colours and labels (e.g. red, 1500 – 2000) but also a summary of the total area of all features in each category (e.g. 28.08 hectares).

How can a legend with this information be created dynamically in QGIS?


texts:
I am quite new to GIS.

I have two sources for my netCDF data. The spatial reference for both is GCS_WGS_1984. One of the rasters has a gap along the prime meridian as it appears in the picture below.

I suspect this is because the longitudinal range is 0-360 so I asked the person who generates the data to change it to -180 to +180. The result shown in the image below is not desirable as I would like to have a focus on Europe.

I was wondering if there are any settings/environments I can adjust at import or afterwards that would get rid of that middle line.


texts: Generate end points from a layer that contains multiple lines

texts:
I generate a layer file that has multiple parallel lines, that I want is to sequentially (from OBJECTID(1) to OBJECTID(Max)) create a point at each end point of the line segments and number these points. The other problem is alternating which side it starts creating a point from...

Say I have 2 lines parallel to each other going left to right and one is above the other. The first line would have a point at the left-end point labeled 1, the right-end point labeled 2. The next line would have the right end-point labeled 3, and the left end-point labeled 4 and so on.


texts: Getting Clip raster ERROR 1: Did not get any cutline features?

texts:
I want to clip a raster using a polygon I made. However, I get the following error message.

I've tried all the possible options but somehow I'm not being able to clip it.

QGIS 2.16.2 on Windows 10


texts: Selecting features in ArcMap continuously?

texts:
My task is to select some of the features in a layer so that the whole area of them can be near to a particular value. While I got trouble when using select tools in ArcMap 10.6.

For example I want to select the features in the pics above in the same time, while I don't know how to select them continuously, since when I select the features on the top and the selections of features under will disappear. I try to press ctrl as it works in Excel while it doesn't work in ArcMap.


texts: Connecting QGIS to a Remote PostgreSQL database using an SSH key?

texts:
I have created a username,password & ssh key with root privileges on a remote server (Vagrant) and I am attempting to connect via the usual methods but my password authentication fails. I can successfully ssh into the server using the same credentials.

How can I configure QGIS to connect to PostgreSQL/PostGIS using an ssh key?


texts: Make a list from shapefiles using GeoPandas

texts:
I have a number of shapefiles (protected areas for different years) which I would like to dissolve using one attribute. I have not found a line of code to create a list from the shapefiles so iterate through all of them at once.

My files:

#files to create a list from
wdpa95 = gpd.read_file('.../wdpa95_uk_terr.shp')
wdpa99 = gpd.read_file('.../wdpa99_uk_terr.shp')
wdpa03 = gpd.read_file('.../wdpa03_uk_terr.shp')
wdpa07 = gpd.read_file('.../wdpa07_uk_terr.shp')
wdpa11 = gpd.read_file('.../wdpa11_uk_terr.shp')
wdpa15 = gpd.read_file('.../wdpa15_uk_terr.shp')

#dissolve wdpa datasets to create single layer
wdpa95 = gpd.read_file('.../wdpa95_uk_terr.shp')
wdpa95 = wdpa95[['ISO3', 'geometry', 'PA_DEF', 'STATUS_YR']]
wdpa95_dissolve = wdpa95.dissolve(by = 'PA_DEF', aggfunc = 'max')
wdpa95_dissolve.to_file('.../wdpa95_dissolve.shp')

I could manually go through the shapefiles one by one but I figured there should a smarter way to create a list and iterate the dissolve process.


texts:
I am trying to create the bubbles on my SVG map generated by Kartograph.
I want to do something like this: http://kartograph.org/showcase/symbols/

The map loads but the symbol does not display. I have no errors thrown in the Javascript console.

$(document).ready(function() {

var map = $K.map('#map');

map.loadMap("mapfinal.svg", function() {
    // add layers
    map.addLayer('background', {
        styles: {
            fill: '#e8f9fb',
            'stroke': 'none'
        }
    });
    map.addLayer('world', {
        styles: {
            fill: '#f5f3f2',
            'stroke': 'none'
        }
    });
    map.addLayer('states', {
        styles: {
            fill: '#FFF',
            'stroke': '#882222',
            'stroke-width': 0.5,
            'stroke-opacity': 0.4
        }
    });
    map.addLayer('urban', {
        styles: {
            fill: '#553344',
            'fill-opacity': 0.6,
            'stroke': 'none'
        }
    });
    map.addSymbols({
        type: kartograph.Bubble,
        data: [{
            lon: -104,
            lat: 40.5,
            name: 'Denver'
        }],
        radius: 40,
        location: function(d) {
            return [d.lon, d.lat]
        },
        style: 'fill:#800000; stroke: #fff; fill-opacity: 0.5',
    });

});

});

I don't know what else to do. I have followed all the example code and read the docs.


texts: Adding image to existing data frame using ArcPy

texts: This is the first time I am using Python on my own, and I have searched for this answer for a few hours with no luck.  I am wanting to take a .JPG image and put it in a data frame.  The image has to be in color, and needs to change with data driven pages.


texts: Is MapProxy and Google's Static Maps API a possible alternative to the QGIS Openlayers plugin?

texts:
I've been looking for an alternative to the openlayers plugin as a means of adding imagery basemaps to QGIS.

The plugin is great but there's a bug when exporting basemaps via QGIS map composer that causes vector layers to become offset from the underlying basemap, or vice versa.

I saw mapproxy mentioned as a possible alternative here, leading me to create this config file which nearly works I think, except for one thing: google's static map api wants tile (yx) location in a lat,long format, whereas mapproxy sends requests in a simple tile numbering system: 0,0 0,1 1,1.

I wanted to avoid accessing imagery tiles directly as this is against google's tos.

Is using mapproxy and google static maps / bing static maps feasible?  Is there another way to get aerial imagery basemaps into QGIS that will work with map composer?

Being new to web mapping, I suspect I'm barking up the wrong tree so hoped to get some help here =]


texts: change encoding for param vectorLayerPath in qgis addVectorLayer()

texts:
I'm trying to add some shapefiles from my simple plugin using

selFile = "c:\åäö\myfile.shp"
fullName = selFile.replace('\\', '/').encode('utf-8')
layerName = "test"
Layer = self.iface.addVectorLayer(fullName, layerName, "ogr")

but that's not working due to the special characters åäö. (I have try to move some files to another folder and that's working)
When i load the files through "Menu->Layer->Add Layer->Add Vector Layer" it's working just fine

How to load them with python? I don't wont to move all my *.shp files.


texts: Can ArcGIS service pack be uninstalled at 10.1?

texts:
At v10, it was nice that you could roll back individual Service Packs.

Ive just rolled forward to 10.1 SP1 on my dev machine (not a fresh install), but it would appear this option is not available at 10.1.

Anyone know of a way to roll back the Service Pack without having to do a re-install?

EDIT - As an Esri distributor employee I have an pre-release of SP1, and I assumed it was the same final version that would be made available to clients.

I would like to suggest leaving this Q open until the final release is made available, and I will re-test and either edit my Q accordingly, or vote to close the Q off if its not an issue anymore.  Apologies if I have caused any confusion.  I can say that there is some nice new stuff to play with in this SP :)


texts:
How can I install mapguide 6.5 on windows 7 ?
 i have problem to set a datasource in mapguide outer. do i need another software or application to install this version of mapguide in win 7 64bit?
please help .


texts:
i am able to build rasterlite library but when it is building .exe for tools(rasterlite_load) it gives linking error for external symbole SPLite3
like this
rasterlite_load.obj : error LNK2019: unresolved external symbol _SPLite3_last_in
sert_rowid referenced in function _export_tile
there are many like this but all are due to splite

I don't know what is missing. Searching google gives sqlite reference.

Development Environment - windows and vc
libraster version -1.1c

Thanks


texts:
I am using Idrisi selva for converting road network map in raster but it always shows "Vector raster window do not overlap". I have checked coordinate system for every related vector and raster file.

How can I convert vector file to raster in IDRISI selva?


texts: Counting layer segments in QGIS Field Calculator

texts:
I have a segmented line (road) dataset and I want to get the number of times each road is segmented.

In SQL it's just

SELECT RoadMntnc, count(RoadMntnc) AS count
FROM clip_DSC_Roads
GROUP BY RoadMntnc

How do I do the same in field calculator?

Sample data is in https://drive.google.com/drive/folders/1RL7VZL_giZuZ9xVfDFgk409_RIErIB0m?usp=sharing

I assume it would be something like
aggregate(count("RoadMntnc"), group_by="RoadMntnc") but this doesn't work.


texts:
I've got 2 raster maps (both with the same values: 0-100). After calculating the average I need to know how precise the map is. Is there any tool in QGis?

I try to explain my problem in another way:

I have 2 or maybe 3 percentaged raster maps. After putting together ((a+b+c)/3) I need to get a map that shows if the result map is statistically firm.

For instance: If all 3 maps have the same value in an area the result must be reliable/firm. If 2 maps have the same values and 1 map is totally different the result is a little bit unreliable. If 3 maps are totally different the result is unreliable.

I want to create a colored map (green, orange, red). I already have processed the average map!


texts: Converting raster presented in KML to polygon using ArcGIS Desktop?

texts:
I have spent quite a lot of time Googling which brought me many places including this site, but I haven't found the resolution.

I have a KML that presents a PNG. Radio Mobile generated the files and it lines up wonderfully. However, I need it as a polygon. The PNG itself doesn't contain any geo-referencing information as that's what the KML's purpose is. However, ArcMap 10 can't take the layer as an input in the raster conversion and when I specify just the PNG, it just makes a solid square that is (as I assumed) not in the right location.

Exported KML and PNG:
https://www.dropbox.com/s/ug6feyvu7mgnntv/ICS%20Basic%2011.kml?dl=0
https://www.dropbox.com/s/ma26e01l7jtvshp/ICS%20Basic%2011.png?dl=0

Screenshot:


texts: Exporting to dxf file from QGIS creating dxf layers by QGIS layer name?

texts: I'm very new to QGIS, and this is baffling me. I used "split vector layers" to create new layers in QGIS, and have been trying to export the file to dxf. However, when I open my new dxf files, every feature is on its own layer, and my new layers are empty. I used "export to dxf" on mac yosemite.


texts: Blank Vector Selection Dropdown in QGIS GRASS Plugin

texts:
I realise there are some issues which getting vectors into the GRASS module in QGIS, but is the behaviour i am getting expected?

I have loaded the vector shapefile via GRASS, closed G and reopened the mapset in QGIS, GRASS TOOLS. I can find the vector in Browser tab, but when I launch v.rast.stats I cannot select a vector. The vector selection drop down remains blank.

Is this the behavious people are seeing, or is it a different problem to that which is already documented?
Trouble is, it used to work a few months ago on 1.6 and the 1.7 trunk no problems.


texts:
I am constructing a GUI using PyQT4 and QGis. Rigth now I can open the MapCanvas whith same buttons of Zoom In/Out using this code:

from qgis.gui import *
from qgis.core import *
from qgis.PyQt.QtGui import QAction
from qgis.PyQt.QtCore import SIGNAL, Qt
from qgis.PyQt.QtWidgets import QMainWindow

class MyWnd(QMainWindow):
    def __init__(self, layer):
        QMainWindow.__init__(self)

        self.canvas = QgsMapCanvas()
        self.canvas.setCanvasColor(Qt.white)

        self.canvas.setExtent(layer.extent())
        self.canvas.setLayerSet([QgsMapCanvasLayer(layer)])
        #self.canvas.setLayers([layer])

        self.setCentralWidget(self.canvas)

        self.actionZoomIn = QAction("Zoom in", self)
        self.actionZoomOut = QAction("Zoom out", self)
        self.actionPan = QAction("Pan", self)

        self.actionZoomIn.setCheckable(True)
        self.actionZoomOut.setCheckable(True)
        self.actionPan.setCheckable(True)

        self.actionZoomIn.triggered.connect(self.zoomIn)
        self.actionZoomOut.triggered.connect(self.zoomOut)
        self.actionPan.triggered.connect(self.pan)

        self.toolbar = self.addToolBar("Canvas actions")
        self.toolbar.addAction(self.actionZoomIn)
        self.toolbar.addAction(self.actionZoomOut)
        self.toolbar.addAction(self.actionPan)

        # create the map toolsq
        self.toolPan = QgsMapToolPan(self.canvas)
        self.toolPan.setAction(self.actionPan)
        self.toolZoomIn = QgsMapToolZoom(self.canvas, False) # false = in
        self.toolZoomIn.setAction(self.actionZoomIn)
        self.toolZoomOut = QgsMapToolZoom(self.canvas, True) # true = out
        self.toolZoomOut.setAction(self.actionZoomOut)

        self.pan()

    def zoomIn(self):
        self.canvas.setMapTool(self.toolZoomIn)

    def zoomOut(self):
        self.canvas.setMapTool(self.toolZoomOut)

    def pan(self):
        self.canvas.setMapTool(self.toolPan)

`Teste Application:
QgsApplication.setPrefixPath(r"C:\Program Files (x86)\QGIS 2.18", True)

qgs = QgsApplication([], True)
qgs.initQgis()

layer=QgsVectorLayer('C:/ProgramFiles(x86)/QGIS2.18/gis_data/PRT_water_areas_dcw.shp', 'water','org')

w = MyWnd(layer)
w.show()

qgs.exec_()
qgs.exitQgis()`

However, I am getting a blank MapCanvas with nothing on it that crushes my program. I think that it is related to this line:

self.canvas.setLayerSet([QgsMapCanvasLayer(layer)])

But I cant understand why this is happening.


texts: Creating Virtual layer that is the centroid of another polygon layer

texts:
There's a polygon layer building and I want to create a point layer centroid containing centroids of building layer. I have 2 more requests:

to keep all attributes in the building layer in the newly-created layer.
to make the newly-created layer auto-updating when I edit the building layer.

So, I created a virtual layer. Here's the query I made:
select b.*, st_centroid(geometry)
from "building" as b

But, that created a virtual polygon layer instead of a point layer.
It seems that because I selected all attributes from the building layer, which also includes the geometry attribute. There are dozens of attributes in the building layer, so typing them all out in the query is time-consuming. Thus, I found a post talking about how to select all but one column using SQL. Then I tried this:
SELECT b.*, st_centroid(geometry) into #TempTable
FROM "building" as b
ALTER TABLE #TempTable
DROP COLUMN geometry
SELECT * FROM #TempTable
DROP TABLE #TempTable

This time it says "syntax error". Could someone help?


texts: Google Maps Api , PHP, Javascript and Postgresq-Postgis

texts:
I'm trying to make a web application, where I take the start/end city from a text box, geocode the city, use the coordinates to query my database in PHP, and return the features to be drawn in the Google Maps API.

I retrieve the latitude and longtitude using the script at  https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple?hl=EL

But I dont know how to pass the latitude and longtitude in PHP to make a select to database. (I plan to return the features to JavaScript, so I can visualize it with the script at https://developers.google.com/maps/documentation/javascript/examples/polyline-simple?hl=EL)

How can I pass the value from the HTML/JavaScript to the PHP file where I have the connection with database?

I try with jQueries but return me an empty vlaues the function i use is

function codeAddress1() {
  var address1 = document.getElementById('address1').value;
  geocoder.geocode( { 'address': address1}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
      latitudeEnd = results[0].geometry.location.lat();
      longitudeEnd = results[0].geometry.location.lng();
    }
  });

$.ajax({
     data: {latitudeEnd : latitudeEnd, longitudeEnd: longitudeEnd},
     type: "POST",
     url: "script.php",
     success: function (e) {
          alert(e);
     },
     error: function (er) {
          alert("Error: " + er);
     }
 });
  document.location.href = 'script.php';
}


texts: How to fix python ImportError: DLL load failed: The specified module could not be found?

texts:
During import fiona, I am getting following error. Error is different from other user so I asked this question may be it is repeated.

import fiona

Traceback (most recent call last):

  File "D:/PROGRA~1/Quantum GIS Lisboa/apps/qgis/./python\qgis\utils.py", line 309, in _import
      mod = _builtin_import(name, globals, locals, fromlist, level)

  File "D:\PROGRA~1\Quantum GIS Lisboa\apps\Python27\lib\site-packages\fiona__init__.py", line 79, in
      from fiona.collection import Collection, supported_drivers, vsi_path

  File "D:/PROGRA~1/Quantum GIS Lisboa/apps/qgis/./python\qgis\utils.py", line 309, in _import
      mod = _builtin_import(name, globals, locals, fromlist, level)

  File "D:\PROGRA~1\Quantum GIS Lisboa\apps\Python27\lib\site-packages\fiona\collection.py", line 7, in
      from fiona.ogrext import Iterator, ItemsIterator, KeysIterator

  File "D:/PROGRA~1/Quantum GIS Lisboa/apps/qgis/./python\qgis\utils.py", line 309, in _import
      mod = _builtin_import(name, globals, locals, fromlist, level)

  ImportError: DLL load failed: The specified module could not be found.


texts: SDO_GEOM.RELATE DETERMINE says 'EQUAL' but doesn't return TRUE in the where clause

texts:
The following query returns 'EQUAL' for the geometry-relation :

select  a.g3e_fid
    ,   b.g3e_fid
    ,   SDO_GEOM.RELATE( SDO_CS.MAKE_2D( a.g3e_geometry), 'DETERMINE', SDO_CS.MAKE_2D( b.g3e_geometry), 0.1) "Relation"
    from gc_fbranch_s a, gc_fsplice_s b
    where a.g3e_fid = 53455168 and b.g3e_fid = 38274644

Then why is it that the following query doesn't return any rows :

select  a.g3e_fid
    ,   b.g3e_fid
    ,   SDO_GEOM.RELATE( SDO_CS.MAKE_2D( a.g3e_geometry), 'DETERMINE', SDO_CS.MAKE_2D( b.g3e_geometry), 0.1) "Relation"
    from gc_fbranch_s a, gc_fsplice_s b
    where a.g3e_fid = 53455168 and b.g3e_fid = 38274644
        and SDO_GEOM.RELATE( SDO_CS.MAKE_2D( a.g3e_geometry), 'EQUAL', SDO_CS.MAKE_2D( b.g3e_geometry), 0.1) = 'TRUE'


texts: ArcMap Open Carto 2 WMTS not displaying in QGIS

texts:
I am a little perplexed as to why I cannot get the OS Open Carto 2 Basemap from Arcmap's Rest Services to display in QGIS.
The WMTS link is here *(OS Open Carto 2) but upon adding it to QGIS through the "Create a New WMS/WMTS Connection" window it is accepted but no map is displayed. The WMTS for Carto does not appear to be down on the Arcmap web map either (see here)
Connection String (OS Open Carto 2)

https://tiles.arcgis.com/tiles/qHLhLQrcvEnxjtPr/arcgis/rest/services/OS_Open_Carto_2/MapServer/WMTS/1.0.0/WMTSCapabilities.xml?cacheKey=ab093530753e4ad5

Connection String (OS Open Raster)
In contrast when I add the OS Open Raster WMTS all works fine.

https://tiles.arcgis.com/tiles/qHLhLQrcvEnxjtPr/arcgis/rest/services/OS_Open_Raster/MapServer/WMTS/1.0.0/WMTSCapabilities.xml?cacheKey=b499350066619da6


texts: arcgis 10.2 server how to get legend to display symbology only for visible classes

texts: i have a web app that consumes legend info via a esri/dijit/Legend widget. The problem is that it displays symbology for all data, even those features not visible in current extent, is there a way to display only visible classes?


texts:
I have big size Sentinel-1 image and I would like to clip it to smaller size. For that i'm trying to import shapefile but I get errors all the time:

This is my polygon WKT:

PolygonZ ((102.09338174054019532 16.42902850335272902 0, 102.0873364934548988 16.46965400839237148 0, 102.16886985695849432 16.46841818418501902 0, 102.1701925377519018 16.42887238582805054 0, 102.09338174054019532 16.42902850335272902 0))

I really don't understand why wouldn't it work.

When I show details:

com.vividsolutions.jts.io.ParseException: Unknown geometry type: PolygonZ (line 1)
    at com.vividsolutions.jts.io.WKTReader.parseErrorWithLine(WKTReader.java:427)
    at com.vividsolutions.jts.io.WKTReader.readGeometryTaggedText(WKTReader.java:495)
    at com.vividsolutions.jts.io.WKTReader.read(WKTReader.java:205)
    at com.vividsolutions.jts.io.WKTReader.read(WKTReader.java:174)
[catch] at org.esa.snap.rcp.actions.vector.InsertWktGeometryAction.actionPerformed(InsertWktGeometryAction.java:148)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at com.jidesoft.plaf.vsnet.VsnetMenuItemUI.doClick(VsnetMenuItemUI.java:1395)
    at com.jidesoft.plaf.vsnet.VsnetMenuItemUI$MouseInputHandler.mouseReleased(VsnetMenuItemUI.java:1190)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)


texts: ArcGIS Server 10.2: Could not connect to the Map Server

texts:
I've installed an ArcGIS for Server 10.2 Enterprise Basic on my Windows server(Windows Server 2008 R2(x64), SQL Server 2008).

I can publish service by ArcGIS Desktop 10.2 on my server, but when I connect to the server as a user. I could only use the Feature service.

If I try to connect to the map service, ArcGIS Desktop will show the ERROR: Could not connect to the Map Server.

I checked ArcGIS Server logs, it shows: HRESULT: 0x80004005.

Can the Enterprise Basic Edition only publish the feature service without the map service?

Sorry for my bad English.


texts: Obtaining feature using ArcGIS for Server and WFS based on featureid?

texts:
This has baffled me for hours, I've tried nearly every combination of request parameters without success.

I have a points coverage published in ArcGIS and can download the feature GML via WFS for the entire layer using the following request (sorry the server is not available on the internet):

http://mymachine.com/arcgis/services/DMS/DMS_WELLS/MapServer/WFSServer?SERVICE=WFS&VERSION=1.1.1&REQUEST=GetFeature&typeName=iwiswells&

Which returns XML for each feature member in the layer like so:

<wfs:FeatureCollection xsi:schemaLocation="http://server/arcgis/services/DMS/DMS_WELLS/MapServer/WFSServer http://server/arcgis/services/DMS/DMS_WELLS/MapServer/WFSServer?request=DescribeFeatureType%26version=1.1.0%26typename=iwiswells http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
    <gml:boundedBy>
        <gml:Envelope srsName="urn:ogc:def:crs:EPSG:6.9:4326">
            <gml:lowerCorner>28.522 -10.5</gml:lowerCorner>
            <gml:upperCorner>80.469 65.01144</gml:upperCorner>
        </gml:Envelope>
    </gml:boundedBy>
    <gml:featureMember>
        <DMS_DMS_WELLS:iwiswells>
            <DMS_DMS_WELLS:FID>0</DMS_DMS_WELLS:FID>
            <DMS_DMS_WELLS:Shape>
                <gml:Point>
                    <gml:pos>64.994 7.5312</gml:pos>
                </gml:Point>
            </DMS_DMS_WELLS:Shape>
            <DMS_DMS_WELLS:gid>1</DMS_DMS_WELLS:gid>
            <DMS_DMS_WELLS:sitelocid>101</DMS_DMS_WELLS:sitelocid>
            <DMS_DMS_WELLS:site_ref>101/1</DMS_DMS_WELLS:site_ref>
            <DMS_DMS_WELLS:latitude>24.9943</DMS_DMS_WELLS:latitude>
            <DMS_DMS_WELLS:longitude>47.5002</DMS_DMS_WELLS:longitude>
        </DMS_DMS_WELLS:iwiswells>
    </gml:featureMember>
    <gml:featureMember>
        ...
    </gml:featureMember>
</wfs:FeatureCollection>

In GeoServer to select the single feature with a feature id of 10 I would use the following WFS request:

http://mymachine.com/geoserver/iwis/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=iwis:points&featureid=10&

And this results in on feature member begin returned.  What I'm looking for is an ArcGIS WFS equivalent!

I have read all the documentation, all the specifications but my request either results in the entire feature list being returned or an error message, here's a few requests I have tried:

http://mymachine.com/arcgis/services/DMS/DMS_WELLS/MapServer/WFSServer?SERVICE=WFS&VERSION=1.1.1&REQUEST=GetFeature&featureid=10&

http://mymachine.com/arcgis/services/DMS/DMS_WELLS/MapServer/WFSServer?SERVICE=WFS&VERSION=1.1.1&REQUEST=GetFeature&typeName=iwiswells&CQL_FILTER=FID='10'&

I've even tried using a filter on a different attribute without success:

http://mymachine.com/arcgis/services/DMS/DMS_WELLS/MapServer/WFSServer?SERVICE=WFS&VERSION=1.1.1&REQUEST=GetFeature&typeName=iwiswells&filter=<Filter><PropertyIsEqualTo><PropertyName>site_ref</PropertyName><Literal>10</Literal></PropertyIsEqualTo></Filter>


texts: How to get custom color palette in rasterVis plot3D in R?

texts:
I am trying to insert an RColorBrewer palette to visualize an elevation raster in R using the rasterVis function plot3D. The rasterVis reference document shows the following parameters:

plot3D(x, maxpixels=100000, zfac=1, drape=NULL, col, rev=FALSE, adjust=TRUE, ...)

However, when I use col= I get the following error:

Error in col(zlen) :
  a matrix-like object is required as argument to 'row/col'

When I use color= I get:

Error in f(...) :
  formal argument "color" matched by multiple actual arguments

I've also tried this:

color.palette = brewer.pal(11, "PRGn")

which renders the 3D-plot, but uses the default color palette.

This article does not provide a solution.
Nor have I found anything useful on GISSE or StackOverflow:

Any suggestions, assistance clarifying the errors, or input is much appreciated.


texts: QGIS SAGA "Natural Neighbourhood" gridding error

texts:
I'm having issues with saving my grid out to file. Every time I try, I get the error " The output layer could was not generated"

C:\Users\Name\Documents\QGIS\Rav.tif

'Check error log for more information'

I tried the option of save to temporary location but same issue and as you would notice,my path does not contain any whitespace...

I'm using QGIS 3.0 and this was the same issue with 2.2.18 Las Palmas version

I checked this question however QGIS Processing error with SAGA, "output layer could not be open"

Here's the log

Processing algorithm…
AlgorithmDialog
Input parameters:
{ 'SHAPES' : 'C:/Users/HP/Documents/QGIS/Ravine/RavSpotH.shp', 'FIELD' : 'ALT', 'SIBSON' : True, 'OUTPUT_EXTENT' : '7.924584,7.933957,5.04092,5.04547 [EPSG:32632]', 'TARGET_USER_SIZE' : 0.0005, 'TARGET_USER_FITS' : 0, 'TARGET_OUT_GRID' : 'C:/Users/HP/Documents/QGIS/Ravine/RavDEM.tif' }

grid_gridding "Natural Neighbour" -TARGET_DEFINITION 0 -SHAPES "C:/Users/HP/Documents/QGIS/Ravine/RavSpotH.shp" -FIELD "ALT" -SIBSON true -TARGET_USER_XMIN 7.924584 -TARGET_USER_XMAX 5.04092 -TARGET_USER_YMIN 7.933957 -TARGET_USER_YMAX 5.04547 -TARGET_USER_SIZE 0.0005 -TARGET_USER_FITS 0 -TARGET_OUT_GRID "C:/Users/HP/Documents/QGIS/Ravine/RavDEM.tif"

C:\PROGRA~1\QGIS3~1.0\bin>set SAGA=C:/PROGRA~1/QGIS3~1.0/apps\saga-ltr

C:\PROGRA~1\QGIS3~1.0\bin>set SAGA_MLB=C:/PROGRA~1/QGIS3~1.0/apps\saga-ltr\modules

C:\PROGRA~1\QGIS3~1.0\bin>PATH=C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\site-packages\numpy\core;C:\PROGRA~1\QGIS3~1.0\apps\qgis\bin;C:\PROGRA~1\QGIS3~1.0\apps\Python36;C:\PROGRA~1\QGIS3~1.0\apps\Python36\Scripts;C:\PROGRA~1\QGIS3~1.0\apps\qt5\bin;C:\PROGRA~1\QGIS3~1.0\apps\Python27\Scripts;C:\PROGRA~1\QGIS3~1.0\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32\WBem;C:/PROGRA~1/QGIS3~1.0/apps\saga-ltr;C:/PROGRA~1/QGIS3~1.0/apps\saga-ltr\modules

C:\PROGRA~1\QGIS3~1.0\bin>saga_cmd grid_gridding "Natural Neighbour" -TARGET_DEFINITION 0 -SHAPES "C:/Users/HP/Documents/QGIS/Ravine/RavSpotH.shp" -FIELD "ALT" -SIBSON true -TARGET_USER_XMIN 7.924584 -TARGET_USER_XMAX 5.04092 -TARGET_USER_YMIN 7.933957 -TARGET_USER_YMAX 5.04547 -TARGET_USER_SIZE 0.0005 -TARGET_USER_FITS 0 -TARGET_OUT_GRID "C:/Users/HP/Documents/QGIS/Ravine/RavDEM.tif"
Unknown option 'SIBSON'

## #####

### ##

# ## ## #### #

##### ## #

# ## ##### #

SAGA Version: 2.3.2 (64 bit)

library path: C:\PROGRA~1\QGIS3~1.0\apps\saga-ltr\modules\
library name: grid_gridding
library : Gridding
tool : Natural Neighbour
author : O.Conrad (c) 2008
processors : 2 [2]

Usage: saga_cmd grid_gridding 3 [-SHAPES ] [-FIELD ] [-TARGET_DEFINITION ] [-TARGET_USER_SIZE ] [-TARGET_USER_XMIN ] [-TARGET_USER_XMAX ] [-TARGET_USER_YMIN ] [-TARGET_USER_YMAX ] [-TARGET_USER_FITS ] [-TARGET_TEMPLATE ] [-TARGET_OUT_GRID ] [-METHOD ] [-WEIGHT ]
-SHAPES: Points
Shapes (input)
-FIELD: Attribute
Table field
-TARGET_DEFINITION: Target Grid System
Choice
Available Choices:
[0] user defined
[1] grid or grid system
Default: 0
-TARGET_USER_SIZE: Cellsize
Floating point
Minimum: 0.000000
Default: 1.000000
-TARGET_USER_XMIN: Left
Floating point
Default: 0.000000
-TARGET_USER_XMAX: Right
Floating point
Default: 100.000000
-TARGET_USER_YMIN: Bottom
Floating point
Default: 0.000000
-TARGET_USER_YMAX: Top
Floating point
Default: 100.000000
-TARGET_USER_FITS: Fit
Choice
Available Choices:
[0] nodes
[1] cells
Default: 0
-TARGET_TEMPLATE: Target System
Grid (optional input)
-TARGET_OUT_GRID: Target Grid
Grid (output)
-METHOD: Method
Choice
Available Choices:
[0] Linear
[1] Sibson
[2] Non-Sibsonian
Default: 1
-WEIGHT: Minimum Weight
Floating point
Maximum: 0.000000
Default: 0.000000

C:\PROGRA~1\QGIS3~1.0\bin>exit
Execution completed in 20.94 seconds
Results:
{'TARGET_OUT_GRID': 'C:/Users/HP/Documents/QGIS/Ravine/RavDEM.tif'}

Loading resulting layers
The following layers were not correctly generated.
C:/Users/HP/Documents/QGIS/Ravine/RavDEM.tif
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.


texts: Date changed to strange values in feature class when uploaded to ArcGIS Online

texts:
I have a feature layer in ArcGIS Desktop running 10.1. It has a Date column with it. In ArcMap, this layer also has Time enabled with Time Zone set to "UTC+10:00 Canberra, Melbourne , Sydney" and "Values are adjusted for daylight savings" checked. The values in the DATETIME column are "dd/MM/yyyy 12:00:00 AM" in the designated time zone so it only shows the date part. It seems all good so far.

When I published the MXD file to ArcGIS Online, however, all the values in the DATETIME columns were changed to strange values.

I know ArcGIS Online would automatically convert the date values to suit the Time Zone of where you view the data. As I have set the correct Time Zone in ArcMap, ArcGIS Online should have shown the correct date values.

Even if ArcGIS Online hadn't done the conversion and did recognise the values as UTC, the date values should have been shown as the UTC time or the date time + 11 hrs. For instance, "23/11/2017" in ArcMap would be "23/11/2017"  or "23/11/2017, 11:00 AM" in Australian Eastern Standard Time with Daylight Savings. The "11/22/2017, 3:00 PM" is totally unexplainable.