texts: Add individual state county borders to an ArcMap project?

texts:
I am working on an emergency response mapping project for our Tribe and I want to develop emergency response maps for individual counties instead of the whole state. Our ArcMap has all the counties in one shapefile.

Is there a way to map individual counties so my maps don't look so cluttered and noisy with information?

I use ArcMap 10.1


texts:
I'm using ArcGis 10.0. While output is faulty cad file

public static void *convertGdb2Cad*(IFeatureClass fromFile, string toFile)
       {

        Geoprocessor GP = new Geoprocessor();
        ESRI.ArcGIS.ConversionTools.ExportCAD tool = new
             ESRI.ArcGIS.ConversionTools.ExportCAD();
        //tool.in_features = "d:/lzx/data/road/test.gdb/line1";
        //tool.Output_File = "d:/lzx/data/cadfile1.dwg";
        tool.in_features = fromFile; // this OK
        tool.Output_File = toFile; // this OK
        tool.Output_Type = "DWG_R2007";
        GP.Execute(tool, null); //**Errors here when run** *Error HRESULT E_FAIL has been returned from a call to a COM component.*
         //MessageBox.Show("ok");

}

How to fix this


texts: Growing several concave hulls until they completely fill larger area without overlap using QGIS?

texts:
This is my problem: I have a very large point layer with polling station locations across one country; each point belongs to a specific constituency  (900k points, 4k constituencies). I wish to use this data to create polygon shapefiles of constituencies, as illustrated in the following image (no overlap between constituencies, and no blank space either). On the left, you see three point clouds (points that represent the green, blue and orange constituencies). You also see the country boundary, three blue points out of place, and one orange point out of place (raw data are not always correct, but the dataset is too large to manually correct such things). On the right hand, you see the expected result.

So far, I have explored two methods. The first is to voronoi all points, subsequently dissolve those with the same constituency variable into one polygon, and cut everything away that is outside country boundaries. Two problems: one, the orange outlier. Second, the voronois do not necessarily extend until the country boundary line, leaving blank space. This is roughly the option chosen in reply to this question: Converting point sets to polygon boundaries?, but it still leaves me with the problem of outliers and blank space at some of the edges.

The second method was to construct concave hulls (convex ones would overlap). The problem here is again both the orange outlier and even more blank space between the various constituencies. The latter could be solved through some sort of growing algorithm, I suppose - but have no idea of how those work.

Overall, my intuition is that the problem could be resolved through yet another strategy, namely some sort of clustering algorithm, which calculates the most likely constituency for every coordinate in the country, on the condition that each constituency needs to be one single area. This would both eliminate the orange outlier and grow each concave hull to maximum extent. I have just no idea how to implement something like this.

I would be interested in any automated, open source solution (or strategy) to my problem, be it in QGIS itself, via scripting (python, SQL in PostGIS), custom software.

I split my point data into one file per constituency, and transformed each into a heatmap. I then overlayed these heatmaps in QGIS, with the intention of using Raster Calculator to create a unified heatmap reflecting constituency codes, later to be re-vectorized. So far, all looks promising - until I use Raster Calculator, which only calculates values for overlaps of the original heatmaps - presumably because of NULL values.

Any idea how to get around this?

The image illustrates the problem. Dark green and red were integrated in raster calculator with "(green@1 >= red@1) * 1 + (red@1 > green@1) * 2" - dark grey is 2 and light grey is 1. The boundary on the left was drawn OK-ish, and more importantly, the single green point to the right was correctly subsumed in the dark grey (=red) constituency.

But what about all the areas where either green@1 or red@1 are NULL?

This can be solved through gdal_calculate.py which does not suffer from the NULL value problem. The final and additional question is whether anybody knows how to automate the heatmap plugin in QGIS (or whether there is a gdal-based equivalent function)?

I would hate to do this manually for 4k constituencies... Since this touches on python and qgis qnd the like, the question is separate: Can one batch-automate the creation of QGIS heatmaps?


texts: QGIS: Only view raster data within polygon

texts:
So i have this raster dataset in .ASC-format. I defined a bounding box polygon of my study area:

Now i want QGIS to only show the raster data within this boundary box without changing/adapting the data or making new files. Is this possible?


texts: Leaflet: my map is moving when popups open

texts:
I have an issue and I can't find a solution by myself.

This is the map I'm working on.

When you check "Afficher les produits échangés", you can see a half-dozen popups opening simultaneously. And you can see my problem: my map is moving from Rome to China.

This is the code for my popups:

    var produits = new L.LayerGroup();

var popupLocation34 = new L.LatLng(33.0, 39.0);
popupContent34 = "[popup content]",
popup34 = new L.Popup({closeButton: false, closeOnClick: false, offset:(0, 20)});

popup34.setLatLng(popupLocation34);
popup34.setContent(popupContent34);
L.circleMarker(popupLocation34, {
                    radius: 0,
                    fillColor: '#ffffff',
                    color: '#000000',
                    weight: 1.0,
                    opacity: 1.0,
                    fillOpacity: 1.0
                    }).addTo(produits);
popup34.addTo(produits);

[...]

    var overlays = {
    "<B>Afficher les produits échangés</B>": produits
};

As you can see too, there are many popups open yet for sea, mountains and desert names, and apparently they don't make the map moving. In fact, I have exactly the same problem with them. I cheated, creating in middle Atlantic a popup with empty content, in order to center the map on Rome when it's loading, but it can't be a real solution.

Can someone help me please?


texts: How to access to the underlying grid table behind Mapinfo's Grid Thematic map?

texts:
I created a grid thematic map using "Mapinfo - Map - Create Thematic Map" function. Now I want to know the distribution of the data from the grids.

But the "Browse Table" option is not functioning for the thematic map.

Is there a way to get access to the grid table used to create this map?


texts: reclassify vector data from multiple source data fields (ArcGIS) (ModelBuilder)

texts:
I am using ArcGIS 10.1 and ModelBuilder. I am not familiar with Python.

My question is very similar to ReClassify Vector Data Between Values using ArcGIS Desktop? . However that question is about reclassification using the values from one other field.

I have experience of using this type of reclassification within the Calculate Value Tool.

However I wish to base a reclassification on the values from more than one source data field. For example from two fields - "Land" and "WellYield". ideally I'd like to be able to run classifications from 2 or 3 source fields.

I know the following code is wrong because i have not defined the "Land" field.

e.g.

parser:
Python

    Expression:
    Reclass(!WELL_YIELD!, !Land!)

    Code Block:
    def Reclass(WellYield, Land):
      if (WellYield == 'Make'and Land == 'Natural'):
        return 'Greenspace'
      elif (WellYield =='Multiple'  and Land == 'Natural'):
        return 'Not Greenspace'

Any help or tips on the correct code would be much appreciated.

I have just been testing some outputs by trial and error.

The above code seems to work now for classifying by different data fields. I will test further by three fields.

Any insights or advice would still be appreciated.


texts:
Often in the hard rock mines that I consult for, they use a local grid coordinate system.  The area is typically small <20km x 20km so curvature of the earth is not a major problem.  Typically I have a (x,y,z) point in the local grid and it's related UTM (east, north, elev) which is easy to deal with since it is just a issue of new false easting/northing.

But typically the local grid is not equal to true north.  Local grid north can be up to +/-45 degrees and even sometimes more.  This is typically done to optimize the linear nature of some deposit shapes for gridding but then sometimes it is just one of those strange things that just happened many years ago!

So how should I define a custom local grid SRID where local grid north is x degrees from true north?

Phil


texts: Using list of file paths in function arcpy.ListFields to create multiple lists of field names for each shapefile

texts:
I have a list object that contains file paths as text. I named the list object filepathlist. An example of a file path within the list is C:\TestFolder\Folder1\A\address_pt.shp. The file paths lead to a directory where some folders contain shapefiles.

I want to use the list object,filepathlist, and iterate through each element of the list passing the list into the arcpy.ListFields function to create multiple lists of field names for each shapefile. I'm not sure if it's possible, but maybe even a list containing multiple lists within.

I want to create lists of Field names for each shapefile in my directory because I ultimately plan to use the list of fields generated from the arcpy.ListFields function and compare the lists to another list that contains field names thought to be within the shapefile. I aim to ultimately solve the problem and question:

Does my list of fields found in the shapefile match the list of fields thought to be within the shapefile?

However, my question and first problem is trying to figure out the logic and code of how to iterate through a list of file paths within the arcpy.ListFields function and return lists of Fields within each shapefile.

I'm not sure if i'm taking the right approach in trying to solve the problem. I have included code below to try and explain what i'm trying to do.

import arcpy

arcpy.env.workspace = r"C:\TestFolder"

#dbf File Process control Table
dbf = "ProcessControlTable.dbf"

#File Path of shapefile
shapefile = "C:\\TestFolder\\Folder1\\F1\\address_pt.shp"

#Define Field within dBASE Table that holds File Paths
myfield = "FI_PATH"

#Print List of Field Names for shapefile defined
print([field.name for field in arcpy.ListFields(shapefile)])

#List of file paths with list comprehension
filepathlist =[row[0] for row in arcpy.da.SearchCursor(dbf,myfield)]
print(filepathlist)

#Use arcpy.ListFields function to iterate through filepaths list
lstfields = arcpy.ListFields(filepathlist)
for row in lstFields:
    #Create a list of Field Names for each Shapefile found in filepathlist
    #Save the field names object list for each shapefile so it can be compared to another list
    #Print a list of Field Names in each Shapefile

Basically, I only know how to list the fields from one shapefile. I would like some guidance on where I can take the logic and code to possibly iterate through a list of file paths and list fields for each shapefile at the path location.


texts: Python toolbox tool objects do not remember instance variables between function calls?

texts:
I am developing a Python toolbox, and came across a peculiar behavior: The tool objects does not remember any instance variables between function calls. Consider this code:

import arcpy

class Toolbox(object):

   def __init__(self):
      self.label = "Test"
      self.alias = "Test"
      self.tools = [Tool]

class Tool(object):

   def __init__(self):
      self.label = "Test tool"
      self.x = "INIT"

   def getParameterInfo(self):
      param0 = arcpy.Parameter(
         displayName = "Parameter",
         name = "parameter",
         datatype = "String",
         parameterType = "Required",
         direction = "Input")
      return [param0]

   def updateParameters(self, parameters):
      self.x = "UPDATE PARAMETERS"

   def updateMessages(self, parameters):
      parameters[0].setWarningMessage(self.x)
      self.x = "UPDATE MESSAGES"

   def execute(self, parameters, messages):
      arcpy.AddMessage(self.x)

The way I would expect this code to behave is this:

First __init__ is called, and x is set to "INIT".
Then updateParameters is called, and x is changed to "UPDATE PARAMETERS".
Then updateMessages is called. It displays a warning with the text "UPDATE PARAMETERS" and then change x to "UPDATE MESSAGES".
Finally, when the tool is executed it outputs "UPDATE MESSAGES".

However, when I run the tool both the warning and the execution output is "INIT". My conclusion is that ArcMap does not use the same instance of the class throughout, but instead creates a new instance for every function call (updateParameters, updateMessages, and execute).

Is my conclusion correct? If so, why does ArcMap behave that way? From an OOP perspective it seems very strange.

This behavior causes big problems for me. The first parameter of the tool I am developing is a text file. When the user has picked one I want to populate the other parameters with different default values depending on the content of the file. Since the file could be rather large I do not want to have to parse it every time any parameter changes, but now it seems like I have to since there is no way to know if the parameter has changed or not.


texts: Error 43 using openlayers, Geoserver, and WMTS

texts:
When attempting to use the WMTS tile service with Geoserver and openlayers I keep getting error 43 (Expected layers to be an array or an ol.Collection.). I am new to openlayers so the issue is likely trivial but I can't figure it out.

 var projection = ol.proj.get('EPSG:4326');
 var projectionExtent = projection.getExtent();
 var size = ol.extent.getWidth(projectionExtent) / 256;
 var mapExtent =  [-13884991, 2870341, -7455066, 6338219];
 var resolutions = new Array(22);
 var matrixIds = new Array(22);

 for (var z = 0; z < 22; ++z) {
   // generate resolutions and matrixIds arrays for this WMTS
   resolutions[z] = size / Math.pow(2, z);
   matrixIds[z] = z;
 }

 layers = new ol.layer.Tile({
       source: new ol.source.WMTS({
       url: 'http://localhost/geoserver/gwc/service/wmts',
        layer: 'Aberdeen:TAC_ALL',
       matrixSet: 'EPSG:4326',
       format: 'image/png',
       projection: projection,
       tileGrid: new ol.tilegrid.WMTS({
           origin: ol.extent.getTopLeft(projectionExtent),
           resolutions: resolutions,
           matrixIds: matrixIds
         })
   })
});

 var map = new ol.Map({
   layers: layers,
   target: 'map',
   view: new ol.View({
     center: [-10997148, 4569099],
     zoom: 4
   })
 });


texts: Looking for good quality DEMs for Svalbard and Faroe Islands

texts:
I'm trying to find Open Data DEMs for a couple of personal mapping projects, for the following areas:-

Faroe Islands
Svalbard (Longyearbyen)

Ideally, with 100m resolution or better.

I normally use SRTM (using the Python elevation library), but the SRTM data only covers the southern half of the Faroe Islands. (SRTM only covers 60S to 60N).

For Svalbard, I had a look at Norway's Kartverket map portal, but even at the lowest resolution, the coverage seems to be restricted to the Norwegian mainland

I've found a nice relief map of Longyearbyen here in JPEG2000 format, but it's not a DEM.

Is there an open data DEM for these areas? I've had a look on OpenData but not seen anything there..


texts: Is there any method to analyze data from fire protection events?

texts:
I want to analyze data from events in fire protection a create some illustration of maps.
In short: my task is to find methods for data visualization. Data are represented by point layer (each event is localized and except the coordinates, each event has some information in attribute table).

Can you tell me some methods I can use (except classic chloropleth map and diagram map)? I analyzed data with kernel density tool, or I have used "count points in polygon" tool from Hawths Analysis tools for creating cartogram maps. I used this tool for Quadrat Analysis too - creating vector grid (polygons) over the extent and counting the events in each polygon (quadrat).

Last method was line diagram map (creating buffer from line data and counting points in each polygon segment of buffer, this information was necessary to visualize events that happened on the roads.

Is there some other method or tool I can use?

Thanks for help


texts: bgcolor problem on cascaded WMS grouplayer

texts:
On GeoServer I have two layers, both cascading a remote WMS. Both layers work fine in the layer preview.

Now I am putting both into one group layer and open the preview, which shows an empty response. When trying to query the group layer in the browser with

  localhost:8080/geoserver/ws/wms?service=WMS&version=1.1.1&request=GetMap&layers=ws:layername&styles=&bbox=6.03777,48.898,14.703518328104952,54.93599775300893&width=768&height=535&srs=EPSG:4326&format=image/png&

I get the following response:

  Rendering process failed Argument "bgColor" should not be
  null.

When I add &bgColor=0xFFFFFF to the request, I still get the same error response.

The same happens, when I call the underlying layers within the layers parameter, without using the group layer.

I thought, it might be about different WMS implementations on the remote WMS side, but even when I switch to different remote WMS services, the problem persists.

When Googling, I didn't find a response that seems to solve the problem. Do I miss something?

UPDATE

The WMS services I am using are

http://www.geodaten-mv.de/dienste/adv_dop, layer mv_dop
https://geodienste.sachsen.de/wms_geosn_dop-rgb/guest, layer sn_dop_020


texts: Replacing all null values from attribute table with zeros in QGIS

texts:
In QGIS 1.8 I have a new column in my attribute table with a lot of NULL values and I want to replace all them to zeros.
How can I do that in field calculator?


texts:
I need to get a WFS 2.0 layer in QGIS through python code.

I am making a QGIS plugin that needs to download a specific WFS 2.0 layer. I have been looking at the code for wfs 2.0 client plugin, and by taking what i assume is the necessary part of the code I have managed to load the layer thru a python console script. I though I could simply put that code in my plugin and be done with it, but that unfortunately resulted in an error. I am rather new to all of this, but have to the best of my ability narrated the problem down too this:
It seems that when i put my code in the plugin, the id that i got (through Qhttp.get()) is different from the requested id. Sometimes the ID's are not different, but then it signals an error through the Qhttp.requestFinnished that i have not been able to read yet.

I have been searching far and wide in order to fix this, but have only ended up empty handed. Therefore I ask here if someone can help me getting access to a WFS 2.0 layer through python in QGIS, or some good place for me to learn about this.

I got the URL for the WFS from this site: https://kartkatalog.geonorge.no/metadata/kartverket/tilgjengelighet-tettsted-wfs/3bec7256-86c2-4d43-a122-0760a6a21790

in wfs 2.0 client I use the URL https://wfs.geonorge.no/skwms1/wfs.tilgjengelighettettsted?, It holds 4 or 5 different layers, I would probably need all of them

I am new to programming with spatial data.

I have both seen and tried codes from this post: Loading a WFS layer using pyqgis, but I don't understand how they find what url to use. The url i find from my webpage is much shorter. Also, I am uncertain whether or not this method works for WFS 2.0.


texts: File Geodatabase sources not matching with QGIS layers

texts:
I have a QGIS project linked to an ESRI file geodatabase.  It was first built a few months ago and hasn't been opened since.  I just re-opened it and noticed that the layers looked odd.  Upon further investigation I noticed that there was a layer mismatch with the file GDB, so what I thought were points for animal habitat locations look more like polygons for geotech reports, and all the layers seem to not be what the layer says it should be, confirmed by looking at the attribute tables.

I suspect this is due to the QGIS layer source making reference to a layerID in the file GDB, and suspecting that ESRI does some cleanup/shuffling in the background ordering of the gdb layers, similar to when it reassigns OID's to records to clean up deleted record numbering holes.  So when QGIS thinks layer 23 = bird habitat, it actually accesses layer 23 = geotech reports, instead of accessing it through a FeatureClass name.

Has anyone else noticed this?  Does anyone know a robust way of linking a QGIS project file to a FileGDB and not have it do this 3 months later?  I am going to try the ESRI driver for accessing the file GDB instead of the OpenFile GDB and see if that fixes it, but will need to wait a while to see if the GDB reshuffles its layers.


texts: How does one create an "Embedded Widget" in the Legend section of a Vector Layer in QGIS?

texts:
By default, QGIS provides transparency widget but this can be extended
  by plugins registering their own widgets and assign custom actions to
  layers they manage.
  from QGIS 2.18 Manual

How can I create such a widget?


texts: How to handle QGIS Server: Failed to download capabilities?

texts:
i am trying to connect to Qgis Server (windows 7)  in Qgis Browser but i get this error

I have just installed Apache and the module "mod_fcgid.so"


texts: PostGIS Raster: Outputting raster into GDAL supported file?

texts:
I have import a raster into my postGIS database via raster2pgsql. My raster tiled to 100x100.
Now I'm trying to export (output) the raster to GDAL supported file (for example: PNG).

Following the instruction in postGIS manual dev 2.1 (page 68). However, I don't get any output
file in destination folder.

Here's what I type in SQL tool in pgAdmin III

<!-- language: lang-sql -->
SELECT lo_export(demo.oid,'D:\demo_rast.png')
FROM
  (SELECT oid,
          lowrite(lo_open(oid, 131072), png) AS num_bytes
   FROM (
         VALUES (lo_create(0),
                 ST_AsPNG(
                            (SELECT rast
                             FROM landsat
                             WHERE rid=1)))) AS v(oid,png)) AS demo
WHERE demo.oid = 1
    WHERE demo.oid = 1


texts:
I was wondering:

Has anyone used spatial data as an input source to build 3D environments and interactive applications with Unity?

The geospatial 3D world is very young, and somewhat immature, while the gaming industry is much more robust and developed.  Unity is more highly developed and provides a lot of great options for building 3D environments.  However, the typical data sources used in the geospatial world (vectors, imagery, DEMs) are foreign to Unity.  I have seen some round about ways to use this data in a Unity project, but I was wondering if anyone has experience or success with this process, and would be willing to share.


texts:
I need to compare millions of geometries by the && operator (BBOX).

When CREATE TABLE see geometry type on PostGIS2, it do also something like INDEX ON t USING GIST(g)? or I need to express, always, the CREATE INDEX in (or after) my CREATE TABLE?

If it is automatic, it is for any field name (or only for "geom")?

PS: (if no index is automatically crated)  when I use ST_DWithin(A,B) PostGIS generate a temporary index?


texts: How to select multiple polygons or points from WFS or WMS and getFeatureInfo

texts:
Is there a way to select multiple polygons and/or points from a WFS or WMS service and then get the feature information for each selected item? There are numerous examples on the OpenLayers website but none of them show how to multi-select AND get the attributes for the selected items.

For instance I can get the feature info for a single selected item by using the getFeatureInfo option for a WMS service but this does not allow me to select multiple items. I absolutely have to have the ability to select multiple items!

Also, I can select multiple items by drawing a box, a freehand polygon, or multi-selecting individual features using a number of different methods but none of those methods have the ability to get the feature info. What good is being able to select multiple items but not be able to get the attributes for the features? Am I missing something really obvious?

My goal is to be able to select multiple features and then extract my unique identifier (point number or polygon number) from each of the features info in order to query data from a SQLServer database. I don't need to do anything fancy to the spatial data all I want to do is select multiple items and take the unique id from each of them so I can query my database for info that relates to the selected items.

I am using OPENLAYERS to build my map interface and GEOSERVER to serve my WMS/WFS services. I can connect to my point and polygon shapefiles using either WMS or WFS but I can not find a way to select multiple items and then get the attribute info for the items.

Is there a way in OpenLayers to select multiple items and then loop through the list of items?

I have been stuck on this problem for four very long and frustrating days and if anyone has any ideas on how to do this I would be eternally grateful!!

10/11/2012 - HERE IS THE CODE I ENDED UP USING

//THIS FUNCTION UPDATES THE TEXT BOX WITH THE LIST OF SELECTED ATTRIBUES WHEN THE USER SELECTS A NEW POLYGON OR MULTIPLE POLYGONS
    var update = function(feature) {
         names.push(feature.attributes['yourLayersAttributeNameHere']);
        showStatus(names.join(", "));
    };

//THIS FUNCTION UPDATES THE TEXT BOX WITH THE LIST OF SELECTED ATTRIBUTES WHEN THE USER UNSELECTS A POLYGON
var clear = function(feature) {
  name=feature.attributes['yourLayersAttributeNameHere'];
    for(var y in names){
       if (name === names[y]){
         names.splice(y,1);
        }
    }
    showStatus(names.join(", "));
};

//INSTANTIATE A NEW CONTROL THAT ALLOWS THE USER TO SELECT FROM THE AVAILABLE WFS FEATURE

// var control = new OpenLayers.Control.SelectFeature(
                   nameOfyourLayerHere,
                  /{
                    clickout: true,
           toggle: true,
                    multiple: true,
           hover: false, //if hover is set to true it takes away the selection functionality.
            toggleKey: "ctrlKey", // ctrl key removes from selection
                   /multipleKey: "shiftKey", // shift key adds to selection
                   /onSelect: update, //ON SELECT CALL THE UPDATE FUNCTION
                    onUnselect: clear, //ON UNSELECT CALL THE CLEAR FUNCTION
         //
                  // }
              // );

//ADD THE CONTROL TO THE MAP CONTROLS COLLECTION

// map.addControl(control);
    //ACTIVATE THE NEW CONTROL
    //control.activate();


texts: float value is rounded off after commitchanges

texts:
Getting field value rounded off to integer equivalent after commiting changes to layer

layer.startEditing()
    layer.dataProvider().addAttributes([QgsField(_NEW_AET, QVariant.Double,'double', 3, 4)])
    layer.updateFields()

    for f in layer.getFeatures():
        if(f[_NEW_LU] == 'agriculture' or f[_NEW_LU] == 'fallow land'):
            print sht_op.range('Q185').value - 0.0
            f[_NEW_AET] = sht_op.range('Q185').value - 0.0
            print f[_NEW_AET]
            layer.updateFeature(f)
        break
    layer.commitChanges()

    for f in layer.getFeatures():
        print f[_NEW_AET]
        break

For above code getting output rounded off after commitChanges() to layer

Below is the output:

359.801528696
359.801528696
359.0


texts: PyQGIS not working for standalone scripts in macOS Sierra

texts:
it's my first time using PyQGIS and I'm having trouble loading layers and making everything work. I've installed Qgis properly and I'm able to use the python console, but I'm not able to use the standalone scripts.

If I run this basic example from the docs:

from qgis.core import *

QgsApplication.setPrefixPath("Applications/QGIS.app/Contents/MacOS", True)

qgs = QgsApplication([], False)

qgs.initQgis()

qgs.exitQgis()

I get no errors. But when I try to add a layer - using a shp file from the training_manual_exercise_data just to be sure the data is right, I get that the layer is not valid:

from qgis.core import *

QgsApplication.setPrefixPath("Applications/QGIS.app/Contents/MacOS", True)

qgs = QgsApplication([], False)

qgs.initQgis()

layer = QgsVectorLayer("/data/training_manual_exercise_data/exercise_data/world/continents.shp", "world", "ogr")

if not layer.isValid():
  print "Layer failed to load!" # This prints!

qgs.exitQgis()

I've checked that my path is the right one. If I type inside QGis:

QgsApplication.prefixPath()

I get:

Applications/QGIS.app/Contents/MacOS

Which is the path I'm using. I've also tried to getFeatures from the layer just to check if there's something in it but it does not print anything.

I've tried multiple approaches, including this:

import os, sys
sys.path.append('/Applications/QGis.app/Contents/Resources/python')
from qgis.core import *

app = QgsApplication([],True)
QgsApplication.setPrefixPath(r"/Applications/QGIS.app/Contents/MacOS", True)
QgsApplication.initQgis()

layer = QgsVectorLayer('/tmp/myshape.shp', 'test', 'ogr')
print layer.isValid()

But it also does not work. I have also checked that my PATH and PYTHONPATH are correct. I added the Paths to my .bash_profile:

export PATH="/Applications/QGIS.app/Contents/MacOS/bin:$PATH"
export PYTHONPATH="/Applications/QGIS.app/Contents/Resources/python"

And I'm able to import qgis.core or any other modules without errors.

This is what I get when I run QgsApplication.showSettings() from insde Qgis Console:

Application state:
QGIS_PREFIX_PATH env var:
Prefix: /Applications/QGIS.app/Contents/MacOS
Plugin Path: /Applications/QGIS.app/Contents/MacOS/../PlugIns/qgis
Package Data Path: /Applications/QGIS.app/Contents/MacOS/../Resources
Active Theme Name: default
Active Theme Path: /Users/cris/.qgis2///themes/default/icons/
Default Theme Path: :/images/themes/default/
SVG Search Paths: /Applications/QGIS.app/Contents/MacOS/../Resources/svg/
/Users/cris/.qgis2//svg/\nUser
DB Path: /Applications/QGIS.app/Contents/MacOS/../Resources/resources/qgis.db
Auth DB Path: /Users/cris/.qgis2//qgis-auth.db

But when I print it in a standalone script after setPrefixPath I get:

Application state:
QGIS_PREFIX_PATH env var:
Prefix:     /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS
Plugin Path:        /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/../PlugIns/qgis
Package Data Path:  /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/../Resources
Active Theme Name:
Active Theme Path:  /Users/cris/.qgis2///themes//icons/
Default Theme Path: :/images/themes/default/
SVG Search Paths:   /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/../Resources/svg/
        /Users/cristobalvalenzuela/.qgis2//svg/
User DB Path:   /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/../Resources/resources/qgis.db
Auth DB Path:   /Users/cris/.qgis2//qgis-auth.db

I'm running Python 2.7.13, QGIS 2.18.2 and macOS Sierra 10.12

Any thoughts? This is driving me crazy!


texts: Raster becomes invisible after changing CRS in QGIS

texts:
I am having trouble displaying this netcdf file in QGIS. The file holds u and v components of wind data from NCEP Climate Forecast System.
When I load the data, it displays over the ocean near Africa and has an invalid projection. When I set the CRS to 4326 (properties-->source-->set CRS) and Zoom to Layer, the map moves to California (the correct location of the data) but the raster is invisible. I've tried saving the raster layer with 4326 CRS and I've tried reprojecting and assigning a projection. Unsure how to fix this.
Link to data: https://drive.google.com/file/d/1PZsYLNp4wirX2BQjZ_CwsyNE3OpT8G1x/view?usp=sharing
NCEP info: https://rda.ucar.edu/datasets/ds094.2/index.html#!description


texts: Why does spatial join on geodataframes return empty result?

texts:
I have two geodataframes that I want to perform a spatial join on; one is points, one is polygons. They are both dtype: int64. They both have .crs = {'init': 'epsg:4326'}. I have verified both of them in ArcMap that the points are indeed within the polys. I even performed an intersect between these points and polygons in ArcMap and it produced the correct new feature class (I have reasons for wanting to do this without arpy/manually in ArcMap). **Note: the points are from a shapefile and the polys are from a feature class

However, when I turn my centroid points and parcel polygons into geodataframes and use .sjoin(), it returns an empty geodataframe. I want the output to be a point-based geometry so that I can eventually turn it back into a point shapefile. I have tried:

intersect_test = gpd.sjoin(cents, polys, how='left', op='intersects')

and

intersect_test = gpd.sjoin(polys, cents, how='inner', op='intersects')

and

intersect_test = gpd.sjoin(polys, cents, how='right', op='intersects')

and

intersect_test = gpd.sjoin(cents, polys, how='left', op='intersects')

and pretty much every other configuration I can think of and it either returns the data for one of them, or returns a completely empty geodataframe result.

 intersect_test = gpd.sjoin(cents, polys, how='inner', op='intersects')
 intersect_test.count()
Out[126]:
BLD_UNITS       0
LAND_USE_T      0
PARCEL_ID       0
PROP_IND_T      0
STORY_NBR       0
geometry        0
index_right     0
GEOID           0
CensusPop       0
CBArea          0
ST_FIPS         0
Shape_Length    0
Shape_Area      0
CO_FIPS         0
HU_Pop          0
Sq_Ft           0
dtype: int64

How can I resolve this without having to manually perform the intersect in ArcMap?

EDIT
Here's how I made my geodataframes. As I mentioned; one is a shapefile and one is a .gdb feature class. Question: Could this be due to crs-related problem?

#create poly gdf
cb_gdb = r"C:\Projects\Pop_Alloc\CensusBlocksStates.gdb"
cb_feat = "CBs_{}".format(state)
cents = gpd.read_file(cb_gdb, layer=cb_feat)
cents = {'init': 'epsg:4326'}

#create point gdf. The parcel centroids are first created from a polygon
gdf. The new gdf is written to a shapefile to be tested against the census
block polygons (to make sure they do in fact fall within the boundaries of
the census blocks (cbs)) and the new centroid gdf(its a
`type='geopandas.geodataframe.GeoDataFrame'`) is then used in the `.sjoin`
cents = parcel_res_df
cents['geometry'] =
cents['geometry'].representative_point()
cents_out_feat = r"C:\Projects\Pop_Alloc\{}_Res_centroids.shp".format(state)
cents = {'init': 'epsg:4326'}
cents.to_file(cents_out_feat)


texts:
I have read the following posts on reading in SRTM HGT elevations- How do you convert SRTM HGT elevations from WGS84 into meters above sea level? and How to extract elevation from .HGT file?  I am currently undertaking this exercise using Java on an Intel Platform. My machine "endianness" is actually little endian and so when I write this file out differently(south to north as a meteorological application requires it that way) are there any additional steps to be carried out ? My initial code checked on the endianness of the system and then read in the .hgt file appropriately. When I actually ran the weather simulation I got strange elevation values.

        fc = new FileInputStream(file).getChannel();
        ByteBuffer bb = ByteBuffer.allocateDirect((int) fc.size());
        while (bb.hasRemaining()) fc.read(bb);
        bb.flip();
        sb = bb.order(ByteOrder.BIG_ENDIAN).asShortBuffer();


texts: Unsupervised classification in Google Earth Engine

texts:
I know, an example of Unsupervised classification was given on GEE but it is not really unsupervised approach as it still needs training. I am looking for the way to perform unsupervised classification without giving training data and the algorithm groups the pixels with common characteristics (number of classes).

Here is the link for the example: developers.google.com/earth-engine/clustering. I want a very simple unsupervised classification which does not need training. In any RS software, you have an option to simply apply unsupervised classification on an image without defining the classes. It only needs a number of classes and the software does the classification based on common characteristics.


texts: How to install PostGIS on Linux Mint 14?

texts:
I am trying to install PostGIS on Linux Mint 14 KDE. First thing I tried was to install PostgreSQL using "sudo apt-get install postgresql". I was successful doing that. I then did "sudo apt-get install postgis" and it installed something, but when I try to use it, say following the tutorials on the postGIS site, it won't recognize any command I type and the tutorial will refer me back to the installation section.

So, I assume the Linux Mint PostGIS package is somehow broken or I am missing some key step. So, I decided to install PostGIS by building from source. After downloading many different dependencies I still can't get it to compile. I can successfully do ./configure. But it fails on 'sudo make' with the following error:

make -C liblwgeom
make[1]: Entering directory `/home/user/Downloads/postgis-1.4.2/liblwgeom'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/user/Downloads/postgis-1.4.2/liblwgeom'
make -C postgis
make[1]: Entering directory `/home/user/Downloads/postgis-1.4.2/postgis' gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pie -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -fpic -I/usr/include  -I../liblwgeom -I. -I. -I/usr/include/postgresql/9.1/server -I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -DLINUX_OOM_ADJ=0 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/tcl8.5  -c -o lwgeom_accum.o lwgeom_accum.c
lwgeom_accum.c: In function ‘pgis_geometry_accum_transfn’:
lwgeom_accum.c:110:52: error: ‘WindowAggState’ has no member named ‘wincontext’
lwgeom_accum.c: In function ‘PGISDirectFunctionCall1’:
lwgeom_accum.c:304:61: error: macro "InitFunctionCallInfoData" requires 6 arguments, but only 5 given
lwgeom_accum.c:304:9: error: ‘InitFunctionCallInfoData’ undeclared (first use in this function)
lwgeom_accum.c:304:9: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [lwgeom_accum.o] Error 1
make[1]: Leaving directory `/home/user/Downloads/postgis-1.4.2/postgis'
make: *** [postgis] Error 2

Is there some easier way to do this or a good and up to date tutorial out there?


texts: How to spread a population data from a vector layer in a raster layer?

texts:
I got a shapefiles for provinces in a African country. In each province there is the population data. I've got 3 TIFF (raster),

one for the agriculture,
one for the cities and
the last one for other (forest,lake, grassland etc...).

Knowing the population of each province, I've got to spread it according to the density. The density of cities are 100x the density of other and 5x the density of agriculture and the density of agriculture is 20x the density of other.

At the end I would like a population size for each pixel. How can I do it using the raster calculator or another tool in QGIS?


texts: Overview of available images per image collection?

texts:
I´m trying to make an overview in a table or graph of the available images in Landsat, Sentinel and Modis series for a certain area of interest. Although I could solve it as follows, this is obviously very inefficient.

Does anyone have an advice how to write this more efficiently?

// ------INPUT------------------------------------------------------------------------------------------------------------
// define a year of classification
var year_start = 1970;
var year_end = 2018;
var date_start = ee.Date.fromYMD(year_start,1,1);
var date_end = ee.Date.fromYMD(year_end,12,31);
var cloud_cover_100 = 100;
var cloud_cover_90 = 90;
var cloud_cover_80 = 80;
var cloud_cover_70 = 70;
var cloud_cover_60 = 60;
var cloud_cover_50 = 50;
var cloud_cover_40 = 40;
var cloud_cover_30 = 30;
var cloud_cover_20 = 20;
var cloud_cover_10 = 10;
var cloud_cover_5 = 5;
//     ------LANDSAT------------------------------------------------------------------------------------------------------------
var size_l8 = l8.filterBounds(aoi).filterDate(date_start,date_end).toList(1000000).length();
print('Total number of images in l8 in current time frame: ', size_l8);

l8 = l8.filterBounds(aoi).filterDate(date_start,date_end).filter(ee.Filter.lt('CLOUD_COVER_LAND',cloud_cover_100));
var size = l8;
print(size);
l8 = l8.filterBounds(aoi).filterDate(date_start,date_end).filter(ee.Filter.lt('CLOUD_COVER_LAND',cloud_cover_90));
var size = l8;
print(size);
l8 = l8.filterBounds(aoi).filterDate(date_start,date_end).filter(ee.Filter.lt('CLOUD_COVER_LAND',cloud_cover_80));
var size = l8;
print(size);
etc...


texts: OGR Error when saving selected features as new shapefile

texts:
I got this geodatabase directly from a county source - is it possible they made it so nothing can be edited? The ogr error says:

  "Export to vector file failed. Error: Creation of layer failed (OGR
  error: Failed to create file DNR.shp: Permission denied)"


texts:
While following the documentation given here for Ubuntu 14.04

on the command  " ./configure --with-js --with-python "

When i check the installation logs there are some "no"

my concern is shall i proceed with next step or these "no" are optional ?

Please refer the installation logs given below


texts: How to get the "absolute value" of a raster cell in QGIS?

texts: I have a raster map (-100 to +100) and I need to get all the minus values as absolute values (-100=100; -99=99...). How can I do this? Is it something like reclassify?


texts: Filling blanks (missing values) in table with value above using ArcGIS Field Calculator?

texts:
I'm using ArcMap to tidy up some field collected point data. The point data is a sequential track from a handheld device. In the attribute table i have a field with differant activities that separate out each track. However, only  the first occurrence/point of the activity is filled in and the rest below are blank till the next activity. .eg.

running

-

walking

-

Is there a way to filldown the entries to blank fields below? There are hundreds of blank entries for each one with a value, not sure if this makes a difference.


texts: Debug/Improve Performance of GRASS v.in.ogr

texts:
I'm trying to import shapefiles (in this case, OpenStreetMap data) into GRASS (grass70-svn) using v.in.ogr; and it is painfully, brutally slow. At first I thought this was because I was using the default sqlite database on an NFS mount. But, trying sqlite on a local disk and trying MySQL to separate server both failed to improve performance. I'm getting a consistent read/write of ~125Kbps/~550Kbps no matter which shapefile or which database I use.

I cannot see any bottlenecks anywhere, as the two python /path/to/grass-gui processes are averaging 10% of one core combined, the network utilization is below 10% consistently, and the DB server is almost quiescent. To give an example of how painful this is:

v.in.ogr dsn=/home/justin/downloads/osm_CA/places.shp
WARNING: All available OGR layers will be imported into vector map <places>
Check if OGR layer <places> contains polygons...
Importing 7020 features (OGR layer <places>)...
-----------------------------------------------------
Building topology for vector map <places@OSM>...
Registering primitives...
7020 primitives registered
7020 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 0
Number of primitives: 7020
Number of points: 7020
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
(Fri Jan 31 19:01:08 2014) Command finished (4 min 38 sec)

Any guidance on how to remediate this problem, or at least find the bottleneck? I'm stumped.


texts: Exporting selected records from a shapefile

texts:
I have a shapefile consisting of insurance data and point features. I select the features I want, and then I try to go to Data - Export, and a new .shp file.

The process seems to run, but the output is an empty attribute table and I can't visualize the point features either.

I don't find any strange letters in my column names.

Anyone got ideas?


texts:
The municipality that I work for is currently using the latest version of MSGovern CityView.  For those that have never used CityView, it's a software package that helps municipalities manage their assets and perform a variety of administrative tasks.  Within this software a GIS/spatial component is made available.  A user can perform non spatial queries on a variety of things (e.g. Parcels, Businesses, Parks, Utilities, etc.) and if they'd like, the information can be viewed on a map.

The current version of CityView uses ArcGIS Server to consume maps. The issue I’m having is an inconsistent rendering of maps once updates are made.  Within ArcGIS Server Manager the updates seem to take place, however, when I go over to REST (http://hostname/ArcGIS/rest/services/mapservicename/MapServer) to view the metadata as well as view the actual map, I notice that the updates have not been executed.

I've read through this blog, but I’m not sure if this is a task I should be caring out when I make updates to the map service.  I want to say this is what's causing the CityView problem, but I'm not sure. I’ve tried deleting the service, deleting browsing history and then republishing the service, but the result within REST is a previous version of the map service. I'm using ArcGIS Desktop 9.3.1 and ArcGIS Server 10.0.


texts: Listing coordinates of polygons in WKT format

texts:
I have a polygon shapefile made up of 2 shapes (independent of each other). I'm using the code below to print in the ArcMap python console, a list of each shapes coordinates in WKT format. I get an error though.

Feature 0:
Part 0:
Runtime error
Traceback (most recent call last):
  File "<string>", line 26, in <module>
AttributeError: 'unicode' object has no attribute 'X'

What am I missing? 'Williamson_Tunnels_Alert_Zone' is the name of the feature in question by the way.

import arcpy

infc = arcpy.GetParameterAsText(0)

# Enter for loop for each feature
#
for row in arcpy.da.SearchCursor("Williamson_Tunnels_Alert_Zone", ["OID@", "SHAPE@WKT"]):
    # Print the current multipoint's ID
    #
    print("Feature {0}:".format(row[0]))
    partnum = 0

    # Step through each part of the feature
    #
    for part in row[1]:
        # Print the part number
        #
        print("Part {0}:".format(partnum))

        # Step through each vertex in the feature
        #
        for pnt in part:
            if pnt:
                # Print x,y coordinates of current point
                #
                print("{0}, {1}".format(pnt.X, pnt.Y))
            else:
                # If pnt is None, this represents an interior ring
                #
                print("Interior Ring:")
        partnum += 1


texts: Sum of attributes in Spatial join when polygons cross boundaries in ArcMap?

texts:
I use ArcMap, where I have two layers:

Buildings as polygons. Each polygon has a number of people living in
it as an attribute.
Polygons dividing the city into "districts". I
drew these "districts" myself, so they sometimes cross buildings
(which is fine).

I need to calculate the number of people living in each district. I used a spatial join using the buildings as the source and the districts as the target.
I set up a merge rule as "Sum" for the number of people.

When I looked at the outcome layer, the total number of people in this layer are higher then in the total number of people in the initial building layer. I think this is because the number of people in buildings that are crossed by "district" boundaries were calculated twice in the summary.

How I can correctly set up the spatial join so that the number of people in the districts are the same as the number of people in the buildings? Ideally, if the majority of a building area fall into polygon, the people should be count as living in this polygon.


texts: Buffer for features selected in the mapcanvas and writing to csv file

texts:
I have some features selected by using "Select Features by Freehand" tool in QGIS and try to find the buffer for those selected features alone and write the city and state names within in the buffer to a csv file. My code and image is attached for a clear understanding. it is writing an csv file in the given location but nothing is found inside the csv.

And my code is

import csv
selection = layer.selectedFeatures()
layer = qgis.utils.iface.activeLayer()
columns=['name', 'state' ]
for feature in selection:
  mbuf = feature.geometry().buffer(50, 2)
  iterFeat = layer.getFeatures()
  for f in iterFeat:
    geom2 = f.geometry()
    valTest = QgsGeometry.within(geom2, mbuf)
    lsNearCities = []
    if valTest:
        idx = selection.fieldNameIndex('name')
        idx1 = selection.fieldNameIndex('state')
        nearCity = f.attributes()[idx]
        state = f.attributes()[idx1]
        state_and_cities = str(state) + "," + nearCity
        lsNearCities.append(state_and_cities)
        print lsNearCities


texts: How to color-code geology maps with given CMYK colors?

texts:
I'm trying to understand whether it is possible to corectly display colours in British Geological Survey maps. Our client has a licence to use the shapefiles but unfortunately BGS don't provide SDL files. In theory, the information to correctly colour each formation is available in the shapefile attribute table so I'm wondering whether some python coding would do the trick.

There is a field that assigns the formation (LEX_RCS) type to each polygon so this is the field you read to colour the polygon. Then there is a field (BGSREF) that assigns the colour to that field. The BGSREF field is a 3 digit field (YCM - Yellow Cyan Magenta). Each digit is from 0 to 9 assigning a percentage of that colour (i.e. 0 is 7%, 1 is 14 % ... 9 is 100%). Therefore, by reading the BGSREF field, you can then assign the colour to the LEX_RCS field for that polygon.

From what I can see, the symbology properties do not allow for this in QGIS 2.0 so I'm wondering whether some python coding would do it.

Regards
Antonio


texts:
I need to use PanZoomBar in my application.

var panZoomBar = new OpenLayers.Control.PanZoomBar();
map.addControl(panZoomBar);

Also I need to overwrite the PanZoomBar css style. I overwrite the whole bar.

.olControlPanZoomBar {
    top: 38px !important;
    left: 18px !important;
    width: 44px;
    height: 214px;
    background: transparent url(../images/zoombar_bg.png) no-repeat 50% 100%;
}

But how I can get access and overwrite the default buttons? I mean:

.whatName(Id)ShowIWriteHere {
    some style
}


texts: Symbol levels between many layers in QGIS

texts:
I have many different layers displaying each a class level from low (blue) to high (red). As I have many layers on different parameters, some low classes can appear on top of high classes, which I don't want (i want the highest first).

My workaround was to duplicate all layers and display only the class i need, then order the layers in colour groups (see below), which is a bit annoying to do.

A similar problem i think : Setting rendering order of line layers in QGIS

If it was only one layer, I'd use symbol levels but as I have many layers (and I don't want to merge them), i'm trying to find a way to order symbols on a higher level (like in arcgis). Is there something that has evolved in QGIS that could allow me to manage symbol order between many layers ?


texts: Time lapse not showing features ArcMap 10

texts:
I am trying to use ArcMap 10 to visualize air quality data. I have created a shapefile with values of measurements of PM2.5 on an interval of 15 minutes each. The total data accounts for circa 3000 measurements and so I am working with this as an example.Now, equal coordinates to each sensor were given since the sensors are static.
The time format I need to show is yyyy-mm-dd hh:mm:ss as seen in the TIME field. I have tried to change the field type to date and also to text, text works when defining the time laps parameters on the layer configuration.
I have also selected a category symbology for the values I need to visualize.
When the time series starts, nothing shows. Any idea why is this happening?

Here the attribute table!
Here the
Here the time lapse with no features shown


texts: How should arrays be stored in PostgreSQL when used as a datastore with GeoServer 2.14+?

texts: I am storing a string array in PostgreSQL to serve through WFS in GeoServer 2.14.1.  As a test, I have two columns in my table; one column is a character varying array and this other is a text array data type.  When I register the layer in GeoServer only the character varying array shows up in the feature type details.  When I try to access the data via WFS, the value in the property shows up as the memory representation of the object, e.g. "[Ljava.lang.String;@1748e3a9" and is not serializing the object.  Does anyone know the proper way to either store string arrays in PostgreSQL to use with GeoServer or properly configure GeoServer to serialize array data?


texts: Is there a way to embed audio files (mp3) into the infowindows of markers in a kmz so that the audio is available offline? I'd like the files to be in the kmz so the kmz can be downloaded as a whole package before entering the field and no streaming in the field would be required. We don't want to use the virtual "Tour" function, rather we want people to access audio clips via the infowindows when they get to certain points in the field.


texts: How to delete multiple fields in an attribute table?

texts: Is there a way to select multiple fields in an attribute table and delete them together in Arcmap without writing the script?


texts:
I'm attempting to create quick code that simply assigns a gps coordinate to a certain station on the map. Here's my current code
Pre-logic script code:

def update_nones(lat,bay_statio):
if bay_statio=="apalachicola0":
    return 29.733333
elif bay_statio == "apalachicola1":
    return 29.7583008
   else:
 return lat

lat=

update_nones(!lat!,!bay_statio!)

For some reason I keep receiving an error in the geo-processing window. The code works with one condition but once I had the elif statement it refuses to compile.

Any ideas?


texts: Processing: Using attribute as input for algorithm

texts:
In Processing Modeller, is it possible to pass a field value (attribute of a feature) to a file name?

Example:

I have raster, MyRaster.tif, and I would like to clip it by different polygons inside my MyClipExtents.shp. My vector polygon shapefile has 3 features with 2 fields (ID and ExtentName).

If I use my model, run it iteratively, and output the clipped rasters as TIFs, they all come out with filenames such as MyClippedRaster_1.tif and MyClippedRaster_2.tif.

Instead I would like them to come out as MyClippedRaster_ExtentName.tif


texts: How to open a second window in QGIS plugin from a button inside the main window

texts: If I already created a qgis plugin, and i need to create a button inside that plugin that opens a new window, how is that possible? Qt creator won't add a slot unless there are a header file. I looked inside the plugin directory and didn't find the .h file, so I compiled it using uic, but it still can't find the .h file it says : no document matching ui_test.h could be found, rebuilding the project might help.


texts: Polygon covered by the intersection of multiple linestrings (PostGIS)

texts:
I have a set a linestrings, and I would like to know the area covered by the intersection of those lines.
I don't want to merge them though. To make things clearer, here is a diagram of three multiline strings. I want to get the pink polygons.
How can I achieve that?


texts: Creating basic authentfcation configuration

texts:
I am trying to configure the master password on several machines. However, I have two machines that persistently give me this error. I tried uninstalling QGIS and that does not seem to solve the problem.

All machines are running the same version of QGIS 3.6 When I connect to the database for the first time and try to set the basic configuration it gives me the option to new master authentification password, I enter my credentials and the OK option remains inactive. Perhaps I need to configure something?

See screenshots below. The other machines do allows me to edit the configuration and work fine. I tried settings, options, authentification, utilities and still, it does not allow me to add a new configuration.

When doing this configuration, I always enter my Postgres superuser credentials. This does not work at first. When you give it a different user name and password. The password authentification manager allows you to create a new authentification, you can then enter your DB credentials, this way you won't be asked to enter the password when opening the QGIS project stored in postgreSQL.


texts:
Using apt-get install, I've added the following packages:

postgis/bionic-pgdg,now 2.5.1+dfsg-1.pgdg18.04+1 amd64 [installed]
postgis-doc/bionic-pgdg,now 2.5.1+dfsg-1.pgdg18.04+1 all [installed,automatic]
postgresql-10/bionic-pgdg,now 10.6-1.pgdg18.04+1 amd64 [installed]
postgresql-10-ogr-fdw/bionic-pgdg,now 1.0.7-2.pgdg18.04+2 amd64 [installed]
postgresql-10-pgrouting/bionic-pgdg,now 2.6.1-2.pgdg18.04+2 amd64 [installed]
postgresql-10-pgrouting-scripts/bionic-pgdg,now 2.6.1-2.pgdg18.04+2 all [installed]
postgresql-10-postgis-2.4/bionic-pgdg,now 2.4.4+dfsg-4.pgdg18.04+1 amd64 [installed]
postgresql-10-postgis-2.4-scripts/bionic-pgdg,now 2.4.4+dfsg-4.pgdg18.04+1 all [installed]
postgresql-10-postgis-2.5/bionic-pgdg,now 2.5.1+dfsg-1.pgdg18.04+1 amd64 [installed,automatic]

I've also added the following GEOS packages using apt-get:

libgeos++-dev/bionic,now 3.6.2-1build2 amd64 [installed]
libgeos-3.6.2/bionic,now 3.6.2-1build2 amd64 [installed]
libgeos-c1v5/bionic,now 3.6.2-1build2 amd64 [installed]
libgeos-dev/bionic,now 3.6.2-1build2 amd64 [installed]
libgeos-doc/bionic,now 3.6.2-1build2 all [installed]

I then try to use psql and add PostGIS with the following call:

CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;

But I'm given an error message:

  ERROR:  could not load library
  "/usr/lib/postgresql/10/lib/postgis-2.4.so":
  /usr/lib/postgresql/10/lib/postgis-2.4.so: undefined symbol:
  GEOSMinimumClearance

I ran into the same type of GEOS error when I tried installing Postgresql 11 & PostGIS.  I assume that the PostGIS library is not finding the Geos.  What should I be doing with the packages to make things work?  I didn't want to download and build from source files which is what most of the older online instructions show.  I'm pretty bad with Linux setup, so I'm hoping it's an easy solution.


texts: Simple way to share maps on a network drive?

texts:
I am not an expert in web GIS and I would like to share some maps I created with non GIS aware colleagues from other offices. I have looked at various options but I can't find one that suits my needs.

The problem I have is that I do not have access to a server and therefore I cannot use web map services and the only way I have to share my maps is by using a shared network drive. Deploying the maps on a cloud service like ArcGis Online is not possible either as it is sensitive data.

I was thinking of deploying my data on the shared drive and than ask my colleagues to use ArcGis Explorer to access the maps. I think this solution might work but I would like to avoid the need of installing the software as I don not want to give them too much control on the data.

All I want for them is to be able to double click on a file that will display a map where they can see where things are and possibly include some chart and tabular information, possibly using a web browser.

Can anyone point me in the right direction?

I tried qgis2leaf, it works but is quite basic. Do anyone have other suggestions?


texts: Adding Locations tool & sublayers in ArcPy

texts:
I run ArcGIS 10.6.1. I am currently doing a network analysis but run into the problem where I can't relate the error I get to what I want to do. My code looks like this:

XMLPath="C:\\Work\\TemplateXML"
NetworkDataset="C:\\Work\\GDBTejo.gdb\\PTA"

arcpy.na.CreateNetworkDatasetFromTemplate(XMLPath, NetworkDataset)
arcpy.na.BuildNetwork(NetworkDataset)
arcpy.na.MakeServiceAreaLayer(NetworkDataset, "TransportBus250m", impedance_attribute="Length", travel_from_to="TRAVEL_FROM", default_break_values=250, polygon_type="NO_POLYS", line_type="TRUE_LINES", overlap="NON_OVERLAP", lines_source_fields="LINES_SOURCE_FIELDS")
arcpy.na.AddLocations(in_network_analysis_layer="TransportBus250m", sub_layer="TransportBusLine250m", in_table=NetworkDataset+"\\BusStops", field_mappings="", search_tolerance=250)
arcpy.na.Solve("TransportBus250m")

Now I get an error on the AddLocations line, stating:

arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000192: Invalid value for Sub Layer
Failed to execute (AddLocations).

Reading the Esri website about it does not really help me as they say:

  sub_layer=The sublayer of the network analysis layer to which the network analysis objects will be added.

What do I need to change, so that my sub_layer gets accepted?

I adapted now my code as suggested by @smiller and it looks now like this:

    XMLPath="C:\\Work\\TemplateXML"
    NetworkDataset="C:\\Work\\GDBTejo.gdb\\PTA"

    arcpy.na.CreateNetworkDatasetFromTemplate(XMLPath, NetworkDataset)
    arcpy.na.BuildNetwork(NetworkDataset)
    outNALayer=arcpy.na.MakeServiceAreaLayer(NetworkDataset, "TransportBus250m", impedance_attribute="Length", travel_from_to="TRAVEL_FROM", default_break_values=250, polygon_type="NO_POLYS", line_type="TRUE_LINES", overlap="NON_OVERLAP", lines_source_fields="LINES_SOURCE_FIELDS")
    outNALayer = outNALayer.getOutput(0)
    subLayerNames = arcpy.na.GetNAClassNames(outNALayer)
    facilitiesLayerName = subLayerNames["Facilities"]
    arcpy.na.AddLocations(in_network_analysis_layer="TransportBus250m", sub_layer=facilitiesLayerName, in_table=NetworkDataset+"\\BusStops", field_mappings="", search_tolerance=250)
    arcpy.na.Solve("TransportBus250m")

The script now gives the error message:
arcgisscripting.ExecuteError: ERROR 030024: Solve returned a failure.
No edges were traversed.
Failed to execute (Solve).

Problem solved! The XML-template had a wrong line in it. Instead of declaring the road network and the facilities as part of the network dataset, one only needs to declare the road network as part of the network dataset. The facilities are then just added as locations to make it work.


texts:
I created this map in cartodb: http://cdb.io/1xBj4Xo

Now I have to merge some of the districts to a bigger district. Is it possible to do this in Cartodb? Using a SQL query for instance?

I can also provide a .csv-file: http://tradukt.ch/owncloud/public.php?service=files&t=2fe413428dd38103705fa4191236b8fc

Screenshot of the table:


texts: How to perform SIA or Bezier line smoothing in PostGIS?

texts: Can anyone provide an example SQL for smoothing linestrings from postgis table using Bezier curves or Iterative Averaging (SIA) algorithm?


texts: QGIS Print Composer align poly extents to page edges

texts:
Is there a posibility to align the edges of an polygon (in my case these edges are also the total extents of the layer) to the edges of the map item? I want to keep the specific page dimensions.

edit: I was trying around a while and found a kind of solution: there is an command called Export map as PDF in the "Project" Menu tab. There you can set the extent from a layer of your choice. This exported all active layers in my main canvas to the given extent. Not exactly what I was looking for but in this case it worked fine for me.


texts:
I'm trying to create a simple form useful for put a point on a map.

models.py

from django.contrib.gis.db import models as geomodels
from django.db import models

class AddPoint(models.Model):
    name = models.CharField(max_length=100)
    geom = geomodels.PointField()

    def __str__(self):
        return self.name

forms.py

from django import forms
from django.contrib.gis import forms

from .models import AddPoint

class AddPointForm(forms.ModelForm):
    name = forms.CharField(
        max_length=100,
        widget=forms.TextInput(
            attrs={
                "type": "text",
                "class": "form-control form-control-lg",
                }
            ),
        )
    point = forms.PointField(
        widget=forms.OSMWidget(
            attrs={
                'map_width': 800,
                'map_height': 250,
                'default_lat': 0,
                'default_lon': 0,
                'default_zoom': 2,
                }
            ),
        )

    class Meta:
        model = AddPoint
        fields = [
            'name',
            'point',
            ]

views.py

def addPointOnMap(request):
    if request.method == "POST":
        geoform = AddPointForm(request.POST or None)
        if geoform.is_valid():
            new_point = geoform.save()
            return redirect('add_points_map')
    else:
        geoform = AddPointForm()
    context = {
        'geoform': geoform,
        }
    template = 'maps/editing/add_point.html'
    return render(request, template, context)

The template is a simple {{ geoform.as_p }}

When I click on "Add point", on the template, I see this message:

  IntegrityError at /map/create/add-points/

  null value in column "geom" violates not-null constraint DETAIL:
  Failing row contains (3, test, null).

From a week a try to solve this without results and I've seen that there aren't similar problem online. How I can solve this?

NB: If I use the admin panel I can add the points without problem


texts: How can QGIS be installed without administrative rights?

texts: I have the impression from searching that this may have been possible with earlier versions but I don't know if it is possible with version 1.8.


texts: GPS point elevation vs Contours layer elevation

texts: I have some survey grade GPS points whose elevation is approx 55 feet lower than my contours layer elevations. I am using 1 ft contours and comparing point elevations with contours in the same location. Any idea why there's such a discrepancy?


texts: Using ModelBuilder to run clip scenario?

texts:
I am using ArcMap 10.5.

I have a layer representing suburbs (n=432) over laid with open space data (both gdb files).

My objective is to get to get the suburbs to individually clip with the open space data, so far everything I have tried has failed. Suburbs with open space traversing the boundary have not been clipped.

I have tried a few models in ModelBuilder with little success.
Watched numerous YouTube videos on Iterate but nothing appears to match my project.

I am a novice in this area of ArcGIS.


texts:
I have GPS points driven over the same road back and forth then clipped to a section of that road. My points are overlapping and need to identify the points going one way or one run down the road in order to make a new feature from it. My points have consecutive numbers but stop being consecutive where the point file was clipped. I'm thinking this would be the best way find the run segment points in one direction.

I have tried using the "Group Analysis" tool, which has got me very close but it is failing to find all the breakpoints in the consecutive number string

An example is one run going north: points 989,990,991 then the next run going South on the same road, points 1088,1089,1090. Where the North run will make a new feature and the South run a new feature. We can do this manually but have over 100 runs and would like to automate it.


texts:
I’m trying really hard to find a free geocoding solution that does not apply a throttle on the amount of requests - throttling the speed to 1 per second is still okay, but on the number not.

Does anyone know of such a service?

My attempts:

to find a simple API that can do this, the best I got was datasciencetoolbox, but the geocoding is on a street and not address level
running a docker container with nominatum - I’m trying it at the moment, but it doesn’t seem to work - it made my Mac Pro crash due to the amount of size the image took (I only focused on Italy) I’m trying this one more time, but I also suspect the geocoding won’t work very well even if I get it setup properly.

Does anyone know of a quality free solution - even if it will require a lot of work to set it up?


texts: Export boundaries as gpx file from Open Street Map?

texts:
How can I export the boundaries of this area as GPX? Is there any way?

https://www.openstreetmap.org/relation/1595533#map=14/50.8945/14.3287

Background: I'm planing a hiking tour through the national part but you're not allowed to camp in the inner zone of the park. Sadly I couldn't find any official gpx data download.


texts: Calculating area of from 10x10 degree tiff raster file using QGIS

texts:
I am new to QGIS.
How do I calculate the area in 0.05x0.05 cells from a 10x10 tiff raster file?
I guess I will have to do a loop function to get the areas from the 10x10 file but I have no idea how to do that.


texts: How to add image base tool control to a drop-down list in ArcGIS 9.3.1

texts:
I have to retrograde an ESRI add-in application from ArcGIS 10.1 to ArcGIS 9.3.1.

My challenge is how in the drop down list can I add base tool control( will be shown as icons inside the drop down list : red and green icons ),

In ArcGIS 9.3.1 is easier to create a drop down list containing text:

By default a drop down list can't contain image , how can I overcome that?


texts: How to measure the distance between two points follow the track?

texts:
I have three points shapefile and 1 line shapefile. I tried to use v.distance but it only got directly distance.

How can I measure them by track?


texts: Load filtered OSM relations into Postgis with OSMOSIS

texts:
I am really hitting the wall trying to grips with merging filters in OSMOSIS.

I would like to load relations, their related nodes and ways.

If I use a tag filter like this:

--tf accept-relations route=train,bus --used-way --used-node

I get all the nodes associated with every way. This is not half bad but I would only like to load the nodes related to the route relations, ie. the bus stops and rail stations.

If I put the --used-node before --used-way then all nodes (buildings, poi, etc) are loaded, that is bad.

Loading NO nodes and just ways doesn't seem to be possible at all. :(


texts: Account for bridge overpasses in a ground DEM to allow for water flow under the overpass

texts:
I have a bare earth DEM made from lidar data (A).

It works well and has passed all accuracy tests. It is used in storm surge models. The problem we are having is on underpasses. I need to allow water to flow through underpasses when one road crosses another. My thought is to:

1) Get all roads marked as bridges from OSM.

2) The select all the crossing roads that cross under them (intersect).

3) Then on the new selection of new road segments (2) convert these to raster.

4) Extract all the DEM (A) values under these road segments.

5) Select the minimum of these values under the new road segment (2).

6) Burn this minimum value into the DEM I have to cut a channel through the underpass.

Open to all suggestions, improvements, ideas on how to achieve this including entirely different solutions.

Other options are just get the intersect point and grow this out or maybe identify sinks and work back from this.


texts: ArcGIS, update features envelopes without "Repair geometry"

texts:
I am developing a toolbar for ArcMap with .NET ArcObjects and I made an option to round vertices coordinates to meters (no decimals). So I change X and Y of each vertex on each feature. The problem is that if I do a Check Geometry after, I get bad envelope on all features. I guess that it's because the envelope doesn't update itself after changing the vertices.

Is there a way to update envelopes without using Repair Geometry?

I don't want to use it because it does a lot more than just updating envelopes.

Here is the code I am using

lIGeometryCollection = layerFeature.Shape
For idx_geometrie As Integer = 0 To lIGeometryCollection.GeometryCount - 1
    Dim pointCollection As IPointCollection = lIGeometryCollection.Geometry(idx_geometrie)
    For idx_point As Integer = pointCollection.PointCount - 1 To 0 Step -1
        Dim lPoint As IPoint = New ESRI.ArcGIS.Geometry.Point
        lPoint.PutCoords(
            Math.Round(pointCollection.Point(idx_point).X / ResolutionXY, 0, MidpointRounding.AwayFromZero) * ResolutionXY,
            Math.Round(pointCollection.Point(idx_point).Y / ResolutionXY, 0, MidpointRounding.AwayFromZero) * ResolutionXY)
        pointCollection.UpdatePoint(idx_point, lPoint)
        System.Runtime.InteropServices.Marshal.ReleaseComObject(lPoint)
    Next
Next
layerFeature.Store()


texts: Removing green Xs and red lines in QGIS?

texts:
I'm using QGIS 2.18.15 and have somehow ended up with the following on my screen. I've deselected every layer and these green X's and red lines persist. I cannot "undo" to remove them.

What are they & how do I get rid of them?

They may have originally been related to a duplicate node or something like that, but I have no idea what's going on.


texts: GRASS: populating attribute table with specific values

texts:
I have a vector map that includes 100 points.  These points were created using v.extract to randomly sample a larger map of 10k points.  As such, the 'cat' values range from 1 to more than 10k.  What I would like to do is to update the attribute table by rescaling these values to 1 to 100.

Here's what I've experienced.  If I use

v.category input=pts100 output=foo option=del
v.category input=foo output=pts100 option=add --o

Then when the 'cat' values appear rescaled when I print them with

v.category input=pts100 option=print

However, if I look at the dbtable with

db.select pts100

the 'cat' values have not changed (presumably because it is the key column).

So I'm thinking I will need to add a new column using v.db.addcol, but I don't know how to specify the range of value to populate the new column.  From what I can tell, I have to specify a single value.

Ideas?


texts: Copying objects to existing records in MapInfo

texts:
This should be fairly simple but I think I'm missing something...

I have two tables of similar structure with corresponding data in them (i.e. same number of rows, rows have the same IDs).

The main difference is that one table has objects attached, the other doesn't.

I would like to copy the objects from one table to the other. I expected the following query to work but  I get an error...

UPDATE Tab1
SET Tab1.Obj = Tab2.Obj
WHERE Tab1.Site_ref = Tab2.Site_ref

Error: Expression does not evaluate to a column or table name.

Any ideas?


texts: Problem with QGIS - Attribute names are shown as _1,_2,_3 ... and Strings are displayed as "NULL"

texts:
Whenever I look at the attribute table or at the attribute dialog for a shape, the attribute names are shown as _1,_2,_3, ... In the attributes, Strings are generally displayed as "NULL". Numbers are fine.

This happens to all shapefiles and it has not been a Problem in the beginning but at some point it startet. I unintalled Qgis several times and reinstalled different versions (2.2,2.6,2.8) from different sources (Ubuntu repositories, QGIS repositories) ... the problem remained. I also uninstalled grass libraries ... the problem remained. I reinstalled QT ... the problem remained. Any suggestion?

With that problem, QGIS is hardly usable :(

I'm using Ubuntu 64-bit. The problem startet under version 14.04, but survived an update to 14.10.

In the message window, I found one warning by python:

warning:/usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.py:890: PendingDeprecationWarning: This method will be removed in future versions. Use 'elem.iter()' or 'list(elem.iter())' instead.

for include in elem.getiterator("include"):

traceback: File "<string>", line 1, in <module>

File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 219, in startPlugin

plugins[packageName] = package.classFactory(iface)

File "/usr/share/qgis/python/plugins/MetaSearch/__init__.py", line 28, in classFactory

from MetaSearch.plugin import MetaSearchPlugin

File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 478, in _import

mod = _builtin_import(name, globals, locals, fromlist, level)

File "/usr/share/qgis/python/plugins/MetaSearch/plugin.py", line 31, in <module>

from MetaSearch.dialogs.maindialog import MetaSearchDialog

File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 478, in _import

mod = _builtin_import(name, globals, locals, fromlist, level)

File "/usr/share/qgis/python/plugins/MetaSearch/dialogs/maindialog.py", line 49, in <module>

from MetaSearch.dialogs.manageconnectionsdialog import ManageConnectionsDialog

File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 478, in _import

mod = _builtin_import(name, globals, locals, fromlist, level)

File "/usr/share/qgis/python/plugins/MetaSearch/dialogs/manageconnectionsdialog.py", line 39, in <module>

BASE_CLASS = get_ui_class('manageconnectionsdialog.ui')

File "/usr/share/qgis/python/plugins/MetaSearch/util.py", line 59, in get_ui_class

return loadUiType(ui_file_full)[0]

File "/usr/lib/python2.7/dist-packages/PyQt4/uic/__init__.py", line 210, in loadUiType

winfo = compiler.UICompiler().compileUi(uifile, code_string, from_imports, resource_suffix)

File "/usr/lib/python2.7/dist-packages/PyQt4/uic/Compiler/compiler.py", line 139, in compileUi

w = self.parse(input_stream, resource_suffix)

File "/usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.py", line 992, in parse

actor(elem)

File "/usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.py", line 890, in readResources

for include in elem.getiterator("include"):

I don't think that this causes the problem, but I don't know.


texts: CartoDB: Question about map loading indicator

texts:
We are using the CartoDB.js API to create our visualizations at runtime using a pre-exsiting Google map. Everything seems to be working fine so far, except that we would like to show some sort of visual loading indicator while the cartodb layer tiles are loading to let the end user know that the map is still rendering.

I see that a visual loading indicator is displayed on the (google) map when I use the cartodb.createVis() function with a pre-defined visualization, however I do not see how I can access/use this with the API for my map visualization that I create at runtime.

Does anyone know how to display a loading indicator on the google map or have an example of doing so?

Thanks,
Greg


texts: ArcGIS Android - Get LatLon position of the graphic

texts:
I'm adding marker to my map using the following code:

mvHelper.addMarkerGraphic(Double.parseDouble(friendData.getLatitude()), Double.parseDouble(friendData.getLongitude()), friendData.getFriendName(), friendData.getStatus(), null, icon, false,
                0);

This is my listener:

mvHelper.setOnGraphicClickListener(new OnGraphicClickListener() {
        @Override
        public void onGraphicClick(Graphic graphic) {
            Log.d("MVHELPER GRAPHIC LISTENER TAG",graphic.toString());
            calculateDirection((float)((Point)graphic.getGeometry()).getX(),(float)((Point)graphic.getGeometry()).getY());
        }
    });

I'm trying to get the lat long position of the clicked marker. But the listener doesn't provide it. So I tried the above way and got this error:

com.esri.core.io.EsriServiceException:Unable to complete operation. Location "Location 2" in "Stops" is unlocated. Need atleast 2 valid stops. "Stops" does not contain valid input for any route.

and this is the method where I get the route:

calculateDirection(float x, float y){
Log.d("Marker X and Y",String.format("%f // %f",x,y));
final Point loc = mapView.toMapPoint(x, y);
Log.d("Marker X and Y in MapPoint",String.format("%f // %f",loc.getX(),loc.getY()));
Thread t = new Thread() {
        @Override
        public void run() {
            try {

                RouteParameters rp = mRouteTask
                        .retrieveDefaultRouteTaskParameters();
                NAFeaturesAsFeature rfaf = new NAFeaturesAsFeature();

                Point p = (Point) GeometryEngine.project(loc, wm,
                        egs);
                Log.d("Marker X and Y after projection",String.format("%f // %f",p.getX(),p.getY()));
                StopGraphic point1 = new StopGraphic(mLocation);
                StopGraphic point2 = new StopGraphic(p);
                rfaf.setFeatures(new Graphic[] { point1, point2 });
                rfaf.setCompressedRequest(true);
                rp.setStops(rfaf);

                rp.setOutSpatialReference(wm);

                mResults = mRouteTask.solve(rp);
                mHandler.post(mUpdateResults);
            } catch (Exception e) {
                mException = e;
                mHandler.post(mUpdateResults);
            }
        }
    };

    t.start();

}

Update 1:

After trying @jdONeill answer. I get the Lat and Long values.This is what I did.

Point temp = (Point)graphic.getGeometry();

Point p = (Point) GeometryEngine.project(temp, wm,egs);
calculateDirection((float) p.getX(), (float) p.getY());

This is the result:

04-30 16:17:54.408  17908-17908/com.test.esrisample D/Marker X and Y﹕ -93.203285 // 44.881104
04-30 16:17:54.408  17908-17908/com.test.esrisample D/Marker X and Y in MapPoint﹕ -10379311.931913 // 5607101.545301
04-30 16:17:54.458  17908-17908/com.test.esrisample D/dalvikvm﹕ GC_FOR_ALLOC freed 484K, 22% free 10018K/12760K, paused 16ms, total 16ms
04-30 16:17:54.719  17908-18235/com.test.esrisample D/Marker X and Y after projection﹕ -93.238945 // 44.908331

Why is there a slight change in the latitude and longitude values?


texts: assign a number for each group in field calculator

texts:
I have several thousand features each of which has a name. The names are not unique.
what I want to do with the field calculator is assign a number to each name so I can refer to a number and always get the same name.

For example if I had:

chris, dave, chris, tom, dave, chris , dave, tom

I'd like my number column to show

1, 2, 1, 3, 2, 1, 2, 3

Is this something I can do using python in field calucator?


texts: Creating new layers of individual polygons from existing layer of many using ArcGIS Desktop?

texts:
I have a shapefile with 30 polygons. I want to create 30 shapefiles/layers from the original. I was doing this by selecting individual features and exporting them to a new layer.

Is there an automated way to do this?


texts: Is the quadrilateralized spherical cube map projection the same as Snyder's cubic equal area map projection?

texts:
Is the quadrilateralized spherical cube map projection [1] the same as Snyder's cubic equal area map projection [2]?

I know both are equal area polyhedral map projections ( http://www.progonos.com/furuti/MapProj/Dither/ProjPoly/projPoly.html ) based on the cube, but i can't access either publication to answer the question myself.

Thanks.

[1] E. M. O’Neill and R. E. Laubscher, Extended studies of the quadrilateralized spherical cube
earth data base, Tech. Report 3-76, Computer Sciences Corp Silver Spring Md System Sciences
Div, 1976.

[2] Snyder, J.P. 1992. An equal-area map projection for polyhedral globes. Cartographica 29(1): 10-21.


texts: Edit table or map metadata programmatically via API in CartoDB

texts:
I'm trying to automate the creation of datasets and maps with CartoDB.
Now I would like to add the metadata information (source, attribution, description, etc).

Is it possibile?
I don't find this in the documentation (but maybe I miss something...)


texts:
I have to convert (lat,lon) coordinates from WGS84 (ITRF2014) to ETRS89 (Finland) (lat,lon) in a C++ program. I am not experienced PROJ user, I have used proj.4 sometimes.
From command line:
projinfo -s EPSG:7912 -t EPSG:4258 -o PROJ --area Finland

I get the pipeline
Operation No. 1:

unknown id, Conversion from ITRF2014 (geog3D) to ITRF2014 (geocentric) + ITRF2014 to ETRF2014 (1) + Inverse of NKG_ETRF14 to ETRF2014 + NKG_ETRF14 to ETRF96@2000.0 + ETRF96@2000.0 to ETRF96@1997.0 + Conversion from ETRS89 (geocentric) to ETRS89 (geog2D), 0.02 m, Finland - onshore and offshore.

PROJ string:
+proj=pipeline
  +step +proj=axisswap +order=2,1
  +step +proj=unitconvert +xy_in=deg +z_in=m +xy_out=rad +z_out=m
  +step +proj=cart +ellps=GRS80
  +step +proj=helmert +x=0 +y=0 +z=0 +rx=0 +ry=0 +rz=0 +s=0 +dx=0 +dy=0 +dz=0
        +drx=8.5e-05 +dry=0.000531 +drz=-0.00077 +ds=0 +t_epoch=1989
        +convention=position_vector
  +step +inv +proj=deformation +t_epoch=2000.0 +grids=eur_nkg_nkgrf17vel.tif
  +step +proj=helmert +x=0.15651 +y=-0.10993 +z=-0.10935 +rx=-0.00312861
        +ry=-0.00378935 +rz=0.00403512 +s=0.00529 +convention=position_vector
  +step +proj=deformation +dt=-3 +grids=eur_nkg_nkgrf17vel.tif
  +step +inv +proj=cart +ellps=GRS80
  +step +proj=unitconvert +xy_in=rad +xy_out=deg
  +step +proj=axisswap +order=2,1

Now the tricky part is how to use this pipeline. I have tried to use proj_create -function in two ways. At first if I simply create a string from the pipeline proj_create(0, "pipeline") I get an error: "proj_create: Error -1: no arguments in initialization list".
The second attempt was to create string list of 10 lines and to loop each +proj line separately to proj_create. It stops at line
+inv +proj=deformation +t_epoch=2000.0 +grids=eur_nkg_nkgrf17vel.tif

with the same error message.
How can I do this correctly?


texts: How to find shortest line from a point on a polygon boundary to a multilinestring, but the line is inside polygon (PostGIS)

texts:
I have 3 geometries

1 polygon
1 point on boundary
1 multilinestring

In this image you can see the problem. I need to find shortest line from point (green square) to line (red), but the line must be inside polygon. The green line is the solution, but ST_shortestLine or ST_ClosestPoint give me the pink line, and this line is not within polygon

This is my SQL:

SELECT ST_AsText(st_shortestLine(line.geom,point.geom)) FROM
(SELECT st_geomFromText('POINT(3 5)') AS geom) AS point,
(SELECT st_geomFromText('MULTILINESTRING ((1 3,11 3,11 9,1 9))') geom) AS line,
(SELECT st_geomFromText('POLYGON ((0 5,10 5, 10 4,0 4,0 2,12 2,12 13, 0 13, 0 5))') geom) polygon
WHERE ST_Within( st_shortestLine(line.geom,point.geom), polygon.geom )

Without WHERE condition return the bad line, and with WHERE condition give me a null value.


texts: Joining xy points to regions to enable time slider-sensitive counts

texts:
I'm attempting to create a heatmap that responds to the time slider.
I'm working with historical newspapers. In one table, I have individual newspapers with fields for their years of publication and location. Another table has polygons representing regions of Colorado.
I have joined the points into the regions and created static heatmaps for the regions, but they show the cumulative total for the entire era; moving time slider doesn't change the map, because the join only counts the total for each region (that is, it isn't dynamically counting the total for the year selected by the slider).


texts: How to implement Landmarks in Network Analyst of ArcGIS 10.1?

texts:
I have been trying to implement the landmark functionality into route solving in Network Analyst using ArcGIS 10.1. I have added a point class as turn landmarks (as well as playing around with confirmation landmarks as well), verified they have a valid name field, and adjusted the tolerance, yet the landmarks are not showing up in the directions. Am I missing something?

Thanks,

Eric


texts: Sharing Open Source Python/ArcPy Code and Models for ArcGIS Desktop?

texts:
I will be writing scripts for ArcGIS Desktop in Python with ArcPy.

Is there a community or open source project where code and models can be shared?


texts: How to query raster data using a polygon in a web environment

texts:
I'm struggling with the following;
I am setting up a web mapping environment using Leaflet. In the front end I use Javascript and the back-end is build with Python. When clicking or drawing an shape on the map I get the lat-lng coordinates back.

What I want to achieve is to extract the raster data within a drawn polygon and parse that information back to the user in the fastest possible way.

For a point dataset it's easy; I just parse the coordinates of the shape to a geoJSON of the points and determine if the points are within the drawn shape.

For a line I use gdallocationinfo. Using the start and end point I can calculate all the intermediate coordinates and query the raster using these coordinates withoud needing to load the geoTIFF in the back-end.

What would be the best way to extract values from a raster using the coordinates of a drawn shape? What I've already tried:

Converting the geoTIFF to a ascii XYZ file: file is way to large (50gb)
Classify raster and convert to polygon: a lot of polygons, slow
Create a hexagon grid and extract values to each hexagon: loss of detail/data

Raster data is rather large: X: 29236 Y: 26458 and consists out of 1 band. The value of that band should be extracted.


texts: Generate legend and export as image using PyQGIS

texts:
I have a vector layer like :
vLayer = QgsVectorLayer('Point?crs=epsg:4326', vLayerName , providerName)
symbol = QgsMarkerSymbol.createSimple({'name': 'circle', 'color': 'red' , 'stroke-color':'red'})
symbol.setSize(3)
symbolColorProperty = QgsProperty.fromExpression(someExpression)
symbol.symbolLayer(0).setDataDefinedProperty(QgsSymbolLayer.PropertyStrokeColor,symbolColorProperty)
vLayer.renderer().setSymbol(symbol)

Note that vLayer symbols have different color by QgsProperty expression.
I can generate and export a plot from vLayer as:
...
options  = QgsMapSettings()
options.setLayers([ vLayer ])
...

render = QgsMapRendererParallelJob(options)

render.start()
render.waitForFinished()
img = render.renderedImage()
img.save(image_path, "png")

How can I generate a legend according to that vLayer which shows me counts, percentages and symbols with colors like below.


texts: Classifying point coordinates to countries or continents?

texts:
I have about 50 000 points (latitude and longitude), and I would like to find out in which country each of the points is located. It does not need to be super precise, though.

(Or actually I only need to classify them to larger geographical areas (North America, South America, Europe, Africa, Middle East, Ex-USSR, Asia, Oceania), but I assume classifying the points to countries and then the countries to larger geographical area is the way to do it.)

How should I proceed?

I would prefer a programmable or a command line solution.


texts: How to mosaic multiple rasters and keep their attribute tables in ArcGIS?

texts:
I have multiple rasters and I would like to mosaic together. For each raster, I have created an attribute table that contains one additional column of text codes. I have not been able to keep the associated information from the attribute tables when mosaicing. I have tried using the 'Mosaic to New Raster' tool and tried building a raster dataset within a geodatabase.

I use arcGIS 10.6 but I also have ArcGIS Pro 2.5


texts: I cannot create a custom point in CARTO BUILDER, option is always greyed out

texts:
I have recently started working with BUILDER and the option to manually add a point (either searching an address or just clicking to create) don´t work for me as with the previous interface.

Could you please help me?


texts: Best routing algorithm for this scenario

texts:
Trying to work out the most appropriate routing algorithm to use for this situation. Even better if it's available as part of pgrouting or similar..

Here's the requirements:

Specified date/time for start point
Specified date/time for end point
Constant speed of travelling
Possibility for a few additional minutes added per hour of travelling
Take into account impedences/weights of certain routes
The number of stages / legs doesn't matter
Preferable not to retraverse stages / legs but can be done if required
Start / end point could be the same
The algorithm should return the top 3 matching routes (if possible)

The idea is that the routing algorithm would work out a near optimal route to take that will take from the start time until the end time. So for example, if the start time is 9am and the finish time is 12pm then a 3hr3min route would take preference to a 2hr route.

Any thoughts?


texts: Installing the development files libqgis-dev in Ubuntu 12.04

texts:
I am trying to install development files which include the headers and the libraries for qgis in Ubuntu 12.04. I used Ubuntu software center, synaptic and the terminal and am still getting the same result.

The following packages have unmet dependencies:

libqgis-dev:

-Depends: libgeos-dev (>= 3.0.0) but 3.3.3-2~precise2 is to be installed

-Depends: libgsl0-dev but it is not going to be installed

-Depends: libqgis1.9.0 (= 1.9.0+git20120902+5a0d2f5~precise-ubuntugis1) but 1.9.0+git20120902+5a0d2f5~precise-ubuntugis1 is to be installed

-Depends: libqt4-dev (>= 4.4.0) but 4:4.8.1-0ubuntu4.2 is to be installed

-Depends: python-qt4 (>= 4.1.0) but 4.9.1-2ubuntu1 is to be installed

-Depends: python-qt4-dev (>= 4.1.0) but it is not going to be installed

-Depends: qt4-designer (>= 4.4.0) but 4:4.8.1-0ubuntu4.2 is to be installed

Can anyone help me with this installation?

Thank You.


texts: Using ArcPy to multiply fields in attribute table?

texts:
I am trying to identify a method to multiply 2 fields in the same attribute table and write the product of the calculation into an added field. The code creates the empty fields, now I just want to understand how to use arcpy to run a field calculation.

This is what I have so far:

# Set the local parameters
inFeatures = "ESR_States"
joinField = "STID"
joinTable = "ESR_Weather"
# Join two feature classes by the STID field
arcpy.JoinField_management (inFeatures, joinField, joinTable, joinField)
# Add fields to ESR_States
fieldName1 = "POT_PROD"
fieldName2 = "POT_CONSU"
fieldName3 = "SELF_SUS"
fieldName4 = "FUTURE_POP"
arcpy.AddField_management(inFeatures, fieldName1, "LONG")
arcpy.AddField_management(inFeatures, fieldName2, "LONG")
arcpy.AddField_management(inFeatures, fieldName3, "LONG")
arcpy.AddField_management(inFeatures, fieldName4, "LONG")
arcpy.CalculateField_management()


texts:
In white box when i try to import or do any processes it's asking .dep extension
How can i convert .tif into .dep extension??

If try to pass LISS3 data in GRASS GIS it is taking as single bands. So i stacked the LISS3 bands as image then I passed . After that also its taking single band data as input.
When I tried with LANDSAT data it's giving dispaly map but its not performing processes on that data...
provide any recommended sample data to GRASS GIS and Whitebox soatial analysis tool...


texts:
I provide statistical support for a public health department.  As you might imagine, we put together a lot of maps on a regular basis.  For me, maps are just another kind of data visualization - useful for getting a feel for the data, for generating and checking hypotheses, etc.  But we don't often follow through on actual modeling and hypothesis testing.

How do you/your organization go about this?  What does a workflow that includes inference look like?  Who's involved?  What tools do you use?  What would it ideally look like, if you had your way?

Thanks!

EDIT

To be clear, I'm curious about different strategies for going from spatial data to formal, statistical tests of hypotheses about what's going on in the world.  For example, let's say I'm trying to target an educational campaign to increase tuberculosis testing.  I (personally) would map out the cases of TB against covariates of interest (say, median income or percent foreign-born residents) and try to see if there were any patterns.

I might or might not find any; but I would ultimately build a model to estimate the association between those covariates and the number of demographics.  This is a critical step because of how good humans are at finding patterns where none exist, or finding uninteresting ones.  I know how to do this on my own, but I'm curious about how different organizations institutionalize it (if at all).


texts: Summarizing areas of features of multiple classes

texts:
I am conducting a buffer analysis on a vector feature class of Urban-Wildland Interface zones, and am trying to calculate the total areas of each particular classification of interface area.

As I walk through this question, elements that represent column attributes will be [framed], and data will be indicated with (parentheses)

For example...
Buffer A's [municipal_name] is (Charleston), and features [Interface_Type] (HighDensity_Interface); (HighDensity_Intermix); and (MedDensity_Interface) areas.

Buffer B's [municipal_name] is (Amherst), and features Interface_Type; (HighDensity_Intermix); and (LowDensity_Interface) areas.

I have successfully isolated the two buffer areas using the
"Identify" function.  The vector data based on the original Urban-Wildland interface feature class is somewhat "checkerboarded" (metaphorically speaking)
given the diversity of interface areas within each.
I then added a new field and "calculated geometry", populating the new field with [Area] data
Now, each metaphorical "square" in the "checkerboard" has an area calculated.  For example 6 of the individual "squares" in (Amherst) have now had their (HighDensity_Interface) [Area] calculated, and so on with the other [Interface_Type].

Since (Amherst - Buffer B) and (Charleston - Buffer A) are in the same feature class, I am having a difficult time summarizing the areas of each interface type and aggregating those calculations based on [municipal_name].

Is there a way to do this in ArcMap?  Or should I begin analyzing my tables in a separate statistical tool, such as SAS?

I tried doing a basic "dissolve" function, but that unites (HighDensity_Interface) across both buffers, which is not what I want.

Is there a way to split this new "dissolved" feature class based on [municipal_name], separating results from (Amherst) and (Charleston)?

I may have just done things backwards... time for some more poking.