texts:
I'm struggling to load spatial data into QGIS from SQL Server 2014.  I have a table with 4 geography columns (3 are polygon layers, one is a point layer). The table has a primary key column that is a 32-bit integer. I believe the data is loaded correctly as it displays fine in the spatial results tab in SSMS query editor.  Also I am able to retrieve the data correctly with custom code I have written.

Whenever I attempt to load with QGIS (or preview with QGIS browser) I immediately receive a crash message "R6025 -pure virtual function call" and down the program goes.

I've tried to populate a geometry_columns table without any help.  FWIW I do not see the primary key column listed when attempting to add a layer.

I traced the sql being generated by qgis when I try to load the point layer and found the following to be the culprit (this is part of the select query for the layer):

select [geography]::STGeomFromText('POLYGON(
(-172.75210512499998572 -73.81694445636215107,
  186.90200612499998556 -73.81694445636215107,
  186.90200612499998556 143.2662874563621358,
  -172.75210512499998572 143.2662874563621358,
  -172.75210512499998572 -73.81694445636215107))',4326)

It appears that latitude & longitude values are somehow scrambled.  I manually queried the geography point field and found latitude ranging from 0 to 69.4 and longitude ranging from -164.4 to 178.3 which seems reasonable to me.

I'm baffled as to where QGIS came up with this bounding polygon that it is using to select the layer (complete sql statement below).

SELECT [id],[centroid]FROM [dbo].[table] where     [centroid].STIntersects([geography]::STGeomFromText('POLYGON((-172.75210512499998572 -73.81694445636215107, 186.90200612499998556 -73.81694445636215107, 186.90200612499998556 143.2662874563621358, -172.75210512499998572 143.2662874563621358, -172.75210512499998572 -73.81694445636215107))',4326)) = 1


texts: Relation 1:n in Drag and Drop is not saved, when I open the project file again

texts:
My new created relation 1:n in the "Drag and Drop Layout" is not saved when I open the project file again. When I look at the layout the field is empty, but I can delete it and put it there new and it works until I reopen the project, even if I save the project.
With older created relation in my project I haven't got this problem.


texts: Style a layer based on an attribute from GeoServer in OpenLayers 3

texts:
I want to take attribute from field_1 in GeoServer to show in OpenLayers 3

This is the script:

var style_titik =(
if (feature.get('field_6') === '4')
{var b2 = new ol.style.Style({
            image: new ol.style.Circle({
                radius: 6,
                fill: new ol.style.Fill({
                    color: 'rgba(20,150,200,0.6)'
                }),
                stroke: new ol.style.Stroke({
                    color: 'rgba(20,130,150,0.8)',
                    width: 1
                })
            })
})});
else {      var b1 = new ol.style.Style({
            image: new ol.style.Circle({
                radius: 30,
                fill: new ol.style.Fill({
                    color: 'rgba(255,1,2,0.6)'
                }),
                stroke: new ol.style.Stroke({
                    color: 'rgba(220,1,1,0.8)',
                    width: 1
                })
            })
})};

What about this problem?


texts:
I got sample shapefiles with the following *prj file content:

  PROJCS["RGF93_Lambert_93",GEOGCS["GCS_RGF_1993",DATUM["D_RGF_1993",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",44.0],PARAMETER["Standard_Parallel_2",49.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]]

Trying to convert the projection using the shp2pgsql command
shp2pgsql -s 4326 kept the original projection and didn't convert it as requested.

I also check spatial_ref_sys table srtext field for similar known projection unsuccessfully.

How can I convert it to WGS 84 projection?


texts: "Empty" cells in attributes table - QGIS3 - QuickOSM

texts:
Just why? (look at picture below) Why no data in attributes table? There should be infomation about map features. I check this area in QGIS on PC with Windows, and there is no problem with table... Also when I work on Mac with QGIS 2.18 it also work correct. I don't know how to fix it...I tried uninstall QGIS, plugins... I don't know what to do... Please help :)

I'm using QGIS 3.4.5-Madeira and macOS Mojave 10.14.3


texts: Creating regular grid cells (square) by ArcGIS Desktop through geographic coordinate system?

texts: I need to create grid cells (square =1000*1000 meter or 500*500 meter) by ArcGIS through the geographic coordinate system. It worth to be noted that the latitude coordinates between 22~23 degree.


texts: Find optimal distance band after running Incremental Global Moran I with PySAL?

texts:
My observations are points along a transect, irregularly spaced.

I aim at finding the distance values that maximize the clustering of my observation attribute, in order to use it in the following LISA analysis (Local Moran I).

I iteratively run Global Moran I function with PySAL 2.0, recreating a different distance-based weight matrix (binary, assigning 1 to neighbors and 0 to not neighbors) with a search radius 0.5m longer at every iteration.

At every iteration, I save z_sim,p_sim, I statistics, together with the distance at which these stats have been computed.

From these information, what strategy is best to find distances that potentially show underlying spatial processes that (pseudo)-significantly cluster my point data?

PLEASE NOTE:

Esri style: ArcMap Incremental Global Moran I tool identify peaks of z-values where p is significant as interesting distances
Literature: I found many papers that simply choose the distance with the higher absolute significant value of I

CONSIDERATIONS

Because with varying search radius the number of observations considered in the neighborhood change, thus, the weight matrix also change, the I value is not comparable.


texts: arcpy.Delete_management does not delete the directory

texts:
I got a problem with Delete_management when I use the FeatureclassToCoverage_conversion function. I don't know why in the gdb I use (arcpy.env.scratchGDB), while the Delete_management is working, the folder is not completely deleted : 2 lockers file stay in.

Here is the code I use (I reduced it to the minimum) :

import os
import arcpy

from os.path import join

# User entries on ArcGIS
out_cover = "C:\Users\user\coverage"
in_lines = "C:\Users\user\lines.shp"
in_points = "C:\Users\user\points.shp"

# Unsplit the lines
fusionned_lines = join(arcpy.env.scratchGDB, "fusionned_lines")
arcpy.UnsplitLine_management(in_lines, fusionned_lines)

# Copy the feature
points = join(arcpy.env.scratchGDB, "points")
arcpy.CopyFeatures_management(in_points, points)

# List the feature classes to put in the coverage.
points_and_lines = [points, fusionned_lines]

# Create the coverage directory if needed.
if not arcpy.Exists(out_cover):
    os.makedirs(out_cover)

# Convert the feature class list into a coverage.
arcpy.FeatureclassToCoverage_conversion(points_and_lines, out_cover)

# The Delete_management of fusionned_lines and points is comparlsary, otherwise
# it is impossible to delete the scratch workspace.
arcpy.Delete_management(fusionned_lines)
arcpy.Delete_management(points)
# This delete does not work like I want :
arcpy.Delete_management(arcpy.env.scratchGDB)

In the scratch.gdb folder I always have a locker for fusionned_lines and a locker for points. For the first treatment it doesn't matter, but because of that I can't execute the script more than once.

Moreover, if I don't add the line : arcpy.FeatureclassToCoverage_conversion(points_and_lines, out_cover), the scratchGDB delete correctly. So the problem definitely come from here, but I don't know why or how.


texts: Doing exp math in R/Google Earth Engine (rgee)

texts:
Is this the correct syntax in R-Studio for rgee (Google Earth Engine) for the following equation?
y=0.7*e^(4.1*x) where x is represented by "data" below.
y<-data$multiply(4.1)$exp()$multiply(0.7)

I also tried...
calcResult<-function(image) {
  return(image$exp(image$multiply(4.1))$multiply(0.7))
}
 y<-calcResult(data)


texts: QGIS 2.16 - Couldn't load QGIS utils. Python support will be disabled

texts:
I use Windows 10 OS and not good at coding. I have been using QGIS standalone installer for a long time (from 1.8 actually), but recently tried installing the OSGEO4W 32 bit version which had the latest QGIS 2.16 version, but when I load the application I get this error and none of the plugins show up, even the ftools (vector analysis). I have attached the error message below.

I did search for solutions, where I found some discussions talking about "python-future" but I don't know what to do exactly with that downloaded folder.

I tried pasting that folder content inside this path "C:\OSGeo4W\apps\Python27\Lib\site-packages\future" and restarted the application and it still didn't fix anything.

Can anyone provide a solution? Error message is provided below.

"**Couldn't load QGIS utils.
Python support will be disabled.**

Traceback (most recent call last):
  File "", line 1, in
  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 21, in
standard_library.install_aliases()
  File "C:\OSGeo4W\apps\Python27\lib\site-packages\future\standard_library\__init__.py", line 457, in install_aliases
__import__(oldmodname)
  File "C:\OSGeo4W\apps\Python27\lib\site-packages\future\backports\__init__.py", line 17, in
from .misc import (ceil,
  File "C:\OSGeo4W\apps\Python27\lib\site-packages\future\backports\misc.py", line 24, in
from socket import getaddrinfo, SOCK_STREAM, error, socket
  File "C:\OSGeo4W\apps\Python27\lib\socket.py", line 68, in
from _ssl import \
ImportError: cannot import name RAND_egd

Python version:
2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]

QGIS version:
2.16.0-Nødebo 'Nødebo', d0b3e39

Python path:
['C:/OSGeo4W/apps/qgis/./python', u'C:/Users/Satish/.qgis2/python', u'C:/Users/Satish/.qgis2/python/plugins', 'C:/OSGeo4W/apps/qgis/./python/plugins', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\matplotlib-1.3.1-py2.7-win32.egg', 'c:\\osgeo4w\\apps\\python27\\lib\\site-packages\\python_dateutil-2.2-py2.7.egg', 'C:\\OSGeo4W\\bin\\python27.zip', 'C:\\OSGeo4W\\apps\\Python27\\DLLs', 'C:\\OSGeo4W\\apps\\Python27\\lib', 'C:\\OSGeo4W\\apps\\Python27\\lib\\plat-win', 'C:\\OSGeo4W\\apps\\Python27\\lib\\lib-tk', 'C:\\OSGeo4W\\bin', 'C:\\OSGeo4W\\apps\\Python27', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\PIL', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\jinja2-2.7.2-py2.7.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\markupsafe-0.23-py2.7-win32.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\pytz-2014.2-py2.7.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\win32', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\Shapely-1.2.18-py2.7-win32.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\six-1.10.0-py2.7.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode']"


texts: ArcGIS The search window doesn't recognize english terms

texts:
In ArcGIS 10.4.1 the search window only works in German even though the performance surface is displayed in English.
I downloaded and installed the English version of ArcGIS 10.4.1

Does anybody know why?


texts:
I'm looking for some examples in OpenLayers to add in my project, and all those examples had something like this in their JavaScript:`

  import Map from 'ol/Map.js';
  import Overlay from 'ol/Overlay.js';
  import View from 'ol/View.js';
  import {toStringHDMS} from 'ol/coordinate.js';
  import TileLayer from 'ol/layer/Tile.js';
  import {fromLonLat, toLonLat} from 'ol/proj.js';
  import OSM from 'ol/source/OSM.js';`

Where did that come from and how can I use it?


texts: Geocoding Australian postcodes - MapInfo

texts:
How do I plot suburbs/location onto a map? I have a list of suburb postcode and their names in Excel. What is the process to plot them onto a Map? I'm in Australia. I use MapInfo Professional 10.1.

Thanks heaps!


texts:
I have a plugin with my own map canvas and I create a button in order to remove all the layers visible or opened in map canvas.
I use this lines:

QgsMapLayerRegistry.instance().removeAllMapLayers()
self.canvas.refresh()

And it works but I noted that the layers are not in canvas but exist even that, I think they are in memory. How can I permanently remove the layers?


texts: Converting oracle geometry to PostGIS with 3d data (wkt?)

texts:
I am converting Oracle spatial database to postgis. Most of of the spatial data is 2.5d. Meaning we have a Z-coordinate which indicates the depth/height of the element compared to soil level.

Getting the 2D elements is pretty easy: I select the WKT presentation of the element and insert that back into postgis. But, in Oracle the sdo_util.to_wktgeometry only works on 2D geometries. I can convert geometries to 2D using sdo_cs.make_2d but only for those elements that have no height at all.

What is the best way to convert the data?

is WKB exchangeable between databases? (I guess not)
are there other formats to extract data from oracle in a format postgis understands?


texts:
Currently I am writing a plugin which allows the user to quickly import a .txt file as a point layer in qgis. The .txt file is output data from a gps device and does not contain a header row. However, I was wondering if it is possible to add headers to the file while importing it as a point layer. Because the .txt structure is always the same, I always know which name a column should have.

Right now I am using addAttributeAlias but this is not satisfying as it only gives an alias to the columns.

Currently I am using the code below for importing the txt file. Is it possible somehow add a line of code in here which allows me add headers for all the columns?

txt_path = self.dlg.lineEdit_txt.text()
txt_info = "?crs=epsg:" + str(crs_rd_new) \
                   + "&type=csv&useHeader=No&xField=field_2&yField=field_3&spatialIndex=no&subsetIndex=no&watchFile=no&=&=&=&="
txt_output_filename = os.path.splitext(os.path.basename(txt_path))[0]
txt_vl = QgsVectorLayer("file:///" + txt_path + txt_info, txt_output_filename + ".txt", 'delimitedtext')


texts: QgsMapCanvas.refresh() does not reload new wfs layer features, but panning does

texts:
I have a wfs layer loaded in a standalone QGIS app, which I am updating by running a database query on the view it is based on. The feature is added with no problems and I reload the layer with:

# Runs insert query here to add feature to WFS layer source table
wfs_vector_layer.dataProvider().updateExtents()
wfs_vector_layer.dataProvider().reloadData()
main_window.mapCanvas().refresh()

However, the refresh() does not visibly update the canvas, and I have to pan or zoom the canvas to get it to redraw the updated wfs layer with the new feature. I can't see anything more than a refresh() happening after panning from the qgsmaptoolpan source code. Am I using the method incorrectly?


texts: Using geopy's vincenty to find distances in pandas data frame?

texts:
I am trying to use geopy's vincenty on each row in a panda's dataframe. However, I am unable to get the syntax right in the lambda argument. geopy's vincenty takes two ordered pair arguments

p1 = (lat, long)
p2 = (lat2, long2)
dist = vincenty(p1, p2)

What I have tried is:

import pandas as pd
from geopy.distance import vincenty
# read in csv file
jss_loc = pd.read_csv('location.csv', sep = ',')
#
coord_col = ['avg_lat', 'avg_long']
matching_ser_no = jss_loc['ser_no'] == jss_loc['ser_no'].shift(1)
shift_coords = jss_loc.shift(1).loc[matching_ser_no, coord_col]
# join in shifted coords and compute distance
jss_loc_shift = jss_loc.join(shift_coords, how = 'inner', rsuffix = '_2')
jss_loc['hdist'] = jss_loc_shift.apply(lambda ((row['avg_lat'], row['avg_long']), (row['avg_lat_2'], row['avg_long_2'])):
    vincenty((row['avg_lat'], row['avg_long']), (row['avg_lat_2'], row['avg_long_2'])), axis = 1)

The columns of jss_loc_shift are: name, id, ser_no, avg_lat, avg_long, avg_lat_2, avg_long_2.


texts: How to overcome missing of "sp::Point" to create points layer in shapefile?

texts:
I can produce Polygon layer from matrix in following way:

pols <- lapply(cdf, Polygon)
    pls <- lapply(seq_along(pols), function(i) Polygons(list(pols[[i]]), ID = i))
    sps <- SpatialPolygons(pls)
    sps_df <- SpatialPolygonsDataFrame(sps, data.frame(x = rep(NA, length(pls)), row.names = names(pls)))

while cdf is a matrix of points (x, y) for the polygon(s). My question is: how to do the same for points or even circles? I don't have a function to cast like pols <- lapply(cdf, Point) to produce SpatialPoints object from many points.


texts:
I have a Shapefile with road data.  Sometimes the roads are blue, sometimes they are green.  I didn't used to mind, but now I'm tiling everything so I need to control the colors.

I'm loading it with this command in ArcEngine:

mapControl.AddShapeFile(fileDir, fileName);

How can I control the colors so they are the same everytime?

I'm using ArcEngine 10 C# with VS2010


texts: Is it possible to install OpenGeo within Amazon Web Services - Free Tier?

texts: I like to ask if it is possible to install OpenGeo within an instance of the Amazon Web Services - Free Tier.


texts:
I’m new using QGIS with PostgreSQL I have imported layers via QGIS via the DBA plugin. The fields in PostgreSQL are encoded, example:

ID   NAME
1   GRASS
2   SAND
3   PAVEMENT

My question resides in the possibility of express the values in the output table as text instead of plain numbers is there a way to do this, should I use some kind of external plugin or there is a way to do it via the console.


texts: Creating a palette for categorized data displays

texts:
I regularly categorize data as follows:

Prehistoric = blue
Roman = red
Anglo-saxon = green
Medieval = yellow
Post-medieval = brown
Modern = grey
Undated = white

Is there any way to save this palette and associate it with the period names so that it can be loaded? I never change the period names, although sometimes there is no data for certain periods.

Its time consuming to have to change the colours for each period, so I am seeking any advice on how to save the colour scheme? I have tried style files (which I already use on layers with a single display requirement0 but these don't seem to be the right things.


texts: Handling events with ArcMap automation via ArcObjects?

texts:
We have a bunch of forms written in C# as ArcMap commands, which are running happily in the normal way from command buttons. The forms interact with the map by creating layers and symbologies, and by listening for selections on the layers to update their own display.

For a number of annoying reasons, we now have to convert these to run from an external executable, but still interact with ArcMap.
I'm attempting to use the approach of ArcMap "automation" so the forms are created by the executable, which also creates an ArcMap instance and passes it to the forms to allow them to interact.

I've got past the process-space issues of not being able to use "new" instantiation in the form's code for ArcObjects (layers, etc) that ArcMap has to interact with, and using IObjectFactory to get ArcMap to create them for me instead.

But I am struggling with events. The form needs to listen to events like SelectionChanged in the map and update itself. If I create an event handler in the normal way like

   dSelChangedE = new IActiveViewEvents_SelectionChangedEventHandler(OnSelectionChanged);
   m_pMap.SelectionChanged += dSelChangedE;

Then my OnSelectionChanged event method in the form fires correctly, but ArcMap seems to miss the event itself (even when it was ArcMap that created it, e.g. by interactive feature selection): the selection isn't displayed on screen! I guess this is process-space issues again but I don't know how to get around them. I can't see any way to make IObjectFactory make the event handler, for instance.

This thread on the old ESRI forums is similar the problem I'm having
http://forums.esri.com/Thread.asp?c=93&f=993&t=213577 but in my case it's the other way around: I can get my controlling application to listen to the events, but then Arcmap loses track of them.


texts: How to remove the Na values from a stack of rasters?

texts:
In R I have a stack (nsw.stack) which contains 6 variables. I have clipped the extent. However, When I look at the summary it appears that there is a lot of NA values (see below). I think this is slowing down the computing power when i do a raster prediction. (right?)

If so, how do I get rid of the NA.values from the rasters prior to using the predict code, or is there a way to ignore the NA values while predicting.

> summary(nsw.stack)
                 riv         lake         ndvi    temp    prec     dem
Min.    0.000000e+00 0.000000e+00      -0.0960     -14     114      -4
1st Qu. 2.640341e-02 7.969768e-02       0.2328      29     162     134
Median  7.040909e-02 1.814401e-01       0.3288      49     219     226
3rd Qu. 1.814401e-01 3.925149e-01       0.4128      75     297     338
Max.    1.120824e+00 1.613323e+00       0.7176     115     406    1281
NA's    2.103107e+06 2.103674e+06 2103309.0000 2103188 2103188 2103188
Warning message:
In .local(object, ...) :
  summary is an estimate based on a sample of 1e+05 cells (2.47% of all cells)


texts: How can I stop the QGIS project projection from changing

texts:
I am using QGIS version 2.18 (I know newer versions are available, but I would like to try and fix this!) and have a problem with the projection changing unexpectedly.

I would like to use OSGB 1936 /British National Grid (ESPG:27700) and I set this using Project Properties > CRS > Apply. In order to set this, I have to enable OTF transformation - otherwise all options except a custom projection (USER:100000) are greyed out. If I turn OTF transformation back off, it sometimes remains in British National Grid but sometimes reverts back to another projection.

I have also had issues when adding files. This sometimes causes the projection of the project to change. I'm used to having to change the projection of the file itself, but not the whole project.

I use QGIS regularly and this problem does not occur on my usual computer. However, it seems to occurs on a computer that I use occassionally at another location (which I did not set up). I feel like an underlying setting may not be working correctly.

How can I force QGIS to stay in my projection of choice, particularly if the Project Properties route isn't working for this?


texts: How to create grid from 2 separate images of latitude and longitude

texts: I have two separate images of latitude and longitude, and want to create a grid from them so I can assign it to my Non-Geo referenced file... How can I create it, particularly in Matlab... But other help will be useful...


texts:
There is table in SQL-Server 2008 R2.  In this table I have date column with date format like this 2006-09-08 14:39:41.000. Now I make a view from this table on GeoServer side and do nothing with the date field. And make WMST layer.

When I go into Layer Preview I do not see any features. I then take source table and publish it on GeoServer, but GeoServer does not see date column.

In the GeoServer docs I see that in WMST I have to use the ISO-8601 time format.

How can I convert date format in view on GeoServer?

UPDATE

I make some tests.

I take Shapefile with date field (i.e. 2002-08-20) put it into SQL-Server using ogr2ogr. SQL-Server says that my date field is date data type. GeoServer says it too, and in Layer Preview I see my features and after adding in address line TIME=2002-08-21 parameter I can see features with other dates.

Then I added a datetime field in my table and put into dates like 2002-08-20 14.00.00.000. GeoServer says that it's Timeswap datatype. In Layer Preview I DON'T GET any features added and   TIME=2002-08-21T14.00.00.0Z also doesn't not help.

When I click on map I get error that can't convert varchar into datetime.


texts: Recommended starting point for an OpenLayers v5 (node.js and npm) project

texts:
I have a large monolithic OL4 js/php system that I have hacked together in the last year, that has lots of raster and vector functionality driven by json parameter files.

I want to refactor/rewrite it using OL5 node.js/npm packages in the best way for future maintenance. I am very familiar with OpenLayers 4 and js/php, but am only starting to learn about node.js and npm packages. I have done the OL5 workshop, and am familiar with the tutorials and examples.

What do you recommend for my starting point for my new system in terms of packages, frameworks, standards? Is it the workshop, or an example? Any other advice?


texts: Using arcpy.GetParameterAsText() or arcpy.GetParameter() to pass datetime.timedelta to script?

texts:
I have a function that takes a datetime.timedelta as an argument in a script that I want to use in ModelBuilder.  I don't see an option for that as a parameter type, so for now I have a solution that involves setting the parameter as a String in ModelBuilder and the following code:

...
startOffset = eval('datetime.timedelta(' + arcpy.GetParameterAsText(0) + ')')
...

Which works, but relies on inputting a valid set of timedelta arguments for the parameter in ModelBuilder (e.g. days=0,hours=3) and just seems like a bad idea in general.

Is there a better way to get a timedelta into a script from a Model using only one parameter?


texts: Issues Adding MapServerCache Raster Layers to Mxd

texts:
I have created a data consolidation tool. It consolidates a users mxd's vector and raster data into a project structure. It also allows the user to optionally cache our companies ArcGIS Server Web Maps. The arcpy.gp.ExportMapServerCache produces a compact cache dataset, which is turned into a layer with arcpy.MakeRasterLayer_management and added to an mxd with arcpy.mapping.AddLayer.

The layer is successfully added to the mxd. But it's not the same as when the user does it manually. The arcpy layers "data source" is not the one that was dictated to it, rather it references a temp in the users application data folder instead.

Why does it reference a temp, and NOT the actual raster cache?

### MOVE CONSOLIDATED MXD TO PROJECT CORE LEVELS
MasterMxdPath = UserProjectPath+"\\Extract_"+Project_Name+".mxd" #new mxd name
mxd2Name = UserProjectPathGDB+"\\v101\\"+mxdNAME #get consolidated mxd
mxd2 = arcpy.mapping.MapDocument(mxd2Name)
mxd2.saveACopy(MasterMxdPath, "10.1")
del mxd2

### ADDING WEB CACHE TO MXD
try:
    UserProjectPathCache = UserProjectPath+"\\Cache"
    arcpy.env.workspace = UserProjectPathCache
    RastersL = arcpy.ListRasters("*", "ALL")
    RcCount = len(RastersL)

    if RcCount >0: ### If there's a web cache:
        arcpy.AddMessage("    J: Web Cache Exists:")
        arcpy.AddMessage("    J: There are: " +str(RcCount) +" rasters")

        ### Get Dataframe From MXD
        mxd3 = arcpy.mapping.MapDocument(MasterMxdPath)
        df = arcpy.mapping.ListDataFrames(mxd3)[0]

        ### Turn Rasters Into Layers & Add To Dataframe
        CNTR = 0
        for raster in RastersL:
            arcpy.AddMessage("    J: Cache Name: "+str(raster))
            CNTR = CNTR + 1
            RasterLayerName = "WebServiceCache_"+str(CNTR)
            RasterPath = UserProjectPathCache+"\\"+raster
            arcpy.AddMessage("    J: New Layer Name: "+ RasterLayerName)
            RLayer = arcpy.MakeRasterLayer_management(RasterPath,RasterLayerName)
            layer = RLayer.getOutput(0)
            arcpy.mapping.AddLayer(df, layer, 'Bottom')
            mxd3.save()
            arcpy.AddMessage("    J: Mxd Saved With Cache Layer")
            del RLayer, layer, df
        del mxd3

        ### Remove Webservices From Dataframes in MXD
        mxd4 = arcpy.mapping.MapDocument(MasterMxdPath)
        df2 = arcpy.mapping.ListDataFrames(mxd4)[0]

        for lyr2 in arcpy.mapping.ListLayers(mxd4, "", df2):
            if lyr2.supports("SERVICEPROPERTIES"):
                servProp2 = lyr2.serviceProperties
                if lyr2.serviceProperties["ServiceType"] != "SDE":
                    arcpy.AddMessage("    J: Removing WEB SERVICE LAYER: " + lyr.name)
                    arcpy.mapping.RemoveLayer(df2, lyr2)
        mxd4.save()
        arcpy.AddMessage("    J: Final Mxd Saved: ")
        del mxd4

    else: ### If there's no web cache
        arcpy.AddMessage("J: No Web Cache Exists:")

except Exception as e:
    arcpy.AddError(e.message)
    arcpy.AddMessage(" DID NOT ADD RASTER TO MXD")


texts: PostgreSQL function string concatenation

texts:
Problem:
Function takes a spatial clause as a parameter of text (more about this later) and appends to the primary sql string.

    clause = '((44<=NeLon AND 45>=SeLon AND 37<=NeLat AND 38>=SwLat) OR
    (SwLon<=45 AND NeLon>=44 AND SwLat<=38 AND NeLat>=37))'

Note the following function:

    CREATE OR REPLACE FUNCTION _fconcat(area integer DEFAULT 100, pdate date
    DEFAULT '2018-01-01', acc real DEFAULT 50.0, clause text DEFAULT NULL)
        RETURN SETOF temporary.myschema AS
    $BODY$
            DECLARE sqmtokm CONSTANT integer DEFAULT 1000000;
                    sql text;
    BEGIN
        SELECT CONCAT ('SELECT * from temporary.myschema WHERE ', ST_Area(ST_GeogFromWkb(geom))\', 'sqmtokm <= ', area, ' AND
        productdate >= ', pdate, ' AND accuracy <= ', acc, ' AND ',  clause, ';') AS sql;
            RETURN QUERY EXECUTE sql;
   END;$BODY$
   LANGUAGE plpgsql STABLE
   SET search_path = public;

am specifically concerned with the following.

a) the sql variable is being executed to generate the SETOF table rows
results
b) I'm using the CONCAT function to amalgamate the string
components to build the sql string but not sure if is the best
approach.
c) my clause parameter is of type "text" rather than
character varying is this ok
d) I am receiving an error stating that

  "sql" is NULL at" RETURN QUERY EXECUTE sql

my primary issue is being able to concatenate an SQL SELECT command and execute it returning a set of table rows.


texts: Rendering specific tiles (by x,y,z) using TileMill

texts:
I'm playing around with an idea for reducing the size of my tilecache (inspired by this FOSS4G talk: http://vimeo.com/106873780.

The main idea is to define a set of tiles related to a bounding box, and I've made a small Python-script to calculate exactly what tiles I need (ie a list of tiles indexed by x, y and zoom), this can be found here: https://github.com/atlefren/ToPHR

Now: what I want to do is use TileMill to generate exactly the tiles i've found that I need, but I cannot find a way to throw a list of x,y,z at tilemill and make it render them.

I've looked at the command line export options: https://www.mapbox.com/tilemill/docs/manual/exporting/#exports-from-the-command-line, and I've even tried changing some of the code in tilelive (which actually does the rendering), but I cannot get this to work (I can limit what tiles are generated by editing a bunch of internals, but then the offsets in the resulting .mbtiles db seems to be off, probably related to metatiling, can provide examples here if wanted).

So: the question boils down to:

Is it possible, using some kind of parameter to index.js export, pass a list of x,y,z and render only those tiles? If not, how to go about forking tilemill and/or tilelive to make this possible.

Or, alternatively: how could I achieve this in a better way?

All suggestions are welcome, but I need a programmatic solution.


texts: How to import selected features from QGIS to PostGIS?

texts:
I am trying to import selected features from Quantum GIS to postgresql directly. I do not know how to do it.

Actually, my problem is, I have full country road network. But, I need to cut road network of a small area. If i import full country road network using Quantum GIS to postgresql, I can do it. But, I can not import small area road network after extracting that small area. Something, has been change after cutting sample area. But, I do not know what it is?? It is very strange.

If anyone have the solution. Please let me know.


texts: Creating and reading z values (coordinates) with pyshp?

texts:
I am trying to parse an input shapefile which consists of multiple polygons and want to create a new shapefile from this with added z values. Each polygon of the input shapefile is defined by multiple points, whereas each of these is defined by an x and y coordinate.

I am creating a new shapefile with x, y (simply copied from input shapefile) and z coordinates like so:

s = shapefile.Writer()
s.autoBalance = 1
s.shapeType = 15 // PolygonZ
pointlist = [[12345.123, 45678.123, 10.0], [23456.123, 34567.123, 10.0]]
s.poly(shapeType=s.shapeType, parts=[pointlist])
s.save("test.shp")

But now when I want to read this created shapefile I can't see the defined z values:

s = shapefile.Reader("test.shp")
print(s.shapes()[0].points) // [[12345.123, 45678.123]]

What am I missing that the z values aren't included? I have also tried to define the polygon with at least 4 points (where the last point is identical to the first one) - exactly like the docs are stating to do this, but this didn't help either.

When I am trying to read the z value of the first point of a polygon with QGIS I can easily see my specified values:

z(start_point($geometry)) // 10


texts: PyQGIS Finding duplicates across multiple columns

texts:
I have a table with three columns that I'm interested in: X, Y and rotate. These specify the position and angle of a symbol. I want to find duplicates across these columns, so anything with the same X,Y co-ords which also has the same angle set. I can find duplicates in geometry but not by finding the angle as well. I thought along the line of a For loop with nested If statements, but am unsure how to set that up - I'm a bit of a beginner with PyQGIS. This the code I'm using to find the duplicates which was found elsewhere on this forum:

layer = subscriber_feed_layer
allfeatures={}
index = QgsSpatialIndex()
for ft in layer.getFeatures():
    allfeatures[ft.id()] = ft
    index.insertFeature(ft)

selection = []
for feat in layer.getFeatures():
    inGeom = feat.geometry()
    idsList = index.intersects(inGeom.boundingBox())
    if len(idsList) > 1:
        for id in idsList:
            selection.append(allfeatures[id])
layer.setSelectedFeatures([k.id() for k in selection])


texts:
I am wondering how to change image size, available under the link in JSON file.

I base on the example:

http://www.gistechsolutions.com/leaflet/DEMO/baseball/BaseballPanel.html

which uses  a links to the icon, based on the web.
This is obviously fine, although the linked image must have a certain size like:

"Logo": "http:\/\/mlb.mlb.com\/mlb\/images\/team_logos\/logo_atl_79x76.jpg",
        "LeagueLogo": "http:\/\/mlb.mlb.com\/mlb\/images\/nl_75x75.png",

I have changed the link and put another one, so my JSON file (properties) currently looks like this:

"properties": {
    "name": "PE1 5RX",
    "MS_Ref": "REG/LYVELLYGDNS",
    "Owner": "Long Term Reversions (Dulwich) Limited",
    "Client_Ref": "LYVELLYGDNS",
    "Address": "The Keep, Lyvelly Gardens, Peterborough",
    "Postcode": "PE1 5RX",
    "Units": 18,
    "Logo": "https:\/\/www.cityfibre.com\/wp-content\/uploads\/2016\/09\/CF-
logo-New-Green.png",
    "No_Under__H_Lease": 0,
    "FH_Title": "CB331893",
    "FH_Title_2": 0,
    "Possible_Query__over__availablity": "No"
  }

and attached logo is enormously big.

I tried to make sth like this:

"Logo": ""

But it doesn't work at all.

To make the graph running i need a rough URL in the quote.

How to change the size of this image to make it more adjusted to the particular map/website? Unless it's necessary to upload the smaller image on the server first and next link it to the JSON?

The logo, which I am interested in is under the link below:

https://www.cityfibre.com/wp-content/uploads/2016/09/CF-logo-New-Green.png


texts: Point Solar Radiation Computation using ArcPy?

texts:
I want to use ArcGIS Point Solar Radiation tool to compute the solar radiation for more than 1000 data points.  The table for the shapefile point data looks like this:

Hour represent the time of start and ending time of collection.  The julian column is the julian day.

I believe ArcGIS provides the code below to work for one row only:

  # Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inRaster = "elevation"
inPntFC = "observers.shp"
outFeatures = "c:/sapyexamples/output/outglobal1.shp"
latitude = 35.75
skySize = 200
timeConfig = TimeWithinDay(183, 16, 16)
dayInterval = 14
hourInterval = 0.5
zFactor = 0.3048
calcDirections = 32
zenithDivisions = 8
azimuthDivisions = 8
diffuseProp = 0.3
transmittivity = 0.5
outDirectRad = "C:/sapyexamples/output/outdirectrad1.shp"
outDiffuseRad = "C:/sapyexamples/output/outdiffuserad1.shp"
outDirectDur = "C:/sapyexamples/output/outduration1.shp"

# Execute PointsSolarRadiation...
PointsSolarRadiation(inRaster, inPntFC, outFeatures, "", latitude, skySize,
                     timeConfig, dayInterval, hourInterval, "INTERVAL",
                     zFactor, "FROM_DEM", calcDirections, zenithDivisions,
                     azimuthDivisions,"STANDARD_OVERCAST_SKY", diffuseProp,
                     transmittivity, outDirectRad, outDiffuseRad, outDirectDur)

How could I edit the code so that it would calculate the solar radiation per row (or per point sample)?

I want to keep most of the values constant, except for:

timeConfig = TimeWithinDay(183, 16, 16)

That means that in every run, it will only change the 'Julian' day and the 'hour' and keep the rest of the values the same. For example: (183, 16, 16) should be (269, 18, 18) when the code runs to calculate the third row.

In the end, once all the rows are calculated, a new column would be added for the solar radiation of each row.

I am new to coding.


texts:
I have python installed here:

C:\Program Files\QGIS 2.18\apps\Python27\Lib\site-packages\pythonwin

When I click on pythonWIn I get this error:
The application cannot locate win32.ui.pyd (or Python) 126. The specified module could not be found. I got python 2.7.5 when I downloaded and installed QGIS 2.18.


texts: Symbol change of line and polygon vector layer

texts:
I am trying to change the symbols of the polygon/ line vector layer using QGIS C++ APIs.
I am able to change the symbol of the point vector layer using below code. I am able to change the color for all types of vector files, but I don't know the names of symbols for using it in QgsStringMap as a value.
Code for changing the symbology of the vector layer.
layer->startEditing();
qDebug()<< "is editable " << layer->isEditable();
QgsFeatureRenderer * layerRenderer= layer->renderer();
QgsSingleSymbolRenderer *mSingleRenderer = QgsSingleSymbolRenderer::convertFromRenderer(layerRenderer);
QgsMarkerSymbol* symbol = new  QgsMarkerSymbol();
QgsStringMap mp;    // key - value relation  for symbol
mp[QString("name")]= QString("diamond");
mp[QString("color")]=QString("blue");
auto newsym=     symbol->createSimple(mp);
mSingleRenderer->setSymbol(newsym);
layer->setRenderer(mSingleRenderer);
layer->triggerRepaint();
layer->commitChanges();

in case of point vector layer
QgsStringMap mp;
mp[QString("name")]= QString("diamond");//put "circle/square/cross/reactangle etc" for different symbols

in case of line vector layer
QgsStringMap mp;
mp[QString("line_style")]= QString("dash") // or dot..but what  else can I put here in place of dash ?

in case of polygon vector player
QgsStringMap mp;
mp[QString("  ? ")]= QString("? ")   what should be places here in these question marks

I need to increase line symbols and polygon symbols.
but I don't know their names. I tried some but they don't work.
I am already using QgsLineSymbol for the line vector symbol and QgsFillSymbol for the polygon vector layer. Any lead will be beneficial.


texts:
I'm making a world map in QGIS 2.18 Las Palmas. The data came from Natural Earth using the WGS84 CRS, however I want to use a Robinson projection for my map. I reprojected the data, by clicking 'save as' and selecting World_Robinson for the output layer.

When I try to display a grid however, nothing happens. If the shapefile is in the original WGS84 I can get the grid to display in the composer, however it doesn't work with the grid CRS set to EPSG:4326 (WGS84) and the data has been reprojected into World_Robinson.

When I set the grid CRS to ESRI:54030, for World_Robinson, this happens.

How can I proceed?

I'm running MacOS El Capitan.

This is my first time using QGIS.

Edit: here is the grid with WGS84.

Edit 2:


texts: Center / normalize choropleth colors in GeoPandas

texts:
I'm looking to plot a choropleth with a divergent colormap. I need to center the colormap in such a way that the middle color is displayed for a specific value (e.g. 0). How could I do this in GeoPandas/Geoplot?

I tried using a normalizer with geopandas.plot() but it's values are reset to data min and max once I plot:

import geopandas as gpd
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world.loc[:,'random'] = np.random.normal(size=len(world))+2

norm = mpl.colors.Normalize(-4,4,clip=True)

fig, ax = plt.subplots()
world.plot('random', cmap=cmap, legend=True, norm=norm, ax=ax)

And here is the figure:


texts: Making new raster using con() script using ArcPy?

texts:
I'm new to Python and have been trying to code a raster calculator style script. Basically, I want to convert a raster that has values 0 to -10,000 into a raster that is populated by 1s between certain values.

The reason I want to do it in Python is because I eventually want to automate this process so that I can pick out different values (ie 0 to -10, -5 to -25 etc) and end up with a raster of 1s for each. My aim then is to convert these to polygons so that I can then do a number of vector clip operations across about 800 shapefiles.

I've written a script which produces a new raster at the end but instead of this grid being full of 1s it has values 0-256, so somewhere in my code there's a bug. I'd be grateful if anyone can spot it! If anyone has a way to speed up the code or a better idea for how I can do all this also then that would also be interesting to know.

Here's my code:

import arcpy
from arcpy import env
from arcpy.sa import *

arcpy.env.overwriteOutput = 1 #this also doesn't work by the way, I have also tried
#TRUE, no errors come up but it still doesn't let me overwrite the output file

#Set environment settings
env.workspace = "C:/folderlocation where inRaster is stored"

# Set local variables
inRaster = Raster("inputraster")

# Check out Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# depths wanted from inputraster raster
var = [-2500,-3000] #min depth, max depth

#Execute and save Con
OutRaster = Con((inRaster <= var[0])&(inRaster <= var[1]),1)

OutRaster.save("C:/drivelocation/outputfilename")


texts:
The address table that I am trying to geocode does not have specific addresses; rather, it has blocks (e.g. 200 Block FIRESTONE LN).

Is it possible for me to still geocode the table?

I can't just open the table in Excel and remove all mentions of "Block", as I then wouldn't have actual existing addresses for most of my table (200 FIRESTONE LN is not an address).

I am using ArcGIS Desktop 10.2.2.


texts: Parameters for ArcGIS REST ".../MapServer?f=jsapi"?

texts:
What parameters can be used with .../MapServer?f=jsapi to alter the results, like turning on or off a single layer?

Background:

When browsing an ArcGIS REST Services Directory one of the options at a MapServer level is to "view in ArcGIS JavaScript":

http://services.arcgisonline.com/arcgis/rest/services/Specialty/Soil_Survey_Map/MapServer

This leads to a light-weight web map with minimal chrome, widgets, etc. and no reliance on a 3rd party server like ArcGIS Online to draw the results. It is really handy for having a quick look at the service, with a bonus of having a shareable URL that anyone can see.

http://services.arcgisonline.com/arcgis/rest/services/Specialty/Soil_Survey_Map/MapServer?f=jsapi

The problem, from my present perspective, is that the view is limited to the default definition in the MapServer service definition. In this soil survey example there are 3 layers in the MapServer. What I'd like to be able to do is use the same minimal-chrome webmap to view just one of those layers, not the whole map.

This Soils Survey isn't the best example of my dilemma since the desired layer will draw at the appropriate zoom level. The circumstance which prompted this question is a map service that has layers turned off by default. I can use ArcGIS Online's Use URL parameters to modify maps &layers=show:2,4 to fix that, but that invokes overhead and complexity I'm trying to avoid (using multiple servers and services for mere data viewing).


texts: Turning off single category of categorized symbology in ArcMap

texts:
I am new to ArcGIS Desktop.
I have one layer with different types of sewer: for rain water only, for waste water only and both mixed.
Every type of sewer should have his own color: rain - blue, waste water - brown, mixed - violet.
So I created a categorized symbology with three categories based on the layers attribut "type".
Now my problem is the following: I want to see only one type of sewer in my map, for example the one for rain water.
How can I get this done?
There is only one checkbox for the whole layer, not for the single categories in the toc.
Prior to ArcGIS/ArcMap I used GeoMedia from Intergraph/Hexagon and now in addition QGIS. In both GIS programs I'm able to turn off single categories but I couldn't find such a function in ArcGIS/ArcMap.
The only solution I have at the moment is to set the symbology of the categories I don't want to see to width zero or to insert the layer three times with single symbology and use filters for the type.


texts: Can't generate leaders with EasyCustomLabeling

texts:
I'm using EasyCustomLabeling with QGIS 2.0.1 and can't get it to generate the leader lines it is supposed to in Action 2.  I create a new layer with EasyCustomLabeling, move labels to new locations, and then save the layer.  I'm not sure how to get it to generate the lines to connect the points and labels after this however.

Any help would be much apprecaited


texts: Installing QGIS 3.12.x on Ubuntu focal 20.04 architecture mismatch

texts:
I am trying to install QGIS 3.12 Bucaresti on Ubuntu Focal Fossa following the steps here:

[https://www.qgis.org/en/site/forusers/alldownloads.html#id20.][1]

First, I have edited the sources.list adding the following repository and code name:

deb https://qgis.org/ubuntu/  focal main
deb-src https://qgis.org/ubuntu/ focal main

and the I have updated the packages:

sudo apt-get update

However, the update process hits an error

Reading package lists... Done
N: Skipping acquisition of configured file 'main/binary-i386/Packages', as repository 'https://qgis.org/ubuntu focal InRelease' doesn't support architecture 'i386'**

The thing is that I don't think I have a i386 architecture, indeed this is the output from

uname -a

5.4.0-21-generic #25-Ubuntu SMP Sat Mar 28 13:10:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

When I check the InRelease file from https://qgis.org/ubuntu/dists/focal/InRelease, the architecture supported is amd64. Which as far as I know from googling is the same as x86_64.

Someone knows what am I doing wrong?


texts: Using ModelBuilder to create smaller individual DEMs from a large DEM using multiple polygon?

texts:
How can I use a polygon (which is made up of smaller polygons) to create individual DEMs from a large DEM using the polygons as the mask/extent?
I am trying to do this in ModelBuilder and it isn't working.
I have a shapefile made up of lots of smaller polygons (each with their own attribute/number that looks like this:

I tried to use this in ModelBuilder by: Insert-Iterator-Feature selection.
Then I used the shapefile 'poly' as the 'input features' and I grouped by field (station number).
I then added the 'extract by mask' tool and choose my large DEM as the 'input raster'.
Then I have to choose the feature mask data:Do I input the same polygon file that has the station number (below poly_Station number)?

Finally I'm really not sure how to specify the naming convention OR the file type: eg. In the extract by mask output raster option, I am putting:
C:\User\Documents\ArcGIS\Default.gdb\Extract_%value%.

Is %value% right here? Should I be including a file type also?

Here are the errors I am getting:

ERROR 999999: Error executing function.
FDO error: -2147024894
FDO error: -2147024894 [GDB_SystemCatalog]
No spatial reference exists.
ERROR 010302: Unable to create the output raster: C:\Users\Documents\ArcGIS\Default.gdb\Extract_10002
ERROR 010067: Error in executing grid expression.
Failed to execute (Extract by Mask).
Failed at Mon Jun 13 16:51:00 2016 (Elapsed Time: 2.63 seconds)


texts: remove duplicate points based on a specified distance

texts:
i have a table of points with each point acquired on a specified date, by a specified source, and having a measured value. i want to consider points as duplicates if they have the same date and if they are within a certain distance of each other (say <10 m), even if they came from different sources.  here's a brief example using 8 points:

create table points (gid serial primary key, date date, source varchar, value integer);

select addGeometryColumn('points', 'geom', 32633, 'point', 2);

insert into points (date, source, value, geom) values
  ('1985-06-19', 'B', 22, st_geomFromText('POINT(593835 3910494)', 32633)),
  ('1985-06-19', 'A', 48, st_geomFromText('POINT(602920 3910591)', 32633)),
  ('1987-04-17', 'B', 12, st_geomFromText('POINT(592317 3910479)', 32633)),
  ('1993-07-22', 'A', 16, st_geomFromText('POINT(592323 3910476)', 32633)),
  ('1993-07-22', 'B', 30, st_geomFromText('POINT(592317 3910479)', 32633)),
  ('2000-07-09', 'A', 20, st_geomFromText('POINT(592108 3909121)', 32633)),
  ('2006-07-14', 'A', 22, st_geomFromText('POINT(592933 3909842)', 32633)),
  ('2006-07-14', 'B', 18, st_geomFromText('POINT(592931 3909843)', 32633));

i'm trying to create a query that should result in 6 points, since points 4/5 and 7/8 would be considered duplicates because they have the same date and <10 m from each other. i also want the query to select the duplicate point that has the maximum value, so in my example the result set would be ('geom' field not shown):

 gid |    date    | source | value
-----+------------+--------+-------
   1 | 1985-06-19 | B      |    22
   2 | 1985-06-19 | A      |    48
   3 | 1987-04-17 | B      |    12
   5 | 1993-07-22 | B      |    30
   6 | 2000-07-09 | A      |    20
   7 | 2006-07-14 | A      |    22
(6 rows)

been trying various queries using self joining and the st_dwithin and st_distance functions, but can't seem to nail it down. i'm using postgis 2.0 and postgresql 9.1. thanks!

update: based on the link whuber suggested, i explored using the st_snapToGrid function and this query seems to produce the result i'm looking for:

select distinct on (date, grid_location) grouped.*
from
(select *, st_snapToGrid(geom, 10, 10) as grid_location
from points order by date, grid_location, value desc) as grouped;

update 2: the above query eliminated most of the duplicates in my actual dataset, but i found several still making it through since sometimes points would be snapped to different grids if they happened to be bisected by a grid boundary. i've posted another solution as an answer to my question.


texts:
When I'm filtering by bounding box, I've found that I can either do

SELECT id, the_geom
FROM my_table
WHERE the_geom && ST_MakeEnvelope(minlng,minlat, maxlng,maxlat);

as well as

SELECT id, the_geom
FROM my_table
WHERE the_geom && 'BOX(minlng minlat, maxlng maxlat)'::box2d;

I believe both queries have a small overhead in converting the given bounding box to a valid geometry but... is there any rational disadvantage on using the second one?


texts: Storing shapefile in PostgreSQL database as a table using PHP?

texts:
I want to create a table from a shapefile in PostgreSQL. To do that, I can run this command in cmd:

shp2pgsql -s 4326 -W LATIN1 E:\Any\THA_adm public.test123 | psql -h localhost -d DATA -U postgres -w 123;

This works, but I want to run it from PHP. How can I do that, I tried PHP functions:

shell_exec()
exec()
system()

but did not work. Is there any other way to create a table from shape in PHP or run this command?


texts: Can I use existing .tfw (of georeferenced .tif images) as the extent in a MapServer Mapfile?

texts:
I have a set of aerial georeferenced tiff and tfw files, I want to be able to access them using MapServer.

Now the mapfile requires an EXTENT parameter with coordinates which i think they are already specified in the .tfw I was hopping for something like this

MAP
  IMAGETYPE      PNG
  EXTENT         "0232BC_23.tfw"
  SIZE           400 300
  IMAGECOLOR     255 255 255

    LAYER
        NAME "0232BC_23"
        DATA "0232BC_23.tif"
        TYPE RASTER
         STATUS ON
    END
END

any idea to make this work?


texts: Finding and deleting loop in line feature

texts:
I was trying to re-construct the topology in stream networks, but I found some loops in the raw datasets after the Feature To Line tool.
The red lines are background flowline, the blue/aqua lines are the flowline with loops.

Upon implementing the algorithm, I found out that there are some remaining loop even though I have removed many loops in the first run. (As a result, it seems to require an iterative approach.)

Is there any tool or algorithm to automatically remove one segment when loop occurs?
My initial thought is to use the start and end point location. If two line features share the same start-end or reverse, then one of them can be considered as a loop segment.
But apparently this is not enough because I also noticed these unresolved loops after the first run.

I tried to avoid using Arcpy because I want to do it across platform.
My first implementation is using gdal python api.


texts: How to export a Landsat 7 and 8 composite to a TIFF image into Google Drive?

texts:
I'm beginning with GEE and I have applied a code that allows me to make a composite between Landsat 7 and 8, the result is the calculation of NDVI, which I would like to export in TIFF format to Google Drive. I am stuck in this process, someone could help me on how to export these results?
I extract the code at the end of the composite and I can plot the result, I need to export it to TIFF.
l78_nocloud_nvdi = l78.qualityMosaic('NDVI')
l78_nocloud_median = l78.median()
l78_nocloud_getmapid_ndvi = l78_nocloud_nvdi.getMapId(l78_viz_params)
l78_nocloud_getmapid_median = l78_nocloud_median.getMapId(l78_viz_params)
mapdisplay(center,{'l78_nocloud_getmapid_ndvi':l78_nocloud_getmapid_ndvi,
                   'l78_nocloud_getmapid_median':l78_nocloud_getmapid_median})


texts:
I'm trying to train a model to predict landslide risk using DL. I'm not going to use the build-in tools in ArcGIS pro to train my model as I want to tweak the network myself. The problem is I'm not sure if I should just merge all my classification layers into one new raster and use it to train the model as it is, or do something similar to 'encoding' for my classified layers. I'm rather new to CNN models.
For example, let's say I have a vector layer with land use classification and there are 3 land uses in the vector dataset. Do I create 1 raster that has values "1, 2, 3" (or something similar) in its pixels representing every 3 land use, or do I create 3 rasters with pixel values "0, 1" where 1 means presence of a class and 0 means absence of it? If encoding is the solution, is there any tool in DL libraries to deal with this problem in 2 dimensions?


texts:
I am trying to add a legend, and it gets to the console.log, but it fails at on the line after it.

It does not show any errors saying it failed, but it wont continue past that line.

map[map_div_id] holds the map (we have multiple maps on the page).

Any Ideas?

//add the legend
dojo.connect(map[map_div_id],'onLayersAddResult',function(results){
  var layerInfo = dojo.map(results, function(layer,index){
    return {layer:layer.layer,title:index};
  });

  if(layerInfo.length > 0){
    console.log(layerInfo);

    var legendDijit = new esri.dijit.Legend({
      map:map[map_div_id],
      layerInfos:layerInfo
    },"legendDiv");

    legendDijit.startup();
  }
});


texts: Setting symbology based on attribute of 1-N table?

texts:
Now, it is possible to edit geographic features and add elements in child tables using 1-N relationships. I want to construct a stacked - symbology  which allows me to represent the multiple attributes.
For example if I have a line feature "linear park" and my linear park has a linked table (1-N)   called "users", i want a stacked or multi-level symbology (with some offsets) that allows me to depict all the "users" of that section of park.

Is it possible in QGIS?

I know it was possible in ArcGIS using relates.


texts: Finding later added data from two layers in QGIS or ArcMap?

texts:
I have two layers which consist of 2010 and 2011 years POI. And in QGIS I want to find which POI have been added new in 2011 data.

Or can we get result from ArcGis or any other tool?


texts: How do you speed up creating new field in attribute table for huge amount of data in QGIS?

texts: In my attribute table for a shapefile, I am converting one field (Julian day) to another field (date) using the field calculator but I'm working with about 7.7 million rows.  QGIS has been running for about 17 hours and is half way done.  Is there a way to speed up this process?  I have QGIS 2.14.19 Essen, not sure if upgrading to 2.18 would be faster.


texts: How to calculate mean coordinates from big point datasets?

texts:
I know there are several questions related to speed issues in QGIS, but I am having problems when running Ftools.

I have a vector with ~70,000 points in it. When I run the generate mean coordinates operation 99% of the time QGIS will crash. When QGIS chooses not to crash, it will take ~ 2 hours to generate the mean coordinates required.

Is there a way to speed up the process/prevent crashing?

Or would the best option simply be to leave the program running until it decides to respond again?

Thanks for your help.

e/ @James s shapefile format, 1.8.0 Lisboa


texts:
I try to export 30 different TIFFs from one TIFF and 30 layer of boundaries boxes
using QGIS.

Maybe someone has a hint for me?

Edit1:
I have a map in TIFF format and I need to export 30 different small areas from it in TIFF format.
I tired one by one from File menu, that works but I need it in batch format.
I tried to search some relevant information but I had no success.


texts: How to test for 'if arcpy.exists' with RemoveFeatureClassFromTopology stand-alone script?

texts:
I have some dataset topologies that I want to loop through, but I need to test for the assignment of feature classes so the scripts don't fail. (Using Win 7, ArcGIS 10.2, Python 2.7.5 and a file GDB)

My research hasn't turned up too much but using the 10.2 "Remove Feature Class From Topology (Data Management)", using ArcCatalog I can remove an existing fc from the topo set. If however I run the script 'stand alone' and the fc isn't currently assigned to the topology, the script fails. (Error shown below script)

I read this post (ArcMap remove feature-class from feature-dataset) as well but I don't want to delete the fc, I only want to remove it from the topo if it exists as I need it again later.

Am I going down the wrong path?

Using ArcCatalog, this succeeds if the fc exists;
topo = "C:/Data/Terrain_36/TOPO_EXPORT_2015_09_09_1_2.gdb/ZONES_1_2/TOPO_1_2"
fc = "RL_10"
arcpy.RemoveFeatureClassFromTopology_management(topo, fc)

# Running the script below as 'stand alone', fails if the fc isnt currently assigned;
# import modules
import arcpy, sys, os, datetime, traceback, string, time
from os import sep, listdir
from arcpy import env  as env

# This scripts name
script_name = os.path.basename(sys.argv[0])
# Create file prefix for unique file naming
prefix = datetime.datetime.now().strftime('%Y-%m-%d %H%M')
# Create file suffix for avoiding filenames staring with numbers
suffix = datetime.datetime.now().strftime('%Y-%m-%d %H%M')

# Set variables
Top_Dir = "C:/Data/Terrain_36"
td = Top_Dir
print "Top_Dir set to: '" +td+ "'" + '\n'
# Out_Dir = td+sep+ 'Exports'
# print "Out_Dir set to: '" +Out_Dir+ "'" + '\n'
Log_Dir = td+sep+ 'zz_logs'
print "Log_Dir set to: '" +Log_Dir+ "'" + '\n'
GDB_Nam = 'TOPO_EXPORT_2015_09_09_1_2.gdb'
print "GDB_Nam set to: '" +GDB_Nam+ "'" + '\n'
GDB_Home = os.path.join(td, GDB_Nam)
print  "GDB_Home set to: '" +GDB_Home+ "'" + '\n'

# Set the workspace environment
env.workspace = os.path.join(Top_Dir, GDB_Nam)
ws = env.workspace
print "Env.workspace set to: '" +ws+ "'" '\n'
topo = "C:/Data/Terrain_36/TOPO_EXPORT_2015_09_09_1_2.gdb/ZONES_1_2/TOPO_1_2"
fc = "RL_10"
if arcpy.Exists (fc):
    arcpy.RemoveFeatureClassFromTopology_management(topo, fc)

# My error messages
Log: 2015-09-14 11:48:32.722000
Begin process: Topo_script.py
 Process started at 2015-09-14 11:48:32.722000
 PYTHON ERRORS:
 Traceback info:
   File "C:\Data\Terrain_36\Data_quality\_Scripts\Topo_script.py", line 62, in <module> arcpy.RemoveFeatureClassFromTopology_management(topo, fc)
 ArcPy ERRORS:
 ERROR 999999: Error executing function.
 Cannot register as versioned on this database.
 Cannot register as versioned on this database.
 Failed to execute (RemoveFeatureClassFromTopology).


texts:
I'm using mapserver 6 with mysql 5.5. It work like a charme, almost...

The layer part of my mapfile is

LAYER
    NAME "monsatR_mySQL"
    TYPE POINT
    STATUS ON
    CONNECTIONTYPE OGR
    CONNECTION "MYSQL:monasteres,host=1.1.1.1,port=3306,user=Foo,password=p4ssW0rd"
    DATA "SELECT a.*,b.id_etab,b.nom_usuel FROM t_geom_points as a LEFT JOIN t_etab as b ON a.id_etab = b.id_etab"
    DUMP TRUE ## REQUIRED

    METADATA
      "wfs_title" "monastR" ##required
      "wfs_srs"    "EPSG:4326" ##REQUIRED
      "gml_include_items" "all" ## Optional (serves all attributes for layer)
      "gml_featureid"     "FID" ## REQUIRED
      "wfs_enable_request" "*"
      "wfs_getfeature_formatlist" "OGRGeoJSON"
    END
    PROJECTION
      #"init=epsg:3857" ##recommended
      "init=epsg:4326"
    END
    TRANSPARENCY 50
    CLASS
      NAME "monastR français"
    END
  END #LAYER

As you can seen, the output is a geoJson. My problem come from nom_usuel column where some characteres are single quote like Saint-Pierre de l'Isle... Single quote are misunderstand in geoJson ...

How can I escape single quotes ?

I have seen some information in the mapserver documentation, but I'm not able to build the solution!

As Laurent Jégou proposed I have tried with SELECT a.*,b.id_etab,REPLACE(nom_usuel, '\'',chr(39)) FROM t_geom_points as a LEFT JOIN t_etab as b ON a.id_etab = b.id_etab

But it returns

<ows:ExceptionReport version="1.1.0" language="en-US" xsi:schemaLocation="http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd"><ows:Exception exceptionCode="NoApplicableCode" locator="mapserv">   <ows:ExceptionText>msWFSGetFeature(): WFS server error. ms_error->code not found
msOGRFileOpen(): OGR error. ExecuteSQL(SELECT a.*,b.id_etab,REPLACE(nom_usuel, ''',chr(39)) FROM t_geom_points as a LEFT JOIN t_etab as b ON a.id_etab = b.id_etab) failed.
MySQL error message:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''',chr(39)) FROM t_geom_points as a LEFT JOIN t_etab as b ON a.id_etab = b.id_e' at line 1 Description: SELECT a.*,b.id_etab,REPLACE(nom_usuel, ''',chr(39)) FROM t_geom_points as a LEFT JOIN t_etab as b ON a.id_etab = b.id_etab
msOGRFileOpen(): OGR error. ExecuteSQL(SELECT a.*,b.id_etab,REPLACE(nom_usuel, ''',chr(39)) FROM t_geom_points as a LEFT JOIN t_etab as b ON a.id_etab = b.id_etab) failed.
MySQL error message:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''',chr(39)) FROM t_geom_points as a LEFT JOIN t_etab as b ON a.id_etab = b.id_e' at line 1 Description: SELECT a.*,b.id_etab,REPLACE(nom_usuel, ''',chr(39)) FROM t_geom_points as a LEFT JOIN t_etab as b ON a.id_etab = b.id_etab</ows:ExceptionText></ows:Exception></ows:ExceptionReport>


texts: SLD PointSymbolizer remove offset in legend?

texts:
I'm trying to style a point layer with map markers using GeoServer, so that each marker points to the geometry it represents. The markers are a variation of the droplet-type icon that has become common place in web-based mapping, e.g. https://commons.wikimedia.org/wiki/File:Map_marker.svg

As far as I can tell the options are either:

Use <se:Displacement> to move the SVG marker. This is how the SLD produced by QGIS handles things, however by displacing the marker it disappears in the GetLegendGraphic response.
Use an offset transformation (in map coordinates) on the point. This doesn't work to reliably position the marker.
Uploading a static legend image to GeoServer. This has the side-effect that the width and height parameters in the GetLegendGraphic resize the entire image, and not individual symbols.
Using an SVG marker image with extra padding, so that the pointy end of the marker is in the symbol's center. This results in the marker and its label not being aligned in the GetLegendGraphic

It feels like I'm overlooking something somewhere. How can I offset a marker from its point but keep it visible in the legend?


texts: Getting text to center in a label expression

texts: Is there an expression that can be entered in the label expression that will force text to center?  Such as the ones used to change case/replace/etc.


texts:
I have created a connection between QGIS (ver. 3.10.1-A Coruña) and PostgreSQL (pgAdmin 4).

Every time I edit/update my table in QGIS I have to delete the table in PostgreSQL and re-import again the updated table from QGIS.

How can I update the table without deleting it?


texts:
I am planning to use R to read hyperspectral images and calculate hyperspectral indices. There seems to be scripts available online, but mostly for multispectral images. For instance, this code for NDVI uses only two bands:

VI <- function(img, k, i) {
          bk <- img[[k]]
          bi <- img[[i]]
          vi <- (bk - bi) / (bk + bi)
          return(vi)
        }

 #knowing the band numbers for k(5) and i(3), the NDVI is:

 ndvi <- VI(hyper_image, 5, 3)

My dilemma is: I use a hyperspectral image with 100 bands.  The above code becomes inefficient because I want to use all 100 bands in the formula.

#if, for example, these are my 100 bands: k, i, j, n, m, o, p, ....

#And just for the sake of illustration, this is a sample equation:

vi <- (bk + bi + bj + bn + bm + bo + bp + ....) / (bk + bi + bj + bn + bm + bo + bp + ....)

return(vi)

hyper_index <- VI(hyper_image, 5, 3, 6, 7, 8, 9, 1, ...)

#Obviously, doing this is excruciating!

Can someone point me to existing R code for this procedure?


texts: Loading raster data into postgis database

texts:
i would like to add raster data to my postgis database. when i try to check if postGIS is responding to requests using the following command psql -c "SELECT PostGIS_Version()" ,i get an error message saying:

  psql: FATAL: role '"blessy" does not exist.

I'm on a 64-bit windows7 os.


texts: How can I use the ArcGIS JavaScript API along with a separate version of Dojo?

texts:
I am using the ArcGIS API for JavaScript in my application which is being developed using IBM WebSphere Portal.

When I integrate ESRI with my HTML code it works fine but when I load the ArcGIS JavaScript API which also loads Dojo which is heavily used in my application breaks.

My application was developed with Dojo 1.7 but since i am using ArcGIS JavaScript API version 3.6 which loads Dojo 1.8.3 I find there are a few issues. Sometimes things work and sometimes everything fails.

I get 'this.navigationManager' is null or not an object in IE and Firefox, while on Chrome I get a different issue pointing to init.js.

I am not able to figure out what could be the issue. Does anyone have any ideas?


texts: Warning message when using read.zoo function in R

texts:
I have dataset (ndvi_bfast) that contains index daily mean covering about 998 days (2002-2020) . It looks like:
 date    mean
     <dbl>   <dbl>
1 20020112  0.471
2 20020112  0.483
3 20020112  0.333
4 20020121 -0.0928
5 20020121  0.209
6 20020121  0.0927

I am trying to convert the data frame into zoo object using read.zoo(ndvi_bfast) (read.zoo is a function in zoo package).
z<-read.zoo(ndvi_bfast,format = "%Y-%m-%d",tz="", FUN=NULL, regular = FALSE)

However it gives me the following error:
In zoo(ndvi_bfast, order.by = timeIndex) :
  some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique.

How can i solve this problem?


texts: Handling UK Date/Time Format for Animation in ArcGIS

texts:
I am attempting to make a time animation in ArcGIS of measured field data across a continuous sequence of 1Hz spatial sampling.

My data are a series of XY points with assigned datetime, lat, long and a measurement which plots nicely in ArcMap (version 10.4.1). However, I have a time variable displayed in the format of "DD/MM/YYYY HH:mm:ss". This format does not allow for time animations to work, creating just 2 timestep keyframes. Although I have tried to re-work the date format to something ArcMap can handle, the Convert Time Field outputs YYYYMMDD000000 for all values with all time as zeroes. The issue is I need the data in seconds (1Hz) for a proper animation.

Can anyone recommend how to handle this date format or how to use the animation tool to get what I want (continuous track of collected 1Hz data)?


texts: Hillshade effect not working when no data is on screen

texts:
I'm working on a DEM and I selected hillshade effect to be active.
The problem is that I can't get it to appear when a no-data area is shown on my screen.
If I move the area just enough for the no-data area to disappear from my screen then hillshade works just fine again.
I couldn't find a setting to correct that. I also tried to color the no data area but that didn't change the result.


texts: Custom forms and Python logic: attribute error

texts:
As a beginner to Python, PyQt4, AND QGIS, I am attempting to work with the custom forms feature in QGIS. At this point I'm not sure if my error comes from the code or the .ui. This blog gave me a great head start, but i'm still pretty lost: http://woostuff.wordpress.com/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/

    from PyQt4.QtCore import *
    from PyQt4.QtGui import *

    Naturefield = None
    Diametrefield = None
    myDialog = None

    def formOpen(dialog,layerid,featureid):
        global myDialog
        myDialog = dialog
        global Naturefield, Diametrefield
        Naturefield = dialog.findChild(QLineEdit,"Nature")
        Diametrefield = dialog.findChild(QLineEdit,"Diametre")
        buttonBox = dialog.findChild(QDialogButtonBox,"buttonBox")

 # Disconnect the signal that QGIS has wired up for the dialog to the button box.
        buttonBox.accepted.disconnect(myDialog.accept)

# Wire up our own signals.
        buttonBox.accepted.connect(validate)
        buttonBox.rejected.connect(myDialog.reject)

    def validate():
# Make sure that the Nature field isn't empty.
        if not Naturefield.text().length() > 0:
            msgBox = QMessageBox()
            msgBox.setText("Champ Nature peut pas etre null.")
            msgBox.exec_()
        if not Diametrefield.text().length() > 0:
            msgBox = QMessageBox()
            msgBox.setText("Champ Diametre peut pas etre null.")
            msgBox.exec_()
        else:
    # Return the form as accpeted to QGIS.
            myDialog.accept()

However, I'm getting an attribute error and cannot figure out why. Anyone willing to take a look?

    if not Nature.text().length()>0:
    AttributeError: 'unicode'object has no attribute 'length'


texts:
Can anybody tell me whats the syntax error in the following python command,

arcpy.ManageTileCache_management("H:\FV","RECREATE_ALL_TILES",”Visible”, "H:\FV\MosaicData.gdb\FVImages", "IMPORT_SCHEME", , "#", "H:FV\Bound.shp", "#", "4224470", "1128.497176")


texts: error while running a geoprocessing service using IGPServer

texts:
I getting the " the remote procedure call failed "error message while running the following code....

enter code here //Here i am getting the polygon geometry from one featureclass......
           IGeometry queryGeom = getBasinGeometry(queryBasin);

            pservContext = SOM.CreateServerContext("ReportGen/buffer_clip", "GPServer");
            IGPServer pgpServer = pservContext.ServerObject as IGPServer;

            string taskName = "State_Clip";

            IGPToolInfo task = pgpServer.GetToolInfo(taskName);
            IGPValues taskValues = (IGPValues)pservContext.CreateObject("esriGeoprocessing.GPValues");
            IGPParameterInfos paramInfos = task.ParameterInfo;
            IGPParameterInfo paramInfo = null;
            string parameterStr = string.Empty;

            for (int i = 0; i < paramInfos.Count; i++)
            {
                paramInfo = paramInfos.get_Element(i);
                taskValues.Add(paramInfo.Value);
                //add to parametername strin.....
                parameterStr += paramInfo.Name;

                if (i != paramInfos.Count - 1)
                {
                    parameterStr += ";";
                }
            }

            //Now start assigning input values....
            IGPRecordSet gprecSet = (IGPRecordSet)taskValues.get_Element(0);
            IQueryFilter qf = pservContext.CreateObject("esriGeodatabase.QueryFilter") as IQueryFilter;
            gprecSet.RecordSet.Table.DeleteSearchedRows(qf);

            IRecordSet rs = gprecSet.RecordSet;
            IFields flds = rs.Fields;
            int shpIndx = flds.FindField("SHAPE");
            IField fld = flds.get_Field(shpIndx);
            ISpatialReference inputrs = fld.GeometryDef.SpatialReference;
            IRecordSetInit rsi = (IRecordSetInit)rs;
            ICursor cur = rsi.Insert();
            IRowBuffer rb = rsi.CreateRowBuffer();

            IPolygon iplgon = (IPolygon)pservContext.CreateObject("esriGeometry.Polygon");
            iplgon = queryGeom as IPolygon;

            //IPoint ipnt = (IPoint)pservContext.CreateObject("esriGeometry.Point");
            //ipnt.PutCoords(4099805.666, 3444416.24);
            //rb.set_Value(shpIndx, ipnt);

            rb.set_Value(shpIndx, iplgon);

            //exception is occuring here..........
            cur.InsertRow(rb);

If i run a same kind of tool with esriGeometryPoint datatype as Input featureset, Working fine. But the problem is only with polygon data type.

Any suggestion will be useful

Thanks
Srinivas...............


texts:
I would like to use the following wiki US Map schematic as a background to my map work. (http://en.wikipedia.org/wiki/File:Blank_US_Map.svg)
It is a .svg file, and GeoReferencer is unable to import it.

I convert it to it to a .tiff through cloudconvert.com
I successfully import to GeoReferencer
I pick corresponding coordinates to situate my map, and use NAD83 as reference
Import in QGIS

=> PROBLEM: The map I have is distorted on QGIS (flattened)

What am I doing wrong?
Should import in georeference in .svg ? (IF so what plugin to install since it is unable to import).
Should I reference more coordinates ? (>10)
Is there a setting I am missing?
Am I using the wrong map?

I imagine many have had to import US map schematics in their QGIS, and face the similar challenge.


texts: Java library for reading geojson from MySQL

texts:
I am looking for a way to retrieve mysql geometry data as geojson from the database either using a java library or for converting wkt to geojson using either java or javascript.

Currently I am doing a lot of string manipulation and regular expression matching to accomplish this.I am using the Google Maps V3 Javascript API as the mapping solution.

My setup is very simple,I use Java Servlets to load JSP pages and recieve AJAX requests.
I write and read data from a column of type geometry using a mysql database using InnoDB as my mapping engine.I am using the mysql-connector to insert/query data from the database using Java.I use the Data layer on Google Maps v3 Javascript API to render data as geojson.

Thanks in advance for your assistance.


texts: ArcPy converting polygons to polylines without Advanced license

texts:
I am trying to convert polygons to polylines in ArcGIS Pro using ArcPy. I do not have the license so I cannot use the tools that do the job. Due to the way things are set-up for now I cannot use QGIS or GRASS GIS modules. I am basically restricted to ArcPy and would prefer not to use other modules that have to be installed / imported to ensure functionality across different working stations.
The manual workflow as provided by Esri: https://support.esri.com/en/technical-article/000018461
I cannot find a way to populate my newly created Polyline feature with the data from the Polygons.
My function so far (I work with shapefiles):
def PolygonToLine(inFC, outPath, outFC_Name):

# Set local variables
   geometry_type = "POLYLINE"
   template = inFC
   has_m = "DISABLED"
   has_z = "DISABLED"
# Use Describe to get a SpatialReference object of input
   spatial_reference = arcpy.Describe(inFC).spatialReference

#Execute CreateFeatureclass
   arcpy.CreateFeatureclass_management(outPath, outFC_Name, geometry_type, template, has_m, has_z, spatial_reference)

#initiate output (note; shapefile)
   outFC = outPath+"/"+outFC_Name

#populate Polyline feature class
   arcpy.Copy_management(inFC, outFC)

The result of this is just a copy of my polygon features and an empty Polyline feature dataset.
Any ideas?


texts: Incorporate treeline in viewshed analysis

texts:
I have performed a bare-earth viewshed analysis of a roadway corridor using a DEM, but upon further inspection on Google Streetview, realize that part of the road has dense trees along it.  I need to figure out a way to incorporate this treeline into the analysis. It seems that the OFFSETB field will accomplish what I need: "The OFFSETB item indicates a vertical distance in surface units to be added to the z-value of each cell as it is considered for visibility." The steps I would follow would be:

1) Segment the observer line feature for where trees are located

2) Add an OFFSETB field and add a value of 10m for the treeline segment

Am I understanding the OFFSETB function correctly?


texts: Creating graduated symbol classification based on values from multiple columns?

texts:
I have three columns of data, each contains data of a different year

Y2015   Y2016  Y2017
131     234    234
442     490    234
1231    543    123
1231    888    111
123     3333   333

I would like to apply graduated symbols with the "Quantile" mode to the map, and classify the symbols based on values from all three columns, i.e. but it seems that QGIS only allows me to do it based on one selected column.

I cannot adjust the ranges manually either, since I don't know how to calculate the "Quantiles"in Excel.


texts: Creating new point features from count number of existing features using ArcMap

texts:
I have point features with coordinates, but some of those points have multiple observations at the same coordinate. I put those as a count column in the attribute table. But now I need to do a spatial join to count the number of points in polygons, but I need those points that have high counts to be included in the spatial join count of number of points in each polygon.

Just to clarify: The attribute table consists of multiple species at multiple coordinates. But for some of those records there were many individuals of the same species at that coordinate so that info was inputted as a count column for each observation. Some counts go up to 10000 individuals. I was initially thinking to just copy the record and paste it as a separate record for the number of counts there are but that takes too long.


texts: Converting TAB-files coordinate system with QGIS?

texts:
Is it possible to convert MapInfo TAB-files from one coordinate system to another with QGIS?

I managed to do the conversion from tab-files to shp-files so that the coordinates were converted correctly, but when I tried saving the files from tab to tab, the x-coordinate was destroyed, and all the features showed up in one vertical line. Is it possible to do the conversion properly?


texts:
I am using Windows 10 and QGIS 3.10.5.

I had this issue a few days  and thought I had fixed it by cleaning the Registry.

However, it has re-occurred.

I load a pdf into the Georeferencer.

I reference the pdf at a few points and process it to overlay the tiff on my base map.

The output is so garbled as to be unusable. (see image) The image is simply a series of black and white lines of variable width across the image.

The first time this occurred I "fixed" it by cleaning out all the relevant appdata files, by cleaning some Qgis material from the registry and by unistalling and reinstalling etc. I used the georeferencing process a few more times on a different map and it was brilliant.

However, it has reappeared when I have started a new map. In this case I did a number of iterations (5-6) of georeferencing on the same pdf to try and improve the accuracy. In one of these iterations the problem popped up again.

So far, even going back through all the steps I took the first time, I cannot fix the problem.

What caused it this time? The error seems to be associated with iterations of georeferencing of the same pdf and saving to the same file.

I am obviously going to keep trying to rid myself of the issue, but this time, despite the cleaning I have done, nothing has changed so far.

I am a brand new user and no computer expert and I am still very much in the early days of trying to understand this program.

I would appreciate any advice.

Richard


texts: Internal server error from ArcGIS for Android sync?

texts:
I am trying to use server based offline maps to do all my edits offline and sync them to the server online. I am able to do all my edits usccessfully. However, when I am doing sync using the geodatabaseSyncTask.syncGeodatabase() call, everytime I see, "Internal Server Error".
Can somebody let me know if this is an issue at my end or the service end?

geodatabaseSyncTask.syncGeodatabase(syncParams, localGdb, statusCallback, syncResponseCallback);


texts: Styling a heat map based on point attribute, not density

texts:
I have a point dataset generated from getting the centroid points from a fishnet/polygon grid. I combined these points using a spatial join to give them an attribute of 'pressure' which is an integer value.

In either qgis, postgis or cartodb (i.e. using CSS styling options) is there any way to display these data as a heatmap with the heat generated by the pressure value rather than the point density?

I've already made a map with graduated symbols based on the pressure but i'd like a more traditional heatmap view.

A workaround I had been thinking about was to put a proportional number of points in each polygon in the grid and generating a standard heatmap of point density but this doesn't seem like a very efficient method so I want to rule out other options first.

Another thought I had was to try and draw best fit contour lines and styling them appropriately but I wasn't sure if I could use a point vector input to create contour lines like this.


texts: Register view with geodatabase fails (view selects table from different user)

texts:
I have two users/schemas in an Oracle 18c geodatabase (10.7.1):

USER_A
USER_B

Scenario 1:

I can create a view in USER_A:

SELECT * FROM USER_A.TEST_TBL.

I am able to successfully register the view with the geodatabase.

Scenario 2:

I can create a view in USER_A that selects a table from a different user:

SELECT * FROM USER_B.TEST_TBL.

When I try to register the view with the geodatabase, I get an error:

ERROR 999999: Error executing function
Underlying DBMS error
Failed to execute (RegisterWithGeodatabase)

999999 : Something unexpected caused the tool to fail. Contact Esri
Technical Support (http://esriurl.com/support) to Report a Bug, and refer
to the error help for potential solutions or workarounds.

Why do I get this error?


texts:
I have a TIFF file which I am trying to plot on tkinter canvas using the following code:

import tkinter

from matplotlib.backends.backend_tkagg import (
    FigureCanvasTkAgg, NavigationToolbar2Tk)
# Implement the default Matplotlib key bindings.
from matplotlib.backend_bases import key_press_handler
from matplotlib.figure import Figure
import matplotlib.pyplot as plt

root = tkinter.Tk()

fig = Figure(figsize=(5, 4), dpi=100)

canvas1 = FigureCanvasTkAgg(fig, master=root)
canvas1.draw()

toolbar = NavigationToolbar2Tk(canvas1,root)
toolbar.update()
toolbar.pack(side=tkinter.TOP, fill=tkinter.X, padx=8)

canvas1.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=1, padx=10, pady=5)

canvas1._tkcanvas.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=1, padx=10, pady=5)

def on_key_press(event):
    print("you pressed {}".format(event.key))
    key_press_handler(event, canvas1, toolbar)

canvas1.mpl_connect("key_press_event", on_key_press)

def _load():
    import rasterio as rio
    from rasterio.plot import show
    ax = fig.add_subplot(111)
    fig.subplots_adjust(bottom=0, right=1, top=1, left=0, wspace=0, hspace=0)

#    fig.tight_layout(pad=0)

    with rio.open(r'C:\Users\Desktop\t1.tif') as src_plot:
        show(src_plot, ax=ax, cmap='gist_gray')
    plt.close()
    ax.set(title="",xticks=[], yticks=[])
    ax.spines["top"].set_visible(False)
    ax.spines["right"].set_visible(False)
    ax.spines["left"].set_visible(False)
    ax.spines["bottom"].set_visible(False)
    canvas1.draw()

button = tkinter.Button(master=root, text="Load", command=_load)
button.pack(side=tkinter.BOTTOM)

root.mainloop()

Issue is that the raster/tiff file is getting plotted on the tkinter canvas, but it is placed inside the matplotlib figure window whose size is not equal to tkinter canvas size. And hence if I am panning the figure inside the canvas, it is only moving inside the window and not across the canvas (as it used to be in ARCMAP/QGIS). Can someone help me out in resolving the issue.

Any help would be of great help.


texts: How to add map layers from Oracle database VIEWS in MapServer mapfile?

texts:
I am using MS4w v 3.0.3 (with Java mapscript) with Oracle Spatial 11g. Can we add layers to MapServer mapfile from oracle database views? If yes, is there any specific way to create views with spatial column for mapserver mapfile?

I am getting the following error when I try to add a layer from a view : Exception in thread "http-bio-8080-exec-1" java.lang.UnknownError: msDrawMap(): Image handling error. Failed to draw layer named 'amplifier'.;msOracleSpatialLayerWhichShapes(): OracleSpatial error. Error: ORA-13226: interface not supported without a spatial index.

Regards,
Shiva


texts: Selecting features by attributes using ogr2ogr?

texts:
I am writing a shapefile after some processing; however, in the final step I need to do some selection by attributes from the the shapefile.

I am using the command in a shell with the aim of using it in a Python script when it works.

ogr2ogr -f "ESRI Shapefile" -select * where ID="1" outfile.shp infile.shp

I am getting the error message:

FAILURE:
Unable to open datasource `Downloads' with the following drivers.

What could I be doing wrong?


texts: Generating new model by altering existing metadata in ArcGIS Desktop?

texts:
I've got a metadata set for a specific geographic area (A).  The datasets used in the metadata are all based on generic data.

Is it possible to generate a similar model for a different geographic area (B) using the same metadata?

How would I go about replacing the datasets from area A with that of area B?

I'm fairly new to GIS.


texts: QGIS Create Map for Each Attribute using Python

texts:
I'm new to GIS and QGIS. I've looked through several of the related questions including here and here, but can't figure out a simple way to automate creating choropleths for each attribute in a shapefile using QGIS but strictly from Python. I figured this was a relatively common use case.

I gave up after about four or so hours of trying to figure it out and wrote this simple code that produces the ~300 pngs that I need:

import geopandas as gpd
import matplotlib.pyplot as plt

sp = gpd.read_file(<shapefile filename goes here>)
column_list = sp.columns.values
for i in column_list:
    sp.plot(column = i, cmap='Blues', alpha=1, legend=True, linewidth=0)
    plt.savefig(i +'.png', dpi=600,bbox_inches='tight')

Again this works fine for what I needed, but is there an implementation in QGIS? I'd like to get better with this software/package.


texts: Seeking shapefiles for New Zealand Cities and Suburbs/Neighbourhoods?

texts:
I'm trying to find some shapefiles (administrative boundaries) of New Zealand CITIES and SUBURBS/NEIGHBOURHOODS.

I've found some boundaries for the Country, Regions, Districts (not useful for me) .. but not cities and suburbs.

Can anyone lead me in the right direction, please?


texts: Digitizing in stream mode in QGIS using a tablet

texts:
How can I digitize in stream mode in QGIS, using a wacom cintiq tablet?
Freehand it's no use. I need something like MNDR stream digitizing extension for ArcView 3.x, which allows continuous tracing, append polygons, split features, etc.


texts: Displaying Images in an Image Coordinate System

texts:
I'm trying to programmatically do what's explained here. ('Focus on Image' to display an image in the Image Coordinate System.

I'm using a mosaic Layer to load an oblique dataset.
Currently I'm able to access a selected feature by getting the feature with:

ICompositeLayer compositeLayer = mosaicLayer as ICompositeLayer;
IFeatureLayer featureLayer = compositeLayer.Layer[1] as IFeatureLayer;

IFeatureSelection featureSelection = featureLayer as IFeatureSelection;
ISelectionSet2 selectionSet = featureSelection.SelectionSet as ISelectionSet2;

ICursor cursor = null;
selectionSet.Search(null, true, out cursor);

IFeatureCursor featureCursor = cursor as IFeatureCursor;
IFeature feature = featureCursor.NextFeature();

and zooming to it with the answer from zoom to geometry

From here I would like to now view the selected feature's image in ICS.

This is currently only one aspect of what I'm trying to do with ArcObjects, which is make an add-in for Oblique display for Desktop.

Anything that would be helpful to first, display an image in ICS or to navigate an display Oblique Imagery using ArcObjects for ArcMap would be helpful

Using a selected footprint of a mosaicLayer How can I display the associated image in the Image Coordinate System?

Also, do I need to first load the raster from the selected footprint/FeatureLayer?


texts: Converting dates in a CSV file into Seasons?

texts:
I'm very new to MongoDB and clear with the basics but got stuck at a point.

I'm working in MongoDB with a CSV file. In it, there's a column called 'Issue Date'. Some dates are represented as MM/DD/YYYY, the others as MM-DD-YYYY. I read in the documentations that MongoDB accepts the hyphen format(?). I don't know if I'm in the right direction, though.

Then, I have to divide them all into Seasons for NYC.

The CSV can be found here


texts: Does anyone know of real-time weather (temp and precip) data for the US that I can bring into ArcGIS online as a layer and also download as a csv?


texts: Setting default ArcGIS Pro Measure Distance value?

texts: How do I set the Measure Distance tool default value to feet instead of Imperial in ArcGIS Pro?


texts: CMV Geocoder widget - adding a location symbol

texts: Is there a geocoderOption to have a symbol dropped on the map for a location searched for with the CMV Geocoder widget?


texts:
I have an XML feed of road conditions that needs to be linked to a roads layer in an Esri web map. The web map should be built with Portal for ArcGIS. (Though other suggestions/approaches are welcome!)

Can anyone provide guidance on how to accomplish this?

The XML data is:
http://hotline.gov.sk.ca/cgi-bin/atom/atom.py?key=92ddd862335b48e494c98f38249a0ee6


texts: How do I delete a non-empty Workspace and its corresponding Namespace with the Geoserver ( 2.10.2 ) REST API

texts:
http://docs.geoserver.org/stable/en/user/rest/api/workspaces.html

When I try to send a delete request to http://mygeoserver/rest/workspaces/my_workspace, I get Namespace for workspace not empty., even if I add the parameter recurse=true which is supposed to  deletes all layers referenced.


texts: Does changing raster image type from .img to .tif change quality?

texts:
I have a DEM raster image in .img format.  I am thinking about converting it (through Export Data in ArcMap) to the .tif format.

Will that change the quality or any pixel values?


texts: Visualize challenge: show origin of aggregated minimum r.series job

texts:
Using r.series with the aggregate minimum option I'm merging multiple viewshed results to visualize how much vertical space a development area has for new buildings. Meaning that a part of the height limitation comes from raster1.tif while the height limitations for another part of the area could come from raster2.tif etc.

Currently I'm classifying the merged results for every 4th meter and coloring it different color so that the reader can understand how much space there is left. This is a working product that fills it's purpose, BUT:

My question is if it's possible to create a compliment map that doesn't care about the actual raster values but rather visualizes the origin of the merged results? Or put in other words: can I style the raster so that values extracted from raster1.tif gets one color and values from raster2.tif another color?

I've been elaborating with a merge that stacks the input layers in different bands but haven't been able to set the color for more than three bands simultaneously, and also the aggregate minimum function is also missing in this attempted solution.

I'm currently using QGIS but also have access to FME, Arc, Mapinfo and PostGIS.


texts: Is it possible to view all the attribute data in QGIS

texts: I use QGIS to map and store local history data. Because of this my point attribute data contains a lot of text. Since the textbox are so small it's hard to use and present the information. Is it possible to view this data in a way simular to Google Earth?


texts: Straight Lines from Label to Feature in QGIS?

texts:
What I’m trying to do is label a series of point features but due to the density of point features I’m going to have to move the labels away from the point features. I then want to use a simple straight line (not an arrow) to show which label refers to which point.

I’ve used the plugin “Easy Custom Labels” to generate the labels and move them to where I want them. But what I’m unable to do is create a simple thin straight line between the point and the table.

The best I’ve achieved is to change the “symbol layer type” (Labels layer > Properties > Style) to “arrow”, uncheck “curved arrows” and uncheck “repeat arrow on each segment”. And then make the head length and thickness 0 and make the “arrow width” and “arrow width at start” as this as possible. But this still creates a chunky line. See image A.

I’ve tried setting the “symbol later type” to “simple line” but this results in lines with kinks/vertices/corners in them. See image B.

Ideally, I’d like straight lines between the labels and the feature (like in image A) that are a similar width to those in image B.


texts: Adding elevation data to a georeferenced image from TIN?

texts:
I have a georeferenced image/tiff and a TIN layer (created from elevation line fc), and want to add the elevation data from the TIN to the image. How do I do this?

I know I can float the image over the TIN, but can I add the elevation values to it also?

I use ArcGIS 10.3


texts: Data flips N/S orientation when projecting from GCS WGS84 to PCS Hartebeesthoek94/LO25

texts: I need to populate area field for a property layer in South Africa, but to do so I have to project the data from WGS84 to Hartebeesthoek94/LO25, a standard projection for South Africa which is avaliable in the QGIS CRS list.  When I do so, the data becomes completely flipped in North/South orientation.  Is this a known bug and can I edit the Y axis definition in the CRS to fix this?


texts: Multiple image data publishing services and controls using GeoServer?

texts:
A project needs to manage massive image data (like satellite images), and publish it as a service for use on the web side, and control the display of some part of the image on the web side. Tessellation data sets can solve this requirement. My current idea is to publish each image as a layer, packaged as a group of layers. The data volume is in the millions.

How many layers can the geoserver service support at most?