texts: Writing QGIS regex for rounding to two places after decimal point?

texts:
In QGIS field-calculator round() is not working in QGIS 1.8 so I try to do the following  with a regex:
I'd like to keep the first two places after the decimal point - where do I go wrong?

regexp_replace( tostring( "Shape_Area" / 10000 ), '(\d+\.\d{2})\d+', '\1')


texts: I am having trouble importing data into my GeoServer workspace, receiving "InsufficientAuthentication error, cannot access workspace as 'anonymous'"

texts:
I am having trouble importing data into my workspace in GeoSever. I am able to create various data stores, however I cannot import data into them anymore from any source including PostGIS. I keep receiving the following error(refer to image below). This error occurs with any workspace I create, I am unable to load data into any workspace; GeoServer keeps reading my role as anonymous, but I have a user role.

Can anyone offer any suggestions/help? I was able to load data before and all of sudden it has stopped working for me 3 weeks ago, and I believe it is a configuration issue, but am unsure how to fix it.


texts: Pros and Cons of using Bilinear Interpolation and Cubic Convolution when dealing with DEMs?

texts:
I am currently processing a handful of DEMs (derived from LiDAR data). I have a conceptual question, when choosing a Resampling Technique what are the pros and cons of using Bilinear Interpolation and Cubic Convolution when dealing with DEMs specifically?

EDIT:

The DEM data will be used to calculate flooding in a watershed, so keeping data values as close to the original DEM as possible seems to take precedence.

I will be Mosaicing 6 DEM rasters together, then re-projecting (datum, NAD1983, will stay the same), and then clipping/masking the mosaic.

My main question is how does Bilinear Interpolation and Cubic Convolution affect DEM data specifically. In other words, what are the pros and cons of using these to methods on continuous data that needs to maintain numerical integrity.

Here are the specs for my data:


texts:
There are 5 polygons in a shapefile. I am extracting the mean value of the NDVI pixel inside each polygon using "zonal statics as table". At this moment, I have 3 NDVI files, thus, I will get 3 sets of values. The codes are as follow

NDVI = ['1.tif', '2.tif', '3.tif']
poly_shape  = "polygon.shp"
table = r"E:\dump.gdb\NDVI_table.dbf"

for NDVI_file in NDVI:
    arcpy.gp.ZonalStatisticsAsTable_sa(poly_shape, "FID", NDVI_file, table, "DATA", "MEAN")
    single_list = [i[0] for i in arcpy.da.SearchCursor(table, "MEAN")]

As you can see, in each pass of the for loop I am getting one new list. I would like to create a CSV file to store the values. After each pass, I want to assign the values of the list in a new column.

To make it clear, after 1st pass, I will get the list below

single_list = [1,2,3,4,5]

after 2nd pass

single_list = [6,7,8,9,10]

after 3rd pass

single_list = [11,12,13,14,15]

I want the csv file to look like the following table (the first row will act as header and contain the raster file name)

1.tif   2.tif   3.tif
1       6       11
2       7       12
3       8       13
4       9       14
5       10      15

Is there any way to do that? I am using both ArcMap 10.6 and ArcGIS Pro 2.


texts: Improving buffer smoothness using PyQGIS?

texts:
I am trying to automate buffering of objects in QGIS using Python. The function below using QgsGeometryAnalyzer works but the output is blocky. I understand that the smoothness of the buffer edge can be improved by increasing the number segments per quarter but i am unsure of how to do this using Python or even if it is possible.

This note and the linked github pull request suggests not.

Is there an alternate method i am missing that would allow me to increase the number of segments and so the smoothness of the buffer object?

QgsGeometryAnalyzer().buffer(LayerToBeBuffered, "Output.shp", 2000, False, False, -1)


texts: Problem reading .qgs file relating to type="plugin"/ "raster"

texts:
I'm programming a plugin for Qgis 2.18 and everything worked fine, until we tried open the plugin from another computer.

On the second computer (same Qgis version) the plugin is unable to open the qgs-project files. After a lot of searching we determined that QGIS is able to open them, if within the xml-file of the qgs-project we change the type from type="plugin" to type="raster".
Yet, the changed projects do not work on the first computer anymore after the change.
Everything else has remained the same.

The .qgs files possess only the layer in which the map itself (generated from an osm map) is shown.

.qgs project on computer 1:

    <maplayer minimumScale="0" maximumScale="1e+08" type="plugin" hasScaleBasedVisibilityFlag="0" name="PyTiledLayer">

.qgs project on computer 2:

    <maplayer minimumScale="0" maximumScale="1e+08" type="raster" hasScaleBasedVisibilityFlag="0" name="PyTiledLayer">

Does anyone know why this happens and what exactly the type is?


texts: Calculating the area of the total buffer in QGIS

texts: I'm struggling to find out how one should calculate the total area of the buffer in QGIS. I'm doing a home range analysis by using buffer. But I need to find out the total area as well.


texts: How much memory need osm2po for loading 10Gb map?

texts:
i'm using osm2po as routing engine,and i'm trying to load whole europe map ( about 10 GB file ) - java always die on memory error.
How osm2po works, do i need to have over 10GB of physical memory to make it working or is there any trick for it ? :)

thanks

m.


texts: R: Can raster predict function pass to predict.rfsrc (a prediction function in a parallel verion of RandomForest)?

texts: It seems that raster predict function can pass to predict.randomForest by setting the "type='response'". I am using a parallel version of randomForest package called the "randomForestSRC" and I am hoping to pass the raster predict function to predict.rfsrc to take the advantage of the parallelization and low memory usage. Does anyone know if raster predict function supports this? Or if there is a way to use raster predict function to do this? Or does anyone know if there are any other packages that can predict a fitted model to raster data and have the ability to handle memory issues (since I am using huge satellite image data)? .


texts: Cache layers automatically in TileCache?

texts:
I'm using TileCache with MapServer as background application server. In GeoWebCache (GeoServer) caching can be done manually or software itself generates if any tiles are not found. In TileCache caching can be done by using tilecache_seed.py layername minzoomlevel maxzoomlevel in command prompt.

My question is how to do caching/seeding automatically in tilecache software as similar to Geowebcache?


texts:
I've just upgraded to Valmiera in QGIS, the only way to do spatial analyses appears to be with the experimental AniMove plugin (?) which is not appearing in my GUI.

Can anyone tell me where to find the plugin and how to make it work?


texts: Performance of PostgreSQL VIEW published in GeoServer?

texts:
Does anyone know what will be the performance difference between publishing a spatial table directly vs. creating a view of the same table and publishing it in GeoServer?

Does the spatial index on a table still work on a view derived from it?


texts: OpenLayers v3.4 getting layer bounding box and CRS data from GeoServer

texts:
I'm looking into OpenLayers v3.4 along with GeoServer.
I'm trying to collect the correct bounding box / extent data from a shapefile which I've already uploaded to GeoServer.

Here I am collecting the layer from the server.

var vectorLayer = new ol.layer.Tile({
    source: new ol.source.TileWMS({
        preload: Infinity,
        url: 'http://localhost:8080/geoserver/Newcastle/wms',
        serverType: 'geoserver',
        params: {
            'LAYERS': "Newcastle:Newcastle_Coverage", 'TILED': true
        }
    })
});
map.addLayer(vectorLayer);

I would have thought I could have just called the extent from the layer.

var extent = vectorLayer.extent;

But alas, the extent is alwayd 'undefined' which is totally useless to me.
I then try to collect the data from using the WMSCapabilities function directly from the XML server download.

    var featurePrefix = '***';
    var featureType = '***';
    var url = 'http://localhost:8080/geoserver/wms?request=GetCapabilities&service=WMS&version=1.1.1&';
    var parser = new ol.format.WMSCapabilities();

    $.ajax(url).then(function (response) {
        //window.alert("word");
        var result = parser.read(response);
        console.log(result);
        window.alert(result);
        var Layers = result.Capability.Layer.Layer;
        var extent;
        for (var i = 0, len = Layers.length; i < len; i++) {

            var layerobj = Layers[i];
            window.alert(layerobj.Name);

            if (layerobj.Name == "Newcastle:Newcastle_Coverage")
            {
                extent = layerobj.BoundingBox[0].extent;
            }
        }
    });

This works to some degree, it does return the bounding box of the defined CRS of the data.  In this case its EPSG:28356 (MGA56).  I know its MGA56 because I uploaded it and told it what it was.

What I need is to get the CRS details for shapefiles that I don't know.  How do I know if its MGA55 or MGA54 etc.  I cannot find a way to get this particular information out.

I did read a similar question like this they suggested to use layer.latlonBBOX which would return a geographic values. But the later version must have chanced as there is no latlongBBOX anymore.


texts: QGIS access Oracle non-spatial database tables

texts:
I stumbled accross this when I tried to connect to a "normal" Oracle 11g instance (no Oracle Spatial) in order to join Oracle tables to spatial data in other formats. Note that this is not about tables without geometry in an Oracle Spatial db (same issue with PostgreSQL db without PostGIS extension).
A related issue has already been addressed and answered in this question: Adding non-spatial Oracle table to QGIS
Unfortunately, the answer to the above question does not work for me, because the scan does not find MDSYS.SDO_GEOMETRY object.

I think that it is a common task to join non-spatial data from non-spatially enabled databases with spatial data of any source, so is there a way to access "normal" Oracle db (rsp. PostgreSQL or any other databases) without spatial extension or is this generally impossible from QGIS?


texts: Which ArcGIS 10.7 transformation to convert WGS84 data to Washington State Plane North?

texts:
A bulk of my GIS datasets reference Washington State Plane North FIPS 4601 (US Feet).  Often I get data in WGS84 that I need to transform to FIPS 4601.  Ten years or so I worked though many of the default transformations in ArcGIS to prove to myself  that the NAD_83_To_WGS84_5 (CONUS) transformation was in fact the best transformation for minimizing any shifting in the datasets. I do not remember the shift in the different transformation from back then but I have been relying on NAD_83_To_WGS84_5 since that time.

I am now running ArcGIS 10.7.2 and noticed a shift of 1.28 meters in data using the NAD_83_To_WGS84_5 transformation.

I have rerun my experiments using some newly created (AKA clean) point data in WGS84. I have experimented with the NAD_83_To_WGS84_5 (CONUS) and the default ITRF00_To_NAD83 default transformation in the reprojection tool and see that this adds about 1.28 meters of shift in my data.

I also ran a transformation using  NAD_83_To_WGS84_1 (CONUS, Canada, Alaska) and see that my data less that 0.000 meters away.

Looking at the ESRI publication ArcGIS 10.7.1 and ArcGIS Pro 2.4 Geographic and Vertical Transformation Tables I see that there is now a newer NAD_1983 to WGS84_OR_WA_41 transformation.  This transformation causes about a 0.2 meter shift in my data.

Interestingly, I duplicated this transformation experiment in QGIS 3.4 and see that QGIS returned less than a 0.000 meter shift in the data without ever being prompted for a transformation type.

My question is:   Why is the more generalized NAD_83_To_WGS84_1 returning better data than the more focused transformations and is there a better transformation that I should be using?


texts:
I am currently pan-sharpening 8-band multispectral raster satellite images with single band panochromatic images.

I use Arcmap pansharpen raster function to achieve this.

The pansharpened result has 8-bands, even though only 4-bands are used by the pan-sharpen tool. What information is retained in the other 4 bands and is it accurate?


texts: Burning shapefile geometry to raster in PNG format with gdal_rasterize?

texts:
I was trying to overlay a shapefile to some raster images from a directory using gdal_rasterize. But then encountered this error:

  ERROR 6: The PNG driver does not support update access to existing datasets.

input_path has the raster images and the shp_path has the shapefile. Any ideas?

@echo off

set "inpath=C:\path\to\input\"
set "shppath=C:\path\to\shape\file\"

cd /d "%inpath%"

for %%a in (*.png) do (
   set "fileName=%%a"
   echo Overlaying the shape file . . .
   FORFILES /m %%a /C "cmd /c gdal_rasterize -b 1 -b 2 -b 3 -burn 0 -burn 0 -burn 0 %shppath%\shpfile.shp %in_path%\@fname.png"

)


texts:
I have a hand-digitized coverage stored in postgis. There, I have a few shiver-polygons I would like to get rid of by including them into one of the neighbouring polygons.

are there any commands that can be used to do that?

Something like

update coverage set the_geom=st_union(...) ...

Of cource, I want to use the attributes from the large polygon - I must be able t decide which way the union goes.


texts: Unable to Work With Attribute Painter in QGIS

texts:
I am trying to add features to a simple point file and assign attributes based on a field using Attribute Painter. I am able to choose the source feature and the field but when I add a point the attribute dialogue appears and I have to fill it manually. Is there a way to have the features assigned the correct field attribute without manually filling out the dialogue?

I'm rather new to QGIS.


texts: Geocoding and SRID - can't get desired SRID

texts:
I want to geocode a set of addresses with GoogleMaps, store the results in a different SRID in a PostGIS table and then project it in QGIS over a layer with the identical SRID. So far, it has been a complete mess since I succeed in geocoding but can't change the SRID so I can't have overlapping layers.

I break the process in steps:

Geocode addresses
Add column mygeometry with a different SRID (2100) than the geocoder's usual (GoogleMaps' Mercator) and store it all at my PostGIS table as tableA
Open QGIS, add layers from tableA and tableB (which is a map of the country).

Here's the Python code for geocoding and storing (I note that mygeometry column has already been created as a geometry(MultiPoint,2100) column:

from geopy import geocoders
g = geocoders.GoogleV3()
for i in range (1,tableAlength):
    location, (latitude, longitude) = g.geocode(tableA.ix[i][1])
    if location:
        mygeometry ='SRID=2100;MULTIPOINT(%r %r)' % (longitude, latitude)
        mystring=("UPDATE tableA SET latitude="
                  +str(latitude) +" WHERE tableA_id='"+str(i)+"';")
        db.alters(mystring)
        mystring=("UPDATE tableA SET longitude="
                  +str(longitude) +" WHERE tableA_id='"+str(i)+"';")
        db.alters(mystring)
        mystring=("UPDATE tableA SET mygeometry='"
                  +str(mygeometry)+"' WHERE tableA_id='"+str(i)+"';")
        db.alters(mystring)
        i=i+1
    else:
        i=i+1

I have tried it also with Nominatim and no success. The question is why it does not store my points in the new SRID.


texts: I've got a batch of addresses to geocode (on the order of 10,000), I've looked at various services for doing the geocoding, and each service seems to be able to locate a portion between 50% and 90% of the addresses with address-level specificity.  Are there any advantages/disadvantages to getting the results from multiple services and trying to combine them?


texts: Making a simple grid/dotted line of specific length

texts:
My boss went out to the field and forgot her GPS unit. Using an anchor point and a compass, she paced out to different points and took soil samples. I have the basemap up with the exact location of her anchor point. I am stuck though.

What I want to do is proceed due west from the anchor point, 25m, then put a marker. Then I want to proceed another 25m, then another, etc., while putting markers. Then I want to go due south in the same pattern, back east, then south, then west... you get the idea.

I need to mark where she went on a basemap as accurately as possibly (i.e., type 25m west and then a dot appears).


texts: I cannot connect to ArcGIS for Server 10.1 from ArcMap, I can in ArcCatalog

texts:
I have a strange error, I created three connections to ArcGIS for Server 10.1 in ArcCatalog as admin, publisher & user, and they connect and opens normally in ArcCatalog.
However, when I try to open that connection in ArcMap (catalog window) it does not open and give me an error.

I want to publish a migrated service from server 10, which has cached files, when I select my connection from publish diaglog it give me the same error again.

I tried to publish the file as service definition but it does not allow me edit cache directory to old cached one.

Any ideas to get rid of this error.

(I have snapshots for succeeded connections and ones with error, but it said i need reputation to post them. if  want to see them I can but how?)


texts: Only getting service definition when uploading feature layer from ArcGIS Pro to ArcGIS Online

texts:
I have a point feature layer in ArcGIS Pro. Whenever I upload this layer to AGOL I only get to see the service definition. The feature layer itself is gone. Basically  I can't do much with only this service definition.

Though I can access this feature layer via more details, but whenever I am in a map I can't add this feature layer.

Anyone knows what this could be and how to solve it?

I tried it a few times.


texts: Openlayers - Vertex style in Control.ModifyFeature

texts:
I want a custom vertex and polygon style for the Control.ModifyFeature. I want to keep the default fillColor of the polygon while editing it, not the blue. I thought this code will work but the blue is still there.

    var shapeStyle = {
        strokeOpacity: 1,
        strokeWidth: 1,
        fillColor: colorPoly,
        fillOpacity: 0.45,
    }

    var shapeStyle2 = {
        strokeOpacity: 1,
        strokeWidth: 1,
        fillColor: colorPoly,
        fillOpacity: 0.45,
        pointRadius: 3,
    }

    var styleMap = new OpenLayers.StyleMap({
           "default": shapeStyle,
            "vertex": shapeStyle2
    }, {extendDefault: false});

    var newShape = new OpenLayers.Layer.Vector( "Editable",{
            styleMap: styleMap
    });

    var edit = new OpenLayers.Control.ModifyFeature(newShape,
         {
            title: "Modify Feature",
            displayClass: "olControlModifyFeature",
            styleMap: "default",
            vertexRenderIntent: "vertex"
    });

colorPoly is the variable containing the #color_code.


texts: Is there an easier way to capture polyline elevation data?

texts:
I am in the middle of migrating a watercourse network dataset from AutoCAD map 3D to ArcGIS 10. I have been able insert the various streams/rivers/nodes into arcgis and project the associated elevation data. I fully expect that in the future others in my department will update and add to this dataset. The problem is that, as I work in a planning department, those who will be updating my dataset do not know a great deal about GIS. Therefore I would like to keep the data capture process as simple as possible.

I have used various methods to project my 3d data including the interpolate to shape tool and ArcScene. However, I fear this process may be too involved for some and I am wondering if there is a more straightforward way to digitize, for example, a 3d polyline?


texts: ArcObjects OnChangeFeature event not firing unless you move feature

texts:
I am displaying points, lines and polygons on ArcMap as features with an addin. I want my end users to be able to change features (move geometries, add vertex, delete vertex etc) and get the updated feature's geometry.

For this purpose, I subscribe to OnChangeFeauture event with the following piece of code:

IEditEvents_Event editEvent = (IEditEvents_Event)ArcMap.Editor;
editEvent.OnChangeFeature += OnChangeFeature;

OnChangeFeauture event is fired only if a feature is moved. For points, this is fine, but for lines and polygon an edit doesn't necessarily mean the geometry needs to move (dragged somewhere else).

I subscribed to OnVertexMoved hoping to receive events if a vertex of line or polygon is moved.

((IEditEvents2_Event)Map.Editor).OnVertexMoved += OnVertexMoved;

UPDATE
OnVertexMoved event DID work. It has a reference to the vertex as an IPoint object, which is fine. But when I checked ShapeCopy property of the selected feature (when that event is fired), it was not updated at all. So when should I expect to get ShapeCopy updated in an edit session unless it is moved explicitly?

Otherwise, I had to ask users to drag geometry as a whole a little bit even if they move just a vertex (to get their updated geometry). That doesn't make sense at all.


texts: Labeling points with numbers and adding text label to legend as list in ArcMap?

texts:
I am developing a series of maps in ArcGIS 10 and don't have a lot of space to label the features on the map. This is why I thought I would number each feature in the dataframe through and then export the labels as a list and put them in the map legend.

So a list in the following way is created and added to the legend

SO
1 Label
2 Label
3 Label

My current workflow to do this is the following: I am adding an attribute 'number' manually for example for all the orange SO points, then I label them with the number. I then export it as a table into Excel and then into Illustrator to generate a nice looking table and copy it back into ArcMap as an image.

Is there an easier way to do this in ArcGIS, I have a lot of maps to do and doing this manually takes a lot of time? Can you think of a better solution to do this?


texts: ArcGIS ModelBuilder Iterate tables: Make Query/SQL expression

texts:
I'm new to ArcGIS and was wondering if someone could help me with my SQL expression.  Essentially, I'm using ModelBuilder to iterate over several tables and Make Query table for each one. I'm trying to join my tables to shapefiles.
Normally what I would do as far as the SQL expression is:
column_name_of_table = column_name_of_my_shapefile

This would work just fine if I use the Make Query table one at a time for each table.
However, I'm having an issue with the SQL expression when I try to iterate over multiple tables.

The column name that I'm using to join to the shapefile colmun name are exactly the same, however the name of the Table itself is not.
For example, I have 4 tables labeled:

Out0
Out1
Out2
Out3

They all share the same field name for the field that I want to join to the shapefile.
Each field name is named Locality.
That means that the actual field name is
Out0.Locality,
Out1.Locality,
Out2.Locality and
Out3.Locality.
The shapefile's field name always stays the same,
MSA.Locality.
So when I try to write the SQL expression and iterate it
Out0.Locality = MSA.Locality
will not work for Out1.Locality = MSA.Locality or so on.
How could I fix it so that the SQL expression is consistent regardless of the table name?


texts: When converting legacy addins to VS 2010 (ArcGIS 10.1), why are references to certain ArcObjects updated while others are not?

texts:
I am converting a number of my addins from VS 2008 Express, ArcGIS 10.0 to VS 2010, ArcGIS 10.1 and I need to update some but not all references. Why? For example, in the current addin I just converted to VS 2010, Why would references to ESRI.ArcGIS.System,ESRI.ArcGIS.Framework, ESRI.ArcGIS.Desktop.AddIns, ESRI.ArcGIS.ArcMapUI be updated automatically while references to ESRI.ArcGIS.Carto, ESRI.ArcGIS.Geodatabase, ESRI.ArcGIS.Geometry were not.

Until I remove references to ArcObjects version 10.0 and add the appropriate reference to version 10.1 I am getting errors such as: The project currently contains references to more than one version of ESRI.ArcGIS.Carto, a direct reference to version 10.0.0.0 and an indirect reference (through 'ESRI.ArcGIS.ArcMapUI.IMxDocument.SelectedLayer') to version 10.1.0.0. Change the direct reference to use version 10.1.0.0 (or higher) of ESRI.ArcGIS.Carto.

Would removing ArcObjects 10.0 (DeveloperKit10.0 directory) from the machine correct this issue?  Should these even be on the machine after using ArcGIS 10 program remover prior to ArcGIS 10.1 installation?  If I can remove these, what is the correct procedure?


texts: Add line break to ArcMap 10.2 label expression

texts:
How can I add a line break to a jscript label expression? My expression so far looks like this

function FindLabel ( [NAME] )
{
  return [NAME]+'National Forest';
}

I would like to add a break after [NAME]


texts: Read pixel values of a raster image for given coordinates stored in a CSV file

texts:
I was trying to find the pixel values of several pixels whose coordinates are known. I did that in this way:

import rasterio

lons = [66.979, 69.2979, 67.2979 ]
lats = [36.5854, 40.9854, 37.9854]
with rasterio.open('P.tif') as src:
    vals = [x for x in src.sample(zip(lons, lats))]

All the pixel values are stored in variable vals as it was intended to be. Here, I want to give lons and lats from a CSV file. However, I was not succesfull in doing that. The code I tried:

import rasterio
points = pd.read_csv('coordinates.csv')
for i in range(0,sz[0]):
    lons = points.iloc[[i],[0]]
    lats = points.iloc[[i],[1]]
    with rasterio.open('image.tif') as src:
        vals = [x for x in src.sample(zip(lons, lats))]


texts:
In ArcGIS Desktop 10.4, is it possible to edit programmatically with Python the SQL query of a Query Layer?
I'm not referring to the Definition Query of the layer, but to the window that is manually accessible with the button "Change Query".

In fact, this is the only way to change the table used in the Query Layer, since it seems that it's not possible to use the replaceDataSource method with this kind of layer.


texts:
As a relatively new user to GIS trying out 3D Analyst tools, I'm trying to run a Line of Sight which is not working the way I'd expect. Note I'm running the tool straight from the toolbox, no Python or ModelBuilder at the moment.

I have an observer point shapefile, which I want to be 2m above the terrain I've set up in the arcmap file (I have set up an attribute field called 'OFFSETA' containing '2' in this point shapefile,) and I have about 8 target points in a seperate point shapefile, which should be 130m above the terrain (I've set up an attribute field here called 'OFFSETB' containing '130'.)

I've used the 'Construct Sight Lines' tool, (specifying the OffsetA and OffsetB fields for respective heights,) and then run the 'Line of Sight' analysis on the resulting lines using the terrain in the file, and I'm getting 8 completely red polylines running from my observer point to my 8 target points, showing no visibility. However, I KNOW from a viewshed analysis from another program, and also a 3D model from another program, that at least one of the my target points is visible at these heights and with this terrain data.

I'm running this whole process in ArcMap, should I be doing it in ArcGlobe?

Do I need to specify somewhere that the OFFSETA and OFFSETB values are on top of the Z values of the terrain at those specific points? (I'd assumed, possibly wrongly, it would automatically allow for this, but maybe it's all running underground?!)

Is there a simple way to specify this or do I need to query the terrain elevation at these points and add manually to my height above ground?

I also found Using line of sight or something similar to identify where lines go through hills which seems to suggest the tool is generally quite unreliable / inconsistent.  I'm not sure if I'm missing something in the process or if it is generally just not a good tool to use.

It seems to work if I just use the shortcut button on the toolbar and point and click on the map - it looks completely different doing it like this and much more like what I'd expect, with parts of the line green and parts red. But I want to be able to use the shapefiles I have as exact inputs!


texts: leaflet icon size based on lat/lon degree?

texts:
I want to plot multi markers on Leaflet like a grid map.
We often seen icons based on pixel size, but I couldn't find case that used lat/lon-sized(e.g. 0.5 degree) icons.
What should I do?

↓In the ordinary way, icon-size base on pixel...

var myIcon = L.Icon.extend({
options: {
    iconSize:       [20, 20],
    iconAnchor:     [10, 10],
    popupAnchor:    [0, -10]
    }
});


texts: How to get text field to show > 254 characters?

texts: Is there away around the 254 character text field limit?


texts: Forcing legend entry to display markers in QGIS

texts:
Is there a way to force the patch in the legend to include a loosely spaced marker symbol in QGIS print composer?

I'm using a large, loosely spaced marker symbol to represent wetlands in a map I'm producing in QGIS.  The symbol looks good in the map, but the legend entry just shows the outline.  I would like to make the legend entry include the marker, but can't figure out how to make it happen.

How it looks on the map:

And in the legend:

I've also run into this issue with line pattern fills.
Is there a way to change either the size of the legend patch or scale the patch to be more representative?


texts: Handling multiple QGIS Plugins in one custom menu

texts:
I want to create multiple plugins (for example 'Plugin_1', 'Plugin_2', etc.) which are independent of each other, but which are organized in one custom menu. For example 'MyMenu'.
I am also aware of these posts:
Python GUI for QGIS plugin ; how to add menu in QGIS 3.0
How to create sub-menus in QGIS 3 plugin
QGIS 2.14 Python sub-menus
Adding new menu item to QGIS Desktop app?
Grouping Custom Plugins using Python QGIS
Anyway I am stuck. With the initGUI and especially with the unload method.
I want to implement the following behaviour:
If one of the plugins is intalled/activated (for example Plugin_1) the custom menu 'MyMenu' should appear in the Menu bar with Plugin_1 as submenu.
If a further plugin is intstalled/activated (for example Plugin_2) the custom menu 'MyMenu' should now contain two submenus: Plugin_1 and Plugin_2.
If one of the plugins is uninstalled/deactivated (for example Plugin_1) the menu 'MyMenu' should now consist of one submenu which is Plugin_2.
If the last plugin is uninstalled/deactivated (in this case Plugin_2) the menu 'MyMenu' should disappear from the menu.
The code i got so far:
First of all there is one line of code in the constructor method (__init__):
self.menu = self.tr(u'&PLUGINNAME')

What does this line of code do? What do I need it for?
In the initGui method:
icon_path = ':/plugins/plugin_1/icon.png'

# check if the menu already exists
self.menu = self.iface.mainWindow().findChild( QMenu, '&MyTools')
# if not create it
if not self.menu:
    self.menu = QMenu( self.iface.mainWindow())
    self.menu.setObjectName('&MyTools')
    self.menu.setTitle('&MyTools')

# create the action
self.action = QAction(QIcon(icon_path), 'Plugin_1', self.iface.mainWindow())
self.action.setObjectName('Plugin_1')
self.action.setWhatsThis('Plugin_1')
self.action.setStatusTip('Plugin_1')
self.action.triggered.connect(self.run)

self.menu.addAction(self.action)

menuBar = self.iface.mainWindow().menuBar()
menuBar.insertMenu(self.iface.firstRightStandardMenu().menuAction(), self.menu)

I would keep this code above in every plugin. Just replace Plugin_1 with the name of the plugin.
In the unload method:
for action in self.actions:
    self.iface.removePluginMenu(
        self.tr(u'&PLUGINNAME'), # here is still the name from the code in the constructor method
        action)
    self.iface.removeToolBarIcon(action)
menu_actions = []
for action in self.menu:
    menu_actions.append(action)
    if len(menu_actions <= 1:
        self.menu.deleteLater()

But I get the error that QMenu object is not iterable. So how do I check if my Plugin is the last one in the menu?


texts: Getting list of all countries using Overpass API?

texts:
I'm a developer that's trying to build a django application and trying to incorporate the Overpass API to it. I'm new to the API and OpenStreetMap (and GIS in general), so I thought I would start off by getting a list of all of the countries and build from that.

However I've searched online and nowhere does it mention how to do this with the API, can someone show what query does this?


texts: Joining my spreadsheet data to my geodatabase file is not including all matching records

texts: I have a map with roads, trails, and site gdb layers, and I have an Excel spreadsheet that I have imported with a list of the permitted companies for each of the designated roads and trails. I would like to join these so that I can click on any particular road or trail and identify which companies are permitted for the specific road or trail. Some roads and trails have multiple companies permitted, and those roads that do not have anyone permitted are not included in the spreadsheet (fine with having those be null values). When I attempt the join feature, all works except for the roads with multiple permits, the attributes table will only show the first matching record for that particular road or trail rather than all of the matching records regardless that I have selected "keep all matching records". In the join validation it states, Matching records may not appear in table due to join validation errors". I have tried the relates function, and once I click on "ok" after inputting all the related information, nothing is created, there is no output from running the relates. Attached is a screenshot of my spreadsheet layout and on the right is the validation I am getting. The next image you can see in the attributes table, that it is only populating the first entry for each road that has an entry.


texts: How to load polygon layer with single field as virtual layer?

texts:
I have a polygon layer with 3 fields (A, B and C). I want to create a copy and add as a virtual layer so I use CREATE VIRTUAL LAYER option but only want the first field.

So I use the expression Select A from "polygon layer"

But it doesnt work. What is wrong with my expression? The fields only contain string values. Do I need to specify geometry column?

This expression works Select * from "polygon layer but takes all fields.


texts: Is there a way to modify an Excel sheet which is already open in ArcMap?

texts:
I have an excel sheet that is joined to a shapefile in ArcMap. I need to modify many elements of the table, but every time I need to close ArcMap in order to be able to do it.

Is there any way to modify the Excel sheet realtime?? I mean without closing ArcMap?

thanks!


texts: Normalize geo coordinates from trips with several stops

texts:
Trips on the globe

I have a large number of trips, each containing one to five stops from origin to destination. Each stop is given with geo coordinates.

Target projection

I would like to transform all trips to a Cartesian system so that:

Origin is in 0,0
Destination is in 1,0
the relative distance of all other stops of each trip to origin and destination is kept

How can I achieve this?

Is there a standard way to do this kind of transformation?
If yes: Does it have an established name?
Is there a similar transformation with an established name (and algorithm/implementation)?
Can you recommend packages in Python or R to do this?

Background

I want to use this transformation for a plot to get insights in the general shape of the trips.


texts:
for i in range (1,7):
layer="s"+str(i)
arcpy.Near_analysis(layer,"Wall")

I have 6 layers labelled s1 to s6 representing 6 points. I'm using Near_analysis to calculate shortest distance of the points to a line. The first iteration returns a correct value for Near_dist. However, the second iteration changes the Near_dist value of previous layer to -1. Finally, only the last layer has the correct value and the others have -1


texts:
I am having a problem trying to enable (activate) the swipe tool in ERDAS imagine.

I used to use it but due to some reason the tool is deactivated.

Is there a way?


texts: Automatically creating html for QGIS atlas feature, listing all attributes?

texts:
I want to create a text box containing HTML, to list all attributes belonging to the current atlas feature.

I think I can do this by hand, writing html which references each and every field. For a simple attribute table, with 3 or 4 fields, that will be quite easy. But for a bigger attribute table, with perhaps 20 fields, that process will be laborious and prone to error.

Is there any easy way to do this - or a workaround with the same result?

Another equivalent way to describe the problem is to say that I'd like to show the current atlas feature's attribute form on the atlas layout page. I don't think this can be done automatically.

I'm aware that I can display the attribute table, filtered to show only attributes for the current atlas feature. This (as above) works fine where there are limited attribute fields - but a table with 20 fields and longer strings (or similar) as values won't fit (running off the edge of the page).


texts: Can I create a TMS layer on geoserver or geowebcache

texts:
I have GeoServer stood up and use it to server out a variety of different data sources and layers.  I would also like to be able to cache tiles (TMS).  Problem that I am running into is that I would like to cache TMS tiles in geoserver/geowebcache, however instead of a local data source I would like to use an external data source to create the cache.  It looks like you can feed a WMS Layer into geowebcache to create a new cache layer and then you can seed that layer.  Almost exactly what I want except for I want to feed in a TMS source not a WMS source.

IE docs say you can create like so:

Add Layer

Sample request:

Given a layer.xml file as the following:

<wmsLayer>
  <name>layer1</name>
  <mimeFormats>
    <string>image/png</string>
  </mimeFormats>
  <gridSubsets>
    <gridSubset>
      <gridSetName>EPSG:900913</gridSetName>
    </gridSubset>
  </gridSubsets>
  <wmsUrl>
    <string>http://localhost:8080/geoserver/wms</string>
  </wmsUrl>
  <wmsLayers>topp:states</wmsLayers>
</wmsLayer>
curl -v -u geowebcache:secured -XPUT -H "Content-type: text/xml" -d @layer.xml  "http://localhost:8080/geowebcache/rest/layers/layer1.xml"

Would it be possible to feed in  that points to a server serving out tiles?


texts: Combine fields from points and polygon datasets using ArcGIS

texts:
I've a large number of points and polygons file; one or more one points are inside a specific polygon as reported in attached images.

The point file has 3 columns whilst the polygon file has 2 columns (none of these 5 column have same value, no possibility to merge in according similar column).

I want to obtain a new point layer (with all 5 columns) deriving from spatial question; so to obtain a sum of values of single polygon with values of all point contained inside them.

How can I do this?

I am using a geodatabase, my version is 10.1.


texts: QGIS 3.12 Can you save the Guides as part of the layout template?

texts:
I have set up a print layout in QGIS 3.12 using the Guides feature to set up the placement of all the objects.  I want to save this layout as a template to be used in future, including having the guides in place so that any changes can use the same grid.

However when I load the template into a new project, the objects appear but not the guides.  Is there a way to save the guides as part of the template?


texts: What is relation- difference and/or similarities between PPP, SBAS, GNSS, RKT?

texts: Recently i came across lot of terms such as IGS, GNSS, GPS,PPP, WAAS, EGNOS, GLONASS, CORS and many more ... I know some of them I can group them such as GPS, GLONASS, GALILEO . And then there is SBAS ...but can any one explain and provide useful links ? What is hierarchy can some draw it ?


texts: How does geofencing work? I am aware that it creates a sort of polygonal bubble which can execute a certain action when you pass through it, but how does it actually do that without just constantly polling GPS? This site states that they improved battery usage using geofences instead of just polling GPS, so it must be different


texts:
Using QGIS 3.4.4, I'm trying to save a layer as shapefile with the following code:
import qgis.core
import os

working_folder = r'C:\myFolder'
fc_Prospect = os.path.join(working_folder, Equipment.gdb|layername=Prospect)
layer1 = QgsVectorLayer(fc_Prospect, 'Prospect', 'ogr')

path = r'C:\myFolder\test.shp'
_writer = QgsVectorFileWriter.writeAsVectorFormat(layer1,path,'utf-8','ESRI Shapefile')

However, I am getting this error:

TypeError: QgsVectorFileWriter.writeAsVectorFormat(): arguments did
not match any overloaded call:
overload 1: argument 4 has unexpected
type 'str'
overload 2: argument 4 has unexpected type 'str'
overload 3: argument 3 has unexpected type 'str'

I am quite new with python, so I am not sure what this error means. I've been checking documentation at https://qgis.org/pyqgis/master/core/QgsVectorFileWriter.html#qgis.core.QgsVectorFileWriter.writeAsVectorFormat, but it didn't really help.


texts: Extracting coordinates of a triangulation from DEM data

texts:
I'm working on the succinct representation of planar graphs and now I'm trying to obtain some datasets to test my results. I saw that Delaunay triangulations of elevation data can be a good source of datasets.

I downloaded DEM data from USGS elevation data, but now I don't know how to extract the Delaunay triangulation and (most important for me) its underlying planar graph. Is that even possible?


texts: Where does `##x=output number` in PyQGIS script store number?

texts:
I am writing a python script providing a number as output in QGIS toolbox. My question is where does the script put my result number if I use ##result=output number and assign a number like result=1.0?

So the complete script would be something like:

##result=output number
result=1.0


texts: Where did the edit UI tab go in QGIS 2.0?

texts:
QGIS 2 looks like a big improvement in the software, but a feature I really loved seems to have either moved or been dropped.  I have been using Qt Creator to make custom forms for attribute entry, and then just linking them in through this nice simple tab in the layer properties dialog.

Does anyone know if there is a new way to do this (python???) or am I just out of luck and did all that work making forms for nothing?


texts: L.control.layers: Uncaught TypeError: Cannot read property 'minZoom' of undefined

texts:
I am trying to add my geojson urls which I loaded from my gist as L.LayerGroup for L.control.layers but I have encountered error "Uncaught TypeError: Cannot read property 'minZoom' of undefined" on L.control.layers line. Then I try to use aeds to add into L.LayerGroup, it stated it as not a layer.

<!DOCTYPE html>

    <title></title>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css" integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==" crossorigin=""/>


texts: How can I create a WFS from netCDF file(s)?

texts:
Currently I'm working on a project that uses OpenLayers and Geoserver to view data from a postGIS server (both on a map through a WMS, and as data through a WFS).

Now, I'd like to be able to compare the output that I currently have with data from netCDF file(s).

So far I've tested ncWMS and used it as a WMS server, but as far as I know, if I want to get the raw data WMS supports getfeatureinfo, but here I can only display data from 1 pixel at a time, so to compare a lot of data would resolve in a huge amount of requests to the WMS server.

I'd like to find an alternative, where it would be easy for a user to compare his/her data from netCDF files with the data in the database. Of course users could download the raw data as is now, and then compare it somehow on their own, but that's not what we're interested in.

What Im thinking: the user gets an option to upload the file(s) to the application and then the application extracts whatever data it wants. I was perhaps thinking it would send the file to a server that would supply a WFS to the application.

I know it is possible to upload the netCDF to a postGIS database, but that seems like overkill? Or is it perhaps the most efficient way? I would also like an option that is reliable and not dependent on third-party software that might now be sufficiently tested or up to date.

I'm quite new to all of this and would really appreciate all help I could get :)

Edit:
I haven't figured this out yet. What I've moved onto now is to test the netCDF API for Java from uninet, see http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/v4.2/javadoc/ucar/nc2/package-summary.html

However, I'm having difficulties understanding how to extract point data from the arrays with raster data that I seemingly get out of it.


texts: Customizing the time slider in ArcGIS Java Script API 3.1

texts:
I want to customize the time slider. Currently I am using "esriTimeUnitsMonths" in which I am getting only months not the year (Please check the image)

I want to put month name +year ex. Jan 09 Feb 09 like that..

I researched on google but I am not able find suitable information. Some one told me that create the array but we can use array on time slider.

Any help will be great..thanks in advance : )

Software : ArcGIS Server 10.1 & ArcGIS Java Script API 3.1

Code: `

var timeExtent = new esri.TimeExtent();
        timeExtent.startTime = new Date("1/1/2009 UTC");
        timeExtent.endTime = new Date("12/31/2011 UTC");
        timeSlider.setLoop(true);
        timeSlider.setThumbCount(2);
        //timeSlider.setTickCount(dojo.date.difference(timeExtent.startTime,timeExtent.endTime,"Months"));
        // original timeSlider.createTimeStopsByTimeInterval(timeExtent,1,'esriTimeUnitsMonths');
        timeSlider.createTimeStopsByTimeInterval(timeExtent,1,'esriTimeUnitsMonths');
        //timeSlider.createTimeStopsByTimeInterval(timeExtent,1,'esriTimeUnitsYears');
        timeSlider.setThumbIndexes([0,1]);
       // timeSlider.timeStops(3);
        timeSlider.setThumbMovingRate(1000);
        timeSlider.startup();`


texts: pyqgis - Load a PostgreSQL/PostGIS layer from a SQL query

texts:
With pyqgis I can load a vector layer from a PostgreSQL/PostGIS database :

uri = QgsDataSourceUri()
uri.setConnection("localhost", "5432", "myBase", "myUser", "myPassword")
uri.setDataSource("mySchema", "myTable", "geom")
vlayer = iface.addVectorLayer(uri.uri(False), "myLayer", "postgres")

I want to apply a SQL query to load just a part of my features. With the documentation i've read i can add a simple WHERE clause :

uri = QgsDataSourceUri()
uri.setConnection("localhost", "5432", "myBase", "myUser", "myPassword")
uri.setDataSource("mySchema", "myTable", "geom", "name like 'Example'")
vlayer = iface.addVectorLayer(uri.uri(False), "myLayer", "postgres")

But I'm not able to build a more complex syntax like st_intersects. For example :

uri = QgsDataSourceUri()
uri.setConnection("localhost", "5432", "myBase", "myUser", "myPassword")
uri.setWkbType(QgsWkbTypes.MultiPolygon)
uri.setKeyColumn(u"idA")
myQuery = """SELECT a.name FROM public.tableA a INNER JOIN public.tableB b ON st_intersects(a.geom, b.geom) WHERE a.name LIKE 'Example' AND b.name LIKE 'Something';"""
uri.setDataSource("mySchema", myQuery, "geom")
vlayer = iface.addVectorLayer(uri.uri(False), "myLayer", "postgres")

How can i use a full SQL query with a QgsDataSourceUri class ? Maybe with setSql method ?


texts: How to get the change event of a layer in OL3 using ol.control.LayerSwitcher

texts:
I'm using OpenLayers 3 with the ol.control.LayerSwitcher plugin and wanted to know how I can get it when I change a layer on the switcher. I was searching a lot on the internet and I can not find a solution to this.
The idea is to change a layer using the ol.control.LayerSwitcher plugin to perform an action such as an alert.

If someone could give me a help or an alternative to this. If you know of another alternative that does not use ol.control.LayerSwitcher and determine the change event of a specific layer, I would like to know.


texts: How to perform a weighted overlay analysis with categorical classed data?

texts:
I have several land use layers (vector polygons) that all contain a field about land use in different classification systems and would like to combine them to a single classification. I would like to give weights on combining these layers in order to get one "land use" per polygon, but I cannot find out how I can possibly do it.

The weights would rank the reliability/accuracy of a particular classification layer. Let's say layer No1 weights 0.26, layer No2 weights 0.14, layer No3 weights 0.20, layer No4 weights 0.17, and layer No5 weights 0.23. If No1 and No5 class as one use and the other three class as another, the final class chosen would be the other because of the weights.

The problem is that since the classes are categorical, it would be possible via the Weighted Overlay tool to generate an illogical result. Consider the following classes: 1 - crop, 7 - park, 3 - urban. No1 says urban, No2 and No5 say crop, and No3 and No4 say park. The weighted overlay would be .24*3 + .14*1 + .23*1 + .20*7 + .17*7 = 3.68 round to 4. That would be a completely different land use from any of the original three.

I am working on ArcGIS 10.1 (Advanced / Spatial Analyst activated) but I could follow instructions on QGIS.


texts: Delete raster values and compress multiple raster files

texts:
I have hundreds of raster files. They have a "band 1" and contain values from 0 - 9000, however only values between 0 and 255 are of interest. In order to make the files smaller I'm thinking to delete all data with values >255 and then use LZW compression to make it even smaller. I'm not sure about how to do this though.
I have made a python script like this:
myDir = '/output/'
layers = QgsProject.instance().mapLayers()
pipe = QgsRasterPipe()
for layer in layers.values():
    print(layer.name())
    opts = ["COMPRESS=LZW"]
    extent = layer.extent()
    width, height = layer.width(), layer.height()
    renderer = layer.renderer()
    provider=layer.dataProvider()
    provider.setUserNoDataValue(1, [QgsRasterRange(256,999999)])
    crs = layer.crs().toWkt()
    pipe.set(provider.clone())
    pipe.set(renderer.clone())
    file_writer = QgsRasterFileWriter(myDir + layer.name() + ".tif")
    file_writer.setCreateOptions(opts)
    file_writer.writeRaster(pipe,
                            width,
                            height,
                            extent,
                            layer.crs())

The visible file in my qgis workspace gets values 0-255 and appears to be correct, but the saved file in /output/ folder has now 3 bands and not correct values. If I manually save the file in my workspace without changing anything, it turns out to be correct. But the python-saved files turns out incorrect.
What am I doing wrong?
(I use QGIS 3.4)


texts: I have a hyperspectral image that I am fusing with a multispectral image (of the same scene) on Matlab. I also have a reference image of the final result in order to be able to compare and evaluate the result of the fusion. After obtaining the fusion result, I try to open it on ENVI 5.5 (64-bit) using the .hdr file from the reference image (since they have the same samples, lines, interleave method, etc). But the image appears corrupted (as seen in the screenshot). The reference image opens just fine without any corruptions. What could the problem be?


texts: Invalid Geometry in PostGIS but Valid in FGDB

texts:
I have a data with lots of polygons which illustrated below (and it's a little tip of my study area)

When I worked with ArcGIS, I run 'repair geometry' and it fixed some of the errors. Then, I uploaded the data to PostGIS using OGR2OGR command.

occasionally it gives wrong data (what I meant by wrong data is not showing but showing another time) so I checked geometry validity in PGadmin and it gives me an error.

so basically, it is not error in ArcMap FGDB but it is error in PostGIS.
How do I solve this problem?


texts:
What is correct name of texture and/or projection, which is suitable for 3D engines?

I want to apply world map to 3D sphere, but a variety of images found by Google makes me thinks that some of them are incorrect.

I imagine an image of size proportional to 360 x 180 (number of latitude and longitude degrees on the globe). What is the name of this projection?

I don't see this projection here https://en.wikipedia.org/wiki/Map_projection because grid should be equi-quadri-lateral on it.


texts: Problems with matching vector data with raster data

texts:
I’m new in Arcgis, and I have some trouble in this task:
I downloaded from ICC (www.icc.cat) a raster data map that is a in a specific coordinate system, if I right click to view its properties, it says:

spatial reference : ETRS_1989_UTM_Zone_31N.

but it says nothing about projection reference so if I try to do a Define Projection it warns me that I have one defined and nothing happens.

On the other hand, I have a gpx file with data extracted from a GPS and I found a geoprocessing tool that converts gpx into features. Once I have it converted and situated in my data frame, I can see that the Projected Coordinate system is:

Geographic Coordinate System: GCS_WGS_1984

So, the raster data map and the vector data points does not match on the screen.

Trying to solve this problem, I used a Project tool to convert from GCS_WGS_1984 coordinate system to ETRS_1989_UTM_Zone_31N the vector data, but map and track still don’t match. If I zoom to layer the map is in one site of the screen and if I zoom to layer the track, is in the other site.

I tried different thinks but I cannot succeded on match the data on the screen. I also created another dataframe with an empy projection defined and inserted the map and the reprojected track, but I still have the same problem.

Can someone tell me what I’m doing wrong?

Raster Data

Vector Data


texts: Checking whether Spatial Reference is Projected Coordinate System using ArcPy?

texts:
I'm modifying CreateFishnet in ArcGIS 10.1 using python.. I want to ask the user to input a projected coordinate as spatial reference.

How can I check if the user didn't put geographic coordinate by mistake?

I have one idea that,i will ask the user to put WKID as reference to input coordinate. In that case I can check whether that is a projected coordinate.
But, if i make a tool with that script, i can use GetParamterAsText function and set the value as 'spatial referecne'. In this case, user will select coordinate from Geographic/Projected coordinate folder.

How can I make sure that a projected coordinate is chosen in this case?


texts:
I am looking to align a CAD file that uses a customised version of the CRS SVY21 where it is in mm instead of m.

My objective is to create/customise a new CRS from the data within SYV21 (see below):

Extent: 103.59, 1.13, 104.07, 1.47
Proj4: +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +ellps=WGS84 +units=m +no_defs

I thought it was as simple as change it to this:

Extent: 103.59, 1.13, 104.07, 1.47
Proj4: +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=*28001642* +y_0=*38744572* +ellps=WGS84 +units=*mm* +no_defs

However this only shows errors. Can someone see where I am going wrong and direct me to the right path?


texts: Whole schema migration from Oracle Spatial to PostGIS import using ogr2ogr

texts:
I can migrate Oracle SQL table to PostgreSQL using ogr2ogr using:

ogr2ogr -progress -f "PostgreSQL" -nln schema.table -skipfailures -overwrite -lco FID=ID_COLUMN -lco GEOMETRY_NAME=geom PG:"host=localhost user=postgres password=yadayada dbname=database" OCI:username/password@server:port/database:schema.table

Is there a way to copy the whole schema?


texts: Drawing map from XY coordinates in CSV and exporting it to JPEG using ArcPy?

texts:
I have a csv file containing about 40,000 rows of data with X, Y (longitude and latitude) data. It is US data, and I have downloaded a state.shp file on which the X, Y points can overlay.

I am able to do it by hand on ArcGIS, but referencing two books on ArcPy ('ArcPy and ArcGIS - geospatial analysis with python' and 'Programming ArcGIS with python cookbook') still doesn't give me a good idea of how to do it using python script with Arcpy, because almost all data used in their examples are not .csv.

Note: I would like to not open ArcGIS at all, but save the map as a jpeg file directly in the python script. Any hints will help.


texts: Setting path to Variable to be able to open new mxd?

texts:
Possible Duplicate:
  How to define Subroutines and functions?

I know its strange but I need to be able to open a new mxd into an existing one. Yes, it can be done. All I need to do is set a path to a variable(most likely iApplication). From dialog box, user selects a district name to open that districts mxd. I believe the code would be Application.iApplication.OPenDocument(Path to folder). But I am having trouble with the sub and function declaration. It keeps giving me an error of sub and function not declared. Sample is below :
Private Sub cmdMap_Click()

Dim District As String
Dim map As mapDocument
Set map = New mapDocument

map.District = ComboBox("Abilene")

Call DrawTasks.RenderMap("Abilene")

Application.IApplication.OpenDocument ("K:TASS......")

End Sub


texts: azimuth and distance from various functions in qgis

texts:
I am comparing the various ways of calculating distance and azimuth between two points with Qgis. I am struggling with the various results and their interpretation.

I need to calculate a loxodromic bearing (rhumb line, i.e. a path beetween two points with constant bearing) : which function should I use ? According to my partial conclusions from the data below, none of them returns loxodromic bearing !

the bearing and measureLine functions compute orthodromic route and distance (both from the function computeDistanceBearing that uses a Vincenty algorithm which indeed aims to calculate a great circle distance and bearing, according to Wikipedia page)
the azimuth function computes a calculation with a "flat" formula according to api documentation (note that the computeDistanceFlat function returns the square root of the distance when the coordinates are in degrees and the distance when the coordinates are in meters and Mercator system, cf. numeric example below)
since my loxodromic calculation seems to be wrong, I don't know if one is close to loxodromic figures

Below are some results of functions and my partial conclusions with the example of New-York (-74,40.73) and Paris (2.34,48.86) - coordinates in long/lat or EPSG 4326.

The results of the various functions are :

tool                                  distance ParistoNY   NYtoParis
tool.bearing(p1,p2)                       -       292        54
tool.measureLine(p1,p2)                 5850       -         -
tool.computeDistanceFlat(p1,p2)           76       -         -
pow(tool.computeDistanceFlat(p1,p2),2)  5893       -         -
p1.azimuth(p2), p2.azimuth(p1)            -       264        84

after conversion of coordinates into Mercator system:

tool                          distance   ParistoNY   NYtoParis
p1.azimuth(p2), p2.azimuth(p1)    -         261          81
tool.computeDistanceFlat(p1,p2)  8593130

Manual calculation from wikipedia formulas for a sphere :

tool                                    distance   ParistoNY   NYtoParis
orthodromic distance and initial route    5830         54          292
loxodromic distance and route          344017235       89           89
manual flat azimuth on epsg4326             -         264           84


texts: Calculating area of voronoi polygon in qgis?

texts:
I have a a layer of Voronoi areas. I would like to know the area for every polygon. What I have done is the following, but the numbers seem strange (negative numbers are there).

So, I do the following:

Right click on Voronoi layer
Click "open attribute table"
Click on "edit mode"
Click on "open field calculator"
Choose "decimal number"
Choose "create new field", give name "surface"
in the expression box type "$area"

But I'm not sure the process is right. Where does it get the polygons from? I don't see any geometry in that... which leads me to believe it's calculating something weird.

The attribute table only has the lat/long of the point that the Voronoi algo uses to calculate the polygon. But I don't know where the polygon itself is.

Is that what I'm getting wrong?


texts: How can I create an aggregate GDAL dataset with a specific ordering for overlapping regions?

texts:
I have a number of raster datasets (with common projections, pixel sizes, and pixel alignments) that I want to mosaic into a single dataset.  The source datasets overlap in a number of areas; in those areas, I want to use the newest data (which I can already determine easily on my own).  What's the easiest way to do this with GDAL?

GDAL's virtual format seems ideal here; I can just throw all of the source datasets into a single .vrt file and then use that .vrt file in subsequent processing.  I can't tell, though, how (or even whether) I can make sure that, say, source dataset "A" takes precedence over source dataset "B" in places where "A" and "B" overlap.  I could also use gdal_merge.py (or gdalwarp) to create a new dataset, but I don't want to do that if it's not necessary, because a) it'll take a while to copy all of the data from the source datasets to the destination; and b) I'll waste a fair bit of time copying data that'll just be overwritten by later files, in the case of spatial overlaps.

What's my best path forward?


texts: Why is result of ST_Area or ST_Distance in SRID 4326 so small

texts:
there is one thing I do not understand when using the following Query in geometries which are all SRID 4326.

WITH s AS (SELECT * FROM de_sim_points_start WHERE id = 6545)
SELECT e.*, ST_Distance(e.geom, s.geom, true) as distance FROM de_sim_points_end AS e, s
WHERE ST_DWithin(e.geom, s.geom, 10000)
AND e.parent_geometry = s.parent_geometry
ORDER BY distance

Result looks like

ID;parent_geometry;geom;distance
14033;"092730137137";"0101000020E6100000FE6FACF6AA8027409C2C8D9A0C744840";0.245261803286329
14031;"092730137137";"0101000020E6100000CCDBF35375812740825574F5F8734840";0.243900901309088
14029;"092730137137";"0101000020E6100000DCEE415F6A812740F7F2A95305744840";0.243893460499341
14026;"092730137137";"0101000020E61000003510CD8FB781274033F5CA0231744840";0.243011470475221
13535;"092730137137";"0101000020E610000039E0FBE271802740C6906BE8D6754840";0.242827846195593
14008;"092730137137";"0101000020E610000020C337BB18822740C5250EA2F3734840";0.242728103270343
13999;"092730137137";"0101000020E61000002A9807A3668227409825450CE4734840";0.242264477969627
13533;"092730137137";"0101000020E6100000C8AB5D1715812740968D666FCD754840";0.241653901891845

As far as I understand, distance results in SRID 4326 are in meters (I'm totally fine with that). So how can a point be just centimetres away from each other, when in reality they are serval meters away from each other? Image below uses point with id 14033 (orange)

EDIT: New Query with accepted answer looks like this and performs as expected

WITH s AS (SELECT * FROM de_sim_points_start WHERE id = 6545)
SELECT e.*, ST_Distance(e.geom::geography, s.geom::geography) as distance FROM de_sim_points_end AS e, s
WHERE ST_DWithin(e.geom::geography, s.geom::geography, 10000)
  AND e.parent_geometry = s.parent_geometry
  AND ST_Distance(e.geom::geography, s.geom::geography) > 2000
ORDER BY RANDOM()
LIMIT 1


texts: Failed once again to import shapefile to PostGIS DB using ogr2ogr

texts:
Once again I try to import a shapefile to my remote PostGIS database using og2ogr. Last time it was an Odyssey but I have managed to solve all the issues and report them one by one here.

I have checked everything:

Permissions of files,
Path of shapefiles,
Validity of shapefile,
triple checked my ogr2ogr command,
used ogrinfo to validate my connection to the DB and check the shapefile,
granted roles on my user and on the required tables (e.g. spatial_ref_sys)
if the table already exists
etc.

This is my ogr2ogr command:

ogr2ogr -f "PostgreSQL" PG:"host=localhost user=my_user password=my_pass dbname=my_db_name" -nlt GEOMETRY my_shape_file.shp

And the error I get (also checked the PostgreSQL log files) is:

ERROR 1: AddGeometryColumn failed for layer wld_bnd_adm2_gaul_2015, layer creation has failed.
ERROR 1: Terminating translation prematurely after failed
translation of layer wld_bnd_adm2_gaul_2015 (use -skipfailures to skip errors)

Last time I got this error cause I haven't GRANTED permissions to my user. That have solved the problem:

GRANT ALL ON TABLE spatial_ref_sys TO my_user_name;

But not this time.

And that's what I see on my log file:

ERROR:  function addgeometrycolumn(unknown, unknown, unknown, integer, unknown, integer) is not unique at character 8
HINT:  Could not choose a best candidate function. You might need to add explicit type casts.
STATEMENT:  SELECT AddGeometryColumn('public','wld_bnd_adm2_gaul_2015','wkb_geometry',4326,'GEOMETRY',2)


texts: QGIS Field calculator Problem: Display percentage

texts:
So basically  I have this formula which puts out decimal numbers, but I want it to output percentages.
How can I achieve this?
This is my formula:
(("crimes_2020" - ("crimes_2017_2019" / 3)) / ("crimes_2017_2019" / 3)) * 100


texts:
I am new to ArcGIS javascript api and I have created a map which allows users to draw circle geometries. I just want to limit the functionality so that the radius is specified at 10000km.

This is the code at the moment:

$('#circle').click(function () {
        clearPreviousSearch();
        map.disableMapNavigation();
        $('#run').fadeOut();
        buttonclickvalue = 'circle';
        drawToolbar.activate(esri.toolbars.Draw.CIRCLE);

    });

And I've amended it to this:

$('#circle').click(function (e) {
        var radius = map.extent.getWidth() / 10;
        radius : radius
        clearPreviousSearch();
        map.disableMapNavigation();
        $('#run').fadeOut();
        buttonclickvalue = 'circle';
        drawToolbar.activate(esri.toolbars.Draw.CIRCLE);

    });

Can anyone possibly help/give me some pointers to try and remedy?


texts:
I have a shapefile with some polygons and I'd like to create a graph that assigns vertices to polygons and creates edges between vertices if the corresponding polygons share a border. Since I'm using networkx, a Python graph library, I was thinking of using GeoPandas to convert from the shapefile to a nx graph. Does anyone have any idea how to do this?

(networkx has a built-in read_shp method, but I don't think that's what I want; I'm pretty sure (but not confident) that that translates points to vertices and lines to edges, not polygons and borders.)


texts: How to calculate average value of points located in each pixels in R?

texts:
I have a raster(.tif) and point(.shp) layer. To calculate the average value of points located in each pixels:
(1) For each image pixel that include multiple points, the average value of all points located in the pixel were calculated.
(2) For each image pixel that include single point, the point value was chose directly.
How can I calculate it in R ?


texts: R doesn't find SpatialPoints or SpatialPointsDataFrame

texts:
I'm trying to create SpatialPoints objetcs from data frame on R

natFPV <- SpatialPointsDataFrame(coords = coordinates(natFPv.per_data[,c(27,28)]),data = natFPv.per_data[,-c(27,28)])
natFPV <- SpatialPoints(coords = coordinates(natFPv.per_data[,c(27,28)]))

But getting the error for both:

  Warning: Error in SpatialPoints: could not find function "SpatialPoints"

I'm really don't konw how to deal it.


texts: Converting NoData to 0 values in ArcGIS Desktop?

texts:
I have a raster of landcover that I have reclassed and the different land cover classifications are now represented by numbers which correspond to fertilizer inputs.

Using ArcGis 10.3, I am trying to extract a certain set of those values while converting the rest to zeros.

Is this possible using the extract by attributes tool?

When I have tried previously, the values other than the ones i selected for all are converted to NoData which is causing me issues later when I try to add rasters.


texts: Script to sort attribute table (create new columns and fill them)

texts:
Starting situation:
I have the following element/file:

A shapefile that contains polygons that are parcels and their boundaries:

The parcels are inside a big polygon ()
Each parcel has a unique id, the official registration id; let’s call it REGID
Some parcels consist of several polygons/parts (all under the same REGID; in the attribute table they are in one row)
The attribute table includes following information:

Name, street address, ZIP code and town of the parcel’s owner (Some persons can own several parcels and some parcels have many owners)
If a parcel has several owners, every owner is in an own row with the REGID (One and the same REGID might be listed several times, because there are several owners assigned to the REGID)

Example of the initial attribute table ( | separates columns):
REGID | Owner | Address

Id1 | Owner A | Address A

Id2 | Owner B | Address B

Id2 | Owner C | Address C

Id3 | Owner D | Address D

Id4 |Owner B | Address B

Id4 | Owner C | Address C

My goal:
I want to create a shapefile that contains the following data:

Naturally the geographic information (parcel polygons)
The attribute table should be brought into a specific order:

I want to assign a MasterID to every landowner / parcel group and sort the parcels and the landowners according to a specific pattern
Basically, each individual REGID gets an own row and if they belong to the same owners, they’ll get the same MasterID and the information of all owners is in every row of the same MasterID

Example of the desired attribute table (using the table above):
MasterID | REGID | REGID2 | Owner 1 | Address 1 | Owner 2 | Address 2

MasterID1 | Id 1 | Null | Owner A | Address A | Null | Null

MasterID2 | Id 2 | Id4 | Owner B | Address B | Owner C | Address 2

MasterID2 | Id4 | Id2 | Owner B | Address B | Owner C | Address 2

MasterID3 | Id3 | Null | Owner D | Address D | Null | Null

I can do this manually, but I’d like to write a script that does this for me. Is this possible in QGIS? Or is this rather something for Excel?
I would prefer to use Python (I’m a real beginner though, but even more with Excel Macros).
Of course, I need to consider here that there can be more than two parcels or more than two owners as in the example above.
The script should basically do the following:

Sort the information provided in the attribute table, by creating rows and columns automatically for each REGID (parcel id) and their landowners

I guess it should be according to the principle n+1 (?):

Automatically create new columns as many as required: Owner 1 | Address 1 | Owner2 |Address 2 | … etc

To my understanding it would be best to create a new attribute table as some columns/rows are not needed anymore after the data has been put together

Any hint here? Also, where should I start looking?


texts:
I am looking automate the creation of a polar grid shapefile (polygon). I am currently creating this in a many-step editing process, starting from a concentric buffer.

Here is how I think I should be approaching the issue. Given a polar grid of this shape:

Where V1 represents the origin, and the length of the line segment (v1,v4) represents the buffer distance. V2 and V3 represent points along the concentric ring that intersects the polar lines. The amount of polar lines can be changed.

Any thoughts on how to do this?


texts: What happened to the GRASS Browser in QGIS?

texts:
In the past I could display the imported layers in the GRASS toolbox within QGIS. This was possible under the tab "Browser" as you see in the image.

Lately I'm missing this tab. The QGIS version is 2.12.1 and the GRASS version 6. But I had the same issue with older QGIS versions.

How can I bring back the browser tab or what alternative option do I have to display the available layers of the mapset?


texts: Why do the SHP lines in QGIS Android look jagged (very simplified)?

texts: I use QGIS for more than five years. I'm trying to make my way with QGIS Android for a while now. For some time I experience the following problem with the "nightly build" 2.0.1-Dufour: the SHP lines exported from DXF designing map are very "simplified" in Android QGIS: The same SHP on "desktop" QGIS: . Anybody has the solution for this?


texts: Extract part of multipolygon that does not intersect with another geometry in Spatialite / QGIS DB manager

texts:
I have a point layer (with a buffer value), and a polygon layer (footprint) that intersects the point buffer.

Using only SQL in QGIS Virtual Layers (i.e. based on Spatialite), how can I get the difference between the point buffer (buffer(pt.geometry,bufvalue)) and footprint, where the difference does not intersect with the point geometry?

See the following image for an illustration - green is the footprint, orange pentagon is the point, orange polygon is the difference. I just want the ticked geometry.

The difference returns a multipolygon, and I only need one part. However, I can't split multipolygons into single polygons (there is no ST_Dump() equivalent in Spatialite due to SQLite not handling array values, apparently)

And I can't use the CLI/GUI commands (which separate multigeometries into 'elementary geometries') as I want to create a virtual layer in QGIS, so it has to be 100% in SQL.

How can I approach this problem using SQL in Virtual Layers only? (i.e. not using any other processing tools)

I am thinking I may have to loop over the number of geometries for multipolygons using recursive functions in place of generate_series(), and test if each one intersects with the point geometry...


texts: SLD- double line (offset) shows only one of two lines in legend

texts:
I've made a double line from a single line feature using the following code:

  <NamedLayer>
<Name>Name1</Name>
<UserStyle>
  <Title>Title1</Title>
  <FeatureTypeStyle>
    <Rule>
      <Title>Title2</Title>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#ffff00</CssParameter>
          <CssParameter name="stroke-dasharray">5 2</CssParameter>
        </Stroke>
      </LineSymbolizer>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#ff6600</CssParameter>
          <CssParameter name="stroke-dasharray">5 2</CssParameter>
        </Stroke>
        <PerpendicularOffset>4</PerpendicularOffset>
      </LineSymbolizer>
    </Rule>

This shows up fine in my mapviewer, however in the legend I can only see the first line along with the "Title1".

Is there a way to make the legend show both the first line and the offset-line along with "title1" by editing the sld code?

I cant see why this wouldn't work as it is. Thankful for any help.


texts:
I have 5 different .tif files and all of them have the same bounding box(same starting and ending coordinates), but the number of rows/columns are different in each one of them. I want to make the number of rows and columns the same for each of the tif file so that they could be used for my simulation.
I am working with POSTGIS database .
Note - There are no holes in the tif file.


texts: Merging multiple vector layers to one layer using QGIS

texts:
I've imported several shapefiles which where exported from a Mapinfo .tab. Several  .tab-files are imported resulting in 20+ layers.
Afterwards I want to export it to GeoJSON; but I'm reluctant to select each layer and export it manually.
Is there a way to merge all the layers into one using QGIS?


texts: SQL Error while using v.distance through simple python editor in grass

texts:
I try to execute the following code:

grass.run_command('v.distance', from='tramstop', to='iso_tram', upload='cat',column='first_tram_distance', overwrite=True)

but i get the "SyntaxError: invalid syntax" Error.
I guess using 'from' is colliding with SQL, yet since it is required as an input parameter I have no idea how to work around the issue. Using "from" with quotation marks doesnt work, since "keyword can't be an expression".

I would be very happy if anyone knows how to fix this problem.


texts: QGIS 3.0.2 Check if a field exists in a layer in Python

texts:
There are a few posts similar to this one, but none that I have found that hit it right on the head. My question is simply, how can you find if a field exists in a layer in QGIS 3.0.2 using Python?

From my understanding, layers have features. Each feature has fields. If you add a SHP file to your Layers window, then right click and select Open Attribute Table, you can view these features and their fields for the given layer.

When looking at the Attribute Table, you can see that it is just that, a table of rows and columns. From everything I can see, each row is a feature and each column is a field. Furthermore, all features share the same fields.

With that said, it is also true that fields can be dynamic for each layer. Meaning all layers do not need to share the same fields. However, in a given layer, all features do share all fields.

So, here inlays my question. The QGIS 3.0.2 API allows you to do the following to get the layers

layers = self.iface.mapCanvas().layers()

This is all well. It would seem, given the rules I described above, that you would now have a table of features and their fields. This table has many different features, but all of these features share the same fields. So you would think there would be a way to get the table meta data, which would contain the field names. Instead, the only thing I have found is to get a list of features and then get a list of one of the feature's fields, as follows.

found = false
for feature in layer.getFeatures():
    try:
        feature.attribute("fieldName") # Throws exception if it does not exist
        found = true
    except KeyError as e:
        # all features have hte same fields, so if it doesn't exists in the first feature, it won't exist in the others
        break
    finally:
        # all features have the same fields, so only need to check the first
        break

Is there no way to just check the field names of a layer's attribute table?


texts:
I'm trying to find the bounding box of US cities but I just can't seem to figure out what to do with the TIGER data I download (not to mention, which data to download!). Could someone experienced with TIGER data (or shapefile) help me with this?

How do I read/extract TIGER data to grab bounding box of cities? Trying to find lat/lon points that bound the city. Thanks in advance!

EDIT:
Sorry for the ambiguous question. Basically, what I want to extract are coordinates of each bounding box for ALL US cities. For example:
New York (12.123,34.345),(12.456,34.678),..etc
Boston (11.111,22.222),(11.123,22.234),..etc
...etc (for all cities in the US)

I'm asking for this because I have a lot of coordinates that needs to be categorized (or reverse-geocoded) into cities, like (A,B) -> City A; (C,D) -> City B; etc. I can't use Google's geocoding feature because they only allow up to 5000ish requests per day per IP address, and I have millions of coordinates. I've tried installing OpenStreetMap data and running reverse-geocoding on my machine, but was turned off by the inaccuracy of results. Hopefully this made sense!


texts: QGIS 2.18 on OS X fewer functionality than Windows version

texts:
Is there a reason why the OS X version of QGIS 2.18 has way less functionality than the QGIS 2.18 Windows version?
Looking at the dissolve for example. On Windows I can dissolve on more than one field. That option does not even show up on OS X. Same for Join Attributes by location. On a windows machine I can specify parameters such as "Intersect", "Overlap", etc. On OS X there are no such parameters.


texts: Polygon with the same points over and over

texts:
I am in the process of reading shapefiles (provided to us by the vendor dealing with GIS products) using a C# program and loading them into a SQL database. I first read the text for the shape and then use that text to update my geometry and geography types. And I am doing this as part of a SSIS package.

My SSIS package failed on one shapefile and threw me an exception:

  A .NET Framework error occurred during execution of user-defined
  routine or aggregate "geometry":  System.FormatException: 24305: The
  Polygon input is not valid because the ring does not have enough
  distinct points. Each ring of a polygon must contain at least three
  distinct points.

After running some manual updates, I found the record that was giving me grief. Then I took out parts of the multi-polygon and ran individual selects on them, creating individual polygons, e.g.

SELECT geometry::STGeomFromText('POLYGON(( 118.501323586697 -20.3203577291617, 118.504216161911 -20.3220101539757, 118.502671059623 -20.3212136027048, 118.501323586697 -20.3203577291617 ))', 4326).MakeValid()

Finally, I found the polygon that was the problem shape: 'POLYGON(( 118.860739531873 -20.2274797478397, 118.860739531873 -20.2274797478397, 118.860739531873 -20.2274797478397, 118.860739531873 -20.2274797478397 ))'

I am trying to understand how to fix this so my SSIS package runs and translates and loads my SQL tables without me having to fix up anything manually. Any help will be greatly appreciated.


texts: pgsql2shp: create shapefile from empty table, but with known attributes (dbf)

texts:
I was trying to generate shapefile from postgis tables using pgsql2shp. Everything is fine except for table with no rows.

When trying to create shapefile from an empty table, an error occurs:

Could not determine table metadata (empty table)

I checked the source code of pgsql2shp in git and it appears that the error is explicitly thrown without checking any of the options provided.

I was expecting that an empty shapefile with a DBF schema the same as the table schema would be generated. Is there a way to get this behavior?


texts: How to create one attribute containing multiple adjacent parcels?

texts:
I'm trying to upload town parcel data to my Garmin GPS from Esri. Garmin registers each attribute as an entirely different file, and requires you to 'turn on' each file to display it on the GPS. This means I would have to click through thousands of parcels to display an entire town's data on my GPS.

I would like to create one attribute with multiple (1000+) adjacent parcels in order to successfully upload parcel data onto a GPS. Is this possible?

From what I understand, you can't create a multipart feature with shared boundaries.


texts: selecting by attribute and specific value replace

texts:
I want to select all of the features by attribute where the attribue in myattrib is like...

Selection "criteria H". That is not a problem.

However then I need to replace (myattrib," H", "") except I only want to replace the H at the end of the attribute, not within, like "toast is Hot H".

In this record I want the value to end up as "toast is HotH"

There are 15k records but only 4800 have the value I am replacing. And it is always the same value.

edit response:

No. All values I want to fix end in H with a space in front of it. I am depending on search replace but not sure how to leave the space in front of Hot.

In my example I am able to select with the "% H" which specifies there is nothing after the H so the select won't get Hot even though there is a space before it. However when it comes to replace it does a literal replace on " H" and doesn't care about the ot.

I think if I knew some regex and "IF" arcmap supports that, It might do the trick (from what I have seen on the FMEtalk forum). I'm sure someone can talk me through this.


texts: How can I optimize a Point in Polygon query for millions of points when most of the points lie within the polygon?

texts:
I have 150 million points in a point table and would like to find the few points lying outside a given polygon geometry. I know that 99.9% of the points are within the polygon geometry. I am interested in finding the few points which lie outside the polygon.

My present best query using indexed PostGIS tables takes about 30 minutes to complete. Is there a way to optimize the following query knowing that most of the points are within the polygon (border)?

SELECT COUNT(*)
FROM italy_points pt
JOIN borders poly
ON ST_WITHIN (pt.the_geom, poly.geom)
WHERE poly.iso3 = 'ITA';

The polygon is basically the admin 0 border of Italy.
Vertices - 405,000. Parts - 510. The envelope is much larger than the polygon (The polygon covers 24% of the envelope)


texts: How do you determine which dbclient connection property to use for an Oracle SQLWorkspace connection?

texts:
I have an Oracle11g database that I connect to via a SQL Workspace; however the actual dbclient string value that works differs depending on machine (and I'm guessing oracle client configuration).  On some machines, its Oracle11g(like the example on resources.arcgis.com):

// Create the connection properties.
IPropertySet connectionProps = new PropertySetClass();
connectionProps.SetProperty("dbclient", "Oracle11g");
connectionProps.SetProperty("serverinstance", "Riverside");
connectionProps.SetProperty("authentication_mode", "DBMS");
connectionProps.SetProperty("user", "BlackDog");
connectionProps.SetProperty("password", "123456");

Sometimes it's Oracle.

// Create the connection properties.
IPropertySet connectionProps = new PropertySetClass();
connectionProps.SetProperty("dbclient", "Oracle");
connectionProps.SetProperty("serverinstance", "Riverside");
connectionProps.SetProperty("authentication_mode", "DBMS");
connectionProps.SetProperty("user", "BlackDog");
connectionProps.SetProperty("password", "123456");

How is that dbclient value used by ArcGIS? Is there a way to detect which is needed at runtime?


texts: Convert labels to Annotation addin crashes ArcMap

texts:
I am trying to write an ArcMap (10.3) Add-In in C# .NET that will convert labels to annotation. I have used a majority of the code from the relevant snippet on the ESRI resources website. When I run the code ArcMap just crashes.

I am running:

Visual Studio 2012
Developer Kit 10.3
ArcMap 10.3 (Advanced license level)

Also, I have intermediate experience with Python and ArcPy, but this is my first attempt at using my novice C# skills with ArcMap, so beware of my code.

Here is my code:

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ESRI.ArcGIS.ArcMapUI;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;

namespace ConvertLabelsToAnnotation
{
    public class labelToAnno : ESRI.ArcGIS.Desktop.AddIns.Button
    {
        public labelToAnno()
        {
        }

        protected override void OnClick()
        {
            IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument;
            IMap pMap = mxdoc.FocusMap as IMap;
            bool featureLinked = true;
            IConvertLabelsToAnnotation pConvertLabelsToAnnotation = new
                ConvertLabelsToAnnotationClass();
            ITrackCancel pTrackCancel = new TrackCancel();

            pConvertLabelsToAnnotation.Initialize(pMap,
                esriAnnotationStorageType.esriDatabaseAnnotation,
                esriLabelWhichFeatures.esriAllFeatures, true, pTrackCancel);

            IEnumLayer pEnumLayer1 = pMap.Layers;
            ILayer pLayer;
            pLayer = pEnumLayer1.Next();

            IAnnotateLayerProperties pAnnotateLayerProperties = new LabelEngineLayerPropertiesClass();
            IFeatureLayer pFeatLayer = pLayer as IFeatureLayer;
            pAnnotateLayerProperties.FeatureLayer = pFeatLayer;
            pAnnotateLayerProperties.DisplayAnnotation = false;

            IGeoFeatureLayer pGeoFeatureLayer = pLayer as IGeoFeatureLayer;
            if (pGeoFeatureLayer != null)
            {
                IFeatureClass pFeatureClass = pGeoFeatureLayer.FeatureClass;

                IDataset pDataset = pFeatureClass as IDataset;

                IFeatureWorkspace pFeatureWorkspace = pDataset.Workspace as
                    IFeatureWorkspace;

                pConvertLabelsToAnnotation.AddFeatureLayer(pGeoFeatureLayer,
                    pGeoFeatureLayer.Name + "_Anno", pFeatureWorkspace,
                    pFeatureClass.FeatureDataset, featureLinked, false, false, true, true,
                    "");

                //Do the conversion.
                pConvertLabelsToAnnotation.ConvertLabels();
                IEnumLayer pEnumLayer = pConvertLabelsToAnnotation.AnnoLayers;
                //Turn off labeling for the layer converted.
                pGeoFeatureLayer.DisplayAnnotation = false;

                //Add the result annotation layer to the map.
                pMap.AddLayers(pEnumLayer, true);

                //Refresh the map to update the display.
                IActiveView pActiveView = pMap as IActiveView;
                pActiveView.Refresh();
            }
        }
        protected override void OnUpdate()
        {
            Enabled = ArcMap.Application != null;
        }
    }

}

I am struggling to see where I have gone wrong. Perhaps some more experienced eyes can suggest something. One thing that did come to mind is that the anno feature classes aren't being put into a gdb, at least as far as I can tell.


texts: Feature Compare Tool giving ArcGIS Error 999999?

texts:
I'm running the ArcGIS feature compare tool against 2 point feature class layers. I'm comparing 9.1 SDE layer against a 10.1 SDE layer.

In the feature compare tool one of the input options is 'continue comparison': I checked off the Continue_Compare option to run in order to check other properties after encountering the first mismatch. However, every time I check off this option, and run the tool is runs for >30 mins and I get Error 999999.

When I uncheck this option the tool runs smoothly and only takes <2 mins, without error.

Just wondering why there is a difference and an error occurs.


texts: Creating a table and inserting selected streets using plpgsql functions

texts:
I am trying to select all streets within 50 meters distance from each address location and store them in a separate table using Postgresql (plpgsql) functions. So far, I have written the following two functions:

The first function which creates a table sel_streets in database:

Create or Replace Function mk_tbl()
Returns Integer As $$
Declare
Begin
Drop Table if exists sel_streets;
Create Table sel_street
(
id Integer,
Geom geometry
);
Create Index sel_streets_indx
ON sel_streets Using
gist (geom);
Return (1);
End $$ Language 'plpgsql' volatile;

The second fucntion which selects streets within 50 meters and inserts into the table sel_streets

Create or Replace Function get_str(ad geometry, st geometry)
Returns geometry AS $$
Declare
Begin
Insert into sel_streets(geom)
Select st.geom From ad
Left Join st On ST_DWithin(ad.geom, st.geom, 50.0);
Return st;
End $$
Language 'plpgsql' volatile;

I am calling the function by this command:

Select mk_tbl(), get_str(ad.geom, st.geom) from ad
Left Join st on st.gid = ad.gid;

Here is the screen shot of the output:

I am storing the results into a table because this table will be used in further steps such as use of  ST_Distance and ST_DWithin etc. (which are not shown here). Is there a better way to perform this operation? What I want to do is to create a table in database and then insert the selected streets into this table.  I am looking for some advice (for both functions) to improve this operation (method specifically).


texts: Good GPS navigation app for iPhone with downloadable OFFLINE maps?

texts:
I am looking for a good GPS navigation app for my iPhone that will work away from wifi and cell coverage (GPS only) and thus allow me to download offline maps.

Paid app is OK.

Must Have features:

Best possibly quality vector and imagery maps for (Non-urban, rural Canada, NW Ontario, filesize does not matter).

Ability to save/organize waypoints, tracks, areas (enter/edit names).

Ability to import KML/KMZ, Shapefile, GPX via email, Google Drive or Dropbox

Ability to export KML/KMZ, Shapefile, GPX to file, email, Google Drive or Dropbox

Track statistics; profile, average elevation, pace, speed, etc.

Nice to have features:

UPLOAD MY OWN IMAGERY and custom maps!

Synchronize with Google Drive / Dropbox

Auto export location on interval to Google Drive / Dropbox

I am currently using a free version of GPS Tracks which is not bad but I don't know what is the quality/coverage of the available "paid" offline maps:

GPS Tracks offers these services for offline download:

Mapbox Street Maps (?)
Mapbox Satellite Maps (?)
Mapbox Terrain Maps (?)
Mapquest Street Maps (mediocre in my area)
MapQuest Satellite Maps (high res only in urban areas)
CalTopo Maps (U.S. only)


texts: How many polygons under a point (ArcGIS solution preferred)

texts:
Opposite of Point in Poly.

How many polygons underneath a point.

I have a point layer with many points.
I have a polygon layer with many polygons.

I need to add an attribute to the points that states how many of the polygons it is in
That is something like

Point 1 18 polygons
Point 2 10 polygons.


texts: How to debug a QGIS python plugin with popups?

texts:
I'm trying to write a python plugin for QGis. I'd like to debug some DB queries and I need a way to display the result.

I thought about using a popup to display it, but I don't know how to show a popup from inside a python plugin.

Can anyone suggest me how to do that?


texts:
I am having a problem with the line of sight tool and viewsheds on ArcGIS 10.1. This is for a viewshed analysis of pillboxes and defences in a particular area in Malta.

I am using a DTM with a 1m cell size. Structures have been filtered out. A discrepancy has arisen with the Line of Sight and the Viewsheds. The observer point of both LoS and Viewshed are the same (1.78 metres) and the target height is also the same (1.7 metres). There are areas which the viewshed shows as visible while the line of sight is stating otherwise. Has anyone ever encountered such a problem before and how can I solve this?


texts: Error writing memory layer to shapefile in QGIS

texts:
I have created a memory polygon layer in my QGIS plugin. Then I added a buffer based on a point. I can see the ploygon memory layer in the map canvas and I can save it to a shapefile from the main GUI. But when I try to save it with the following code, it doesn't work. What am I doing wrong?

(please forgive my beginner-style coding)

uri = "Polygon?field=id:integer&index=yes&crs=27700"
self.polyLayer = QgsVectorLayer(uri, "Study area", "memory")
self.provider = self.polyLayer.dataProvider()
QgsMapLayerRegistry.instance().addMapLayer(self.polyLayer)

# create buffer feature
featurepoly = QgsFeature()
featurepoly.setGeometry(QgsGeometry.fromPoint(QgsPoint(self.point.x(),self.point.y())).buffer(200,1000, 1, 1, 1.0))
self.polyLayer.startEditing()
self.polyLayer.addFeature(featurepoly, True)
self.polyLayer.commitChanges()

# getting the new buffered memory layer
poly = self.iface.activeLayer()

prov = poly.dataProvider()
fields = prov.fields()

dir_poly = self.plugin_dir + '/data/poly_temp.shp'
writer = QgsVectorFileWriter(dir_poly, "CP1250", fields, prov.geometryType(),
                                     prov.crs(), "ESRI shapefile")
if writer.hasError() != QgsVectorFileWriter.NoError:
            self.iface.messageBar().pushMessage("Error when creating shapefile: ", str(writer.hasError()))

geometry = poly.geometry()
feature = QgsFeature()
feature.setGeometry(geometry)
writer.addFeature(feature)
del writer