texts: PostGIS - Need to convert Integer type X/Y coordinates to decimal lat/lon

texts:
I am working on a data warehouse project. I need to load a XML file information to our data warehouse. This file contains geographic information:

<geocodificacio x="31008099" y="85478573"/>

Our data warehouse has two columns for lat lon but they are in decimal (float) data type. I need to find a way to convert this integer values to float.

I tried using PostGIS to archieve this but no luck.

Edit: Basically what I need is to obtain decimal values from those integer values. For example:

<geocodificacio x="31008099" y="85478573"/>

This coordinates are in WGS84 format and point to Ronda Guinardo in Barcelona:

https://www.google.es/maps/place/Centre+C%C3%ADvic+Guinard%C3%B3/@41.416402,2.1701573,17z/data=!3m1!4b1!4m5!3m4!1s0x12a4a2cc158f101f:0x215a1deee2ad8d8e!8m2!3d41.416402!4d2.172346

So I need a way to figure how to convert:

x="31008099" to 2.172491
and
y="85478573" to 41.416455

Any ideas?

Edit2: The dataset is this and as you can see on the webpage, the reference system used is ED50:

http://opendata-ajuntament.barcelona.cat/data/en/dataset/agenda-mensual/resource/2469d688-6056-48cb-a043-8cd8587f6890

API Info: http://opendata-ajuntament.barcelona.cat/es/api-cataleg

Another API Document: https://www.decodeproject.eu/file/203/download&usg=AOvVaw26is6a2BCF_rQkvMA-iDK6

This last document points to a custom transformation formula from ED50 to WGS84:

Coordinates conversion Custom ED50 to WGS84:
ED50(long_iris / 1000 + 400000, lat_iris / 1000 + 4500000)

But it doesn´t work either.

I tried using PostGis ST_Transform to obtain lat lon based on ED50 but no result. I suppose that UTM Zone is 31T (Barcelona)


texts: Choosing the right parameters to interpolate a DEM from contours

texts:
I have a 5 meter interval contour lines feature class which I would like to interpolate to a DEM.

I am well aware of at least 2 tools ("tin to raster" and "topo to raster") which can help me with that. To produce the proper DEM I need to define first its purpose.

Long story short - I need to track the progression\advancement of small streams (AKA: gullies). They are typically 1 meter wide and 2 m long. My algorithm which will be using the DEM as a basis, must have as much as accurate DEM as possible. How accurate? - detailed enough to see an advancement of a 30 cm length for example.

To do that I must interpolate (from the mentioned above contours) a most pleasing DEM.

The questions is: what course of action would you suggest me to implement? How can I choose the correct parameters?

I know trial and error would be the most advisable answer, yet there are so many parameters (smoothing, cell size, method type, enforce drainage, tolerance) to consider it might take me weeks until I get the correct DEM.


texts: Georeference single drone image from EXIF data

texts:
Looking for an algorithm (python, formulas, whatever...) to georeference a single drone image based on its EXIF data.
Specifically, I need to translate drone GPS latitude and longitude (after conversion to projected coordinates, of course), relative altitude, drone camera orientation (pitch, roll, yaw), and drone sensor parameters (sensor size and focal length) to ground coordinates of the centre and four corners of the drone image.

I'm comfortable assuming flat terrain, so this would be independent of the DEM, and recognize measured GPS coordinates will have imprecisions affecting the results too.
I'm aware that commercial UAV mapping software and services, such as Pix4D, DroneDeploy, and MapsMadeEasy.com, solve the much more complicated problem of stitching many such images together and extracting 3D terrain information, including dealing with those imprecisions. I'm looking to solve the much simpler problem of "what is this one image looking at, more or less".
Based on Getting coordinates of pixel from georeferenced drone photo?, I've also started looking at literature about "monophotogrammetry" and "monoplotting" (example: https://www.wsl.ch/en/services-and-products/software-websites-and-apps/monoplotting-tool.html), but the emphasis seems to be on interpolation of features/lines on the photo after manually identifying GCPs. In this context, I'm after the math to approximately but automatically identify the corners only.
I've dusted off my geometry and trigonometry knowledge, and can do simple cases with simple formulas. For instance, ignoring roll and yaw, the centre of the photo is (I think!) the following distance in front of the drone's GPS location, and likewise the horizontal field of view at the centre:
fwd_dist_img_ctr = altitude * tan(-pitch)
ground_fov_img_ctr = hypotenuse(altitude,fwd_dist_img_ctr) * sensor_width / focal_length

I'm hoping for leads how to extend this to a) the four corners of the image, and b) incorporating roll and yaw, and therefore camera direction (bearing) too.
Adding: seems this is embedded in GRASS' i.ortho.photo (https://grass.osgeo.org/grass78/manuals/i.ortho.photo.html), but buried behind a GUI focused on GCPs, correction, and stitching a map from multiple photos. I'm looking for the minimally complicated math to do it automatically, per single image.
Eventually, this will be used to visualize a layer of research drone photos on a map by the ground footprint displayed, rather than by GPS location of the drone/sensor itself. Probably as a processing algorithm in QGIS after extracting all of the pertinent EXIF tags as attributes.


texts: Imagery on March 6, 2014 @ Lat 42dd55'22" N, Long 079dd37'36" W

texts:
I am looking for any advice where to find imagery on March 6, 2014 (or a few days following) for:

I have searched the USGS, ImageHunter, and Digital Globe with no luck.

Does anyone have a resource where I can find imagery for Dunnville Ontario on March 6, 2014?

There was a fire on this day and I am looking for before/after imagery. See this article by the hamilton spectator about the fire.

Dunnville ‘in shock’ over Rosa Flora fire


texts: Copying geometry (not attributes) from feature in layer 1, to a feature in layer 2

texts:
Having trouble copying the shape of a polygon in a parcels layer feature to the shape of a polygon I'd like to change in a water districts layer.  I don't want to exchange the attributes from the parcel layer to water district layer, only shape.

Attached is a screenshot of the two features (each in a different layer) in question.  The goal is to copy the shape of the parcel outlined in green roughly beneath the blue water district feature laying on top of it.  The boundaries should be matching, but as you can see the blue water district layer is going over the road, doesn't include some houses in its southeast portion it should, includes some houses in its lower power it shouldn't, etc.


texts: Tutorials related to the transformation of building geometries from CityGML to KML/Collada?

texts:
I have some 3D building geometries in CityGML that I want to transform into KML/KMZ. Apparently the way KML works is to build the geometry in Collada and do the georeferencing in the actual KML file.

I don't want to use a program to do the transformation but rather want to do it by hand to understand how KML/Collada works. Do you know good tutorials that focus on the manual creation of 3D geometries in Collada and the georeferencing in KML?


texts:
I'm actually using QGIS (3.10 a Coruña) on Mac OS Catalina and I'm having troubles with it.
I'd like to use the function "r.reclass" but it doesn't run correctly. It says that there is an incompatibility with the code at some lines. I hope my screenshot will help to find how I can get rid of the problem...
I saw that it says that the type error is: TypeError: can't concat str or bytes.


texts:
Following this answer.

I notice that the cpg (decoding declaration) file isn't delete using .deleteShapeFile pyQgis function.

Any suggestion on how to delete these files using automatic method?


texts: How can I use geoserver's vendor specific parameters in openlayers?

texts:
I want to rotate my map in openlayers. When I set an "angle" as an url option in geoserver openlayers preview, the map is rotated, but I can't seem to find the correct place in my openlayers html-file.

http://docs.geoserver.org/latest/en/user/services/wms/vendor.html


texts: Calculating Areas in QGIS - Projection Scale Factor

texts:
I have a problem in calculating areas in QGIS. The data is in projection EPSG 25832 (ETRS89/UTM32). According to the cadastre, the feature has an area of 34025 m². If i measure the area of this feature with the measurement-tool it says 33920 m² (minus 105 m²). If i lable the feature with $area it says 34034 m² (plus 8 m²). In our CAD-program GEOgraf we have a setting called 'Maßstabsreduktion', i think in english it could be the projection scale factor or scale distortion or scale reduction. We have the problem that we are at the edge of zone 32 to zone 33. So we have distortions in area and lenght. In GEOgraf we have to set this parameter to 0.9996 instead of 1.0000 and the program calculate a reduction in the area and in the lenght. If i disable this parameter in GEOgraf i get the same area, QGIS calculate for the label of this feature (34034 m²). If i enable this parameter in GEOgraf i get the area given by the cadastre.

So my question is: Is there a possibility to give QGIS such a parameter somewhere?


texts:
I have a piece of land (vector) with, for example, potatoes and I want to make a grid for spraying. That means i need a grid with size 45mx10m with different values per box. Important is that the grid is parallel to one boundary of the vector. With Vector Grid the grid is always facing north. Could anyone help me?

Imagine this is the field. The grid should be parallel to the left boundary of the field. The size of the boxes should be the same size, exactly. Except the right side of course.


texts: difference of reference plane/Plane Height / Z factor in Surface volume calculation?

texts:
I have a TIN surface with Minimum elevation 25 m and Maximum elevation 140 m.
I want to calculate surface volume in different elevation between 25 and 140 meter.
I wonder for example If I want to measure the area above 25 m ( which is the lowest elevation)
how shall I set the Plane Height and Z factor?

PS: I am working in Arcmap 10.1 area.


texts: Openlayers pop-up FeatureSelected doesn't invoke even FeatureClicked works well

texts:
My code snippet is:

//Vector Layer with listeners:

var vectorLayer = new OpenLayers.Layer.Vector("Kuzzular");

    vectorLayer.events.on({
        'featureselected': function(evt) {
            var feature = evt.feature;
            var popup = new OpenLayers.Popup.FramedCloud("popup",
                    OpenLayers.LonLat.fromString(feature.geometry.toShortString()),
                    null,
                            feature.attributes.name+"
"+feature.attributes.address+"
"+feature.attributes.speed + " km/h",
                    null,
                    true,
                    null
            );
            popup.autoSize = true;
            popup.maxSize = new OpenLayers.Size(1600,1600);
            popup.fixedRelativePosition = true;
            popup.relativePosition = "tl";
            popup.panMapIfOutOfView = true;
            popup.calculateRelativePosition = function () {
                return 'tr';
            };

            feature.popup = popup;
            map.addPopup(popup);
        },
        'featureunselected': function(evt) {
            var feature = evt.feature;
            map.removePopup(feature.popup);
            feature.popup.destroy();
            feature.popup = null;
        }
    });

map.addLayer(vectorLayer);
//create selector
    var selector = new OpenLayers.Control.SelectFeature(vectorLayer,{
        hover:true,
        autoActivate:true
    });

    map.addControl(selector);

//create vector features

var feature =

 new OpenLayers.Feature.Vector(
                            new OpenLayers.Geometry.Point( unit.lon,unit.lat ).transform(epsg4326, projectTo),
                            {name:unit.name, address:unit.address, speed:unit.speed},
                            {externalGraphic: '/assets/admin/layout/img/avatar/' + unit.id + '.png', graphicHeight: 74, graphicWidth: 74, graphicXOffset:-18, graphicYOffset:-71  }
                    );
                    feature.id = unit.id;
                    vectorLayer.addFeatures(feature);

If I change featureselected with featureclicked, popups are shown well but they don't disappear as I wish. What is the problem here?

Additionally, can I give an offset to the popup? And how?


texts: How to create DBF field with length > 254?

texts:
Is it possible to create a text field in a database (DBF) table with a length that is greater than 254 characters?

Using ArcGIS 10.1 for Desktop.


texts: export to GeoJSON coordinates in the reverse order

texts:
This question has been asked before, but I don't understand how to use the answer given by cengel. I want to make a GeoJSON file with lat long coords, not the default of long lat coords. I have a current (wrong order) GeoJSON file, I have the original shp file it was created from and I can't for the life of me find a .gml that is referred to in the answer the first time this question was asked. Please Help! :(

Here is the old question:
Exporting GeoJSON file with correct order of coordinates?


texts: Creating 1-sided buffer that varies with slope in ArcMap?

texts:
I am a forester using ArcMap 10.5.  I need to map the riparian management zone (RMZ) along  a river that I have delineated using lines for each shoreline of the river.  I have 2 foot contour interval maps created using LIDAR data, and I know how to create polygons using those contour lines where the polygons show the slope percentages classified using a classification scheme that I define.  The RMZ needs to be 100 feet wide from each side of the river with the 100 feet measured along the slope, not horizontal distance.

I know how to create a one-sided buffer using an Arc Tool, but is there a way to attach a slope attribute to the line as it passes through each of the slope polygons?

Then I could create another column in the attribute table and calculate the horizontal (mapping) distance that corresponds to 100' along the various slope percentages.

Then, is there a way to have the buffering tool vary the width of the buffer based on that horizontal distance in the attribute table?

I am guessing a Python script might perform the last step but I don't know how to use Python.


texts: Why is OGC error "NoApplicableCode" mapped to HTTP 400?

texts:
The "OGC Web Feature Service 2.0 Interface Standard" says that the OGC Error "NoApplicableCode" should be mapped to an HTTP 400 Error with the reason phrase "Internal Server Error" [1]. This is weird, because HTTP 400 is usually "Bad Request", while "Internal Server Error" is used for HTTP 500 [2].

My question: is there a know reason for this combination? Is it possible that this is simply a typo in the specification document?

[1] http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#411
[2] https://tools.ietf.org/html/rfc7231


texts: Postgis - Construct linestring of length N

texts:
Give a table of linestrings (roads)

ogc_fid, wkb_geometry

And a road with ogc_fid = X

In postgis how could I construct a linestring that is of length Y metres made up of roads starting from road X? I do not care which direction the line expands out of. It is important that the algorithm goes both ways to prevent dead ends.

My starter code was this:-

SELECT ST_LineMerge(ST_Collect(R.wkb_geometry)) FROM ROADS R
WHERE ST_Touches(R.wkb_geomtry, (SELECT wkb_geometry FROM ROADS where ogc_fid = X))

But I am not on the right track as this returns a MultiLineString which means the LineMerge  has not worked?


texts:
I have velow code that works 100% only problem is you have to click on the marker to see what the marker name is. how do i show a label or a tooltip without loosing the html link functionality?
     <?php echo $n1; ?>
    <?php echo $o1; ?>
    <?php echo $p1; ?>
    <?php echo $q1; ?>
    <?php echo $r1; ?>
    <?php echo $s1; ?>

        ["Office",-25.6641595,28.2375668]
    ];
  var map = L.map('map').setView([-25.890852, 28.090852], 10);
    mapLink =
        'OpenStreetMap';
    L.tileLayer(
        'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        attribution: '&copy; ' + mapLink + ' Contributors',
        maxZoom: 18,
        }).addTo(map);

    for (var i = 0; i < planes.length; i++) {
        marker = new L.marker([planes[i][1],planes[i][2],planes[i][3]])
            .bindPopup(`<a href="${planes[i][3]}" target="_blank" rel="noopener noreferrer">${planes[i][0]}</a>`)
            .addTo(map);
    }

     function onClick(e) {

}


texts:
Downloaded QGIS 3, downloaded Grass 7. Opened QGIS version 2.18.21. I get the following error message:

2019-03-27T19:42:38 1   Traceback (most recent call last):
              File "/Users/CMM/.qgis2/python/plugins/openlayers_plugin/openlayers_layer.py", line 141, in pageLoaded
                self.checkMapReady()
              File "/Users/CMM/.qgis2/python/plugins/openlayers_plugin/openlayers_layer.py", line 148, in checkMapReady
                self.setup_map()
              File "/Users/CMM/.qgis2/python/plugins/openlayers_plugin/openlayers_layer.py", line 201, in setup_map
                olSize = QSize(int(olWidth), int(olHeight))
            OverflowError: cannot convert float infinity to integer
            "

My laptop is running apples OS Mojave ( 10.14.2 (18C54)).
What does the error message mean ?
I read a post that said that the project CRS hast to be set to EPSG:3857 in order for open layer to work. I set it to EPSG:3857, saved, closed and reopened QGIS, but still get the same message.


texts: QGIS Server when builds the UPDATE query to postgis sets date field ='' instead of =null which raises an error in the DB

texts:
I noticed in QGIS Server 2.18.3 and using QGIS Desktop 2.18.3 client the following:

I have a postgis table with a date field called "fecha_inst".

A user is updating the table using WFS-T protocol from outside our network.

When de user updates a feature and does not fill this "fecha_inst" date field, the field remains null and there is no problem.
After this the user fills the field (with the date QGIS Widget) and it is updated in the DB ok.
But after this, when the field is already filled and the user deletes its content and saves, when the QGIS Server converts the HTTP package to SQL UPDATE query, it sets "fecha_inst"='' instead of "feach_inst"=NULL. This raises the following error in the BD which is shown also in QGIS:

"PostGIS error while changing attributes: ERROR: invalid input syntax for date: <<>>"

I created an issue in QGIS Application issues repository: http://hub.qgis.org/issues/16125

I created a trigger before update on the table that sets the date to NULL when the value is ='09/09/1999' and told the user to insert this date when he wants to delete the date. This is very ugly...

Anyone has any other workaround to this problem?


texts:
Has anyone had any luck intergrating a GPS unit with your Smartphone?  Looking to gain sub 5m accuracy.  Ideally would like the phone to just use the better gps reciever when it is connected.  This goes for any tablets as well.

Also, are there any cheap add-on gps units that get this accuracy for a smart phone?

Anyone done anything like this?

Thad


texts: Updating raster of mxd file using ArcPy?

texts:
Using ArcGIS 10 wanted to update the raster file in a mxd file using python. for example, i created a.mxd which contains b.tif file in it. now, i obtained c.tif and want to update the a.mxd, i.e. want to delete b.tif and add c.tif, or overwrite b.tif with c.tif

import arcpy

mxd = arcpy.mapping.MapDocument(r"C:\data\a.mxd")
df = arcpy.mapping.ListDataFrames(mxd)[0]

updateLyr = arcpy.mapping.ListLayers(mxd)[0]
sourceLyr = arcpy.mapping.Layer(arcpy.Raster(r"C:\data\c.tif"))

arcpy.mapping.UpdateLayer(df, updateLyr, sourceLyr, True)

del mxd

i started as above, but i think that i am not getting most of the things correctly.


texts: trouble deleting data in an fgdb using python

texts:
I am trying to use  delete_management to delete files in a gdb based on whether or not they are in a list. I keep getting an error with the delete_management tool that says   the file either does not exist or is not valid. I can't figure out what the problem is?

import arcpy, os, easygui, sys
mxd_path = easygui.enterbox("Enter directory where mxds are located:",title='Search for Data Sources')
lyr_lst = []
lyr_lst_files = []
fl_nm_lst = []
FCList = []
RList =[]
#out_loc = easygui.enterbox("Enter ouput directory for copying files:")
out_loc = r'C:\GIS\Assimilate_Mxd_Data\Assimilate_Mxd_Data_TESTING\Output Data\test_output.gdb'

#set mxd and output geodatabase directory paths, exit if not specified
if mxd_path == None or mxd_path == '':
    sys.exit()
if out_loc == None or  out_loc == '':
    sys.exit()

#generate a list of feature classes and a list of rasters already exist in
#output geodatabase
for gdb, fd, fc in arcpy.da.Walk(out_loc,datatype='FeatureClass'):
    for f in fc:
        FCList.append(f)
for gdb, fd, rasters in arcpy.da.Walk(out_loc,datatype='RasterDataset'):
    for rstr in rasters:
        RList.append(rstr)

#walk through mxds in mxd path and generate unique list of layers sourced in all
#mxd documents
for dirpath, dirnames, filenames in os.walk(mxd_path):
    for filename in filenames:
        fullPath = os.path.join(dirpath, filename)
        basename, extension = os.path.splitext(filename)
        if extension == ".mxd":
            mxd = arcpy.mapping.MapDocument(fullPath)
            LyrList = arcpy.mapping.ListLayers(mxd)
            for item in LyrList:
                if item.supports("DATASOURCE"):
                   lyr_lst.append(item.dataSource)

lyr_lst_unique = list(set(lyr_lst))

#retrieve file names without extension from unique mxd layers lists, to compare
#with contents of output gdb
for lyr in lyr_lst_unique:
    path, file = os.path.split(lyr)
    fl_nm = os.path.splitext(file)[0]
    fl_nm_lst.append(fl_nm)

#compare file names in lyr_list_unique to lists of feature classes and rasters that
#already exist in output gdb. If file names are not in FCList and RList, meaning
#they do not already exist in the gdb, copy files to output gfb
    if fl_nm not in FCList and fl_nm not in RList:
        try:
            arcpy.FeatureClassToGeodatabase_conversion(lyr,out_loc)
        except:
            print 'Input file ' + lyr + ' is not a feature class'
            try:
                arcpy.RasterToGeodatabase_conversion(lyr,out_loc)
            except:
                print 'Input file ' + lyr + ' is not a feature class or a raster'

#compare file names in fl_nm_list to lists of feature classes and rasters that
#already exist in output gdb. If files exist in gdb that are not found in mxd
#unique layers list, delete
    for gdb, fd, fc in arcpy.da.Walk(out_loc):
        for f in fc:
            if f not in fl_nm_lst:
                arcpy.Delete_management(f)


texts:
I'm creating a map based on this example:
https://labs.mapbox.com/education/impact-tools/finder-with-filters/
In their example, they have two dropdown filters and one checkbox filter. I would like to have three checkbox filters. I created three checkbox filters, and on their own, they seem to work well. The issue is that the filters seem to override each other in the order clicked. In their example, the filters seem to be working together, so I can't figure out why it's not working anymore when I changed the filter type.
Here's the code for my project:
https://codepen.io/flyinginsect2/pen/eYdyqxZ
I read this Mapbox documentation on combining filters, but I can't figure out how to work it in.
https://docs.mapbox.com/mapbox-gl-js/style-spec/other/#other-filter
I know there are many other Stack Exchange posts out there that address filtering on multiple criteria, but I can't find one that seems to address this specific issue.


texts: Time-Aware Layer from ArcGIS Pro is not working in ArcGIS Online

texts:
I am using ArcGIS Pro 2.1 to share a web map with time aware layer on AGOL.  When I publish the web map I get no errors but the field for time is missing when I open the map online.  The time slider appears but no features appear even though they are in the table.

The layer contains 1,905 features with a Date field.  In the service there is a field for "USER_DATEOPEN" but that is a Long Type which I converted to Date.  That new field is missing.


texts: Warning from SAGA when doing Topographic Corrections?

texts:
I am trying to use SAGA for topographic corrections for the first time, however I am getting a warning that says:

  data not in the same grid

Can any one suggest ways of formatting the data (DEM and source images) so that it's properly handled?


texts: Converting projected coordinates to lat/lon using Python

texts:
This site returns
Point:
X: -11705274.6374
Y: 4826473.6922

when you search with the first key value of 000090, as an example. I assume that this is a spatial reference.
I am looking for instructions, or examples, of how to convert this to latitude and longitude using Python.


texts: How do you identify ridges on an elevation raster?

texts: I was wondering whether anyone might be able to tell me in layman's terms how to extract or differentiate between ridges and hilltops from 10m elevation data using ArcGIS 10.1?


texts: lidR lasaddextrabytes does not update header

texts:
My lidR version is 2.0.2

I am trying to add an extrabyte about treeID that I get from raster (lasmergespatial with vector is super slow). I have a problem with saving that extrabyte to LAS file.

I have following code:

library(lidR)
library(raster)
library(rgdal)

path <- "path/to/two/las_files.las"

setwd(path)
ctg <- catalog(path)

tif <- raster("Segmenty_Obszar13_TIF.tif")
las = readLAS(ctg$filename[[1]], filter = "-keep_class 4 5")
tif_crop = raster::crop(tif, raster::extent(las)*1.1)
las_tree = lasmergespatial(las, tif_crop, "treeID")
lasaddextrabytes(las_tree, name="treeID", desc="ID of a tree")

Now las_tree has summary:

class        : LAS (LASF v1.4)
point format : 7
memory       : 474.4 Mb
extent       :7497590, 7498410, 5788790, 5789610 (xmin, xmax, ymin, ymax)
coord. ref.  : NA
area         : 670422.1 units² (convex hull)
points       : 4011573 points
density      : 5.98 points/units²
names        : X Y Z gpstime Intensity ReturnNumber NumberOfReturns ScanDirectionFlag EdgeOfFlightline Classification ScannerChannel Synthetic_flag Keypoint_flag Withheld_flag Overlap_flag ScanAngle UserData PointSourceID R G B Amplitude Pulse width treeID
File signature:           LASF
File source ID:           0
Project ID - GUID:        00000000-0000-0000-0000-000000000000
Version:                  1.4
System identifier:        LAStools (c) by rapidlasso GmbH
Generating software:      lasheight (181108) commercial
File creation d/y:        12/2019
header size:              375
Offset to point data:     815
Num. var. length record:  1
Point data format:        7
Point data record length: 40
Num. of point records:    4011573
Num. of points by return:
Scale factor X Y Z:       0.01 0.01 0.01
Offset X Y Z:             0 0 0
min X Y Z:                7497590 5788790 -1.58
max X Y Z:                7498410 5789610 38.92
Variable length records:
   Variable length record 1 of 1
       Description:  RIEGL Extra Bytes
       Extra Bytes Description:
          Amplitude: Echo signal amplitude [dB]
          Pulse width: Full width at half maximum [ns]

Seems like header is not updated after lasaddextrabytes. Am I doing something wrong?

I try also to write las_tree to new file:

writeLAS(las_tree, "new.las")
las_new = readLAS("new.las")

But las_new does not contain "treeID" attribute at all and the header is similar to the header of las_tree. How can I export LAS with extra bytes?


texts: Why does gdalwarp's cubicspline method expand into nodata areas?

texts:
The image below shows part of a peninsula on the Australian island of Tasmania. The black pixels are 9" climate data with GDA94 (EPSG:4283) SRS, projected by QGIS on the fly to Australian Albers (EPSG:3577). The purple (pink?) and blue pixels are the same data projected to a 250 m grid in Australian Albers with gdalwarp, using "cubicspline" and "cubic" resampling methods, respectively, e.g. with:

gdalwarp -multi -tr 250 250 -s_srs "EPSG:4283" -t_srs "EPSG:3577" -r "cubicspline" -dstnodata "-9999" in.flt out.tif

I've used GDAL 1.11.1 for the above.

Why do the data resampled with "cubicspline" extend beyond the cells of the original data, and is there a way to make the behaviour consistent with that of "cubic"?

Comments on which approach is more appropriate when resampling climate data are also welcome.


texts: RasterBand.GetMaximum() returns None during unit tests only

texts:
I'm running GDAL 2.2.0 and have set up some unit tests to run using Jenkins CI (1.609.2). One of the tests fails every time, even though if I log on to the Jenkins box and run the test manually, everything runs ok.

Here's a simplified version of the code I'm testing (it's a raster checker QA tool):

def check_band_info(ds, expected_max_value=None):
for rc in xrange(1, ds.RasterCount + 1):
    rb = ds.GetRasterBand(rc)

    # more tests here

    if expected_max_value is not None:
        actual_max_value = rb.GetMaximum()
        if actual_max_value is None or actual_max_value > float(expected_max_value):
            print('Band {} Maximum value {}'.format(rc, actual_max_value))

Running gdalinfo on the raster shows band 5 does have a maximum value:

  Band 5 Block=20x19 Type=Int32, ColorInterp=Undefined
    Min=140.000 Max=654.000
    Minimum=140.000, Maximum=654.000, Mean=378.645, StdDev=103.930
    NoData Value=-2147483648
    Metadata:
      RETURN_PERIOD=1000
      SCALE=0
      STATISTICS_MAXIMUM=654
      STATISTICS_MEAN=378.64473684211
      STATISTICS_MINIMUM=140
      STATISTICS_STDDEV=103.93007567684
      UNITS=m

However, the test fails with:

======================================================================
FAIL: test_max_value_pass (autoqc.test.test_raster_checker.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/.jenkins/workspace/autoqc/test/test_raster_checker.py", line 120, in test_max_value_pass
    expected_max_value=expected_value)
  File "/home/user/.jenkins/workspace/autoqc/test/test_raster_checker.py", line 33, in _test_task
    self.assertEqual(result[-1][-1], message)
AssertionError: "Actual ['Band 5 Maximum value None']" != 'OK'

----------------------------------------------------------------------

I've added a skip to get the build to pass, but I shouldn't need to as on every other machine, and when I run it manually this test passes.

Has anyone seen something similar? Is there a race condition that is making gdal return None, but only when running under CI?


texts:
I want to place a polyline at the correct altitude in QGIS.

Is that possible and how do I do this?

What I have is a polyline (railroad) and I want to add information on the electrics above the railroad.

Say, the electrics are z meters above the rails, how do I get this data into the attribute table?

I want to use this information to calculate the number of trees that can reach the electrics if they fall. And yes, I get that they would reach the rails even if they aren't tall enough to reach the electrics.

I've tried to use the tip I got in the comments below, but it was a bit too complicated for me, I simply don't understand how to do it.

I just want to add values to the z-coordinat (of a polyline).


texts: ArcGIS Android SDK Calculate area in square meters from polygon geometry?

texts:
I have a Polygon object in ArcGIS Android SDK that I'm creating on a map, I would like to calculate that polygon object to square meters.

currently I use

 double area=polygon.calculateArea2D();

But I don't know what that geometry's default unit is to convert from..

Anyone know how I can take that Geometry's area and convert to meters squared?


texts: Include WPS in Geoserver (Build with Eclipse)

texts:
I'm running GeoServer from Eclipse.
Now I want to create my own WPS. How can I implement it in my Eclipse-Project?
I created the *.class-File and don't know, where to put it.

Normally, when I'm using the "normal" GeoServer-Installation, I have to put the *.jar-File in the WEB-INF/lib directory.


texts: Unable to establish connection to www.arcgis.com from ArcGIS Pro?

texts:
After installing ArcGIS Pro 1.1 on two machines, I am now unable to run the program.

The error received is:

  Unable to establish a connection to www.arcgis.com.

After installing the first instance of the software I tested it and it worked fine.

It stopped after I installed the second instance.

What did I do wrong?


texts: Getting attribute form data from another layer

texts:
I’m trying to use the attributes form in QGIS 3. Most of what I’m doing is relatively simple use of combo boxes but I’ve run up against a wall.
The idea is that I’m trying to streamline how we notify people of issues on their land. The layer I’m working on is points of note, and I’d like to take the name of the owner of the land, which is stored in a separate polygon vector file.
My idea was to use the 'text edit' widget and write an expression to default to the name of the property owner from another layer.


texts: Calculating the coordinates of the selected pixel point from an image with known corner coordinates

texts:
How can I calculate the coordinates of the point(P) we want from an image with known corner coordinates?

I want to find out respective coordinates from the selected the pixel of the image obtained while looking at the earth from the drone. First I'm trying to find the corner pixels' coordinate then the selected pixel coordinates by using ratio proportion. I need an algorithm to find the respective coordinate. Can someone walk me through this process?


texts: GDAL Calc Set Specific Values to Another Number

texts:
I have a GeoTiff raster with a format of Float32 and values 0.00 to 5.00. I am attempting to change all raster cells with a value below 0.10 to 0.10, and leave all other cells in the raster dataset unchanged.

Using some of the basic code examples provided on the GDAL Man pages, the initial snippet of code I used is as follows:

--calc="A*(A<0.10)"

The code executes successfully, however this sets all values below 0.10 to zero. What alteration to the formula needs to be made in order to meet the desired result?


texts: QGIS Live GPS - turn the map according to the direction I move

texts:
Using Live GPS in QGIS I would like the map to be rotated automatically, that the direction I am moving to is always upside like in a car navigation sytem.

How can I configurate that?


texts: Does google maps use elevation to calculate travel distance?

texts:
For example, lets say I have two parallel roads with starting point and ending point 1 mile apart.

The left hand road is as flat and straight as an arrow.

The right hand road is also straight....but has a series of sine-wave shaped hills and valleys.

Obviously, if I measure using a Surveyor's wheel, the second path will be longer, even though both roads are starting and ending a mile apart.

My question: which measurement does google maps use? Does it account for difference in elevation adding to the travel distance?


texts: How do you protect your PostGIS credentials when using QGIS 1.7?

texts:
I'm fairly certain this should be a community wiki, but I don't know how to make it one. So if an admin sees this please change if appropriate.

So... how do you protect your PostGIS database data when using QGIS 1.7? (I am using QGIS 1.7 and PostGIS 1.5)

The reason I ask is that I opened a QGIS project file in notepad++ to alter the host value in my datasource string as we recently had a server change its name. When I was editing the project file in notepad++ I saw plain as day the user name and password to the database like shown below.

 <datasource>dbname='spatialdb' host=gis port=9999 user='generaluser'
              password='gisv13wer' sslmode=disable key='gid'
              table="gisprod"."aq_pipeline" (the_geom) sql=</datasource>

This does seem to be somewhat of a double edged sword because I like the fact that I could easily edit the host value in my datasource string so that I didn't lose my projects, but I am uncomfortable with the fact that the database credentials are sitting there unencrypted and for the world to see so to speak.

As a contingency I've placed all my project files which use my admin account into a folder which now only I can access. But I don't think this is ideal.

As the GIS Administrator I am responsible for the spatial databases integrity and I am concern that I have just exposed my whole database to anyone who is curious enough to get in. I'm a bit bummed I missed this when we were evaluating QGIS.

So how do you manage this risk if you are in a similar situation? Is my contingency good enough for a production environment or would I be better off putting in a QGIS feature request to address the problem?


texts:
I used labelImg to create some bounding boxes around items of interest on a TIF image. I am wondering if I can convert those XML bounding boxes into shapefiles? I've looked at a few other posts for converting xml to shp or even csv to shp, but those posts are all dealing with lat/lon coordinates. Unfortunately, I have xmin, ymin, xmax, ymax values that seem to be specifically attached to the image/tif that I drew them on.
So I am confused on how I could convert to a shapefile when the xml does not have any georeference information. I could add the georeference information because my image/tif contains it, but I am still not working with lat/lon coordinates. Perhaps I could convert the mins/maxs into lat/lon?
Any suggestions on how I might approach this problem?

Edits:
I found this solution that someone has posted. I however am using a .tif for an image and they are using a .jpg. I am unaware if that will screw up the encoded parameter? The code is running, but I do get the printed error: error in labelme conversion: 'NoneType' object has no attribute 'shape'. The "data_test.json" is saved, but only contains {}`.
Edits 2:


texts:
I have this polygon:

library(maptools); library(sp)
setwd(system.file("shapes", package="maptools"))
columbus <- readShapeSpatial("columbus.shp")

proj4string(columbus) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
columbus <- spTransform(columbus, CRS("+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"))

I need to buffer 1km around the polygon, so I tried this:

library(rgeos)
gBuffer(columbus, width = 1000)

Could someone tell me if buffering by width=1000 is buffering by 1km?


texts: Switching between symbologies for two different fields quickly in ArcGIS Pro

texts:
I'm trying to quickly switch between two different coloring schemes for my map quickly. I have a map filled with several polygons that are colored according to a particular field. The image for that is attached here:

I would like to introduce another coloring scheme for these same polygons based on a different field. I cannot figure out how to quickly toggle between the two color schemes without resetting my symbology preferences each time. I suppose I could copy the data layer and introduce that new color scheme there, but I'd like to avoid that if at all possible.
Any ideas?


texts: multiple lines of annotation from CADD combined into one textstring

texts:
I am bringing a Microstation dgn file into ArcGIS using the conversion tool. The results include several lines of annotation for each property, each line of text is a separate record, i.e. line 1: owner name, line 2: parcel number, etc.

I was going to spatial join the text to the property polygons but I end up with text that creates multiple polygons.

Does anyone know how to group or combine these "blocks" of text so they are one record?


texts: What projection system for the entire world should I use to calculate distances ArcGis?

texts:
I've got two point shapefiles (A and B) that represent features all over the world, and I'm using Near (Analysis Tools-Proximity). I'm trying to calculate the distances between the points in layer A and layer B and I'm not obtaining the correct distance values. What projection system should I use?

Thanks.


texts:
I am trying to georeference a .png file. After inserting all the data I get the following error
"Transform Failed: Failed to compute GCP transform: Transform is not solvable."
What can be the problem?

gdal_translate -of GTiff -gcp 324.814 728.712 11.3582 43.5428 -gcp
354.101 637.672 11.3582 45.5428 -gcp 476.351 216.605 11.3586 43.5427 -gcp 518.207 168.548 11.3585 43.5426 -gcp 342.315 362.074 11.3585 43.5428 "C:/Giulio_files/Documenti/University/PhD/PhD Thesis/Data/02_Aerial photos/frattaglie.png"
"C:/Users/Giulio/AppData/Local/Temp/frattaglie.png"
gdalwarp -r near
-tps -co COMPRESS=NONE  "C:/Users/Giulio/AppData/Local/Temp/frattaglie.png"
"C:/Giulio_files/Documenti/University/PhD/PhD Thesis/Data/02_Aerial
photos/frattaglie_modified.tif"


texts:
I want to put some labels on a globe in ArcGlobe.  I've spent time looking here : http://resources.arcgis.com  and here http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html

However, I can't seem to find any solid examples.

I've looked in the ArcGIS Snippet Finder when using Visual Studio as well.  Also tried looking in the examples that include source code.

Is there somewhere else to look?


texts: osm2pgsql failed import The system cannot find the file specified

texts:
I got error message, when loading osm file to PostgreSQL by osm2pgsql command. I run the following command line :

osm2pgsql -c -G -U postgres --hstore -S D:\osm2pgsql\default.style  -U postgres -W mypassword -d osm -r "D:\.....roads.osm"

and i got this error message:

Osm2pgsql failed due to ERROR: Open failed for 'mypassword': The system cannot find the file specified.


texts: Using list of values for custom function in QGIS Field Calculator?

texts:
I'm writing a custom function in the Field Calculator (QGIS 2.18.5).

Creating a new function from Function Editor > New file, I'm able to start using a default function called func:

"""
Define new functions using @qgsfunction. feature and parent must always be the
last args. Use args=-1 to pass a list of values as arguments
"""

from qgis.core import *
from qgis.gui import *

@qgsfunction(args='auto', group='Custom')
def func(value1, feature, parent):
    return value1

At the beginning of the above code, I noticed this:

  Use args=-1 to pass a list of values as arguments

Desiring to pass, for example, this list:

my_list = ['a', 'b', 'c']

as an input parameter, I tried to use args=-1 instead of args='auto':

@qgsfunction(args=-1, group='Custom')
def my_func(my_list, feature, parent):
    return my_list

but I wasn't able to add this list for my custom function because I wrote it using an invalid syntax:

What am I doing wrong? Or maybe I made some confusion about the using of args?


texts:
I have to implement a linear with plateau fuzzy membership function. Here is my solution.
var dem = ee.Image("USGS/SRTMGL1_003");

// the breakpoints for the fuzzy membership
var a = 200;
var b = 700;
var c = 1500;
var d = 2000;

var a = ee.Image(a);
var b = ee.Image(b);
var c = ee.Image(c);
var d = ee.Image(d);

var fuzDem = ee.Image(0).where(dem.gte(a).and(dem.lt(b)), (dem.subtract(a)).divide(b.subtract(a)))
                     .where(dem.gte(b).and(dem.lt(c)), ee.Image(1))
                     .where(dem.gte(c).and(dem.lt(d)), (d.subtract(dem)).divide(d.subtract(c)));

Map.addLayer(fuzDem, {min:0, max:1}, "Fuzzy DEM")

Two questions, is there a more "beautiful" way to go about the reclassification into fizzy? And the more central question, how to convert this to a function to minimise repetition of code, e.g. I would like to have function which looks like this
fuzzyMembership(image, a,b,c,d)


texts: Merge all separated lines with connecting extremities into single continuous lines

texts:
I got a DWG file from a friend that contains the curve lines of an area. However, once I import the file and then convert it to shapefile, all the lines are split. I would like to connect all the split lines whose end points connect into a single continuous line. There aren't any attribute to be maintained, my objective is purely geometrical. Since I have many lines, I cannot do it by selecting manually the segments and then merge them with Merge Features, I need to find an automatic way of doing.

I tried using the MergeLines plugin (https://plugins.qgis.org/plugins/QGISMergeLines-master/) in QGIS 2.18 (it only works for QGIS < 3.0), but the merging result is incomplete. I thought of using Shapely but I am still a novice in Python, so I am not sure if I would be able to do it.

The lines are complete separate before using MergeLines (QGIS 2.18)

Some have merged but not all after using MergeLines (QGIS 2.18)

The lines do not posses any attributes, such as the elevation, that could help me merge them with the tool Dissolve. Also, the lines aren't grouped under a multiline geometry. They are separate entities. I know that the Merge Lines (in QGIS 3) works with multiline geometries, which unfortunately isn't my case


texts: How to import a shapefile from database into QGIS plugin?

texts:
I am building a QGIS plugin, and want to add some base maps from the shapefiles which were stored in the PostgreSQL database.

My question is:

Is there a way to import shapefiles stored in the database into the QGIS plugin without displaying in the map canvas?

Updated on 13/06/2019:

Sorry I didn't explain the question clearly. I will try to describe my question in more detail.

Currently, I managed to store shapefiles in the database (Figure 1) and use "Add PostGIS Layer" (Figure 2) to visualise the shapefile in QGIS (Figure 3).

In the plugin I am going to build, I would like to choose one of these shapefiles (stored in the database) as my environmental layer (something like a base map).

However, my problem is that I can only choose the layers from the map canvas (shapefiles which have already been added into QGIS). My plugin looks something like figure 4, when users click the red circle, a list of shapefiles stored in the database is supposed to be displayed instead of maps on QGIS canvas.

(Figure 1:)

(Figure 2:)

(Figure 3:)

(Figure 4:)


texts: gdal_warp of multiple rasters keeping maxium intensity value

texts:
I have multiple rasters which overlap eachother geospatially but do not completely occupy the same space. I can combine them with gdalwarp like:

  gdalwarp -s_srs EPSG:4326 *.tif larger_output.tif

In this method gdalwarp uses the order of the input files to determine which pixel ends up in the final image in the case that two pixels occupy the same location in the x,y plane.

Is it possible to tell gdalwarp to use the max(intensity(x,y)) of a given pixel that overlaps another pixel in the input as a means of determining which one ends up in the final image?

I presume the code behind gdalwarp works on the images sequentially or at least in separate threads and then combines them one at a time into a final raster? This addition might be as simple as an if statement that before replacing a given pixel in the final raster would compare intensities (if there were already a value there).

Does something like this already exist or should I get into the code to try something out?


texts: Clipping results in a black (empty value) raster althoug having the same CRS

texts: I use QGIS 2.18 (error occurs by 2.14, as well). I want to clip a raster layer with a mask (shape layer) and when I do so the output is only a black layer, which is not even clipped. The CRS of both layers is the same. The raster layer has 4 bands, but the error occurs with one band as well. When i choose "Extend" the same error occurs.


texts: How does `ST_Union` treat NULL values in a raster?

texts:
My question is about how ST_Union of rasters containing NULL values are handled. For example suppose I have two rasters that intersect but the values of the intersection are NULL in one of the rasters. According to the documentation ST_Union takes the last value by default.

Does this mean that the unionized raster would contain null values at the intersecting locations where the second raster was null? In other words if one of the two rasters contains null values at the intersecting points (pixels) does order matter?

I am motivated to understand this because some of my rasters were not perfectly aligned and ST_SnapToGrid created extra an extra row/column on some of my rasters that contains only null values.


texts: Raster data projection without spatial reference

texts:
I have hundred raster data without spatial reference on it. (Spatial Reference is undefined and xY coordinate system is unknown)

The original raster data was Subdataset so I used 'Data Management tools\Raster\Raster ProcessingExtract Subdataset' to extract the single raster.

Now, I think I have to define the projection so I can make a mosaic data from raster file.
I have a point shape file which indicate the middle of the raster data.
I also have to rotate the raster data as well.

What is the best way to do this process?
I tried geo-reference however I have more than 100 files to process so I will like to use ArcMap tool or GDal or Python.


texts:
I'm trying to create a style for a vector shapefile that matches a raster map. I have detailed information about the different attributes and much of the layers are easy to style but there are one main problem that I've run into.

Please look at the attached image. Here I'm showing the same area with different layer styles. Picture 1 shows only the raster image. The arrow points to a diffuse shoreline in the raster map. It should have a blue fill with a dashed border like in picture 2.

The problem is that not only the shoreline gets the dashed border but the border that is located in the water also. When I fill the other water areas with a blue fill and a thin blue border it looks like picture 3.

So my question is how can I get rid of the borders that are out in the water? Can I fix that with styles in some way?


texts: I need to add routing functionality in my application how to add the routing in openlayers.


texts: Finding correct X Y values from two pairs of X Y map coordinates?

texts:
I am working on trying to get values for a specific latitude and longitude from a netcdf3 file with Python. The model uses X and Y coordinates and an LCC projection.

The netcdf file comes with a set of corresponding 2d lats and longs. I can look up my desired lat and long and find the nearest value of each in the 2d lat long file. I am using scipy.io netcdf and numpy. Dataset is a netcdf object.

lat = 41.050
lon = -125.685
wind_lats = dataset.variables['lat'][:]
wind_lons = dataset.variables['lon'][:]
lat_idx = np.abs(wind_lats - lat).argmin()
lon_idx = np.abs(wind_lons - lon).argmin()
lat_idx = np.unravel_index(lat_idx, wind_lats.shape)
lon_idx = np.unravel_index(lon_idx, wind_lons.shape)
wind_lat_y = lat_idx[0]
wind_lat_x = lat_idx[1]
wind_lon_y = lon_idx[0]
wind_lon_x = lon_idx[1]

This gives me a separate XY pair for the latitude and for the longitude. The variable of the netcdf file I am trying to access has indices time, height, y, and x.

It only uses 1 value for x and 1 for y. I have two values, but I don't know how to go from 2 to 1. Also the netcdf x and y variables are each a 1d array containing the respective x and y values.

The lat_idx and lon_idx after they are unraveled return the indices for the x and y values from the netcdf file. There is about a 100km difference between the x and y values of the lat longs. For example the latitude x value is -2641.2786. The longitude x value is -2543.75. The y values are similarly separated. The x and y values are not actual latitudes and longitudes themselves. The 2d lat long files reference the x and y values. Below is an example of how each of the files is organized:

From Panoply

2d latitude file:

y,          x,           lat
1959.0411,  -3043.5815, 38.9718
1959.0411,  -3031.3906, 38.9985
1959.0411,  -3019.1997, 39.0251

1d x file:

x,  x
-3043.5815, -3043.5815
-3031.3906, -3031.3906
-3019.1997, -3019.1997

1d y file:

y,  y
1959.0411,  1959.0411
1971.2321,  1971.2322
1983.4230,  1983.4231


texts:
I am attempting to polygonize a raster using GDAL C API. The input rasters can contain nodata pixels. My current method (see the code below) produces a new polygon vector, but the output also includes polygons representing nodata pixels. Is there a way to exclude nodata pixels from being polygonized or to remove new nodata polygons after polygonization?

driver = GDALGetDriverByName("ESRI Shapefile");
dh = GDALCreate(driver, vector_fname, 0, 0, 0, GDT_Unknown, NULL );
OGRSpatialReferenceH srs = OSRNewSpatialReference(srs_txt);

layer = GDALDatasetCreateLayer(dh, "new_layer", srs, wkbMultiPolygon, NULL );

field = OGR_Fld_Create("new_field", OFTInteger);
OGR_L_CreateField(layer, field, TRUE)
OGR_Fld_Destroy(field);

GDALPolygonize(hBand, NULL, layer, 0, NULL, NULL, NULL);
GDALClose(dh);


texts: Unable to Process Line Feature Class in in_memory Workspace

texts:
I'm trying to run a script that will generate a contour map from a raster in a geodatabase, run Simplify Line on the contour map, and then run Smooth Line. At first I ran it in disk, and it worked (albeit slowly), and now I'd like to do it using the in_memory workspace. However, it returns the error message at the bottom. I've tried this in PyScripter and ArcMap with both foreground and background (64-bit) geoprocessing, and the result is the same. What is the problem with my code that is causing this to fail when I use the in_memory workspace?

>>> # -*- coding: utf-8 -*- ...
# --------------------------------------------------------------------------    - ...
# Snippet.py ...
# Created on: 2018-07-17 11:14:47.00000 ...
# (generated by ArcGIS/ModelBuilder) ...
# Description: ...
# --------------------------------------------------------------------------    - ... ...
# Import arcpy module ...
import arcpy ...
from arcpy.sa import * ...
from arcpy.ddd import * ...
arcpy.CheckOutExtension("Spatial") ...
arcpy.CheckOutExtension("3D") ... ...
# Local variables: ...
FilteredDEM = "D:\\ArcGIS\\Folder\\Geodatabase.gdb\\FilteredDEM" ...
FiveMeterContour = "in_memory\\FiveMeterContour" ...
FiveMeterSimplify_Pnt = FiveMeterContour ...
FiveMeterSimplify = "in_memory\\FiveMeterSimplify" ...
FiveMeterSmooth = "in_memory\\FiveMeterSmooth" ... ...
# Process: Contour ...
arcpy.Contour_3d(FilteredDEM, FiveMeterContour, "5", "0", "1") ... ...
# Process: Simplify Line ...
arcpy.SimplifyLine_cartography(FiveMeterContour, FiveMeterSimplify, "BEND_SIMPLIFY", "5 Meters", "RESOLVE_ERRORS", "KEEP_COLLAPSED_POINTS", "CHECK") ... ...
# Process: Smooth Line ...
arcpy.SmoothLine_cartography(FiveMeterSimplify, FiveMeterSmooth, "BEZIER_INTERPOLATION", "0 Meters", "FIXED_CLOSED_ENDPOINT", "FLAG_ERRORS") ... ...

arcpy.CheckInExtension("Spatial") ...
arcpy.CheckInExtension("3D") ...

Result:

Runtime error Traceback (most recent call last):
File "", line 27, in File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\cartography.py", line 1340, in SimplifyLine
raise e ExecuteError: ERROR 000207:
Cannot create intermediate output GPInMemoryWorkspace:{5568791D-08F7-4A36-BC5F-A640D3D64572}\FiveMeterSimplify_TmpIn Failed to execute (SimplifyLine). >>>


texts: Transform from WGS84 to Cylindrical Equal Area

texts:
What transformation should I use to go from GCS_WGS_1984 to Sphere_Cylindrical_Equal_Area?

I am using Arc to project a dataset over for and area calculation and then will project it back.


texts: Earth Engine: filtering to non-zero pixels surrounded by only zero value pixels

texts:
I'm trying to create a mask of only pixels surrounded by zero-value pixels in the GHSL layer on Google Earth Engine.

The layer image would be: ee.Image('JRC/GHSL/P2016/POP_GPW_GLOBE_V1/2015')

Anyone have advice on how to do this?


texts: ArcGIS server manager export tool in python code

texts: In ArcGIS server manager, I am using export tool to take a backup for my site. Now I am trying to do schedule for this tool to take a backup automatically. So how I can find this tool in python code to make this schedule


texts:
I am running successfully GeoServer 2.15.0 as a Web Archive started from WildFly 16.0.0 using OpenJDK 1.8.0 (RPM built for CentOS 7.6).

I would like to upgrade to GeoServer 2.16.2 (i.e. the latest stable release as of today) but the service cannot be started.

Here is the first error shown:

2020-02-13 11:27:14,554 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."geoserver.war".component."org.springframework.http.server.reactive.ServletHttpHandlerAdapter$HandlerResultAsyncListener".WeldInstantiator: org.jboss.msc.service.StartException in service jboss.deployment.unit."geoserver.war".component."org.springframework.http.server.reactive.ServletHttpHandlerAdapter$HandlerResultAsyncListener".WeldInstantiator: Failed to start service
        at org.jboss.msc@1.4.11.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1731)
        at org.jboss.msc@1.4.11.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
        ... 4 more
Caused by: org.jboss.weld.resources.spi.ResourceLoadingException: Error while loading class org.springframework.http.server.reactive.ServletHttpHandlerAdapter$HandlerResultAsyncListener
        at org.jboss.weld.core@3.1.2.Final//org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:186)
        at org.jboss.weld.core@3.1.2.Final//org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:194)
        ... 11 more
Caused by: java.lang.NoClassDefFoundError: Failed to link org/springframework/http/server/reactive/ServletHttpHandlerAdapter$HandlerResultSubscriber (Module "deployment.geoserver.war" from Service Module Loader): org/reactivestreams/Subscriber
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        ... 33 more

I would say that the key problem here is java.lang.NoClassDefFoundError but I do not know how to fix it.

There are several identical issues ; here is the full list:

Caused by: java.lang.NoClassDefFoundError: Failed to link org/springframework/http/server/reactive/ServletServerHttpResponse$ResponseBodyProcessor (Module "deployment.geoserver.war" from Service Module Loader): Failed to link org/springframework/http/server/reactive/AbstractListenerWriteProcessor (Module "deployment.geoserver.war" from Service Module Loader): org/reactivestreams/Processor
Caused by: java.lang.NoClassDefFoundError: Failed to link org/springframework/http/server/reactive/ServletServerHttpRequest$RequestBodyPublisher (Module "deployment.geoserver.war" from Service Module Loader): Failed to link org/springframework/http/server/reactive/AbstractListenerReadPublisher (Module "deployment.geoserver.war" from Service Module Loader): org/reactivestreams/Publisher
Caused by: java.lang.NoClassDefFoundError: Failed to link org/springframework/http/server/reactive/ServletHttpHandlerAdapter$HandlerResultSubscriber (Module "deployment.geoserver.war" from Service Module Loader): org/reactivestreams/Subscriber

I have removed all GeoServer plugins and community modules in order to minimize side effects.

I should mention that GeoServer runs fine under Jetty instead of WildFly.

I also have upgraded WildFly from 16.0.0 to 18.0.1, but the service still does not start. I also upgraded OpenJDK from 1.8.0 to 11.0.6, still the same. And of course I have tested each combination (WF16+Java8, WF16+Java11, WF18+Java8, WF18+Java11).


texts: Joining lines with SLD style in GeoServer

texts:
I want to create a sld style in road lines in qgis. the style has a fill and a border symbology. Everything is ok in qgis but i have an issue with the style in geoserver.  The lines do not merge at the joins. How do i join lines with sld style? I use the sld for three layers in geoserver (I have three layers in a group layer). The other solutions like this work for just one layer with filtering.
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:se="http://www.opengis.net/se" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink">
  <NamedLayer>
    <se:Name>test</se:Name>
    <UserStyle>
      <se:Name>test</se:Name>
      <se:FeatureTypeStyle>
        <se:Rule>
          <se:Name>Single symbol</se:Name>
          <se:LineSymbolizer>
            <se:Stroke>
              <se:SvgParameter name="stroke">#000000</se:SvgParameter>
              <se:SvgParameter name="stroke-width">14</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">round</se:SvgParameter>
              <se:SvgParameter name="stroke-linecap">round</se:SvgParameter>
            </se:Stroke>
          </se:LineSymbolizer>
          <se:LineSymbolizer>
            <se:Stroke>
              <se:SvgParameter name="stroke">#ffffff</se:SvgParameter>
              <se:SvgParameter name="stroke-width">11</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">round</se:SvgParameter>
              <se:SvgParameter name="stroke-linecap">round</se:SvgParameter>
            </se:Stroke>
          </se:LineSymbolizer>
        </se:Rule>
      </se:FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

I tested it with just one layer and faced the same problem.


texts: SQL Server Geography Tables Not Connecting

texts:
This has me totally confused... it was working last week, isn't working now.

Using QGIS v3.0 and 3.2 and no love. Even tried 2.18.21... no difference.

Follow the pictures...

This is my connection screen, I have used a userid/password and the trusted connection, no difference. I have blurred out what doesn't matter. The database I am connecting to is GIS:

When I get to the datamanager, I select MSSQL and then GIS and get this list, with the little whirlly thing... that ever stops... and never presents the one table I need!

Finally, the table:

This is in SQL Server 2012 R2. I have tried this as both Geometry and Geography... no luck.

If I take out the Place field - the geo point data - I can see the table. Otherwise, it is invisible. It is acting backwards...


texts: How to fix a mirrored GML file in ArcMap (Latitude & Longitude values reversed)

texts:
I want to import this file into ArcMap 10.4.
On the page it says it's a csv, when downloaded it's a .text-file. I renamed it to GML, as they usually have GML on that platform, and the file content looks like GML to me.

Using Add Data in Arc Map (Data Interoperability Extension is activated), i get a mirrored version of the data, with no spatial reference.

It's supposed to look look like this.

How do I fix this?


texts: I am new to using ModelBuilder, however, I have created a model to create "straight lines" that represent multiple stream condition monitoring. I have multiple gdbs, and within, multiple feature classes for each date a stream was monitored. The set naming convention when creating these straight lines (routes essentially) manually are as follows "5 digit DEP code_Date" for example "12345_20160404" Is there a way for me to set naming conventions in ModelBuilder? I am not opposed to using python.


texts: Geocode Locator - USA_PostalEXT locator for Zip+4

texts: I have a list of addresses for which I need to get the ZIP+4. I am trying to geocode following https://support.esri.com/en/technical-article/000014901 which specifies to select the USA_PostalEXT locator to get the ZIP+4 in the output. Does anyone know what the USA_PostalEXT locator is, and how I can get it? Can I get ZIP+4 using the ArcGIS World Geocoding Service? I have ArcMap 10.5, ArcGIS Pro 2.5.1, and can use Python. AGOL credits are not an issue.


texts:
When I use the ruler tool and create a segment between two points, which one of the following is true for the calculated distance?:

The geodesic distance calculated over a an ellipsoid
The projection of the geodesic path of the ellipsoid over the terrain
The 3D distance between the two points

For example in a mountain I would like to know the distance I travel in a certain path considering the ups and downs of the terrain (thus the height at each point of the line). This would mean I want the second statement to be true. Is that what Google Earth Pro calculates?

What if I want to know the distance traveled by a laser between those same coordinates (from one mountain peak to another)? Then I would like to have something like the third statement. How can I do that in Google Earth Pro?


texts: Programmatic Zonal statistics to obtain cell value at 2% and 98% cumulative frequency IN GDAL OR PYTHON

texts:
I would like to be able to extract the same values that QGIS obtains automatically when calculating the 2% and 98% values for a raster in GDAL.     But GDAL only yields the result for the minimal and maximum value of the pixel as -1 and 1.

Someone has any idea of what's happening here?

QGIS VALUES:

Min: -0.052 |  Max: 0.254

GDAL RESULTS:

For obtain the gdal information i used :

gdalinfo -mm RASTER

But I am not looking for the Min and Max values for the raster, but for the Cumulative count cut. My file is a GeoTiff

The GeoTiff is a Raster of NDVI values.


texts: open street map api working for one city but not another

texts:
I went to Open Street Map to download a small area of a city (Toronto) I'm making a map for. When I went to Export it, I tried to manually adjust the northern bounding box at this url

https://www.openstreetmap.org/api/0.6/map?bbox=-[mycoordinates]%2C[mycoordinates]%2C[mycoordinates]%2C[mycoordinates]

But it said the api is down

The webpage at https://www.openstreetmap.org/api/0.6/map?bbox=-79.4026%2C43.6418%2C-79.3641%2C43.6689 might be temporarily down or it may have moved permanently to a new web address.
ERR_INVALID_RESPONSE

I then tried to do a download without adjusting the bounding box and got the same message.

However, I then went to New York City on OpenStreetMap and tested an export from there, and it worked fine. Going back to my city, it still doesn't work.

How is it possible the api works for some cities but not others?


texts: I have points that form a line. I would like to assign a radius to each point to give them volume, e.g. 50m and then find the area of the combined points. Does anyone know of a way to do this in PostGIS?


texts: Shapefile Features that were once KML features will not convert to MapInfo

texts:
I am working on a process where routes are created in My Maps. These files are then exported to a KML file that is then converted to Shapefile in ArcGIS. These features are then merged with the old set of files replacing the corresponding route.

Once this is completed the shapefile is then opened in QGIS and then I do a right-click > Save as > WGS 1984 > MapInfo MIF.

At this point an error will appear. The file is generated, but the three features that were not written are the features that once were KML features.

update
I have been able to convert KML files directly over to MapInfo files, but there are still some edits that need to be made in both the attribute table and geography of the files. However, I am unable to edit both KML and MapInfo files in QGIS.

Has anyone encountered this issue or are there some features that are left unchanged when files convert from KML to a Shapefile?


texts: Selecting by attribute by specific characters fields

texts:
I have a field "HNR_S".

It contains values like "124", "122", "1315", "1465", "15151", "124512642".

How can I select more than three numbers?


texts: Coordinates(Latitude, Longitude) are different at same place on iPhone and Android devices, why?

texts:
I used HTML5 code for getting coordinates on Android (HTC desire s) with GPS enabled and iPhone (3gs). But the latitude and longitude are different on both devices at same place, why?.

Difference was around 20 meter. Why the difference is so much?

Edit

Coordinates only differ on cross platform(iPhone-Android), these are almost same on same platform(Android-Android).


texts: Debugging 'module' object has no attribute 'SdeWorkspaceFactory'?

texts:
I am new to python, am debugging one of existing python code, where am facing an error "'module' object has no attribute 'SdeWorkspaceFactory". Earlier this code was working fine but suddenly does not work.

am using sde connection file from path
"C:\Users\user1\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\Connection.sde

I could able to connect this using sde file using Arcatalog.

Environment : ArcGIS 10.1

I cannot provide entire code base, however most of code looks like correct.

Please provide me a pointer?

def OpenFeatureClass(sWorkspace, sFCName):

    import comtypes.gen.esriGeoDatabase as esriGeoDatabase
    import comtypes.gen.esriDataSourcesGDB as esriDataSourcesGDB

    #pWSF = NewObj(esriDataSourcesGDB.FileGDBWorkspaceFactory, esriGeoDatabase.IWorkspaceFactory)
    pWSF = NewObj(esriDataSourcesGDB.SdeWorkspaceFactory, esriGeoDatabase.IWorkspaceFactory)
    pWS = pWSF.OpenFromFile(sWorkspace, 0)
    pFWS = CType(pWS, esriGeoDatabase.IFeatureWorkspace)
    pFC = pFWS.OpenFeatureClass(sFCName)
    return pFC


texts: Layers render very slowly when importing from sql

texts: I am trying to get a handle on importing layers into qgis 2.6 using the "Add MSSQL Spatial Layer" option. I was able to import a layer successfully, but it seems to take a long time to render. Is there a way to handle layers from a database more efficiently? Are there plugins that you would recommend? Also, would it be better to use a Postgres server and add "PostGIS Layers" as opposed to what is being done now, which is adding mssql spatial layers through an Azure DB connection?


texts:
How to create inset of a polygon?
Not just visually but as a new polygon. For example - I have yellow polygon and need to create green one:
Looking for solution in QGIS.


texts: Is there a free mapping tool which has its on Android SDK?

texts: I am looking for the functionality(s) ArcGIS provide for developing Android apps for free. What I want in specific is a tool like ArcMap where I can develop a map and convert it to some file format like (*.tpk) by which I can develop some routing and geocoding functionality(s). I know it's a long shot but is there a tool which provides this?


texts:
I am using the arcpy.QuickImport_interop tool to convert AutoCAD files into feature classes based on the layer names as below:

arcpy.QuickImport_interop(os.path.join(subdir, file), temp_GDB + file + ".gdb")

Is there anyway I can call the arcpy.ValidateFieldName function within this to ensure that my generated tables have valid names and avoids crashing the script.


texts: Adding map from website maps-for-free.com as basemap on QGIS?

texts:
How can I add map from maps-for-free.com as my base map on QGIS 2.10 Pisa?

My operating system is Windows 7, x64 bit.

@Spacedman. Here, I've gone to ~/.qgis2-->python-->plugins-->quick_map_services-->data_sources

and created a new folder and named it freemap_relief

.

But how to save it as metadate.ini ??


texts: Cartodb: How to make dates appear in Torque time slider

texts:
I am trying to use my date column as a time-slider in my cartodb map. But it doesn't appear or seem to be an option.

What am I doing wrong?

Here's my map: Map

Here's my data:

Thanks.


texts: How to create a polygon from other polygon boundaries?

texts:
I want to write an algorithm that creates a polygon inside a hole made by a set of other polygons.  It's something like a flood fill and it's like the "boundary" tool in Autocad.

The image shows an example: the algoritm should fill the enclosed white space in the center (after a click on it).

Any theory, pseudocode or examples would help a lot.


texts: Publishing Maps to Mobile Devices and the Web

texts:
I have a bunch of agricultural information stored in a local postgis database.  We use qgis to manipulate/analyze this information and to print output.

I would like to publish this information (both raster and vector layers) so that it can be loaded as a layer on both mobile devices and web browsers.  The information to be displayed needs to be a function of the user that is logged in.  It also must be able to interact with the gps on end users mobile devices.  I would like to host all of the data to be published on the web offsite because my upload bandwith is terrible.

In the past I have saved vectors as .kml files and loaded them into google maps for users, but this strategy seems to have problems when displaying large datasets.

I'm comfortable doing a large amount of development work but am also willing to pay for solutions that save me time and headaches.

After researching this project for a couple of days I've found that there are about a million ways to do this.

Any help narrowing down my options would be much appreciated.


texts: Elevation from GPS Vs. Query Elevation from Static TOPO database like SRTM

texts:
As far as I understand the GPS determines Elevation by real time calculations. What I don't understand is how?

For example let's assume perfect (errors free) Lat/Lon fix by GPS. So I can query static (Raster) TOPO data base like SRTM 1 arc second, and get elevation relevant for 1 arc second resolution. If the GPS fix has error so I get location to the next 1 arc second rectangle - In addition to the 1 arc second resolution error, I have error in getting location for the incorrect 1 arc second rectangle.

But how the GPS calculates the elevation (assuming not in the mentioned way), and does the vertical accuracy generally considered so severe, so the query DB eventually can be better?


texts: Making ui.Select out of Feature Collection

texts:
I would like to make items/list for ui.Select out of Feature Collection. I have developed a code, but I am receiving an error: .

var subset = borders.filter(ee.Filter.eq('GID_0', 'UZB'));
var filtered = ee.List(subset.aggregate_array('NAME_1'));
print(filtered);

  var provincename_select = ui.Select({
  items: filtered,

  onChange: function(value) {
    var provincename = value;
  },
  style: {width: '200px'}
  });

print(provincename_select);

https://code.earthengine.google.com/f6005af7e1bd5bfe8e8a598fbb749fdd


texts: Geoserver css Icon size/ scale best practise

texts:
Currently  my rules for styling point Icons bound to scale look like this:

:mark{
  mark: url("file:./icon.svg");
  mark-mime: "image/svg+xml";
}

[atrib='xyz'][@scale > 600 ][@scale < 1000] {
  mark-size:10;
}

[atrib='xyz'][@scale > 400 ][@scale < 600]  {
  mark-size:60;
}

[atrib='xyz'][@scale < 400]  {
  mark-size:120;
}

It´s hard to guess the correct icon size compared to scale. (Trial and error).

Questions:

is there a best practice like "between scale  600 and 1000 mark
size X is appropriated" (or a formular?)
which unit is "mark-size"?
pt, px,em?


texts: Listing items using QGIS combo box from PostgreSQL

texts:
I am building a plugin for QGIS which will have a combo box listing data from PostGreSQL.
I have already connected PostGreSQL.
Now I would want to make this a plugin and add the list of jobs to the combo box .

import psycopg2
from PyQt4.QtGui import*
from qgis.core import QgsMessageLog
msg = QMessageBox()
msg.setText("Message Box Created")
msg.show()
try:
connection = psycopg2.connect(user = "****",
                              password = "********",
                              host = "******",
                              port = "******",
                              database = "******")

cursor = connection.cursor()
# Print PostgreSQL Connection properties
print("connected")
#print ( connection.get_dsn_parameters(),"\n")

# Print PostgreSQL version
cursor.execute("SELECT version();")
record = cursor.fetchone()
print("You are connected to - ", record,"\n")
#creating table in database
'''create_table_query = CREATE TABLE TEST
      (ID INT PRIMARY KEY     NOT NULL,
      job_desc          TEXT    NOT NULL,
      username         REAL);
cursor.execute(create_table_query)'''
connection.commit()
print("Table created successfully in PostgreSQL ")
except (Exception, psycopg2.Error) as error :
print ("Error while connecting to PostgreSQL", error)
finally:
#closing database connection.
    if(connection):
        cursor.close()
        connection.close()
        print("PostgreSQL connection is closed")


texts: Variable parameters for input table and field name

texts:
I searched for others who've asked this question but I couldn't quite find one that matched what I'm trying to do.

I want to make a model that aggregates three address point feature classes and merges them into a single address point feature class with a single field containing the address. Assume all three source feature classes already have some field that contains the address attribute, but each uses a different field name for it.

The source data might be saved in different places each time the tool is run, so I want the user to  navigate to the input feature classes (x3, once for each of the inputs).
Once each input feature class is chosen, I would like a drop-down of the field names in that input table, so that the user can indicate which field contains the address information (i.e., which one to 'keep' in the field mapping of the merge). This is x3 as well, once for each input.

I can't seem to find a way to do this. It seems like it should be simple, but I'm afraid I'm going to end up having to bash the whole thing out into a python script (which I'm clumsy at).

Am I missing something that's already built-in and available in ModelBuilder?


texts: Saving/Loading QGIS style .qml and avoid specified symbology

texts:
Is it possible to save QGIS styles without the symbology style? This may seem like a strange question, but I am trying to automatically set the ValueMap widget under layer properties via a plugin for QGIS 2.0. I'm not able to set the key:value pair in this version, as it's not possible until version 2.2.

What i'd like to do is save the .qml file without any symbology style specified. This is so that when the .qml is loaded via pyQGIS, the user identified symbology doesn't change with it (only the layer property widgets).

I've tried to edit the .qml style file by removing the information pertaining to "symbols". This results in changing the symbology to a simple black line, not remaining unchanged as set by user as I was hoping.


texts:
I´ve got a quite specific question and hope someone understand what I want.
I´ve got two datasets (point-shapes):

Camera traps which gained data of roe deer on forest meadows
Camera traps which gained data of lynx (each camera trap counts given lynx event)

What I did:
I loaded both point-shapes in QGIS. Both point-shapes are overlapping each other.
I created a heatmap based on lynx events

blue rhombus symbolize camera traps on meadows;
heatmap symbolize the redder the more lynx-events were counted

What I want:
I want values of the heatmap (perhaps the center, camera traps where many lynx were present has a value of 10 and camera traps which had no lynx present has a value of 0), so I can question the roe deer camera traps which lynx-value they have.


texts: QField crashing unexpectedly with no error

texts:
I have a QField project that crashes intermittently with no error message. When I open the project again, there is no text in the log.
Is there a way to turn logging on to try and find what is causing the issue?


texts:
Two questions:

Is Geoserver SLD validation the same as validation with some XML Validator?
Is there a way of automating SLD Validation? Let´s say I´d have to validate 700 SLDs – doing this programmatically (by terminal or REST) would be more than helpful.


texts: Use Cursor to Calculate Field with Input Parameters

texts:
I have the following script that is used with a script tool to truncate each word in an input string and output the result to another field.  There is an input parameter for the length of the truncation.

import arcpy
arcpy.env.overwriteOutput = True

# Prelogic used to pass through for calculating truncated name values
codeblock = """
def nmshort(stname,stnum):
  s = stname.split()
  s2 = s[:] = [elem[:stnum] for elem in s]
  s3 = ' '.join(s2)
  if s3 == stname:
    return None
  else:
    return s3
""" # Finished code block

try:
    # Set input parameters
    inFC = arcpy.GetParameterAsText(0)
    inName = arcpy.GetParameterAsText(1)
    inNameShort = arcpy.GetParameterAsText(2)
    inNumber = arcpy.GetParameterAsText(3)

    # set expression for field calculation to variables
    expression = "nmshort(!{0}!, {1})".format(inName,int(inNumber))

    # perform field calculation
    arcpy.AddMessage("Calculating truncated strings for values in input name field")
    arcpy.CalculateField_management(inFC, inNameShort, expression, "PYTHON_9.3", codeblock)
    arcpy.AddMessage("Calculation complete")

except:
    arcpy.AddError("Could not complete the calculation")

    arcpy.AddMessage(arcpy.GetMessages())

How would I accomplish this same calculation using a cursor instead of CalculateField?  I'm using ArcGIS 10.0 so I won't be able to use the data access cursors.  I've used cursors successfully involving simpler expressions (one line'ers) but I can't figure out how to do it for multiple process steps.

I applied Paul's answer as follows:

import arcpy
arcpy.env.overwriteOutput = True

# Prelogic used to pass through for calculating truncated name values

def nmshort(stname,stnum):
    s = stname.split()
    s2 = s[:] = [elem[:stnum] for elem in s]
    s3 = ' '.join(s2)
    if s3 == stname:
        return None
    else:
        return s3

try:
    # Set input parameters
    inFC = arcpy.GetParameterAsText(0)
    inName = arcpy.GetParameterAsText(1)
    inNameShort = arcpy.GetParameterAsText(2)
    inNumber = arcpy.GetParameterAsText(3)

    # set expression for field calculation to variables
    arcpy.AddMessage("Calculating truncated strings for values in input name field")
    cursor = arcpy.UpdateCursor(inFC)
    for row in cursor:
        row.setValue(inNameShort, nmshort(inName,int(inNumber)))
        cursor.updateRow(row)

    del row, cursor

    arcpy.AddMessage("Calculation complete")

except:
    arcpy.AddError("Could not complete the calculation")

    arcpy.AddMessage(arcpy.GetMessages())

The values all come back as "PLAC" for each row.  "PLACENAME" is the field name that was used as the input.


texts: Retrieve geolocation and image url from Blob in MySQL

texts:
I have a web form that collects three items: name, notes, and a geotagged img and stores it in mysql. The image is stored as a blob.

I would like to scrape/access the blob's geo-location properties with a python framework (MySQLdb) and create a geojson.

I am familiar with connecting to the db and retrieving individual rows.

con = MySQLdb.connect(user=user, passwd=passwd, host=host, db=db)
cursor = con.cursor()
query = "SELECT DISTINCT column FROM table;"
cursor.execute(query)

Then start a cursor and save to text.

 for row in cursor.fetchall():
       ....
        print '{'
        print  '"id": "{0}",' .format(row[0])
        print  'name": "{0}",' .format(row[1])
        print  'notes": "{0}",' .format(row[2])
        print '"lat": "{0}",' .format(row[1])
        print '"long": "{0}",' .format(row[2])
        print '"url": "file://{0}"'.format(row[3])
        print '},'

What I'm interested in specifically is how to extract the geographic info and file url from the blob format?  Is there an easier method?


texts: Compute distance between two point from longitude, latitude & height

texts:
I am currently trying to compute the real distance between two 3D points (on a WS84 ellipsoid represensation of our earth), but my knowledge in Geographic Information System is pretty nil (except the fact that I know about using geodesic distance instead of the classic sqrt).

What I use can already compute the geodesic distance between two pair of longitude / latitude, it does not however provide the 3D distance.

So I though about using the classic sqrt distance formula using the result of the geodesic distance and the height, is this approach right ?

I can use either the raw mathematica formula, or one that use the current geodesic distance with the difference of elevation.

Note : I obviously tryed to google it, but I only end up on full of article about building 3D mesh using geodesic distance. So I am wondering also if I am really using the right word when searching for "geodesic distance between 3D points".

I checked this from a post given by the tool that suggest question to check but as it seems it ignores the elevation differences : http://www.movable-type.co.uk/scripts/gis-faq-5.1.html


texts: Mapnik generate_tiles.py error using .xml from TileMill

texts:
I wanted to render PNG tiles (like form tile server of OSM). I made PostGIS db, successfully run TileMill with OSMBright style. I read that I need now export Mapnik XML from TileMill. I checked Mapnik as in Python tutorial and everything works fine.
I've changed generate_tiles.py:

changed the .xml file to read
changed the bbox (I have checked bbox of small area while exporting to PNG in TileMill)
changed the render line to render_tiles(bbox, mapfile, tile_dir, 15, 16 , "mymap")

but an error occurs:
Failed to load fonts from: ./fonts in Map at line 3 of '/home/myacc/bin/mapnik/osm.xml/'
I think the .xml is not made properly (it has written path as reference to current path) but maybe I am wrong.
My questions:

I am doing it wrong (generate XML from TileMill, put it into ~/bin/mapnik and changing generate_tiles.py)?

Is there a better way to make these tiles?

If not- what I should do to make this work (where are those fonts it can't find (I think there will be more errors with reading files) )
edit 1

I have checked:
python -c "import mapnik;print mapnik.fontscollectionpath"
and changed the fontpath in osm.xml, but there is no such fonts registered by Mapnik . I printed out known fonts by:
python -c "from mapnik import FontEngine as e;print '\n'.join(e.instance().face_names())"
but there isn't a font face 'Free Sans Semibold'


texts: GRASS command line: r.thin produces no output

texts:
I am trying to use GRASS on the command line, specifically the r.thin module. It seems to execute properly but I have no output raster dataset to work with afterwards, it is as if it just gets swallowed into the void. This is the exact command:
grass79 -c /data/mapset/PERMANENT --exec r.thin input=dummy_img output=thinned
And I get the following output:
Starting GRASS GIS...
WARNING: Mapset </data/mapset/PERMANENT> already exists. Ignoring the request to create it. Note that this warning may become an error in future versions.
Cleaning up temporary files...
Executing <r.thin input=dummy_img output=thinned> ...
Raster map <dummy_img> - 658 rows X 658 columns
Execution of <r.thin input=dummy_img output=thinned> finished.
Cleaning up temporary files...

So it seems that it executed properly.
But when I look inside the /data/mapset/PERMANENT folder, I see only the dummy_img (which was already there) and no mention of thinned:
$ ls data/mapset/PERMANENT
dummy_img

Am I doing something wrong? here is the docpage but I don't see any specific caveats to this.
I am executing it inside of a docker container with several other commands, this is the full list of commands to be executed, in case they provide any clues (formatted for readability):
sudo docker run -v /home/ibtravel/grass_data:/data neteler/grassgis7 /bin/bash -c
'rm -r /data/mapset;
grass79 -c /data/paths.TIFF -e /data/mapset;
grass79 -c /data/mapset/PERMANENT/ --exec r.external input=/data/paths.TIFF output=dummy_img;
grass79 -c /data/mapset/PERMANENT/ --exec r.null map=dummy_img setnull=0;
grass79 -c /data/mapset/PERMANENT/ --exec r.thin input=dummy_img output=thinned;
grass79 -c /data/mapset/PERMANENT/ --exec r.to.vect input=thinned output=vectorized type=line;
grass79 -c /data/mapset/PERMANENT/ --exec v.out.ogr input=vectorized output=/data/out/out_lines.shp format=ESRI_Shapefile'

https://grass.osgeo.org/grass76/manuals/r.thin.html
I also downloaded a docker image with GRASS 7.6 instead of 7.9, as it is supposed to be stable, but it still did not work, just seemingly no output whatsoever.
Furthermore, this algorithm seems to work when I run it in QGIS 2.18.23 so there must be something going on...
In response to @Micha's answer:
I have put everything into a shell script as suggested, and indeed it is much cleaner. This is the script as it stands now:
r.external -o input=/data/paths.TIFF output=dummy_img
g.region -ap raster=dummy_img
#r.reclass input=dummy_img output=dummy_img_nulled rules=/data/reclass_rules.txt
r.null map=dummy_img setnull=0
#r.thin input=dummy_img_nulled output=thinned
r.thin input=dummy_img output=thinned
r.to.vect thinned output=vectorized type=line
v.out.ogr input=vectorized output=/data/out/out_lines2.shp format=ESRI_Shapefile --overwrite

But now it seems to segfault when I run r.null map=dummy_img setnull=0. You can see in the commented lines that I have come up with a patch solution by using r.reclass to just mimic the intended effect of r.null, but I still find it odd that r.null is giving me such grief with this


texts: How to create an array of repeated values on the client side using JavaScript in Google Earth Engine?

texts:
I want to do something like:

var from = [2,3]
var to = Array(from.length).fill(1)
image.remap(from,to,0)

Of course, I could just assign [1,1] to to, but from is an input of a function and it is not guaranteed to have a length of 2.

The problem is that I get an error that says Array(...).fill is not a function

This suggests that the fill function is not supported, but I thought that the pure javascripts parts are interpreted in the browser's JavaScript engine, and only ee objects are sent to the Earth Engine. My browser definitely supports fill, as it works on its test page, so does anyone know why and how the code editor in Google Earth Engine does not support full Javascript? Also, does anyone know what JavaScript version is supported by Google Earth Engine's code editor?
And lastly how can I actually create an array of variable length filled with 1 in Google Earth Engine's flavor of JavaScript?


texts: Editing of layers on an ArcGIS server in ArcGIS Collector

texts:
We have an ArcGIS server with REST API, containing some feature layers we want to edit also on machines without ArcGIS Desktop, ideally through ArcGIS Collector. We don't have the Portal, but we have ArcGIS Online organization account. However, this says that only hosted layers can be set edittable, and maps without edittable layers seems to be invisible for ArcGIS Explorer. We can't afford keeping all the layers to be editted as hosted ones.

This answer mentioned working directly with the feature server's services, so it should be possible, even though I didn't find how to do it in a day of searching. So how to make the Collector work with the layers without hosting them to AGOL?


texts: Updating OpenStreetMap maps database of own tile server?

texts:
I am working with a osm2pgsql database, and I do not know wheter I can use Osmupdate or not because in the StreetMapWiki it says furry-sansa should be used for osm2pgsql databases. The problem is furry-sansa does not only make the updating but also gives a styling to the maps, something I want to avoid.

Does Osmupdate work with osm2pgsql?

Should I modify furry-sansa in order to obtain only the updating function?*

*Modifying furry-sansa would be hard for me.


texts: How to search and zoom to result using WMS?

texts:
I am making a web gis application (openlayers/geoserver) to display a layer of properties, I need to add a functionality of search in it based on the name of the owner.

A list of similar names owners with address should be displayed and when i click a particular item the map should be zoomed on the particular property location.

The problem is that i want this functionality using WMS. (I do not want it in WFS as the vector layer can be copied using QGIS or other tools, it is not secure). Please let me know how will this be possible using WMS.


texts:
I know this seems to have been approached many different ways.  I just can't find a way (or examples by searching this site) that meet what I want to do.  It's odd as it seems as if it's something that would be a common need (hopefully I'm missing something easy).
I'm creating a map of a reach (segment) of stream.  I've established a benchmark from which I have gps coordinates.  I've measured to points along the stream bank (distance, bearing) from the benchmark. In excel I've converted all these to points that I've imported into GIS.  No problem there.  I now have 8 points that show me both banks of stream.  In my import into GIS, I could include a sequence number attribute for each point.
I'd like to create a polygon from these points - Ideally, the polygon's lines would be connected from point to point (in sequence order), finally connecting the last sequence point to the first, enclosing the polygon.   The end result would be a polygon in the shape of the stream reach.
I can connect the points into a polygon manually now, easily, for one reach.  Thing is, I have about 60 - 10m reaches per stream (I have 7 study streams).  I need automation.
Attached should be an example image for one reach of stream where I've manually connected the points into a polygon shape.  (ignore the line and points within).
Any ideas or paths to send me down to figure this out?

((EDIT: I'm going to add here that I have used points to path - gets me close but I cannot get the last and first points to connect.


texts: PHP PostGIS to GeoJSON missing required parameter error

texts:
I'm using this PHP PostGIS to geoJSON script: https://gist.github.com/bmcbride/1913855

But I keep getting this error: 'missing required parameter: geotable'

This is my code:

  # Retrive URL variables
    if (empty($_GET['WTGs_All'])) {
        echo "missing required parameter: geotable";
        exit;
    } else
        $geotable = $_GET['WTGs_All'];

    if (empty($_GET['the_geom'])) {
        echo "missing required parameter: geomfield";
        exit;
    } else
        $geomfield = $_GET['the_geom'];

    if (empty($_GET['srid'])) {
        $srid = '4326';
    } else
        $srid = $_GET['srid'];

    if (empty($_GET['fields'])) {
        $fields = '*';
    } else
        $fields = $_GET['fields'];

    $parameters = $_GET['parameters'];

    $orderby    = $_GET['orderby'];

    if (empty($_GET['sort'])) {
        $sort = 'ASC';
    } else
        $sort = $_GET['sort'];

    $limit      = $_GET['limit'];

    $offset     = $_GET['offset'];

    # Connect to PostgreSQL database
    $conn = pg_connect("dbname='postgres' user='postgres' password='****' port='5432' host='localhost'");
    if (!$conn) {
        echo "Not connected : " . pg_error();
        exit;
    }
# Build SQL SELECT statement and return the geometry as a GeoJSON element in EPSG: 4326
$sql = "SELECT " . pg_escape_string($fields) . ", st_asgeojson(transform(" . pg_escape_string($geomfield) . ",$srid)) AS geojson FROM " . pg_escape_string($geotable);
if (strlen(trim($parameters)) > 0) {
    $sql .= " WHERE " . pg_escape_string($parameters);
}
if (strlen(trim($orderby)) > 0) {
    $sql .= " ORDER BY " . pg_escape_string($orderby) . " " . $sort;
}
if (strlen(trim($limit)) > 0) {
    $sql .= " LIMIT " . pg_escape_string($limit);
}
if (strlen(trim($offset)) > 0) {
    $sql .= " OFFSET " . pg_escape_string($offset);
}
//echo $sql;

# Try query or error
$rs = pg_query($conn, $sql);
if (!$rs) {
    echo "An SQL error occured.\n";
    exit;
}

# Build GeoJSON
$output    = '';
$rowOutput = '';

while ($row = pg_fetch_assoc($rs)) {
    $rowOutput = (strlen($rowOutput) > 0 ? ',' : '') . '{"type": "Feature", "geometry": ' . $row['geojson'] . ', "properties": {';
    $props = '';
    $id    = '';
    foreach ($row as $key => $val) {
        if ($key != "geojson") {
            $props .= (strlen($props) > 0 ? ',' : '') . '"' . $key . '":"' . escapeJsonString($val) . '"';
        }
        if ($key == "id") {
            $id .= ',"id":"' . escapeJsonString($val) . '"';
        }
    }

    $rowOutput .= $props . '}';
    $rowOutput .= $id;
    $rowOutput .= '}';
    $output .= $rowOutput;
}

$output = '{ "type": "FeatureCollection", "features": [ ' . $output . ' ]}';
echo $output;
?>

My table is called WTGs_All, I don't know what am I doing wrong.


texts: Handling non-spatial data for QGIS projects with Camelot

texts:
Most of my projects include data which is non-spatial or which is point data and can be managed by a regular relational database.  Previously I found Manifold and ms-access were a good combination that could almost seamlessly work together.  Now that I am with QGIS, I would like to move over to Spatialite entirely.  The missing piece for me is an application development environment for the non-spatial side.  I have tested the QGIS forms builder on a non-spatial table and it is quite reasonable.  I set up a viewer of geotagged photos in just a few minutes without coding.  However for the times I want to work with more complex non-flat data I have been looking at using Camelot for Python.  The documentation suggests that it can do most or all of what ms-access can do and that the coding approach required is similar.  I have not built a useful app yet, too much new stuff at once.  My direct questions:

Have any other QGIS users developed or tried to develop complimentary applications in Camelot?
Can you just create non-spatial tables in Spatialite databases or is it best to keep the non-spatial tables in a regular SQLite database?
Do any QGIS developers have something in the pipeline that will allow parent/child data forms (subforms) to be created?