texts: How to retrieve text from a QLineEdit in a tabifyDockWidget

texts:
I've write a plugin that calls a tool when a certain push button in my tabifyDockWidget is clicked. When the comboBox button is clicked it works perfectly carring the comboBox.currentText() to the tool, but when the lineEdit button is clicked the tool is called but doesnt get the lineEdit.text().

imports...
    def run(self):
        if not self.pluginIsActive:
            self.pluginIsActive = True
            if self.dockwidget == None:
                self.dockwidget = revEnvDockWidget()
            self.dockwidget.closingPlugin.connect(self.onClosePlugin)
            self.iface.addDockWidget(Qt.RightDockWidgetArea, self.dockwidget)
            self.dockwidget.show()

            #  sets the text that must be passed to tool
            #  QComboBox
            acquisitionTxt1 = self.dockwidget.acquisitionTab_comboBox.currentText()
            editionTxt1 = self.dockwidget.editionTab_comboBox.currentText()
            #  QLineEdit
            acquisitionTxt2 = self.dockwidget.acquisitionTab_lineEdit.text()
            editionTxt2 = self.dockwidget.editionTab_lineEdit.text()

            #  sets tool, it's the same tool for each different text
            a_ComboBoxClicked = HookCreator(self.iface.mapCanvas(), acquisitionTxt1)
            a_lineEditClicked = HookCreator(self.iface.mapCanvas(), acquisitionTxt2)
            e_ComboBoxClicked = HookCreator(self.iface.mapCanvas(), editionTxt1)
            e_lineEditClicked = HookCreator(self.iface.mapCanvas(), editionTxt2)

            #  calls the tool when certain button is clicked
            self.dockwidget.acquisitionTab_pushButton1.clicked.connect(
                lambda: self.iface.mapCanvas().setMapTool(a_ComboBoxClicked))

            self.dockwidget.acquisitionTab_pushButton2.clicked.connect(
                lambda: self.iface.mapCanvas().setMapTool(a_lineEditClicked))

            self.dockwidget.editionTab_pushButton1.clicked.connect(
                lambda: self.iface.mapCanvas().setMapTool(e_ComboBoxClicked))

            self.dockwidget.editionTab_pushButton2.clicked.connect(
                lambda: self.iface.mapCanvas().setMapTool(e_lineEditClicked))

from qgis import core
from qgis.core import QgsProject, QgsFeature, QgsGeometry, QgsPointXY
from qgis.gui import QgsMapTool
from qgis.PyQt.QtCore import Qt

class HookCreator(QgsMapTool):
    def __init__(self, canvas, txt):
        self.canvas = canvas
        QgsMapTool.__init__(self, self.canvas)
        self.txt = txt
        self.x = float
        self.y = float

    def canvasPressEvent(self, event):
        point = self.toMapCoordinates(self.canvas.mouseLastXY())
        self.x = point[0]
        self.y = point[1]

    def canvasReleaseEvent(self, event):
        features = []
        layer = QgsProject.instance().mapLayersByName('aux_revisao_p')[0]
        pr = layer.dataProvider()
        feature = core.QgsFeature(layer.fields())
        geom = QgsGeometry().fromPointXY(QgsPointXY(self.x, self.y))
        feature.setGeometry(geom)
        features.append(feature)
        for feat in features:
            feat[1] = self.txt
            feat[3] = 2
            feat[4] = 999
            feat[5] = 999
            if event.button() == Qt.RightButton:
                self.canvas.unsetMapTool(self)
            else:
                pr.addFeature(feat)
                layer.commitChanges()
                layer.triggerRepaint()

I've been searching about and find this question Activate a panel in tabbed panels that mentioned a findChild/Children method but I couldn't apply it. Am I missing somethig?


texts: Get every coordinate from an address database

texts:
I have a xls database of street addresses. I want to get the latitude/longitude coordinates for all of them.

I know very little programming, but I can learn. What's the easiest way of doing this?


texts: Finding layer based on source name using ArcObjects?

texts:
I am relatively new at creating tools with ArcObjects and I am having trouble finding a layer based on the layer's source name by looping through all layers.  I've seen here that it is possible, but I am unable to get it to work.  Am I missing something simple or is there another approach that I should be taking?  I see here it is possible to enumerate layers and loop through them, but I am still left trying to determine the source name of a layer.  My example below is looking for a layer whose source is a feature class named buildings.  If it helps, the dataset variable has a value of "Nothing" when I use a MessageBox to print the value of dataset.Name at each iteration.

'--other code to get editor, set up other variables, and start edit operation

Dim findName As String = "buildings"
Dim isLayerFound As Boolean = False
Dim map as IMap = m_Editor.Map
Dim subfield as Integer = 'some subfield integer

'--Check For Point Layer In Editing
If Not map Is Nothing Then
'--Loop through all of the map layers to find the desired one
    For i = 0 To map.LayerCount - 1
        Dim currentLayer As ILayer = map.Layer(i)
        Dim dataset As IDataset = CType(currentLayer, IDataset)
        If dataset.Name = findName Then
            isLayerFound = True
            '--Make sure layer is editable
            If m_editLayers.IsEditable(currentLayer) Then
                '--Set layer for editing
                m_editLayers.SetCurrentLayer(currentLayer, subfield)
                Exit For
            Else
                m_Editor.AbortOperation()
                MessageBox.Show("Layer " + findName + " is not editable. Operation aborted")
                Exit Sub
            End If
        End If
    Next i
    If isLayerFound = False Then
        m_Editor.AbortOperation()
        MessageBox.Show("Layer " + findName + " could not be found. Operation aborted")
        Exit Sub
    End If
End If


texts: Use a .shp file to map multiple entries in a .csv in QGIS

texts:
I have a .csv file with several entries with data for events which happened in places, and a corresponding .shp file which shows the locations where the events took place. How would I go about mapping a point for each of these events, using the .shp file to provide the locations?
The .csv file has more entries than the .shp file (ie some places have multiple events attached to them), so when I've tried joining one layer to the other, the best I can do is create one event point for each of the locations, when there should be several (ie the number of points mapped is limited to the number of location points in the .shp file, but there are more events in the .csv than there are locations).

To be clear, the .csv and .shp both have a field with corresponding entries denoting the location, but some of these are repeated over several entries (events) in the .csv, whereas the .shp only contains unique entries.

Apologies if the answer to this is obvious or available elsewhere, this is my first time using QGIS so I wasn't quite sure what to search for to get the right answer.

I'm using QGIS 3.4.

Edit: I've just spent a while trying to get this to work, but to no avail - I think it's because the .csv isn't (yet) spatially referenced in any way, so even once I've created a relation, it won't let me open the feature attributes window.


texts: Apply style to a layer in a geopackage using PyQGIS

texts:
I have a geopackage containing layers and styles stored, I need to assign one of the layers a style defined by its name. I have seen several examples but they use styles stored in external files and I could not solve that task. This is the code that I am trying to use without success.

def TestStyle_gpk(self):
        GpName = 'd:\\temp\\3584-I-a.gpkg'
        fileName = GpName
        sub_vlayer = QgsVectorLayer(fileName, 'embalses_areal', 'ogr')
        style_manager = sub_vlayer.styleManager()
        styles = sub_vlayer.listStylesInDatabase()
        style_xml = QgsMapLayerStyle(sub_vlayer.getStyleFromDatabase("4")[0])

        style_manager.addStyle('embalses_areal', style_xml)
        style_manager.setCurrentStyle(style_manager)
        style_manager.setCurrentStyle(style_xml)
        self.iface.layerTreeView().refreshLayerSymbology(sub_vlayer.id())
        self.iface.mapCanvas().refreshAllLayers()

And this is the error that QGIS gives:

2020-04-16T18:20:41     WARNING    Traceback (most recent call last):
              File "C:/Users/frank/AppData/Roaming/QGIS/QGIS3\profiles\Mapificacion/python/plugins\gestion_proyectos\gestion_proyectos.py", line 270, in TestStyle_gpk
              style_manager.setCurrentStyle(style_manager)
             TypeError: QgsMapLayerStyleManager.setCurrentStyle(): argument 1 has unexpected type 'QgsMapLayerStyleManager'

How can I solve this problem?


texts:
I have a problem in labeling.Labels of near by points get overlapping.If I use spacearound option label of any of the poi displays

In the above picture Bank of Baroda and Central bank of India get overlapped.I want to display the label of Bank of Baroda into left side of the point.I used maxdisplacement option.But still it is not working.

I used the following otion in my SLD

"maxDisplacement"=15

"spaceAround"=-1

Is there any option in geoserver that change the position of the label automatically when it gets overlapped


texts: Extract Specific Raster Cells From Gridded Shapefile

texts:
I have a raster image with a corresponding shapefile grid in which I am looking to extract an individual piece of that image using a single grid of the entire shapefile. The gridded shapefile is ordered sequentially from 0...n in the column FID. The code I was currently working with to loop through this process is as follows:

outws = r"C:/folder_with_resulting_extraction/"
raster = r"C:/somefolder/rasterfile.tif"
fc = r"C:/somefolder/fishnet_clipped.shp"

arcpy.CheckOutExtension("Spatial")
count = 0
with arcpy.da.SearchCursor(fc, ["FID", "SHAPE@"]) as cursor:
    for row in cursor:
        out = os.path.join(outws, "outraster" + str(count) + ".tif")
        ebm = arcpy.sa.ExtractByMask (raster, row[1])
        ebm.save(out)
        count = count + 1

arcpy.CheckInExtension("Spatial")

I would preferably like to modify or execute this script such that I would extract the corresponding raster from any FID number in the shapefile I specify (example would be 65). I had originally had this in a while loop, however the search cursor would start the extract at FID = 0 in the shapefile regardless of where the count was initiated.


texts: Adding automated values to attribute field?

texts:
I have parcel and buildings layers.

In their attribute tables I want to replace "NULL" values with numbers from 1 to 2000, in "Parcel ID", or "Building ID" field.

How can I do this in ArcGIS Desktop?


texts: How to use all QGIS 3 custom widgets in Qt Designer?

texts:
For example, QGIS 3.4 has various custom widgets such as QgsFieldValuesLineEdit and QgsColorWheel (and later versions have even more widgets) but they are not listed in the QGIS custom widgets list of the Qt Designer even when I run the "Qt Designer with QGIS 3.4 custom widgets". However, those widgets shown in the answer by @Joseph for the question by @Basile, No custom widgets in Qt Designer for QGIS 3, are available:

Is it somehow possible to add QGIS custom widgets that are, at least by default, missing from the custom widgets list of the Qt Designer to the list? If not, can they somehow, still be used in the Qt Designer (maybe through Qt Designer promoting widgets functionality for custom widgets)?


texts: Stack draw toolbars with ArcGIS API for JavaScript

texts:
I want to stack two different geometry draw toolbars with the ArcGIS API for JavaScript namely a point and a polyline.

The goal is to create a point with the first click and simultaneously start the polyline draw mode so that the polyline start and the point overlie each other.

I created a sample which partially works but the last part of the polyline is not recognized and won't be drawn to the map:

codepen sample

      map.on("load", createToolbar);

  function createToolbar(themap) {
    pointToolbar = new Draw(map);
    pointToolbar.on("draw-end", addToMap);
    polylineToolbar = new Draw(map);
    polylineToolbar.on("draw-end", addToMap);
  }

  on(dojo.byId('draw'), 'click', activateTool);

  function activateTool() {
    pointToolbar.activate(Draw["POINT"]);
    polylineToolbar.activate(Draw["POLYLINE"]);
  }

  function addToMap(evt) {
    var symbol;
    if (evt.geometry.type == "point") {
      pointToolbar.deactivate();
    } else if (evt.geometry.type == "polyline") {
      polylineToolbar.deactivate();
    }
    switch (evt.geometry.type) {
      case "point":
      case "multipoint":
        symbol = new SimpleMarkerSymbol();
        break;
      case "polyline":
        symbol = new SimpleLineSymbol();
        break;
      default:
        symbol = new SimpleFillSymbol();
        break;
    }
    var graphic = new Graphic(evt.geometry, symbol);
    map.graphics.add(graphic);

Is this a bug because of not intended use in the ArcGIS API or is there a way to fix this?


texts: Get a gpx file from the boundaries of a city

texts:
Is it possible to get a gpx file from the boundaries of a city displayed in Google Maps.
For example, this boundary: City Boundaries


texts: GeoServer WMS layer won't load on OpenLayers 5

texts:
I was making some tests using Tiger products: I converted one .shp in a PostGIS database using shp2pgsql, then imported the db into GeoServer; the layer works fine with the preview provided by GeoServer.

But when I try to add this layer to a new map, it doesn't work: I obtain an empty map, as if there weren't any other layers. I tried to look for other solutions to the problem, but none worked for me because they're mainly related to previews versions of OL. I'm sure it's only related to my inexperience with OL and JS in general, but still.

Here is the link provided by the GeoServer preview:

http://localhost:8080/geoserver/Test/wms?service=WMS&version=1.1.0&request=GetMap&layers=Test:Mass&styles=&bbox=-73.5018768310547,41.228515625,-69.9055328369141,42.8950424194336&width=768&height=355&srs=EPSG:4269&format=application/openlayers#toggle

And here the script related to the map:

    const wmsBaseLayer = new ol.layer.Tile({
        source: new ol.source.OSM()
    });

    const wmsMassLayer = new ol.source.TileWMS({
        url: 'http://localhost:8080/geoserver/Test/wms',
        params: {
            'LAYERS' : 'Test:Mass',
            'TILED' : true,
        },
        serverType: 'geoserver',
        projection: 'EPSG:4269'
    });

    const view = new ol.View({
            center:  ol.proj.fromLonLat([-71.0589, 42.3601]),
            zoom: 8,
    });

    const map = new ol.Map({
        target: 'map',
        layers: [ wmsBaseLayer, wmsMassLayer],
        view: view
    });

**Edit #1
I forgot to mention that I'm using a Docker architecture for my test. One container hosts GeoServer and one PostGIS. The containers are linked and the connection between them and the localhost works. I also tried to import the layer through both containers (as PostGIS db or as a WMS layer) in QGIS and it all works well. I figured that the problem is related to OL.

I made some digging and these are the errors showed in the Web Developer Console (I use Firefox)

TypeError: t.getLayerStatesArray is not a function
oo</e.prototype.getLayerStatesArray/<     Group.js:209
U</e.prototype.forEach                    Collection.js:137
oo</e.prototype.getLayerStatesArray       Group.js:208
lo</e.prototype.renderFrame_              PluggableMap.js:1198
e/this.animationDelay_<                   PluggableMap.js:191
<anonymous> self-hosted:975:17

I also checked the Network tab, and it doesn't show any request to the WMS service (as instead happens in the GeoServer preview).


texts: Swapping order of basemaps and overlays in Leaflet layers control?

texts:
Is it possible to swap the order of the basemaps and overlays section in L.Control.Layers?

I would rather the basemaps were below the overlays, since that reflects the zIndex of them in the map.


texts: Cannot see some shapefiles in QGIS Madeira 3.4.1

texts:
We have been working in QGIS without any problem. However in this new QGIS Madeira we are having some issues with some shapefiles. We open them we can see the atribute table but we cannot see the geometries (small file 6 geometries). However the same file can be correctly opened in QGIS 2.18.20 or in ArcGIS.
If the file is saved in QGIS 2.18.20 into a shapefile I can open it in QGIS Madeira.


texts: Configuring Project CRS to reflect degree coordinates

texts:
I have close to zero GIS background.

My goal is to extract only a certain UTM zone of this land use tiff file. I only know how to do that via specifying lat lon clipper box, however right now Qgis only shows things in pixel coordinate. Is there any way I can:

i. change project coordinates to lat/lon, or
ii. extract UTM zone straight from the current one (meters from origin @ 45N100W)?

The docs show the projection as Lambert Azimuthal Equal Area Central Meridian -100.0, Lat of Origin 45.0 which to my knowledge corresponds to US National Atlas Equal AREA EPSG:2163

I've tried setting both layer and project CRS to the mentioned projection, but no avail.

Here's a screenshot + first bit of gdalinfo.

Size is 37000, 35000
Coordinate System is:
PROJCS["Sphere_ARC_INFO_Lambert_Azimuthal_Equal_Area",
    GEOGCS["Sphere_of_Radius_6370997m",
        DATUM["Sphere_of_Radius_6370997m",
            SPHEROID["Sphere of Radius 6370997m",6370997,0]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Lambert_Azimuthal_Equal_Area"],
    PARAMETER["latitude_of_center",45],
    PARAMETER["longitude_of_center",-100],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["meters",1]]
Origin = (-4418000.000000000000000,4876500.000000000000000)
Pixel Size = (250.000000000000000,-250.000000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
  TIFFTAG_SOFTWARE=IMAGINE TIFF Support
Copyright 1991 - 1999 by ERDAS, Inc. All Rights Reserved
@(#)$RCSfile: etif.c $ $Revision: 1.10.1.9.1.9.2.11 $ $Date: 2004/09/15 18:42:01EDT $
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-4418000.000, 4876500.000)
Lower Left  (-4418000.000,-3873500.000)
Upper Right ( 4832000.000, 4876500.000)
Lower Right ( 4832000.000,-3873500.000)
Center      (  207000.000,  501500.000)


texts: Running EsriRegAsm on Windows 7 without running as Administrator?

texts:
Even though I'm logged in as a user with admin privs, Windows 7 still won't let me register with EsriRegAsm.exe.  I need to explicitly run as Administrator.

Is there some way to configure a machine so that I can use EsriRegAsm without running as administrator?

  Starting with ArcGIS 10, it has been
  decided to move away from the COM
  component category approach. The
  replacement consists of a new
  registration utility (ESRIRegAsm.exe)
  and an Extensible Markup Language
  (XML) database stored in published per
  product and version configuration
  folders, independent of the system
  registry; therefore, the registration
  of component and category information
  for a developer’s assembly or
  dynamic-link library (DLL) is achieved
  using the new ESRI provided utility
  called ESRIRegAsm. ESRIRegAsm performs
  registration on both native COM DLLs
  and managed COM assemblies, and as
  previously discussed, does not write
  the component category portion of the
  registration information into the
  system registry.

Update:
So does it write anything to the system registry?

If not, why should admin privs be required for installation?


texts: How to create multipart line and polygon with interior ring in arcgisscripting?

texts:
My objective is to swap X,Y coordinates of feature classes using Python and arcgisscripting.

Based on help examples, I managed to write script which reads and writes all geometry types.

The problem is with polyline geometry: for multipart lines, all parts are connected and they should be disjoint. It seems that connection between last vertex of one part is connected with first vertex of next part.
It's strange especially as script deals well with multipart polygons and polygons with void.

Am I missing something with multipart polyline geometry?

import arcgisscripting
gp = arcgisscripting.create(9.3)

gp.overwriteoutput = True
gp.workspace = r"D:\Work\SwapXY.gdb"
inFC = r"D:\Work\SwapXY.gdb\Line"

desc = gp.Describe(inFC)
shapeField = desc.ShapeFieldName  #SHAPE field name
shapeType = desc.ShapeType

# Create FC for inserting swaped geometries (if not exist)
...

try:
    rows = gp.SearchCursor(inFC) #open SearchCursor on input FC
    row = rows.next()
    outRows = gp.InsertCursor(outFC) #open InsertCursor on output FC

    #create Array object which will contain features vertices (other than points)
    vertexArray = gp.CreateObject("Array")

    while row:
        feature = row.getValue(shapeField) #get the SHAPE field into variable

        ##For point geometry there is another way of reading coordinates than for polyline/polygon
        if shapeType.upper() == "POINT" or shapeType.upper() == "MULTIPOINT":
           #this part works right

        else:
            #feature can have multiple parts - first goes iteration through parts
            partNum = 0
            partCount = feature.PartCount
            while partNum < partCount:
                part = feature.GetPart(partNum) #the output is Array of points
                pnt = part.next() #take first point from Array of points

                #iterate through all points in array
                while pnt:
                    #for each geometry create new POINT obj and assign swapped Y, X. Then add vertices to ARRAY
                    vertex = gp.CreateObject("Point")
                    vertex.X = pnt.Y
                    vertex.Y = pnt.X
                    vertexArray.add(vertex)
                    pnt = part.next()

                    #If pnt is null, either the part is finished or there is an interior ring
                    if not pnt:
                        pnt = part.next()
                        if pnt:
                            print "Interior:"

                partNum += 1

            newFeature = outRows.newRow()
            newFeature.shape = vertexArray       #assign ARRAY filled with points to shape field
            outRows.insertRow(newFeature)

            vertexArray.RemoveAll() #clear ARRAY before processing new geometry

        row = rows.next()
except:
    print gp.GetMessages()

In fact script doesn't work for polygons with more than one interior ring. So the problem is wider than I thought.
In polygon case, I've found that null point between exterior and interior rings should be inserted. But when gp.CreateObject("Point") is inserted, a point with coordinates (0,0) is added.


texts: Adjusting polygons to boundary and filling holes

texts:
Here's the problem:

Where:

1: department boundary

3: polygons inside department boundary that "touch" the department boundary(1). They are not necessary fitting well inside

2: holes between 1 and 3

I need to "adjust" polygon shapes (3) to "match" department boundary (1) filling the holes (2)

Using PostGIS:

My 1st approach was to get the st_pointonsurface of all numbers 2 and number 3 by departments. Then assign the holes (2) to the nearest polygon by pointonsurfaces between each other.

See image (from another department boundary but same problem, exceeding dotted lines with no fillcolor are polygons zones that exceeded department boundary that I've already cut off by department boundary so no problem there)

This worked but got me another problem::

some (lots of) holes (2) that where attached to the nearest polygon (by st_pointonsurface) were really long lines

Here (2) are the holes that were attached to the nearest polygon, and the result is 'strange' new polygons with really long lines.

I can use any of ArcGIS 10, Quantum GIS and PostGIS to solve this, but I can't get a way to solve this.

EDIT

How about using topology? what rules may be useful for this problem?

How topology will resolve when multiple polygons are fighting to get the same hole?

EDIT 2

Using geometry approach with PostGIS.

one idea:
- make buffers of the multiple polygons that are inside the department boundary
- get the st_intersection between buffered polygon vs original polygon + hole. This way the new "buffered" polygon only keep the buffer where the "hole"-intersected-area is touched.

This may work with simple examples .. but with real world holes and polygons..
This will leave us another problem: the overlaps between different buffered polygons inside hole areas..


texts: Convert GeoJSON form EPSG 3857 to 4326 with JavaScript

texts:
Given a GeoJSON in EPSG3857:

{
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "LineString",
    "coordinates": [
      [
        -13720479.997764934,
        5688254.733325758
      ],
      [
        -13720479.47473932,
        5688241.794717406
      ]
    ]
  }
}

I am trying to convert the GeoJSON to EPSG 4326 for a Leaflet map. The user input in the map comes in EPSG 3857. I want to do the conversion with JavaScript after the user enters the GeoJSON. So I am looking for a JavaScript library that I can use. I am not looking for tools with whom I can convert the GeoJSON outside of my script (like GDAL/OGR)  .

I tried Proj4 but didn't get it to work. Is it possible to use Proj4 to convert line strings? If not, what other options should I consider?

var epsg4326 = new Proj4js.Proj('EPSG:4326');
var epsg3857 = new Proj4js.Proj('EPSG:3857');

var geoJSONOBJ4 = new Proj4js.Point(geoJSONOBJ3);
Proj4js.transform(epsg4326,epsg3857,geoJSONOBJ4);


texts: Giving names to polylines in ArcGIS Desktop?

texts:
Is it possible to give names to the polylines in ArcGIS 10.3?

what is the name of the tool?


texts:
I have a georeferenced raster in QGIS and a shapefile of the same area. Both files are in the same projection, but they do have different extents. For some reason on the left side the shapefile features have been shifted up and on the right, down. The shift is scaled from the center (center is lined up perfectly). Is there a way that I can twist my shapefile based the center point of the file, or a point that I pick? Or could I georeference my shapefile to my raster?

Right Side

Left Side

Center


texts: Clustering 40k+ points from shapefile and populating Google Maps/Webapp?

texts:
I just started a new Python/Django webapp job related to GIS (and i'm totally new to GIS). Here is my task and what i have found so far, and i am stuck as to finding out what's the best way or the global standard way of doing things.

We are building a webapp where a user can upload a shapefile, and take the records and points from the file then populate them on a map.

Upload a shapefile
Parsed the shapefile using pyshp library - this seems OK
I'm able to read the shapes (coordinates) and the records (value for
each field on each shape)
Now say for instance i've got about 40,000+ coordinates, each of
them with field records in it
I'll need to populate those 40k points onto Google Maps - those
points should be represented with a marker, and the field records
can be represented with a heatmap (depending on which field the user
choose to filter it as)
Certainly loading 40k points onto Google Maps wouldn't make sense as
it will slow down the client side of things.

What can i do to make this fast or make this work?

Thinking of clustering nearby coordinates in a grid, and not only that, each coordinate has a field record and we have to somehow cluster them(?) so that the clustered coordinate has an accurate representation of the values in it.
A few options that i have looked at are :-

Use http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/docs/reference.html, this would speed things up.. but the server will still be sending 40k points, which may not work at a point where we need to load more than 40k points for each different section on the map
Was looking at how we can achieve
http://www.gdal.org/grid_tutorial.html by using
http://www.gdal.org/gdal_grid.html - I've not been able to get the
.tiff generation to work yet
Also to achieve grid data, i found http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html - though i don't think this actually does it
I just happen to learn about GeoDjango and
https://github.com/biodiv/anycluster, and am looking into it to see
if this should be something i should use
and i'm still continuing to research

I don't know if there is any global standard, it looks like a common problem that plenty of people may have come across. I am probably unaware of the lingo terms to search for.


texts: Measuring length of curved lines for district

texts:
I work in a country which is divided in election destricts(polygon shp). I have the roads of the country as a vector layer (vector shp).

I want to find a tool for QGIS like sum line lengths of qgis (perhaps a plug-in) to do the same work as the above-mentioned one but only for the curved lines of roads not the straight lines or the opposite. I use either ArcGis or QGis.


texts: Higher than maxNativeZoom requests tiles

texts:
Leafet is requesting tiles while at a higher zoom level than maxNativeZoom from defined mapserver instead of just stretching the maxzoom sized tiles. It is creating a lot of 404s since my maxzoom is 18 and the maxNativeZoom is 13. Is this expected or desired behavior? I would like it to display the level 13 tiles at level 18.

Leaflet 1.3.1

var mylayer = L.esri.dynamicMapLayer({
  url: "https://gis1.usgs.gov/arcgis/rest/services/thelayer/MapServer/",
  useCors: false,
  maxNativeZoom: 13,
  maxZoom: 18,
  f: "image",
  opacity: "0.5"

});


texts: Was possibility to mix shape types in shapefiles (.shp) planned for?

texts:
For those who have in-depth knowledge of the definition of shapefiles and their file structure ...

Why is each and every record header followed by the shape type of the record/shape when,
by definition, it is not allowed to mix shape types in a shapefile or its set of files?

I have surmised that they perhaps planned to implement the possibility to mix shape types for future applications.


texts:
I am still new to PostgreSQL and am hoping someone could help be optimize the following code for speed. The hg100 table has 17 million records, curstate has 11 million, and getting any information related to it is painful so want to make sure I am coding optimally and correctly. This script does run, however , I get an error:

  ERROR:  GEOSUnaryUnion: TopologyException: Input geom 0 is invalid:
  Self-intersection at or near point 5095.56885091
  6240.45418185 at 537.56804091 62441.4540885
  ********** Error **********

The first time I ran the code it took 1.5 hours to get that error message. To try and solve this issue I placed ST_MAKEVALID; it crashed again with the same error but it took 3.3 hours instead.

I am trying to get a summary of lang. The result will have 15 rows and the area within each according to disturbance state.

SELECT d.lang, st_area(st_union(st_intersection(st_makevalid(b.geom), st_makevalid(d.geom)))) / 10000 distbuf_area
     FROM p797.hg100 b, p797.ages d
     WHERE st_intersects(b.geom,d.geom)
     AND b.hex_id in
             (
              SELECT hex_id
              FROM p797.curstate_20170120_100
              WHERE disturbed = 1)
     GROUP BY lang;

Geoms and Hex_ID's are indexed. Hex_id is PK.

PostgreSQL 9.3


texts:
I have decimal XYs for 3 data point to create a line.

Do I need to convert the table to a WKT format such as?

LINESTRING (30 10, 10 30, 40 40)

I have multiple locations to import to create several shapes from a csv that are lat/long datapoints.


texts:
In QGIS I've loaded the shapefile "province" in which attribute table contains 242 fields (the municipalities of this province) and also two other files downloaded from OpenStreetMap about hotels (points and polygons) in the province.

I need to count the number of hotels for each common and I think the best way to do so is by using the "Group Stats" plugin. The problem is that only 26 commons in the province have at least on hotel in them, the others (242-26=216) don't have one or more of them.

Consequently the plugin generates a table containing only the commons with at least one hotel, but I need the full list of them (242 elements) and the number "0" in the commons without hotels.

How can I do to get this?


texts: Create a map of only one country in DIVA-GIS

texts:
I made a map of china with the places where the climate is suitable to plant Brussels sprouts.
The bounderies of China are in a shapefile. However the layer with the colormap showing where the climate is suitable goes beyond the boundaries of China and I only want a map of China. How can I fix this?

I'm completely new to GIS


texts: How to get raster metadata use Geotools just as gdalinfo do?

texts:
Is there anyway to get raster file's metadata, such as pixel size and nodata value of a GeoTIFF file, use GeoTools in a Java program?

Now, I can get the Coordinate Reference System and Envelope's coordinates, but don't know how to get full metadata just as gdal's gdalinfo function does.

GDAL's Java bindings API is not convenient during deployment.


texts: PostGIS does not export shortest path to Shapefile

texts:
I am trying to draw a bunch of lines overlaying the globe map in a WGS84 projection. To this effect I have created a PostGIS DB with a table that has one column containing linestring data.

My problem is that when I export it to WGS84 shapefile (either using pgsql2shp or adding a PostGIS layer directly in QGIS) the lines around the edges are drawn the wrong way.

For example:

Suppose you have a line that connects Tokyo to Los Angeles. I would expect it to go over the pacific, but it does not. Instead I see a line go over Asia, Europe, Atlantic, US and finally end at LA.

What I think is happening is that it's trying to keep the line contiguous in the WGS84 projection (which cuts the map in the middle of the Pacific Ocean), instead of picking the shortest route. How can I configure either PostGIS or one of the tools to do the right thing?

The right thing being:

A line segment goes from Tokyo to the right edge of the map, and another line segment picks up at the left edge of the map (same coordinate) and goes to LA.


texts: How to translate QgsMapCanvas coordinates to wgs-84?

texts:
My application uses QgsMapCanvas.

I've got point coordinates in wgs-84 crs and i need to add this point to vector layer (represents postgis table) inside of the canvas.

Have no idea how to transform correctly wgs-84 coordinates to canvas/layer crs.
Can anyone help me? Is there any python/c++ examples?


texts:
I am debugging a problem in an openlayers-based map application. Some time ago the ScaleLine control stopped being shown and I cannot find why. In the code below, if I change the units to degrees, the ScaleLine will show up as expected but for any other of the accepted units (us, metric, imperial, etc.) the ScaleLine will not be rendered.

Code that creates the ScaleLine:

var scaleLine = new ol.control.ScaleLine({
        target: document.getElementById('map-scale-bar'),
          units: "metric",
          minWidth: 100
      });
      map.addControl(scaleLine);

The target div looks like this after being rendered:

Does anyone have any hint for why the ScaleLine will only be shown for degrees?


texts: How to change the resolution of NetCDF data and start at a specific point in GDAL

texts:
I have temperature data which is in NetCDF format and lat=1801 lon=3600 and I want to convert it to a NetCDF file with lat=360 and lon=720. In other words, I want to change the resolution of my data whose resolution is 0.1 degrees, and convert it to 0.5 degrees. (By lon and lat, I mean longitude and latitude.)
When I change the resolution the output netCDF data starts at a point which has latitude= -89.7 and longitude= 0.2 but I want an output data whose start point has latitude= -89.75 and longitude= -179.75. How can I change the resolution in GDAL in a way that the output data starts at a specific point?


texts: Eliminating gaps in ArcGIS union operation?

texts:
I have a layer that has nested polygons in them.  I want to aggregate the polygons.  I do this using the Union function.

I use the "No Gaps" option when I perform the union.

However, when I overlay my unioned layer on top of the original, I can see small gaps in the polygon.

We also thought that doing a topology would work better than the union.  Except when we overlay the polygon count is different.

What causes these gaps, and how do I remove them?


texts: Sample points based on multiple conditions

texts:
Can anyone suggest a QGIS/R approach to sample from a polygon n points that satisfy some conditions depending on underlying raster layers values?

E.g. I have a country polygon and I would like to sample 10 points such that for those points the population density (density_raster) is >100 and altitude (altitude_raster) is <1000.


texts: QGIS Contour Plugin Says No Shapely; can import shapely in QGIS console

texts:
I'm keen to create some contours (isochrones for a pedestrian 'ped-shed' catchment) from a point dataset in QGIS, using the contour plugin from the Plugins repository.

I installed the plugin, but restarting QGIS generated a popup saying that the plugin had been disabled because one or more of shapely, matplotlib and numpy were not installed.

Since other plugins already depend on numpy and matplotlib, it was clear that only shapely could be the problem. pip install shapely finished without a hitch, but re-opening QGIS again spat out the popup.

When I open the Python console in QGIS and type import shapely, it's found - as the screenshot below shows.

A trawl of the internet and of this SX yield mostly questions like this - i.e., people who missed the dependencies (as I did, but have remedied).

Has anybody seen this behaviour before? If so, how was it resolved?

Both Python (2.7) and QGIS (2.8.2 Wien) are 32-bit; running on Windows 7 ultimate.


texts: How to specify content in a WCS GetCapabilities request

texts:
I have the following GetCapabilities request to a GeoServer WCS service:

http://fast.openearth.eu/geoserver/Netherlands_Study_Site_Paulina/wcs?service=WCS&version=1.1.0&request=GetCapabilities&

Very neatly it returns me an XML response with a lot of nice information.
It also returns information, on different contents, i.e. different GeoTIFFs that are located within the folder "Netherlands_Study_Site_Paulina".

However, I am specifically interested in 1 of the GeoTIFFs. For example, there is one with the title: DTM.

Question:
Is there a way to specify which content I want in the GetCapabilities request?


texts: Custom form with QT for QGIS 3.4, Date edit Widget, Null value

texts:
I made a custom form for QGis with QT-designer and I have a problem with the Date-Widget.

When I create a form in QGIS with drag and drop or automatically, then it works: Fore a date-field I can choose Date/Time and there I can choose the Null-Value as standard. And the calendar pop-up shows the actual date.

Is there a possibility to this with QT-Designer? I don't find a possibility there to choose the  Null-Value as standard (I don't find at all to choose the Null-Value). And for the Date I have to choose a concrete date and cannot use the actual date (now()).


texts: What is a simple binary raster storage format which ArcGIS can read?

texts:
I have a C++ program that manipulates raster digital elevation models.

I have been using ArcGrid ASCII format for results. It is simple to code and gets the job done, but it necessitates a decimal output. This means a loss of precision in floating-point numbers.

Is there a simple binary raster format which I could write to and ArcGIS could read from?


texts: How to flash selected feature using pyqgis?

texts:
In ArcGIS, when one clicks a feature with the identify tool, it will flash/flicker, which makes the feature really easy to see for a moment. Reportedly, there is also a flash method in its ArcObject API.

Is there a way to flash a set of selected feature to the same effect with PyQGIS (2.x or 3.0)?

I searched around, and couldn't find any mention of this or examples


texts: Why are Lat/Lon Coordinates often displayed as Lon/Lat in data sets?


texts: What is Lanczos resampling useful for in a spatial context?

texts: GDAL includes a resampling method beyond the normal mix of nearest neighbor, bilinear, cubic and splines: "Lanczos windowed sinc resampling". I understand that its a convolution filter, but unlike images where results tend to be subjective, the resampling used for spatial data has other implications. What's Lanczos and how does using it affect the output?


texts: QGIS Print Composer - Set Map Frame to Map Extent

texts:
How do I fit the Frame (A) of the Map Item exactly to the extent of the Map Canvas (B)?

I have done all of the following:

In Project View, I clicked "Zoom to layer" (specifically, the widest raster layer).
In Print Composer, under the Item Properties tab, specifically Extent, I clicked "Set to map extent."

These together were insufficient to move A to B.


texts: Geocortex Viewer: Running a Workflow with Arguments

texts:
I have a webpage with the Silverlight Geocortex Viewer embedded in it.

Through the browser's developer console, I can run commands through it such as

silverlightPlugin.Content.essentialsViewer.RunCommand("RunWorkflow", "demo1");

However, I can't figure out how to run a workflow that has arguments. There's another command called "RunWorkflowWithArguments". Doing the following doesn't produce any results:

silverlightPlugin.Content.essentialsViewer.RunCommand("RunWorkflowWithArguments", {"workflowId":"demo2", "my_string":"test", "my_int":3} );

The developer manual said:

Parameter:
An object with the following properties: workflowId, and a
named property for each workflow argument.


texts:
Possible Duplicate:
  How to install SDA4PP plugin for Kriging in QGIS?

I'm trying to use the SDA4PP plug-in for QGIS but it doesn't work. The software says to me that I need the rpy2 plugin for python but I have no idea how to install it. I read about the use of the "easy_install" software to install python module but I was not successful in using it.

Could you help please?

Paolo Tizzani


texts: How do you restore a doughnut polygon that has been turned into a simple polygon, using QGIS?

texts:
I've received a .shp file which has a hole in the middle, I'm trying to style it nicely so I don't want the outline that cuts from the "inner" to "outer" polygon. I quote inner and outer aren't actually inner and outer but are both part of the same outline. The cut is probably was originally made by the originator to have a hole in the middle of a simple polygon.

How do I using QGIS2 or its plugins change the polygon to a complex one, remove the "cut" edges marked by the arrow and correctly make the inner and outer boundaries for it?


texts: Select Features outside of polygon or reverse .filterBounds Google Earth Engine

texts:
Is there an easy way of selecting only those features not contained inside a certain polygon, let´s call it aoi?

FeatureCollection.filterBounds(aoi) retrieves every Feature inside aoi?


texts:
This refer to this post : Read Here

I'm in trouble when using osmosis command line to export data from planet-latest.osm.bz2 directly to osm2pgsql using some criteria to select what to transfer.

I think is more easy to export planet-latest.osm.bz2 to an XML with osmosis and then use osm2pgsql to import to Postgre, but I can't go further. So I need help in osmosis parameters to show how can I to export data using filters like

--place='city' --admin_level='2'

and import to Postgre using osm2pgsql.

Sorry about this very similar post, but the user was helping me was gived up.


texts: Animation around center point in Google Earth

texts: What is the best way to create an animation path around a central object like a mountain in Google Earth? At the end I think the animation path should be a "tour" to create video file from it.


texts: How to control layer visibility in the Map Composer Overview map?

texts:
I wonder if it is possible to choose which layers would be visible in the Overview Map loaded in the Map Composer.
Note that this is already possible for the Overview Panel in the QGIS Desktop: for each of the layer in your Map you can right-click on the name and check the "Show in Overview" (see image below).

But if I insert an Overview Map in the Map Composer I've no control on the layer's visibility: so all the layers (vectors and rasters) that are visible in the reference Map Frame will be also visible in the Overview Map (see image below).

I'm currently working with QGIS 2.14 Essen.


texts: Creating line that follows lowest elevation on contour map in QGIS

texts:
I have a shapefile of contours that I generated from LiDAR data on QGIS. I'm trying to create a line that follows the lowest point of elevation across the entire map that follows a ditch (it's a long section).
Is this possible to do this with a tool or do I need to draw the line manually?


texts: How can I use leaflet over vue+webpack inside a component?

texts:
I am making a vue project and I want to use leaflet inside of my components.

import L from 'leaflet';

  export default {
    created() {
      L.map('map').setView([33.4501001, -101.9107704], 4); // Coordinates, Zoom
    },
  };

html:

<template lang="html">

 Hello

</template>

But I get the error Map container not found?


texts: Import UML Metadata definition as template to Geonetwork

texts:
I would like to import the metadata definition from this link to Geonetwork.
The zip file has a UML file that follows the ISO 19115 definition with some adaptions for Switzerland, but I struggle to import the definitions to Geonetwork. My aim is to use the definition from the link as a template in Geonetwork, so that new entries have the fields of the standard.
Also I am interested to insert custom fields to the definition, possibly with predefined codelists. Is there a software that aids with this process?


texts: what format distanceTo function returns in OpenLayers?

texts:
i am using distanceTo function in OpenLayers Geometry.
http://dev.openlayers.org/docs/files/OpenLayers/Geometry/Point-js.html#OpenLayers.Geometry.Point.distanceTo
here am confused in which format it will return the value. It is in Kilometers or meters?


texts:
Qgis project can be published as WMS service ,WFS service etc.

But any library is there to create geojson-vt which will be equivalent to wfs


texts: Using dictionary of file names and DD coordinates to create points in shapefile using shapely?

texts:
I'm working on a Python script that strips the GPS info from images and uses that info to create a shapefile from that info. Right now I have all the file names as keys to tuples of decimal degrees coordinates. This dictionary prints out like this:

{'IMG_2840.jpg': (39.08861111111111, 114.80472222222222), 'IMG_2823.jpg': (38.61611111111111, 119.88777777777777), 'IMG_2912.jpg': (41.97861111111111, 106.25500000000001), 'IMG_2859.jpg': (39.742777777777775, 112.19694444444444), 'IMG_2813.jpg': (39.200833333333335, 119.79416666666665), 'IMG_2790.jpg': (41.82111111111111, 121.72472222222221), 'IMG_2753.jpg': (41.72027777777778, 124.32249999999999), 'IMG_2916.jpg': (41.01388888888889, 105.97611111111111), 'IMG_2750.jpg': (42.50833333333333, 125.72888888888889)}

How would I take this dictionary and turn it into a shapefile so that the names of the files are the names of the points?

I would prefer an open source way such as shapely or ogr/gdal.

Here's the code that generated this list.  It does not really deal with spatial data at all.

filelist = os.listdir(Path)
for f in filelist:
    if f.endswith(".jpg"):
        with open(Path + "/" + f, 'r') as I:
            print(I)
            img = Image.open(Path + "/" + f)
            exif = {ExifTags.TAGS[k]: v for k, v in img._getexif().items() if k in ExifTags.TAGS}
            print(exif)
            meta = exif['GPSInfo'][2]
            meta = [x[0] for x in meta]
            d = meta[0]
            m = meta[1]
            s = meta[2]
            NCDict[os.path.basename(I.name)] = dms_to_dd(d=d,m=m,s=s)
            # Ncoords = {I:dms_to_dd(d=d, m=m, s=s)}
            # print(Ncoords)
            meta2 = exif['GPSInfo'][4]
            meta2 = [b[0] for b in meta2]
            d = meta2[0]
            m = meta2[1]
            s = meta2[2]
            WCDict[os.path.basename(I.name)] = dms_to_dd(d=d,m=m,s=s)
print NCDict
print WCDict

# writing xy coords to new file
corddict=[NCDict,WCDict]
finalCoord = {}
for k in NCDict.iterkeys():
    finalCoord[k] = tuple(finalCoord[k] for finalCoord in corddict)
print(finalCoord)


texts: Does annotation only work at a specific reference scale in ArcMap 10.2?

texts:
I know that we could set "Define classes of features and label each class differently" for a point feature class but I prefer to label the features in an annotation layer.
We have to set a reference scale when we create an annotation layer. My question is that how to fix the problem that the labels do not scale up or down very well?


texts:
I see that there is no option in the layer->save as menu for saving to a postgis database.  There are for both SpatiaLite and SQLite.

I am guessing that the interface to PostGIS is significantly more complex than either of the "Lite" options and it has simply never made it to the top of anyone's todo list seeing as there are reasonably straight forward workarounds that can (presumably ?) be automated by scripting.

I ask because I am looking for something relatively straight forward to work on as a programming project involving QGIS. I am assuming that I can use the other two as a sort of template along with the shape to Postgres plugin.  I am an experienced programmer but a relative novice at GIS stuff.


texts:
I have some layers in Geoserver(latest stable) that came from PostGIS data (they belong to a store with PostGIS type and gets data from a PostGIS database)

In those layers there are only WMS settings, not WMTS

I went to Caching Defaults in Geoserver, the WMTS Service is already enabled.

So I went to my Openlayers and try this, so I can get a PostGIS-based layer, from Geoserver to the map.

var projection = ol.proj.get('EPSG:3857');
var textent = ol.proj.transformExtent([2297128.5, 4618333, 2459120.25, 4763120], 'EPSG:900913', 'EPSG:3857');
var projectionExtent = projection.getExtent();
var size = ol.extent.getWidth(projectionExtent) / 256;
var resolutions = new Array(14);
var matrixIds = new Array(14);
for (var z = 0; z < 14; ++z) {
  // generate resolutions and matrixIds arrays for this WMTS
  resolutions[z] = size / Math.pow(2, z);
  matrixIds[z] = z;
}

 var ait  =  new ol.layer.Tile({
      opacity: 0.7,
      extent: textent,
      source: new ol.source.WMTS({
        url: 'http://localhost:8080/geoserver/mymap/wmts?',
        layer: 'mymap:planet_osm_polygon, mymap:planet_osm_line, mymap:planet_osm_roads, mymap:planet_osm_point',
        matrixSet: 'EPSG:3857',
        format: 'image/png',
        projection: projection,
        tileGrid: new ol.tilegrid.WMTS({
          origin: ol.extent.getTopLeft(projectionExtent),
          resolutions: resolutions,
          matrixIds: matrixIds
        }),
        style: 'default'
      })
    })

planet_osm_polygon, planet_osm_line, planet_osm_roads and planet_osm_point are composing the final layer. In simple WMS settings would be
params: {'LAYERS': 'mymap:planet_osm_polygon, mymap:planet_osm_line, mymap:planet_osm_roads, mymap:planet_osm_point'.... but, in the WMTS case I dont know how I should set them, so that why I set them in layer

This does not work, I get

GET http://localhost:8080/geoserver/mymap/wmts?layer=mymap%3Aplanet_osm_polygon%2C%20mymap%3Aplanet_osm_line%2C%20mymap%3Aplanet_osm_roads%2C%20mymap%3Aplanet_osm_point&style=default&tilematrixset=EPSG%3A3857&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix=9&TileCol=286&TileRow=196 404 (Not Found)

Am I using the wrong settings or Geoserver does not support WMTS for PostGIS-based layers?


texts: Saving shapefile layer as KML with datasourceOptions using PyQGIS

texts:
I'm trying to export a shapefile layer to KML format in QGIS , trough Python coding.
The code is:
QgsVectorFileWriter.writeAsVectorFormat(inputlayer, outputlayer, "utf-8", coord_system, "KML")

But I have to add dataSourceOption in the line, because I have to specify a "nameField".
How I can add dataSourceOption in the writeAsVectorFormat method?
I have see that dataSourceOption accept a QStringList() but I don't understand.


texts: QGIS: Show label only when corresponding marker is displayed

texts:
I'm using rule-based symbology in QGIS to organize my data so that the markers of different categories of features can be turned on and off using the per-rule checkboxes in the layers window.
However, if I set up labels for a layer, they are always shown for all features, regardless whether the corresponding marker is displayed or not.
Is there any way to show a label only when the marker for the corresponding feature is displayed?


texts: Geometry distance PostGIS query with  operator suddenly much slower

texts:
One of my websites suddenly got much slower, and I've managed to track down the issue to a query that uses the <-> operator together with ORDER BY (2D distance between two geometries) to retrieve the 10 rows with a POINT field nearest a geographic point. The strange thing is that the exact same query has been working fine for a long time.

The app had been responding within 400 ms for the 99 percentile (and with an average of about 100 ms) up until a few days ago when the 99 percentile suddenly went up to over 1000 ms. Here's a graph of this:

Turning on logging of slow SQL queries (>250 ms), the following query comes up repeatedly:

LOG:  duration: 1084.692 ms  statement:
SELECT
    event.*, place.slug as place_slug, place.published as place_published, place.id as place_id, place.name as place_name
FROM
    event
INNER JOIN
    place
ON
    event.city_id=place.original_id
WHERE
    deleted=false AND
    is_public=true
ORDER BY
    point <-> st_setsrid(st_makepoint(103.856757191,1.29607891905),4326) LIMIT 10

It's a very common query in my app, so it should explain why the response time rocketed. An EXPLAIN on the query gives:

                                                   QUERY PLAN
----------------------------------------------------------------------------------------------------------------
 Limit  (cost=0.83..15445.04 rows=10 width=1875)
   ->  Nested Loop  (cost=0.83..2478796.59 rows=1605 width=1875)
         ->  Index Scan using event_point_id on event  (cost=0.41..2462008.83 rows=6835 width=1849)
               Order By: (point <-> '0101000020E61000005FE7DE77975D5E4025CC3F39943D3F40'::geometry)
               Filter: ((NOT deleted) AND is_public)
         ->  Index Scan using place_original_id on place  (cost=0.42..2.45 rows=1 width=30)
               Index Cond: (original_id = event.city_id)
(7 rows)

There's been no dramatic size change of the database table though it's continually growing slowly so I'm guessing it might have climbed over some threshold.

What might have caused the query to suddenly become much slower, and what steps I can take to debug it?

PostgreSQL version is 9.4.

Update with some more clues:

I realized that when I remove the deleted=false condition in the WHERE clause, the query suddenly execute fast again. It's only 439,000 rows, out of 1,505,000 rows that have deleted set to true. However 178,000 of these rows got updated with deleted set to true at around the time when the query suddenly became slow (!).


texts: How to add push pin on map with mouse click using bing API

texts:
I am new to BING API. What my requirement is I have to add a pushpin on my map where the mouse is clicked.

I added a map to my web page, created an click event on map and try to add a push pin. But its not working..

Mu piece of code :

<script charset="UTF-8" type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1"></script>

    <script type="text/javascript">
    var map,mapoptions;
    var pinInfobox = null;
    function init()
    {

        var bingkey="Bing map key";

        var loc=new Microsoft.Maps.Location(58.995311, -103.535156)
        mapOptions ={   credentials: bingkey,
                        center: loc,
                        zoom: 3,
                        mapTypeId: Microsoft.Maps.MapTypeId.road
                }

        map = new Microsoft.Maps.Map(document.getElementById("bingMap"), mapOptions);
        Microsoft.Maps.Events.addHandler(map, 'click',getLatlng );
    }
    function getLatlng(e) {
        if (e.targetType == "map") {
           var point = new Microsoft.Maps.Point(e.getX(), e.getY());
           var locTemp = e.target.tryPixelToLocation(point);
           var location = new Microsoft.Maps.Location(locTemp.latitude, locTemp.longitude);
         alert(locTemp.latitude+"&"+locTemp.longitude);

           var pin = new Microsoft.Maps.Pushpin(location, {'draggable': false});

             map.entites.push(pin);
             alert("Done");

        }
       }
      </script>

This is my script. This init() function is invoked on body onload.

Any help is greatly appreciated ..


texts: Insufficient memory available for raster calculator on DEM with float 32 pixel type

texts:
I merged 102 Tiff files downloaded from ASTER: https://earthexplorer.usgs.gov/.

They were each 17 MB, plus or minus. I merged them using the Processing toolbox/GDAL merge tool. I am trying to use the raster calculator on it, but I get an error message saying Insufficient memory available for the operation. The pixel type is float 32, and I heard at my previous question that this may be making the file size too big.

About my computer:
7.8 GiB of memory
32 bit
483.8 GB disk space (128.5 used)
Ubuntu 16.04 LTS
QGIS 2.18.11

I have tried changing the pixel type with GDAL Translate, but I get an error message saying no output file was created:

When I use r.mapcalc to do the raster calculation, I click run and it seems to work, but no file is saved and no layer appears. I tried using both the name of the file in the Layers panel and its filename.

I could try merging the different rasters into small groups, but idoes anyone know an easier way?


texts: Calculating how long arc second is for given long/lat?

texts: I am wondering what area is covered by a dataset which is one arc second wide.


texts:
When trying to use gdal_merge.py (from alpine-normal-3.2.1) to actually merge 4 large raster files (roughly 6 GB each) this way:
gdal_merge.py -o merged.tif -of GTiff input_*.tif

my computer memory went through hell:

Synthetic figure drawn by hand to catch the idea, but not actually representing the true behaviour...as it freezed the computer.
RAM (magenta) is 12 GB, swap (green) is 5 GB.
Is there a way to limit RAM usage by gdal_merge in order to avoid a crash?
The current results are not encouraging, because the command abruptly ends with:
0Killed


texts:
I have loaded the following GeoJSON into PostGIS using Java and the table is there but the line will not display. If I zoom to feature it correctly shows the extent, it just doesn't draw it. I've created a spatial index also. Any ideas?

{"type":"Feature","geometry":{"type":"LineString","coordinates":[[360563.95,176361.8627],[360608.6526,176321.6237]]},"properties":{"name":"Canada","classification":1,"height":20.5},"id":"fid.1"}

I ran this to load it:

                            try {
                                p = Runtime.getRuntime().exec("cmd /c ogr2ogr -f \"PostgreSQL\" PG:\"dbname=design user=postgres\" \"C:/Users/ajsmi/Dropbox/Consultants/Design/Bristol/Data/Created Data/access.json\"");

                                p.waitFor();
                                BufferedReader reader = new BufferedReader(new InputStreamReader(
                                        p.getInputStream()));
                                String pline;
                                while ((pline = reader.readLine()) != null) {
                                    System.out.println(pline);

                                }
                            } catch (IOException e) {
                                e.printStackTrace();
                            } catch (InterruptedException e) {
                                e.printStackTrace();

                            String query = "CREATE INDEX accessspx ON access USING GIST ( wkb_geometry );";
                            try (PreparedStatement pst = conn.prepareStatement(query)) {

                               pst.executeUpdate();


texts: Remove inner border and extend dangles to outer border

texts:
I'm struggling with a massive file of grids that need borders extend or snapped onto the outer border of the file. I'm looking to batch this process as I'm currently using topology and and tracing borders then redrawing them and then cutting after doing the entire file.

I have tried many things and am now out of ideas and have come to you for help.

I have Arcgis Advanced users licence and don't wish to buy new product or addons.
Starting Point


texts: ArcGIS - Locate features along routes returning double results?

texts:
I am using locate features long routes using a points layer and a routed polyline network.

Each point has a unique ID. My end goal is to determine is a point is to the left or right of the line.

However my locate features along routes output is returning the point (field UNIQ) as being on both side of the line? Each row has exactly the same measure as the one above it and the same distance (but negative). Any idea why this is happening?


texts: Converting date field value returned by REST API to correct date?

texts:
I performed a query on this USGS feature service of Airport locations:

Click for query

And the value for the field LOADDATE is:

LOADDATE: 1411380301000

However, when I pull the layer into ArcMap, the value is:

LOADDATE: 9/22/2014 10:05:01 AM

Does anyone know what the 1411380301000 value represents, and how to convert it back into 9/22/2014 10:05:01 AM?


texts:
I installed OSGeo4W.
I have no other Python version on my computer.
I can import osgeo.
But when I try to import qgis.core I am getting the error:

>>> import qgis.core
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named qgis.core

What could be the reason for that?


texts: I have a project that requires us to plot floods in a certain area, the example below shows the flood areas.  What I would like to know is how would I be able to shows these polygons in a better fashion.  What I want is to show in a way wherein the overlapped area of the polygons are shown in a darker shade of blue; since i need to be able to show the area where it usually floods.  Any suggestions? BTW these areas are all drawn using google.maps.polygon wherein the coordinates came from the database.  It is also suggested that we use heatmaps, do you guys know of any way I can turn these polygons into heatmaps format.


texts: Add Vector Layer - Database OODBC does not work

texts:
What I am trying to do: Add a vector layer from an remote Oracle database.

Platform: Linux Red hat 7
Database: Oracle 11g
Connectivity via unixODBC Oracle

Description:
I tried to add a vector layer using ODBC connectivity to an Oracle database on QGIS 2.8.2.

Add vector Layer
Choose Database
Type ODBC
Click New

I filled the form as:

Type ODBC
Name: myODBCConnection
Host: ssfdata
Database: CAAR
Port: 1521
Username: USER
Password: PASS

When I clicked Test Connection I got:

Connection failed – Check settings and try again

Extended error information:
Unable to initialize ODBC connection to DSN for USER/PASS <at> CAAR,
[unixODBC][Driver Manager] Datasource name not found, and no default driver specified

I opened a terminal window and I typed:

Isql –v caarODBC

I was able to connect to my database

+------------------------+
| Connected              |
|                        |
| sql –statement         |
| help [tablename]       |
| quit                   |
+------------------------+

SQL>

So the unixODBC driver works for the database but QGIS is not able to access via ODBC.
Is any special settings related qgis to make ODBC working?


texts: Finding toolbox in Geoprocessing Package (GPK)?

texts:
I have downloaded the tessellation tool for ArcGIS Desktop for making hexagon grids around a study area.

I only found a *.gpk file at https://www.arcgis.com/home/item.html?id=03388990d3274160afe240ac54763e57

Where do I find it as a toolbox (*.tbx)?


texts: Copy two datasets that particpate in the same relationship class

texts:
I have an ArcSDE GDB that looks something like this:

++ GDB
+++++ Dataset1
++++++++ FeatureClass1
++++++++ FeatureClass2
+++++ Dataset2
++++++++ FeatureClass3
++++++++ FeatureClass4
+++++ Table
+++++ Table_FeatureClass1_RelationshipClass
+++++ Table_FeatureClass3_RelationshipClass

I wanted to create a backup of the two datasets as follows:

arcpy.Copy_management('C:/GDB.sde/Dataset1', 'C:/Extract.gdb/Dataset1')
arcpy.Copy_management('C:/GDB.sde/Dataset2', 'C:/Extract.gdb/Dataset2')

The problem is that when I run the first statement it automatically copies Table and all related classes, including FeatureClass3 from Dataset2. Then, when it gets to the second line, the script fails because it's trying to create Dataset2 which already exists. It doesn't give a specific error, but when I remove the relationship classes everything works fine. So does anyone know how to copy multiple datasets that share a related table like this?

UPDATE:

Following blah238's comment below, I tried using the Export XML Workspace tool with the SDE connection as the input, and a local XML file as the output. It ran fine for most of the datasets, and then hit one it didn't like an threw an error 999999: Failed to execute. I don't see anything peculiar about the dataset, other than it's empty and not registered as versioned. I then tried exporting each of the two datasets individually, which worked but was quite slow and added a few hundred MB to the total file size. Not really a practical solution.

Also, I found this ArcGIS Forums post describing the same issue. There's an explanation of how to list FC's that participate in relationship classes, so I could potentially check against that before trying to copy.


texts: Writing osmnx queried footprints to shapefile

texts:
I'm attempting to pull a set of building footprints from open street map using a shapefile boundary.  I have success getting the buildings into a geodataframe, but when I attempt to write them out to a shapefile I get the following error:

ValueError: Invalid field type class 'list'

Here's my code

import osmnx as ox
import shapefile
import geopandas
from shapely.geometry import shape

shp = shapefile.Reader("StudyArea.shp")
feature = shp.shapeRecords()[0]
first = feature.shape.__geo_interface__

#convert to shapely shape
shp_geom = shape(first)

fprints = ox.footprints.footprints_from_polygon(shp_geom,
footprint_type ='building')
ox.plot_shape(ox.project_gdf(fprints))
type(fprints)
fprints.to_file('footprints.shp', driver='ESRI Shapefile')

Everything works except the last line when I attempt to write the file.  It actually writes a shapefile but it writes an empty polyline shapefile (based on the icon in ArcCatalog)  I've read about others who've had issues with the datatype conversion of some of the footprint attribute info but am new to geopandas and didn't find a clear solution.


texts: I was looking at the API for the ArcGIS Editor widget (esri.dijit.editing.Editor), and I couldn't find a list of methods that are on the widget. I've seen other examples online that call destroy(), but that method isn't listed.  Where can I find a complete listing of the Editor's methods?


texts: Layer specific popup template in openLayers 3

texts:
I want to define individual pop up templates for different vector layers in Openlayers 3.

The layers are defined with the following options (that are passed to a constructor-function):

n2k_dh_l = new ol3Vector({
            map: map,
            title: "Natura 2000 Habitats Directive_ol3Vector",
            attribution: "
Réseau Natura 2000 Habitats Directive",
            geotable: "n2k_dh",
            fields: "gid as id,sitecode,sitename,surfha",
            where: "sitename ilike '%moselle%'",
            fill: "rgba(100,250,0,0.1)",
            stroke_color: "green",
            stroke_width: 2,
            minResolution: 0.01,
            maxResolution: 50,
            content: "'
 HD' + feature.get('sitecode') + '
' + feature.get('sitename') + '
' + feature.get('surfha') + ' ha
'"

});

To build the content of the popups I use the following code:

map.on('click', function(evt) {
  var feature = map.forEachFeatureAtPixel(evt.pixel,
    function(feature, layer) {
      return feature;
  });
      var popupcontent = map.forEachLayerAtPixel(evt.pixel,
    function (layer) {
      return layer.get('content');
  });

if (feature) {
  popup.setPosition(evt.coordinate);
  var content = popupcontent;
//  -- This code works, but is static
//var content = '
' + feature.get('sitecode')+'
'+ feature.get('sitename') + '
' + feature.get('surfha') + ' ha
';
//
  $(popup_div).attr( 'data-placement', 'auto' );
      $(popup_div).attr( 'data-content', content );
      $(popup_div).attr( 'data-html', true );
  $(popup_div).popover();
  $(popup_div).popover('show');
} else {
  $(popup_div).popover('destroy');
}
});

My problem is that the content-string (from my layer options) is passed to the data-content of the popup_div, but the code is not evaluated (as in the outcommented version). It is passed as string.

I've tried to remove the " at the beginning and the end of the string with RegEx, but this didn't change anything.

var content = popupcontent.replace(/^"(.+(?="$))"$/, '$1');

How can I pass my popupcontent so that it gets evaluated?

Here the solution I've found right now:

var content = eval(popupcontent);


texts: Map variables do not appear in field editor or in project settings

texts:
I am attempting to utilize a few of the map variables (particularly the new @map_start_time variable associated with the added temporal features in 3.14). I am on version 3.14.1.
I do not see any of the defined "map" variables (seen here) either in the project properties "variables" tab nor in the field calculator.

Does anyone know why this is occurring?


texts: QGIS 2.99.0 Providers not available in processing options

texts:
I just wanted to have a deeper look at the graphical modeller in QGIS 2.99.0-147, and I stumbled upon the providers not available under Settings|Options...|Processing|Providers as shown in the screenshot below (Good idea to move it away from the processing menu by the way...).

I installed it with the 64bit OSGeo4W installer on Windows 10, and it is installed as QGIS 2.99.0 with GRASS 7.2.1 (Nightly), so shouldn't at least provider 'GRASS' be available?

And where have all the others gone (e.g. SAGA)? Will they be there again in QGIS 3.0?


texts: How to set more than one font sizes for a legend item in a QGIS?

texts: I am looking for a possibility to set a second font size for one legend item in QGIS (2.8.1) Printcomposer. For every item (name of a plant) I need a smaler expression in brackets (name in latin). Is this possible, if yes, how?


texts: Is there any way to select only the layer of which the features have been selected? That is, if I have selected some roads then I want only the road layer to be selected.


texts:
I am trying to add all of the counts in an attribute table, to get the total number of counts (I am trying to figure out the percent aspect for a polygon).

My code works fine, I am not getting any errors. I just need to know how to sum the "Count" row in the attribute table. I know how to do it in ArcMap, but I don't know how to write a code for the summarize statistics. I am using ArcGis 10.3

def getaspect(outras):
    TheRows = arcpy.SearchCursor(outras)
    for TheRow in TheRows:
        pixval = TheRow.getValue("VALUE")
        pixcount = TheRow.getValue("COUNT")
        count = TheRow.getValue("COUNT")
        print count
        if pixval == 3:
            shed = pixcount
        else:
            pass
    cellsize = arcpy.GetRasterProperties_management(outras, "CellSIZEX")
    cellsize = float(cellsize.getOutput(0))
    pixarea = cellsize * cellsize
    print "writing new watershed"
    exfile = open("C:...Myworkspace.../List.txt", "a")
    aspect = shed * pixarea


texts: Run PyQGIS script always - in the background

texts:
How to always run a PyQGIS, in the background?

In my case, I want to delete "feature A", the polygon, that have a "attribute X", if feature B, the lines, that have "attribute X" as well.


texts: Using value from Get Count tool in Calculate Field statement in ArcGIS ModelBuilder?

texts:
I'm trying to assign the number of crashes (points) found in a buffer to the line segment found in the same buffer. I need to iterate through the rows of the buffer feature class. I have the model built, all i need to do is figure out how to pass the number of selected crashes (Get count) into the Calculate field in the line feature class.

See the attachment of  the model I have built.

I know very little Python. I'm using ArcGIS 10.5 Advanced license.


texts: Creating a constant elevation raster with multiple attributes

texts:
Is it possible to create a raster with a constant value with multiple attributes?  Such as:

rowid  value  count  Name
1      630    36000  Forest
2      630    75000  Anthro
3      630    2600   River
4      630    5500   Harvested

The above table would create a constant elevation but have different attributes for each cell.  I have tried a reclass but it deletes the existing attributes leaving only one row.


texts:
I want to export a query to a Shapefile.  If the query is empty I get an error
and it will not export. How can I do nothing if the query is empty and export next query in the list?

Sample if I exporting Land but it is no Building on the land I get error

Export_with_query("2", "BUILDING", "1")

Export_with_query("2", "LAND", "1")

  Public Sub Export_with_query(ByVal ep_layer, ByVal ep_name, ByVal ep_query)

    Dim pDoc As IMxDocument
    Dim pMap As IMap
    Dim pFLayer As IFeatureLayer
    Dim pFc As IFeatureClass
    Dim pINFeatureClassName As IFeatureClassName
    Dim pDataset As IDataset
    Dim pInDsName As IDatasetName
    Dim pFSel As IFeatureSelection
    Dim pSelSet As ISelectionSet
    Dim pFeatureClassName As IFeatureClassName
    Dim pOutDatasetName As IDatasetName
    Dim pWorkspaceName As IWorkspaceName
    '   Dim pExportOp As IExportOperation
    Dim pExportOp As ESRI.ArcGIS.GeoDatabaseUI.IExportOperation

    Try

        pDoc = My.ArcMap.Document
        pMap = pDoc.FocusMap
        pFLayer = pMap.Layer(ep_layer)
        pFc = pFLayer.FeatureClass

        'Get the FcName from the featureclass
        pDataset = pFc
        pINFeatureClassName = pDataset.FullName
        pInDsName = pINFeatureClassName

        'Get the selection set
        pFSel = pFLayer
        pSelSet = pFSel.SelectionSet

        Dim pQFilter As IQueryFilter
        pQFilter = New QueryFilter
        pQFilter.WhereClause = "TYPE =  '" & ep_query & "'"
        If pFc.FeatureCount(pQFilter) = 0 Then
            Exit Sub
        Else

        'Define the output feature class name
        pFeatureClassName = New FeatureClassName
        pOutDatasetName = pFeatureClassName
        pOutDatasetName.Name = ep_name
        pWorkspaceName = New WorkspaceName
        If Chk_default_path.Checked = True Then
            pWorkspaceName.PathName = "c:\map"
        Else
            pWorkspaceName.PathName = Txt_path.Text
        End If
        pWorkspaceName.WorkspaceFactoryProgID = _
              "esriCore.shapefileworkspacefactory.1"
        pOutDatasetName.WorkspaceName = pWorkspaceName
        'pFeatureClassName.FeatureType = esriFTSimple
        pFeatureClassName.FeatureType = ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTSimple
        '  pFeatureClassName.ShapeType = esriGeometryAny
        pFeatureClassName.ShapeType = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryAny
        pFeatureClassName.ShapeFieldName = "Shape"

        'Export
        ' pExportOp = New ExportOperation
        pExportOp = New ESRI.ArcGIS.GeoDatabaseUI.ExportOperation
        ' pExportOp.ExportFeatureClass(pInDsName, Nothing, pSelSet, Nothing, pOutDatasetName, 0)

        pExportOp.ExportFeatureClass(pInDsName, pQFilter, pSelSet, Nothing, pOutDatasetName, 0)
        'pExportOp.ExportFeatureClass(pInFClassName, pQFilter, pSelSet, pGeomDef, pOutDatasetName, 0)
        '   End If

    Catch ex As Exception
        MessageBox.Show("Error exporting map: " & vbCrLf & ex.ToString)
    Finally
    End Try
End Sub


texts:
I am searching for a file in any geospatial vector format (Shape, ...) with the Alps classified by Suddivisione Orografica Internazionale Unificata del Sistema Alpino (SOIUSA) with the 36 sections and if possible also the corresponding subsections as described in detail on the italian Wikipedia page.

As mentioned in this article there is also a book by the same author called Atlante orografico delle Alpi. SOIUSA with some detailed illustrations. My italian is not that perfect, that I would understand everything but there might be some digital files somewhere.

There is a nice image visualising the classification by Luca Bergamasco, but it is just a PNG:


texts: In QGIS 3.2, I want to show text labels on a map that are coming from a polygon attribute - easy enough. But I want to have the flexibility to set the wrap text position in a certain space, not just at all spaces - as the text now looks ugly in that layout with a word on each line. Is there any way that can be done? e.g., make the only text wrap after the word "Regis" in this example: "Newtown Regis and Seckington".


texts: SAGA_CMD: select polygon features of one shapefile and save in new shape files

texts:
I want to use saga_cmd to select from a shapefile only the shapes, which have a certain area size and store this selection into a new shapefile. I'm using the following command to filter via the respective area size:

    saga_cmd shapes_tools 3 -SHAPES=objects_8_area.shp -FIELD=AREA -EXPRESSION=a > 5.0 -METHOD=0 saga_cmd

However, it seems that SAGA is not working - means there is no output on the cmd.

Does anyone of you have an idea what the problem might be?

After the selection will work, I would like to store the selection in a new shapefile with:

    saga_cmd shapes_tools 6 -INPUT=objects.shp -OUTPUT=objects_red.shp

Or could anyone of you suggest another workaround?

I got a solution in another forum.

https://sourceforge.net/p/saga-gis/discussion/790705/thread/b9a1d1ae/


texts: How to batch run an FME workspace on a feature basis?

texts:
Not sure about the title of my question...

My point is to run an entire workspace for each feature contained in a reader.

In python this would look like:

for s in bus_stops:
    run_workspace(s)

Basically my workspace works as following :

reads 1 bus stop
reads a road network
computes network cost for the input bus stop (NetworkCostCalculator)
outputs contours

The workspace works if input is limited to 1 bus stop (une source only for NetworkCostCalculator).

By now I have split my input bus stops in as many feature types and I batch run my workspace on them but I'm sure there's a more efficient way to achieve that.


texts: Plotting NetCDF file using lat and lon contained in variables

texts:
I am trying to plot this NetCDF file (and similar) as a 2d contour map.
The file contains a single layer of one variable, "pr".
The file has 413x229 X-Y pixel coordinates, and, stored inside the "xlon" and "xlat" variables, the exact coordinates of each grid point.
I can easily plot using X-Y coordinates:

filename <- "file.nc"
varname <- "pr"
library(raster)
variable <- raster(filename, varname=varname)
plot(variable)

Hpwever, the plot comes out "squeezed", and moreover I want to plot using lat-lon coordinates. How can I do that?

This is somehow similar, I think, to this question:
https://gis.stackexchange.com/questions/48518/how-to-re-project-ease-equal-area-scalable-earth-grid-with-a-25-km-cylindrica?newreg=0eac93c7cbf04b6386d4e62e64e747ef

However, the solution given there is not suited to my case because:

I would like to avoid using the ncdf4 package, I'd prefer to use raster only as this would allow me to expand the procedure to bigger files
I get several errors in the convertGrid() function, such as:
coordinates(xp)=~x+y
Error in .subset(x, j) : only 0's may be mixed with negative subscripts

I should reverse the projection, I think. All I know of the projection is contained in the file ncdump:

projection = "LAMCON"
grid_size_in_meters = 12000.
latitude_of_projection_origin = 39.
longitude_of_projection_origin = 14.
standard_parallel = 35., 51.
grid_factor = 0.684241343018562

The file does not have a CRS specification.
I know I should be able to do so using the sp, raster and rasterVis packages but so far I've not succeeded.

Trying to plot as a data.frame does not work either because the grid is not constant.


texts:
I tried to project satellite image of pixel size 2.5m*2.5m. It's in wgs84 UTM zone 44 North. I tried to project it to nepal_87 but failed. The error massage displayed was 'error-000289,failed to alter spatial reference.'

Also this satellite image and shape files of the area are not displayed at same time, only which the one loaded first is displayed.


texts: Polygon Centroids working for only some Polygons in PyQGIS?

texts:
I have a building Layer(Full of Polygons).I want to get centroids of polygons and save them as point layer.I am using python console within Qgis 3.0. I have tried below code.I got my Centroid Layer(but only for some polygon,not ALL).But I want the centroid for all Polygons.

vectorLyr=QgsVectorLayer("C:/Test/demand/Demand.shp", "BuildingLayer", "ogr")
vectorLyr.isValid()
import processing
processing.run("native:centroids", {'INPUT':'C:/Test/demand/Demand.shp','ALL_PARTS':False,'OUTPUT':'C:/Test/demand/centroid.shp'})
#{'OUTPUT': <qgis._core.QgsVectorLayer object at 0x000000000EF9C438>}

I am getting below error

traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\code.py", line 91, in   runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python/plugins\processing\tools\general.py", line 84, in run
return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python/plugins\processing\core\Processing.py", line 190, in runAlgorithm
raise QgsProcessingException(msg)
_core.QgsProcessingException: There were errors executing the algorithm.

I have added visualization of my output


texts: Leaflet Tooltips on GeoJSON multipolygons

texts:
I'm currently using the bindTooptip function on a layer to bind a label to it.

One of my layers, however, consists of 2 Polygons that are within the same feature, using the array format:

[
  [
    [0.22, -0.26], [0.23, -0.25], [0.23, -0.26], [0.22, -0.26]
  ],
  [
    [0.29, -0.273], [0.29, -0.26], [0.30, -0.26], [0.30, -0.27]
  ]
]

While I am able to automatically style both Polygons this way, adding a label will center it on the first one. I'm wondering if there's any way to bind a tooltip onto the 2nd one, or if I simply need to separate the polygons and make my own logic for them to be grouped as they currently are.


texts: I am using ArcGIS 10.1, I am just wondering if there is a way to maintain constant the selected symbols for some shapefile. The scope is to use the same shapefile with the same chosen symbols also in other map projects avoiding to select every time again the symbols.


texts: Get default values from PostGIS DB in QGIS 2.4 editor

texts:
One of my postgis tables tables automatically includes the nextval(xxx) in the edit feature form in qgis(and I think will also update ids of multiple features automatically). The other seems to have the same definition in postgis and qgis, but does not. Is there a key setting that I am missing? This is the definition of both my tables in postgis:

Property    Value
Name    id
Position    1
Data type   integer
Collation
Default nextval('seq1'::regclass)
Sequence    seq1
Not NULL?   Yes
Primary key?    Yes
Foreign key?    No
Storage PLAIN
Inherited   No
Statistics  -1
System column?  No
ACL
Comment

-- Column: id

 ALTER TABLE x ADD COLUMN id integer;
 ALTER TABLE x ALTER COLUMN id SET NOT NULL;
 ALTER TABLE x ALTER COLUMN id SET DEFAULT nextval('seq1'::regclass);

And the other

 Property   Value
 Name   id
 Position   1
 Data type  integer
 Collation
 Default    nextval('seq2'::regclass)
 Sequence   seq2
 Not NULL?  Yes
 Primary key?   Yes
 Foreign key?   No
 Storage    PLAIN
 Inherited  No
 Statistics -1
 System column? No
 ACL
 Comment

-- Column: id

ALTER TABLE y ADD COLUMN id integer;
ALTER TABLE y ALTER COLUMN id SET NOT NULL;
ALTER TABLE y ALTER COLUMN id SET DEFAULT  nextval('seq2'::regclass);

And QGIS metadata definitions:

Doesn't work Metadata

General
Storage type of this layer
PostgreSQL database with PostGIS extension
Description of this provider
PostgreSQL/PostGIS provider
PostgreSQL 9.3.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit
PostGIS 2.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
Source for this layer
dbname='x' host=y port=5432 user='z' sslmode=disable key='id' table="xx" (geom) sql=
Geometry type of the features in this layer
Polygon
Primary key attributes
id
The number of features in this layer
249
Editing capabilities of this layer
Add Features, Delete Features, Change Attribute Values, Add Attributes, Delete Attributes, Fast Access to Features at ID, Change Geometries, Simplify Geometries, Simplify Geometries with topological validation

Does work metadata

General
Storage type of this layer
PostgreSQL database with PostGIS extension
Description of this provider
PostgreSQL/PostGIS provider
PostgreSQL 9.3.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit
PostGIS 2.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
Source for this layer
dbname='a' host=b port=5432 sslmode=disable key='id' srid=4326 type=MULTIPOLYGON table="c" (geom) sql=
Geometry type of the features in this layer
Polygon
Primary key attributes
id
The number of features in this layer
128
Editing capabilities of this layer
Add Features, Delete Features, Change Attribute Values, Add Attributes, Delete Attributes, Fast Access to Features at ID, Change Geometries, Simplify Geometries, Simplify Geometries with topological validation

Below is the editor view when I add a feature to the working layer - I get nothing in either box when adding to the other layer.


texts: ArcGIS Search searching only in my own toolboxes

texts:
when I want to search for some tool and I write e.g. Merge into Search window (ctrl+F), ArcGIS (ArcMap) finds only tools named Merge or similar that are located in my own toolboxes. It doesn´t find normal ESRI installed Merge located somewhere in... management toolbox I think. Why? It just searches through my own toolboxes and not ESRI installed toolboxes.

If I delete search index in options, it is ok then (it finds all Merge tools - default and also mine) but just for a while. Then something unnoticable happens and search is corrupted again.

Does anybody know how I can fix this?
Thanks
jonlew

Win8 64bit, ArcGIS for Desktop - Basic 10.1 SP1


texts:
I downloaded 2 1/3 arcsecond DEMs from the national map as .img files. First I ran the Mosaic to New Raster tool in Arcmap. The values of the first DEM are 49.0551 to 1111.13. The values for the second DEM are 274.089 to 3505.05. The output is -78.4316 to 3505.05. I have tried changing some of the options as follows.

Pixel type: 32bit float, 32 bit unsigned (this one gave a low of 0)

Mosaic Operator: All the possible options

So then I tried it in ERDAS with mosaic express. I got the same result.

I looked at the histograms, not just the stretch classification to confirm the values.

I used the pseudocolor option in ERDAS to locatate the negatave pixels of which there are many thousands. They are not located at the seam line, rather it is a big valley that is the lowest area of the DEM.

I downloaded the DEM again, but this time as arcgrid. Now it displays the min of -78 instead of 49 and the max is now 1875 instead of 1111. Not sure why the IMG gave different values. I went to google earth to check if this is an error. Turns out that at the very edge of the DEM it does drop below sea level, so it is correct. I still do not understand why the IMG file did not display the -78 and 1875 in the first place. I would not have been worried if the min and max of the mosaic output was the same as the inputs.


texts: Changing the method of the area command from planimetric to ellipsoid in QGIS

texts:
I am trying to use the QGIS Field Calculator to calculate the area of a feature. When I do this, the area returned is calculated using the planimetric method. This differs to $area which uses the ellipsoidal method.
When I try area(intersection(feature1, feature2), it returns the planimetric area, but I need the ellipsoidal area.
How can I change the method of the area command from planimetric to ellipsoid in QGIS? Or is there a way to get the ellipsoidal area of intersection(feature1, feature2) in Field Calculator?


texts: Best way to show shapefile in a layered map

texts:
I'm creating my first app using maps and shapefiles.

I have some shapefiles with attached dbase databases and I would like to show these shapefiles as an overlay on a map.

I have JavaScript code that interprets the SHP and DBF and draws the map, but I don't know how could I put this shapefile on a map.

I thought to use Google Maps or another kind of maps as a base map.

I researched a lot of solutions but I didn't find any solution that really works.


texts:
My app based on Mapserver contains dynamic layers and using PHPMapscript I modify MAPFILE->LAYER->DATA value based on a parameter that comes via GET.
Or I could even use RegEXP in the LAYER->DATA (http://osdir.com/ml/mapserver-users-gis/2012-02/msg00208.html)

I know GeoServer has good REST support and most probably after my analysis this will be one of the reasons why I'm going to change.

Is it possible to define a GeoServer layer dynamically?
E.G.
I will create datastores for specific topics
Layers (shp or raster) are stored following the criteria:

/data/layers/topic1/2013/201305/Layer1.shp,
/data/layers/topic1/2013/201305/Layer2.shp,
/data/layers/topic2/2013/201305/Layer3.shp

/data/layers/raster/2013/201304/Raster1.{png,geotiff,},
/data/layers/raster/2013/201304/Raster2.{png,geotiff,}

The layers change each month and absolutely I don't want to recreate them via GeoServer admin. Using OpenLayers I can pass a parameter mergeNewParams=YYYYMM and get the specific OWS out of the layer (WMS or WFS), but how?

Something like this when I define the datastore URL http://docs.geoserver.org/latest/en/user/webadmin/data/stores.html#adding-a-store in the connection URL I would like to specify file:/data//YYYY/YYYYMM/YYYYMMDDUTC
Is it possible?

Thanks!


texts: Interactive map solutions that support overlapping polygons - stand alone or web based

texts:
I need to make an interactive map (stand alone or web based) where users click on an area and it shows the polygon area and the attributes associated with GIS polygons. My users do not have access to GIS so I can't email them the GIS table. Users need to be able to zoom in and out, pan and see a base map but there doesn't need any more sophisticated functionality.

Some of the polygons in my GIS table overlap. If there are two polygons A and B, the overlapping area is C. I want users to click on area C and see the separate attributes for both A and B (not a sum of A and B added together).

What interactive maps support overlapping polygons? Instant Atlas and Google My Maps do not.


texts: Remove All Features from Vector Layer in OpenLayers 3

texts:
Looking at the OpenLayers 3 ol.source.Vector docs, I can see that there exists a method ol.Vector.removeFeature(feature).

Does this mean the best way to remove all the features from a vector layer would be something like this...?

var iter = layer.getFeatures().values();
while (!(entry = iter.next()).done) {
    layer.removeFeature(entry.value);
}

Or is there better way?


texts:
I'm trying to test the new QgsTask and QgsTaskManager, I found some examples in the PullRequest in github. I modified it slightly and added a print(i) in the code bellow:

from qgis.core import QgsTask, QgsTaskManager
from time import sleep
import random
def run1(task,time):
   wait_time = time / 100.0
   sum = 0
   iterations = 0
   for i in range(101):
       sleep(wait_time)
       print(i)
        # use task.setProgress to report progress
        task.setProgress( i )
        sum += random.randint(0,100)
        iterations += 1
        # check task.isCancelled() to handle cancellation
        if task.isCancelled():
            stopped()
            return
        # raise expections to abort task
        #if random.randint(0,100) == 7:
        #    raise Exception('bad value!')
    # use task object to store results of calculations or operations
    task.result = [sum,iterations]

task=QgsTask.fromFunction('waste cpu', run1, 2)
mgr=QgsTaskManager()
mgr.addTask(task)
task.isFinished()

When I run this code in the Python console it returns 0 two times and then nothing more. I expected 101 printouts (0-100)? Afterwards I tried to see if it was finished with trying to call task.isFinished(), hence that gave me a RuntimeError: wrapped C/C++ object of type QgsTaskWrapper has been deleted.

In the end I would like use one QgsTask to run a time consuming script and one QgsTask to run a dialog (maybe a progressbar) telling the user that script is still running..

Any suggestion what I'm doing/thinking wrong or were to look at other examples?

EDIT:
The problem was not only that there was two "L" in isCancel and start of QgsTaskManager, it was also that I tried to use print() within QgsTask. So I tried another approach with two GUIs that I tried in this repo.

EDIT:
I updated the github Master repo using a QtTimer, still no 100% success, hence the branch without QgsTask is working as expected. But I really want to understand how QgsTask is to be implemented..


texts: Is there any way to connect features (entities) of dxf to database in python?

texts:
I'm using gdal, ezdxf, sqlite python packages and sqlite ODBC driver. They work fine, and in AutoCAD I can easily manually connect to my dbase.sqlite (read only)  using _DBCONFIGURE and _DBCONNECT commands. Then, in AutoCAD, I  manually make a connection template like table1Connection1 and select the primary key (in my case GID) from dbase. Then I save an empty DXF with dbconection and use it as header and trailer parameters in gdal to create a new dataset. Now using gdal, sqlite and\or ezdxf I want to convert to GIS files (mapinfo, shapefile, Filegdb etc.) with TABLE OF ATTRIBUTE. I've made a couple of hand-made connections to my dabse.sqlite in AutoCAD and saved it as sqlite_connected.dxf and then ran the following code:

#! c:\Python27\ArcGIS10.2\python.exe
# -*- coding: utf-8 -*- import ezdxf import os

ezdxf.options.debug

def test_dxf(source_drawing):
    source_drawing = ezdxf.readfile_as_utf8(old_dxf, errors='strict')
    source_drawing.encoding = 'utf-8'
    modelspace = source_drawing.modelspace()

    for element in modelspace:
        print element.dxftype()
        print 'Valid_tag_list'
        print  element.valid_dxf_attrib_names()
        handle = element.dxf.handle
        tags = source_drawing.entitydb[handle]
        for tag in tags:
            print tag

if __name__ == '__main__':
    old_dxf = os.path.abspath('../../data/sqlite_connected.dxf')
    test_dxf(old_dxf)

prints shows the following:

ELLIPSE
Valid_tag_list
'[u'shadow_mode', u'layer', u'handle', u'linetype', u'color', u'start_param', u'major_axis', u'end_param', u'true_color', u'ltscale', u'color_name', u'transparency', u'owner', u'ratio', u'extrusion', u'invisible', u'paperspace', u'center']
DXFTag(code=0, value=u'ELLIPSE')
DXFTag(code=5, value=u'246')
DXFTag(code=330, value=u'1F')
DXFTag(code=100, value=u'AcDbEntity')
DXFTag(code=8, value=u'0')
DXFTag(code=62, value=3)
DXFTag(code=100, value=u'AcDbEllipse')
DXFTag(code=10, value=(-64.72147324890284, 1396.049664909873, 0.0))
DXFTag(code=11, value=(-432.5005430651363, 17.30093799269207, 0.0))
DXFTag(code=210, value=(0.0, 0.0, 1.0))
DXFTag(code=40, value=0.4321803290912964)
DXFTag(code=41, value=2.392818306675625)
DXFTag(code=42, value=6.340229330820504)
DXFTag(code=1001, value=u'DCO15')
DXFTag(code=1071, value=2)
DXFTag(code=1071, value=2)
DXFTag(code=1000, value=u'pipelineconnection1')
DXFTag(code=1004, value=u'02000000')
DXFTag(code=1071, value=1)
DXFTag(code=1000, value=u'pipelineconnection1')
DXFTag(code=1004, value=u'01000000')

As I understand I need to SET 3 tags in each entity I want to connect to dbase. These are:

1071 - the ordinal number of connection element.
1000 - ASCII string (up to 255 bytes long) in extended data. ('pipelineconnection1' in my case)
1004 - Chunk of bytes (up to 127 bytes long) in extended data. (primary key or connectoin filed number in hex)

But I can't use set methods to these kind of tags:

set_dxf_attrib(1071, 3)
set_dxf_attrib(1000, 'pipelineconnection1')
set_dxf_attrib(1004, hex(123))

This gives me an error: AttributeError: 1000
I can set only tags in the Valid_tag_list e.g. set_dxf_attrib('layer', 'my_layer').

How can I set tag by it's code not the name?
Are there any other methods to connect attribute table to DXF entity using python?

Documentation: ezdxf , dxf specification


texts: Stitching Sentinel 2 neighboring images in QGIS

texts:
I'm working with Sentinel 2 imagery, and don't know how to stitch neighbouring images. The problem is that the region im analyzing is on the border of the orbit, and there's a region with no data.
How could I proceed to merge the images correctly with QGIS?