texts: What is a suitable Global/Universal Unique Identifier for a PostGIS database?

texts:
I have read that using OIDs as a primary key in a postgreSQL/PostGIS db is poor practice because there are instances where these can be reset. Sounds logical, but then what is a suitable alternative? I believe there is an option to use a "Universal Unique Identifer" UUID, but the large text and number value that spits out is horrible.

Just a bit more background to my situation. I have all of my spatial tables created with a field called "gid" which is the primary key for that table and unique only to that table. I have an issue now because I want to relate my spatial tables (all with a "gid" field starting at 1 and incrementing) to one large table with the related information. Obviously for my relationship to work all of my spatial features need a unique identifier which differentiates them from one another.

EDITED Added this image as per Peters' comment. Peter this is the idea I have in my head, it may not be the best way to go about it or it might not even be good db design. I am interested in what you think.

Any tips?


texts: Qgis globe plugin (2.16) missing on Ubuntu 14.04

texts:
I just upgraded from Qgis 2.14 to 2.16 and I can't get the Globe plugin to work. Apparently, under Ubuntu it is necessary to install it separately. But in the Ubuntugis repository, only version 2.14 of qgis-plugin-globe is available and Synaptic refuses to install it:

qgis-plugin-globe:
  Depends: qgis (=2.14.3+dfsg-2~trusty1) but 1:2.16.0+20trusty is to be installed
 Depends: libopenscenegraph100v5 but it is not going to be installed
 Depends: libosgearth3 but it is not going to be installed
 Depends: libosgearthqt3 but it is not going to be installed
 Depends: libosgearthutil3 but it is not going to be installed

Any idea how to get this plugin to work?


texts: How can I create a csv file starting from a layer with some boundaries to a layer with others boundaries?

texts:
I have a vector layer with the definition of the blocks of the state of NY, and I have another vector layer with the definition of the group blocks of the state of NY. They are two different vector layer (shapefiles).

I also have a CSV table with some extra information (population) with the field GISJOIN, and I can join this csv file with one vector layer, the block vector layer (that have the same field GISJOIN).

How can I do the join with the other group block vector layer?

My goal is to have a csv file compatible with the group block vector layer.


texts: Using update cursor to place points along line from .csv file?

texts:
I work for a utility company and we have a number of poles that did not have their GPS locations taken, rather where the line turns the GPS location was taken, and the span of each pole in between each "angle" pole was calculated.

I ran the point to line function to create the line that runs between the GPS'd points and am currently working on a single span where the poles all line up in a straight line (I plan to expand this script to populate multiple spans after their angles change).  I have line name, pole number (the points), and the distance to the next pole (in feet, which I convert to meters) in a .csv file.  I have calculated the angle of the line and used trig functions to calculate the position of the next point (I'm using UTM zone 14 so it's a grid).  When I run the script, as I have it now, it places the first point exactly where it should be, based on the location of the start of the line it follows.  The problem is, the way the script is written it places all the points the distance in the .csv file away from the START point of the line.  What I'm stuck on is placing the point the distance in the .csv from the PREVIOUS point that I populate in the update cursor, instead of from the initial point.

Here is the script as I currently have it.

# Import system modules
import arcpy
import math
import csv
from arcpy import env

#Set Variables

input_line = r"P:\Scripts\missing_poles\missing_poles.gdb\missing_poles_script\angle_line"
angle_field ="Angle"
rotationMethod = "GEOGRAPHIC"
coordSystemField = "UTM"
pole_distance_file = r"P:\Scripts\missing_poles\missing_poles_demo_no_empty.csv"
new_points = r"P:\Scripts\missing_poles\missing_poles.gdb\missing_poles_script\updated_poles"

#Create Field to add line angle too

arcpy.AddField_management (input_line, angle_field, "FLOAT")

#Calculate the angle of the line
for row in arcpy.da.SearchCursor(input_line, ["OID@", "SHAPE@"]):
    # Print the current line ID

    print("Feature {0}:".format(row[0]))

    #Set start point
    startpt = row[1].firstPoint

    #Set Start coordinates
    startx = startpt.X
    starty = startpt.Y

    #Set end point
    endpt = row[1].lastPoint

    #Set End coordinates
    endx = endpt.X
    endy = endpt.Y

    #calculate xy of new points
    radian = math.atan((startx-endx)/(starty-endy))
    with open(pole_distance_file) as csvfile:
        readCSV = csv.reader(csvfile, delimiter=',')
        for row in readCSV:
            #convert span ahead to meters
            span_ahead = (float(row[2])*0.3048)
            pole_id = row[1]
            #calculate x and y coordinates
            x = (math.sin(radian)*span_ahead)+ startx
            y = (math.cos(radian)*span_ahead)+ starty
            #update Feature Class with new coordinates
            new_coordinates = (x,y)
            print new_coordinates
            cursor = arcpy.da.InsertCursor(new_points, ["SHAPE@XY"])
            cursor.insertRow ([new_coordinates]

And here is the .csv file I'm working off of.

555B,65,475
555B,66,455
555B,67,430
555B,68,355
555B,69,490
555B,70,450
555B,71,400
555B,72,460
555B,73,450
555B,74,495
555B,75,430
555B,76,455
555B,77,495
555B,78,465
555B,79,495
555B,80,470
555B,81,490
555B,82,478


texts:
I have an OL3 map with a WMS layer generated in a React component. I'm trying to update the parameters of the ol.source.ImageWMS() dynamically, using React props to set CQL_FILTER and STYLES parameters.

Here's a basic example :

import React, { Component } from "react";
import ol from "openlayers";

export default class Map extends Component {

    componentDidMount() {

        let wms = new ol.source.ImageWMS({
                url: 'http://url/wms',
                params: {
                    LAYERS: 'layer',
                }
            })

        let layer = new ol.layer.Image({source: wms})
        let map = new ol.Map({
            target: this.refs.map,
            layers: [layer],
        })
    }

    render() {
        return (

        )
    }
}

Now let's say my app state feeds the component with an id and a style. In what React lifecycle hook and with what Openlayers method can we update WMS parameters?

I first failed using for ex: CQL_FILTER = 'attribute={this.props.id}', or STYLES = '{this.props.style}
I also failed putting the logic into a function and calling it like this: CQL_FILTER = setCQL.bind(this)
I then discovered there was a dedicated OL3 method called updateParams().
My failed implementation of that method was to call it at the end of the componentDidMount() hook,

like so :

let wmsStyle = !this.props.style ? '' : 'style1'
let cqlFilter = !this.props.id ? '' : 'attribute=id1'

wms.updateParams({
    CQL_FILTER: cqlFilter,
    STYLES: wmsStyle,
})

This doesn't even work with static parameters. I'm running out of ideas and I'm not even sure if it is a React or an OpenLayers issue. Anyone?


texts: Setting the initial scene of OL3-Cesium map in Tilt View

texts:
I have two maps.

One of them is using CesiumJS library, and the other map is using the OpenLayers3-Cesium integration library.

What I need to do is set the initial scene of the maps in Tilt View.

I have managed to do so in my Cesium map. See code below:

var viewer = new Cesium.Viewer('cesiumContainer');
var url='http://localhost:8080/geoserver/gwc/service/wms';
var layers=viewer.scene.globe.imageryLayers;
layers.removeAll();
layers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
    url:url,
    layers:'ghaziabad_map'
}));

var scene = viewer.scene;
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(77.567485,28.829527, 0.0));
var model = scene.primitives.add(Cesium.Model.fromGltf({
    url : 'SampleData/models/CesiumGround/modimandir.gltf',
    modelMatrix : modelMatrix
}));
var position = Cesium.Cartesian3.fromDegrees(77.567485,28.829527, 0);
var entity = scene.entities.add({
        position : position
});
viewer.trackedEntity = entity;
Sandcastle.finishedLoading();

I want to achieve the same thing now in my second map, using ol3-cesium.
My code so far:

var source=new ol.source.TileWMS({
  url: 'http://localhost:8080/geoserver/wms',
  params:{LAYERS:'ghaziabad_map'}
});
var ol2d = new ol.Map({
  layers: [
    new ol.layer.Tile({
      source:source
    })
  ],
  controls: ol.control.defaults({
    attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
      collapsible: false
    })
  }),
  target: 'map',
  view: new ol.View({
    center: ol.proj.transform([72.77469766,18.8907357,72.992294311,19.293357849], 'EPSG:4326', 'EPSG:3857'),
    zoom: 3
  })
});

var ol3d = new olcs.OLCesium({map: ol2d});
var scene = ol3d.getCesiumScene();
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(77.567485,28.829527, 0.0));
var model = scene.primitives.add(Cesium.Model.fromGltf({
    url : 'SampleData/models/CesiumGround/modimandir.gltf',
    modelMatrix : modelMatrix
}));

var provider = new Cesium.WebMapServiceImageryProvider({
    url: 'http://localhost:8080/geoserver/wms',
    layers : 'ghaziabad_map'
});
scene.provider = provider;


texts: Overriding default popup anchor in Leaflet GeoJSON polygon?

texts:
By default popups open wherever you click within the boundaries of polygons in Leaflet geojson layers. Here's an example:

JsFiddle

I would like to anchor the popup either:

so it opens in a specific place on the map (setLatLong)

or

at a specific coordinate relative to where the cursor clicks on the polygon. (anchorPopup)

I know from docs that this can be achieved using anchorPopup or openPopup: if this be the case where does one add this to the code?

My code is similar to the jsfiddle:

var outcroppings = L.geoJson(outcroppings,{

 style: function(feature, layer){
    return {
        color: "black",
        fillColor: "orange",
        fillOpacity: 6,
        weight: 2,

    };
},

   onEachFeature: function (feature, layer){
    layer.bindPopup(

                    ""+
                    "
area: "+feature.properties.Shape_Area
                   );
}

 }).addTo(map);


texts: QGIS N:M relations - possibility to edit multiple features?

texts:
I have a working QGIS project with multiple relations and all is well until I try the Toggle multi edit mode for N:M relations. I'm working with QGIS 3.10+ (3.14.16) and Windows  and PostGIS.
Is it even possible to edit multiple features with N:M relation and, if it is, what buttons should I push to activate this?

When in multi edit mode the N:M relations are hidden and not shown. I thought I managed to do this once, but don't know what buttons I pushed and now I start to think I was imagining things.
If you need better example I can draft one in English, but I have been following the documentation here: https://docs.qgis.org/3.10/en/docs/user_manual/working_with_vector/attribute_table.html#editing-multiple-fields
I can also contribute to the documentation on this if needed.


texts: GDAL-Georefrencing already Georefrenced single band Raster

texts:
I am trying to georeference already georeferenced single band raster data using GDAL with four GCP's.

Input image is having Coordinate system GCS- WGS1984 (EPSG:4326).
Following Command is run on command Prompt:

"gdal_translate -of GTiff -gcp 72.4819 23.0179 72.4819 23.0179 -gcp 72.492 23.0079 72.492 23.0079 -gcp 72.4819 23.0086 72.4819 23.0086 -gcp 72.496 23.0169 72.496 23.0169 input.tiff output1.tiff"

"gdalwarp -r near -order 1 -co COMPRESS=NONE -s_srs EPSG:4326 -t_srs EPSG:4326 output1.tiff" output.tiff"

Issues:

After running this command on command prompt and opening output generated file  in QGIS the output is not having the coordinate system as EPSG:4326.
Image is opening somewhere else location in QGIS viewer. Hence the image is not properly georeferenced.
I ran  georefrencing tool in QGIS with same input dataset it is giving the expected output and image is opening on exact Geographic location.
I copied generated gdal script from QGIS and ran again in Command Prompt and opened output  again in QGIS. The image is not as expected.

Questions:

Is this above command is correct for georeferencing already georeferenced data?
Apart from above command Is there any another internal Command QGIS using for georeferencing raster image?
After running gdalwarp, why the output generated is not resampled and not having mentioned coordinate system.


texts: Can't see WFS-T layer with OpenLayers and GeoServer (Windows)

texts:
I am trying to implement a simple test of a OpenLayers + WFS-T + GeoServer -setup. I have followed the instructions by populating PostGIS and configuring GeoServer, and can see the WFS-T layer data in GeoServer's preview fine.

I am following these steps: http://www.gistutor.com/openlayers/22-advanced-openlayers-tutorials/47-openlayers-wfs-t-using-a-geoserver-hosted-postgis-layer.html

When I view the test page in browser, WSF-T layer is not displayed.

I have not defined proxypass to GeoServer (I have not done this: http://www.gistutor.com/geoserver/21-intermediate-geoserver-tutorials/38-configuring-geoserver-proxy-for-public-and-remote-data-access.html)! This is because

I think this should not be necessary since I am testing my page only using file://somefolder/mytestpage.html URLs
My setup does not have Apache web server at all - GeoServer Windows installer did not install it
The symptoms do not sound like the problems are due to not using proxypass - there are no failed requests when I look at Firebug, and no "XMLHttpRequest cannot load http://www.yourdomain.com/geoserver/wfs. Origin localhost is not allowed by Access-Control-Allow-Origin." errors

What I am weirded about is that when the page loads, the only request to localhost is OPTIONS request to /geoserver/wfs. There's no POST messages to localhost at all.

I have installed GeoServer in port 28080, and this is how I modified the source code from http://www.gistutor.com/openlayers/22-advanced-openlayers-tutorials/47-openlayers-wfs-t-using-a-geoserver-hosted-postgis-layer.html

disabled proxypass (just commented the whole row - is this how you do it?)
changed some parameters to reflect my environment: url: "http://localhost:28080/geoserver/wfs", geometryName: "geom", schema: "http://localhost:28080/geoserver/wfs/DescribeFeatureType?version=1.1.0&;typename=cite:wfst_test"

.

// disabled proxypass
// OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

// wfs-t editable overlay
var wfs_layer = new OpenLayers.Layer.Vector("Editable Features", {
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
//projection: new OpenLayers.Projection("EPSG:26910"),
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
// loading data through localhost url path - jannem: use port 28080 as we have no apache proxy
url: "http://localhost:28080/geoserver/wfs",
featureNS :  "http://www.opengeospatial.net/cite",
maxExtent: mapextent,
// layer name
featureType: "wfst_test",
// geometry column name
geometryName: "geom",
schema: "http://localhost:28080/geoserver/wfs/DescribeFeatureType?version=1.1.0&;typename=cite:wfst_test"
})
});

If I open localhost:28080/geoserver/wfs/ with browser, I get

<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="2.0.0"
  xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://localhost:28080/geoserver/schemas/ows/1.1.0/owsAll.xsd"
  xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ows:Exception exceptionCode="MissingParameterValue" locator="request">
    <ows:ExceptionText>Could not determine geoserver request from http request org.geoserver.platform.AdvancedDispatchFilter$AdvancedDispatchHttpRequest@7db12fce</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>

Any ideas?

EDIT: added two pictures for the discussion in the comments:


texts:
I posted this on digitalocean, but it's imperative I resolve this problem.

Freshly updated 14.04 and I went from trying qgis.org debian to the ubuntugis repo. Results:

xx@XX:~$ sudo apt-get install qgis python-qgis qgis-plugin-grass
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 unity-control-center : Depends: libcheese-gtk23 (>= 3.4.0) but it is not going to be installed
                        Depends: libcheese7 (>= 3.0.1) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

However:

xx@XX:~$ sudo apt-get install libcheese-gtk23 libcheese7
Reading package lists... Done
Building dependency tree
Reading state information... Done
libcheese-gtk23 is already the newest version.
libcheese7 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I have made several attempts at this by purging, auto removing, etc. I'm at a loss.

Additionally, with the QGIS and ubuntugis repos added, I try to install from software center and get this error:

The following packages have unmet dependencies:

unity-control-center: Depends: libpulse-mainloop-glib0 (>= 1:0.99.1) but 1:4.0-0ubuntu11.1 is to be installed
                      Depends: libpulse0 (>= 1:0.99.1) but 1:4.0-0ubuntu11.1 is to be installed
                      Depends: libxi6 (>= 2:1.2.99.4) but 2:1.7.1.901-1ubuntu1 is to be installed

When I go to update them, terminal says they are up to date.


texts: Creating generic tool with ModelBuilder in ArcGIS Desktop?

texts:
We are working on the creation of a tool with ModelBuilder in ArcGIS Desktop 10.1. We want to build a generic tool that can be launched from any computer. In order to do so, we have set the input files as parameters in the model. When launched from the Toolbox, the paths on our computer come up in the parameter boxes. The user can change them, but we would like to have blank boxes instead.

To do so, we delete all relative path of the parameters in the model. When we test the model in ArcMap, we get the following message “Error Warning 000873” which says that our workspace does not exist. Also we have a second kind of error: “ERROR 001000” which means that some value of zone field does not exist.

Is there anyone who has executed this operation with success and could explain us the right way of process?


texts: Extracting polygon coordinates from only two specific corners

texts:
End goal: To add two (or 4) fields to a polygon grid feature class which will contain coordinates of the lower left (southwest) and upper right (northeast) corners of each grid.

I have a feature class containing 40km grids (about 100 total polygons).  I realize that "Feature Point to Verticies" will output every corner for each grid but I only want the Northeast corner and the Southwest corner attributed to each polygon.

I'm thinking if there is a way to produce a unique attribute code for the output of each quadrant (another process to create quadrants within each grid poly?), I could then select the corners I want based off of the unique code.

Another method may be to generate xMin + yMin, for the lower left, and then xMax + Ymax? Could something work around this?

If there is an easier way of doing this that I'm missing here then please let me know!


texts: Address feature missing in Nominatim returned data

texts:
When you search http://nominatim.openstreetmap.org the details page shows a lot of information and some are missing when querying nominatim.

For example when I search for "choisy" : http:/nominatim.openstreetmap.org/search?format=xml&limit=5&addressdetails=1&q=choisy

(I removed a slash of http:// because I'm not allowed to post 2 links ...)

Result on nominatim : http://nominatim.openstreetmap.org/details.php?place_id=158972963

Result I get with the httprequest is the following:

It's missing (from the "Address" table on the page) in my returned XML result.

  "Haute-Savoie boundary:administrative relation 7407   6   0"

Do you know how to get it ?


texts: Can you use WFS services in a front-end Cesium app?

texts:
I am using Web Map Services (WMS) in Cesium Apps

.WebMapTileServiceImageryProvider

.WebMapServiceImageryProvider

However I cannot find any Cesium official reference to WFS or WFS-T services which I now need to start using.

I have visited this site regarding OpenLayers and Cesium integration:

ol-cesium

but no explicit reference to WFS services as such, only to 'vectors' examples (i.e. JSON).

Is there any implementation of the WFS standard for Cesium?


texts:
We are using GeoServer and OpenLayers to display our data. We have a static WMS layer and several dynamic WFS layers. I want to use client side caching of the WMS layer at different pre-defined zoom levels.

When I first load the map I want the layers to display. The WMS layer will be client cached but then in the background I want the WMS layer for the next ZoomIn level  to cache also. Is this possible?

How much should we be caching i.e. how much is too much?

Also is there any point in caching dynamic WFS layers?

Any help appreciated.


texts:
I need help to connect R with Grass. In RStudio when I send the line:

loc <- initGRASS("C:/Program Files/R/R-3.1.0/bin/i386", home=tempdir(), override=TRUE)

It says:

Error in system(paste("g.dirseps.exe -g", shQuote(Sys.getenv("WINGISRC"))),  :
  'g.dirseps.exe' not found

Guys, can you help me, please?


texts: Generating N points from polygon field values in FME?

texts:
I have a polygon layer with 33 rows. I want to generate N number of points at the centroid of each polygon, where N is a value unique to each polygon contained in a field value.

I've been looking at the Creator transformer, but I can't figure out how to feed the Creator with dynamic values for X/Y or the amount of features to create, based on another dataset.

There is a RandomPointGenerator available from the FME Hub, however it seems this transformer cannot create points based on field values, only a fixed, common value for all the polygons in the dataset.


texts: How to merge two polygons and a splitting line or polygon in WFS-T

texts:
I am working on merging two features and splitting in openlayers 3. Features may be a line or polygon without any plugin like turf.
Below is code of merge two polygon
f1 = selectclick.getFeatures().item(0);
        f2 = selectclick.getFeatures().item(1);
       console.log(f1.getGeometry().getCoordinates());
       console.log(f2.getGeometry().getCoordinates());
        var f3 = new ol.Feature({
            geometry: new ol.geom.MultiPolygon(
              f1.getGeometry().getCoordinates().concat(f2.getGeometry().getCoordinates().slice(1))
            ),
            name: "I'm the joined geom"
        });
        console.log(f3);
        selectclick.getFeatures().clear();
        sourceWFS_polygon.removeFeature(f2);
        sourceWFS_polygon.removeFeature(f1);
        sourceWFS_polygon.addFeature(f3);

There are no errors in the above code but it's still not working. Can anyone help me to merge two selected features?
UPDATE
I have changed code like below. In database both f1 and f2 are deleted and f3 is inserted as in image
A is showing f1 and f2 B is showing f3. As observed in image f3 is same as f2 it means merging is not working properly.
   f1 = selectclick.getFeatures().item(0);
        f2 = selectclick.getFeatures().item(1);
        var f3 = new ol.Feature({
            geometry: new ol.geom.MultiPolygon(
                f1.getGeometry().getCoordinates().concat(f2.getGeometry().getCoordinates().slice(1)) ),
            name: "I'm the joined geom"
        });
        console.log(f3);
        f3.getGeometry().transform('EPSG:3857', 'EPSG:4326');
        transactWFS_polygon('insert', f3);
        transactWFS_polygon('delete', f1);
        transactWFS_polygon('delete', f2);

XML:
 var payload = xs.serializeToString(node);
       $.ajax('http://localhost:8066/geoserver/spatial_editing/ows', {
        type: 'POST',
        dataType: 'xml',
        processData: false,
        contentType: 'text/xml',
        data: payload
    }).done(function () {
        sourceWFS_polygon.clear();
    });

Response from geoserver
<?xml version="1.0" encoding="UTF-8"?><wfs:TransactionResponse xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:spatial_editing="http://spatial_editing" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://localhost:8066/geoserver/schemas/wfs/1.1.0/wfs.xsd"><wfs:TransactionSummary><wfs:totalInserted>1</wfs:totalInserted><wfs:totalUpdated>0</wfs:totalUpdated><wfs:totalDeleted>0</wfs:totalDeleted></wfs:TransactionSummary><wfs:TransactionResults/><wfs:InsertResults><wfs:Feature><ogc:FeatureId fid="polygon.71"/></wfs:Feature></wfs:InsertResults></wfs:TransactionResponse>


texts: Mapfish Print on linux server doesn't print any texts to png or jpg outup formats

texts:
I'm using Mapfish Print 1.2 on Windows and everyhing works correctly. But on Linux server, Mapfish Print doesn't print any texts to output formats like png or jpg. It does work only with pdf.

Do you have any ideas, what's the problem?


texts: Converting from .lyr to .kmz with error and shifted pixels in ArcGIS Desktop?

texts:
I had the .tif file and by using "Layer to kml" toolbox (without changing the preset parameters) i got the kmz file with very bad resolution. Then i tried to modify it changing the values for output image properties. But the results is strange, instead of having the same cell size i got this weird shifted/overlapped pixels. Scale and all other parameters stayed the same, only the output image properties that were changed..

Have you ever met this problem?


texts: Using custom filters (server side) for OpenLayers Vector Layer

texts:
I have a vector layer in openlayers with source in GEOJSON (custom php server, which I have in complete control) and BBOX strategy.

Vector points contain point sources which have different attributes. I want to implement some filters by one or two attributes. I can manage server side php code - for e.g. I can get the filters by adding URL parameters to existing url like:

Existing URL: mywebservice.php
Filtered URL: mywebservice.php?someattributte=somevalue

How do I implement it on the OpenLayers side?

My code is as follows:

            var in_options = {
                'internalProjection': EPSG_900913,
                'externalProjection': EPSG_4326
            };
            var ems_sources = new OpenLayers.Layer.Vector(EMS_SOURCES_TITLE, {
                strategies: [
                             new OpenLayers.Strategy.BBOX({
                                 resFactor: 2,
                                 active: true,
                                 autoActivate: true,
                                 ratio: 1.3
                             })

                         ],
                 protocol: new OpenLayers.Protocol.HTTP({
                     url: EMS_SOURCES_WS,
                     callbackKey: 'callback',
                     format: new OpenLayers.Format.GeoJSON(in_options)
                 })
            });


texts: Display LiDAR data in E00 (interchange file) on maps

texts:
I have Lidar data in E00 files (interchange files). Can I overlay them on some maps like say Bing maps or Geoserver with OpenLayers?

If yes, what is the right way of doing it?


texts: How can I open a georeferenced JPG file in OCAD?

texts:
I have a georeferenced .jpg file with the .jgw file containing the coordinates. I want to use it as a background in OCAD. But when I open the file as a background, the jpg file is not georeferenced to any coordinates. How can I open it and reference it to the right coordinates in OCAD?

I have done the same thing with a georeferenced .tif and a .tfw file containing the coordinates.


texts:
I'm trying to make geodjango app. I'm using SQLite and SpatialLite.
I want to add shops, and be able to sort them from closest to furthest from my location.

When in my model I have:

location = gis_models.PointField(srid=4326, blank=True, null=True)

then adding works, but sorting by distance does not work, and I get:

SQLite does not support linear distance calculations on geodetic coordinate systems.

When I have:

location = gis_models.PointField(srid=3857, blank=True, null=True)

than adding does not work, and sorting works, and I get:

geo_shop.location violates Geometry constraint [geom-type or SRID not allowed]

What do I do to make them both work at the same time?


texts:
Is there a way to integrate my own custom tools into the Processing toolbox in QGIS? I believe I have found where to strategically hack the stock processing scripts to ensure it picks up my custom provider (python/plugins/processing/core/Processing.py) but I can't figure out if there's a less kludgy way to register things.

I can't find any tutorials or anything so hoping that someone has either done this or can walk me through it.


texts: Latitude and longitude values conversion

texts:
I received a backup file and the latitude and longitude in this backup are very big, for example, Latitude: -106994676, Longitude: 488026770.
I have not idea how to convert them into regular latitude/longitude numbers. Any ideas on how to?
My understanding the position measured should be somewhere close to 29.7282° S, 135.5651° E.


texts: Removing attribute from SpatialPointsDataFrame with spdplyr::select() in R

texts:
I'm trying to drop columns/attributes from a SpatialPointsDataFrame, using spdplyr, like so:

library(sp)
library(spdplyr)

x <- c(15.2, 15.3, 15.4, 15.5, 15.7)
y <- c(50.4, 50.2, 50.3, 50.1, 50.4)
v1 <- c(1.0, 2.0, 3.0, 4.0, 5.0)
v2 <- c("a","b","b","c","a")
attributes <- as.data.frame(cbind(v1,v2))
xy <- cbind(x,y)
locationsDD <- SpatialPointsDataFrame(xy, attributes)

locationsDD <- select(locationsDD, -v2)

With the result

Error in `[.data.frame`(x@data, i, j, ..., drop = FALSE) :
  undefined columns selected

With SpatialPolygonsDataFrames this method works without issues. Is this a bug, or am I doing something wrong?


texts: How to select features that are outside the boundary of a polygon

texts: I have a polygon that there are some partitions inside its boundary and some partitions outside its boundary. My question is how to select the partitions that are outside the boundary of the polygon? I know how to implement it in ArcGIS. I should use select by location and set the target to the layer that have partitions, set the source to the polygon layer and set the relation to "have their centroid in the source layer". But I can't find the corresponding spatial relation in spatial filter class when using ArcObjects and C#. The picture of my polygon and the partitions are as follows:


texts:
I have a large number of cloropeths stored in SLD and QML formats. QGis is unable to apply any of those, there is no option in the GUI for SLD, whereas it fails to apply QML files correctly.

Is there any way to use an externally defined choropleth in QGIS 3? Some way to convert QML or SLD to another format that QGIS understands? Or some plug-in that can apply the SLD standard?

Update I: The screen capture below shows the Load Style dialogue in QGis 3.4. Note that the SLD file is not shown in the list: the dialogue only lists .qml files, since there is no SLD option in the file type dropdown menu. If the SLD file name is inserted manually, the Open button remains greyed out.

Update II: From the comments to the answer below, it is apparent that the Style Load dialogue is different in Windows from what I get on Linux. A discussion is now open at the UbuntuGIS list.

Update III: the screen capture below was obtained in a different system, with QGis 3.10 installed on Fedora 29. As with QGis 3.4 on Ubuntu, the file type dropdown only contains the QML option and only .qml files are listed.

Update IV: the problem reported in this question can be verified with the OSGeo-Live 13 distribution. Load a map from /usr/local/share/data/raster and then follow Layer Properties > Symbology > Style > Load Style. The dialogue does not list SLD as a possible type, only QML. If an existing QML file is selected it is not applied correctly.


texts: Highlight a feature on WMS layer using OL3 + mapserver

texts:
In OL2 I think that it was done by using something like this:

the_control = new OpenLayers.Control.GetFeature({
   protocol: OpenLayers.Protocol.WFS.fromWMSLayer(mymap, {
      geometryName: 'geom',
      featureType: 'feature'
   }),
   box: false,
   hover: false
});

which sent XML request to mapserver which returned GML response with the geometry.

What is the alternative in OL3? I just want to 'highlight' the the feature on WMS layer. How to setup the select interaction with the WMS layer OL3, send information to mapserver and highlight the feature according to the response? And how to configure layer in mymap.map file?

I get response from mapserver like this:

<?xml version="1.0" encoding="UTF-8"?>

<msGMLOutput
     xmlns:gml="http://www.opengis.net/gml"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <tudu_linestring_layer>
    <gml:name>TODO 3 (WMS)</gml:name>
        <tudu_linestring_feature>
            <gml:boundedBy>
                <gml:Box srsName="EPSG:102067">
                    <gml:coordinates>-687941.344000,-1099495.708000 -678154.701000,-1093996.637000</gml:coordinates>
                </gml:Box>
            </gml:boundedBy>
            <fid>8394</fid>
            <color>#00C800</color>
            <layer>0</layer>
            <version>20.3</version>
            <idgr>173314038596</idgr>
            <width>1</width>
            <linetype>solid</linetype>
            <todo>173314</todo>

        </todo_linestring_feature>
    </todo_linestring_layer>
</msGMLOutput>

The style is set up like this:

new ol.style.Style({
  stroke: new ol.style.Stroke({
     color: '#007FFF',
     width: 5
  })
}),


texts: Can anyone tell me how to show the file path of a map when I'm composing my final map figure. Kinda of like in excel in the headers and footers options where you can show the file path of the excel table. I am using QGIS 2.4


texts: Smoothly interpolating Polygons from set of coordinates?

texts:
I'm still quite new to QGIS and I'm using it to display and analyze my soil data. I have point information on the distribution of the soils in a specific area and I need to create a soil map from that. I'm using QGIS 2.2.0 Valmiera and I used the voronoi polygons function to interpolate the areas between the points. Now these are very edgy but in soil science it is custom to have smooth bent lines in the soil maps because that rather represents the nature of soil distribution then straight lines.

Is there another function or algorithm that interpolates smooth polygons, or is there a way to smooth the voronoi polygons?
I have seen that there a some threats on smoothing polygons already but none refer to exactly this problem.

Below is a picture of the polygons I've got so far.


texts: Load OpenRailwayMap layer in Google Maps

texts:
I'm quite new using Javascript Google maps API, and I need to create a simple map showing the railways in Europe.

I was thinkin in downloading the data from OSM and show it in my map, but I'm sure there is a simple way to do it, showing the data directly from OpenRailwayMap as a WMS-like layer.

Does somebody know if could be possible do it like this?


texts: Calculating a field with a codeblock in gdal/ogr

texts:
I'm trying to calculate a field ('duplicates') to reflect the identical records, here's a part of the code:

d = []
def isDuplicate(t):
     import string
     global d
     iD = 0
     for item in d:
         if item == t:
             iD = 1
             continue
     if iD == 1:
         return 1
     elif iD == 0:
         d.append(t)
         return 0

I'm calling the function isDuplicate() in the code below:

ogrinfo input.shp -dialect SQLite -sql "UPDATE input SET duplicates = isDuplicate('account_No')"

It doesn't output anything and it doesn't give any errors either. Can anyone see the problem?


texts: Using ArcGIS Pro Vector tile package in ArcGIS Desktop?

texts:
Does anyone perhaps have a work around for reading a ArcGIS Pro Vector tile package in ArcGIS Desktop?

There is an option to open the online service in Desktop but raises an unsupported file type error when I select this option.


texts: Turning a line layer into a polygon layer and automatically adding an attribute

texts:
I have been given a .DXF file of a site which has been split into a 10 x 10 grid system consisting of 910 individual squares.
In order to create these squares the person who made the grid made 30 lines running north / south and 31 lines running east / west and where these intersected became the boxes. (I've tried to attach a photo but apologies if it doesn't appear properly)
Anyway I would like to create a polygon shapefile with several attribute columns based on these boxes.
One of which is a label for each box - North / South squares are numbers, East / West are letters so where these intersect you would get a cell ID i.e. I10
How can I create a layer creating polygons from the line layer and label these accordingly as automatically as possible using QGIS 3.16?


texts: Is there a way to build an URI without specific programs?

texts:
My purpose: to be able to load a text to CSV directly with Python console in QGIS.
When I read the QGIS guide (https://docs.qgis.org/3.10/it/docs/pyqgis_developer_cookbook/loadlayer.html) for Python it seems that you can build an URI from a CSV file that you have in your folder.
With this Python expression in Python console in QGIS 3.10 you can load the CSV file into your project:
uri = "file://{}/testdata/delimited_xy.csv?delimiter={}&xField={}&yField={}".format(os.getcwd(), ";", "x", "y")
vlayer = QgsVectorLayer(uri, "layer name you like", "delimitedtext")
QgsProject.instance().addMapLayer(vlayer)

Critical aspect of the guide are the "{}", what does it mean? I tried to guess what to add inside "{}".  So I tried to reconstruct the URI of the CSV file assuming that the first {} is referred for the path of the folder, the second should be empty and the {} after xField= have to be fulfilled with the field name of the longitude and the {} after yField= with the latitude. In my case, they also remain empty because my CSV is a table without field lat/lon.
Then, it should be:
uri = "file://C:/Users/Simone/OneDrive/Documenti/qgis/Grass esercizi/COVID19_Fallzahlen_FL_total.csv/delimited_xy.csv?delimiter={}&xField={}&yField={}".format(os.getcwd(), ";", "x", "y")
vlayer = QgsVectorLayer(uri, "layer name you like", "delimitedtext")
QgsProject.instance().addMapLayer(vlayer)**

But there is no right result, I obtain a CSV table without data source (with symbol triangle with "?") and I have to manually add. The error is the following:
--- Logging error ---
Traceback (most recent call last):
  File "C:\OSGEO4~1\apps\Python37\lib\logging\__init__.py", line 985, in emit
    stream.write(msg)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
  File "C:/Users/Simone/AppData/Roaming/QGIS/QGIS3\profiles\mio/python/plugins\qgisnetworklogger\model.py", line 140, in request_about_to_be_created
    self.pop_nodes(child_count-NODES2RETAIN)
  File "C:/Users/Simone/AppData/Roaming/QGIS/QGIS3\profiles\mio/python/plugins\qgisnetworklogger\model.py", line 327, in pop_nodes
    log.debug('Removing {} Request nodes.'.format(count))
Message: 'Removing 10 Request nodes.'
Arguments: ()

Why have I to build manually the URI? Because I don't want to install software only for this request. I prefer to reconstruct manually the URI.
So, please doesn't answer me "you can install URI builder/C and so on…".


texts: Merging two different geometry layers into one (SQL, GeoPackage)

texts:
I have a point layer ('points') and a polygon layer ('multipolygons') . I want to load the points layer combined with the centroids of the polygon layer.

Im using GeoPackage and tryed to go a SQL way by inserting the centroids into the points table:

insert into points
select ST_Centroid(geom) as geometry, *
from multipolygons where "tourism"!='NULL'

This returns that error:

  table points has 27 columns but 28 values were supplied

Im using the DB-Manager of QGIS:

The GeoPackage was generated from osm.pbf by using ogr2ogr

I need to have the centroids and the points into one place. Also other solutions would be nice (virtual layer?)

Add: According to the answer of user30184, I wrote the following query, resulting in a expected attribute table but without relating geometries:

insert into points (geom, osm_id, name, amenity, historic, leisure, man_made, natural, office, place, sport, tourism)
select st_centroid(geom) as geom, osm_id, name, amenity, historic, leisure, man_made, natural, office, place, sport, tourism
from multipolygons
where tourism in ('attraction','museum','camp_site','caravan_site','hostel','zoo','information','viewpoint')


texts: Bounding box as a 4-tuple - south/west/north/east order?

texts: We need to pass a bounding box as a 4-tuple and we cannot pass named arguments. I've searched a bit at found that different APIs use different order of lat/lon and different corners (northwest/southeast and southwest/northeast). What's in fact is a "best practice"?


texts:
I have a spatialpolygons-dataframe in R that contains overlapping polygon features. I would like to dissolve only the overlapping features into separate polygon features (one feature per par of overlapping polygons) and preserve the other features as they are. The length of my dataset should therefore reduce e.g. from 4000 to 3900 if say 200 polygons overlap pairwise.

A simplified visualization:

I tried the unionSpatialPolygons() from the maptools package as indicated here. However this will dissolve all polygons into a single polygon.

A workaround would be to use an id-vector that defines which polygons should be dissolved as indicated by the help manual.

  if the id argument is used, it should be a character vector defining the memberships of the output Polygons objects, equal in length to the length of the polygons slot of spgeom

In my case it would be those polygons that overlap together (can be two or more).

Edit

A possible but not efficient solution is given in the code below, assuming you already have an intersection matrix, that you can create e.g. with gIntersects setting byid=TRUE. IF anyone knows an easier and more efficient solution for this, please contribute.

### example data (this should later be your intersection matrix)

mx<-matrix(c(TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,
             TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,
             FALSE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,
             FALSE,FALSE,FALSE,TRUE,TRUE,FALSE,FALSE,
             FALSE,FALSE,FALSE,TRUE,TRUE,FALSE,FALSE,
             FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,
             TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE),7)

### groupings
# create a list for the results
results.list<-as.list(vector(length=ncol(mx)))

# group
for(i in 1:ncol(mx)) {
  tmp <- which(mx[,i]) # get TRUE FALSE values for the i-th column
  ifelse(length(tmp)>1, # if there is more than 1 TRUE value,
         tmp.expand<-which(apply(mx[,tmp],1,any)), # get the row-number of the other TRUE Values and create a vector called expand
         tmp.expand<-tmp) # otherwise define tmp as expand
  while(length(tmp.expand)>length(tmp)){ # while tmp.expand has more items than tmp
    tmp<-tmp.expand # reset tmp to tmp.expand
    tmp.expand<-as.vector(which(apply(mx[,tmp],1,any))) # get all new row-numbers of new TRUE values
  }

  results.list[[i]]<-tmp.expand # store results in the list
  print(paste("nr", i, "out of", ncol(mx),"done", sep=" "))
}

# create unique ids from the results
results.list<-
llply(.data = results.list,
      .fun = function(x)paste(x,collapse=""))

Now you can use this list as an ID vector in the unionSpatialPolygons function. This will create new polygons from the overlapping ones and leave the others as they are.

Note
The amount of computational power required by this approach increases exponentially with the size of your matrix/nr of polygons and the nr. of overlappings. If you have a very big data-set you might rather subset it first and than process the subsets separately. After you can join them again and apply the function again to get the same result.
I also tried the code with the lapply function instead of a for loop but it is not really faster, at least if applied on a single core.

The code was partly developed with help of this question on SO.


texts: Implementing gs:Nearest WPS process from geoserver

texts:
I am implementing gs:Nearest WPS process available in GeoServer using openlayers in OpenGeo Suite SDK.
I am trying to implement this process as a openlayers plugin to hook into my custom web mapping application.Though there is many tutorial on how to implement JTS:Split and JTS:Buffer process there is no tutorial for any other wps process.This Process Require Feature collection or Vector Layer as a input.

Firebug Error Geometry.CLASS_NAME undefined i think this is because I am not able to collect all the features from the vector layer.

So How can I create a vector layer using OpenLayers.Layer.Vector????

var test = Ext.extend(gxp.plugins.Tool, {

ptype: 'myapp_test',

/** Initialization of the plugin */
init: function(target) {
    test.superclass.init.apply(this, arguments);

    // Create a WPSClient instance for use with the local GeoServer
    this.wpsClient = new OpenLayers.WPSClient({
        servers: {
            local: '/geoserver/wps'
        }
    });

    // Add action buttons when the viewer is ready
    target.on('ready', function() {
        // Get a reference to the vector layer from app.js
        this.layer = target.getLayerRecordFromMap({
            name: 'sketch',
            source: 'ol'
        }).getLayer();
      //I am not getting Feature Collection or can not create Vector layer
       this.layer2 = new OpenLayers.Layer.Vector("parks", {
                strategies: [new OpenLayers.Strategy.Fixed()],
                projection: new OpenLayers.Projection("EPSG:4326"),
                protocol: new OpenLayers.Protocol.WFS({
                    version: "1.1.0",
                    url:  "/geoserver/wfs",
                    featurePrefix: "medford",
                    featureType: "parks",
                    featureNS: "http://medford.opengeo.org"
                })
            });

        // Some defaults
        var actionDefaults = {
            map: target.mapPanel.map,
            enableToggle: true,
            toggleGroup: this.ptype,
            allowDepress: true
        };

        this.addActions([

            // Action for splitting by drawing a line
            new GeoExt.Action(Ext.apply({
                text: 'TEST',
                control: new OpenLayers.Control.DrawFeature(
                    this.layer, OpenLayers.Handler.Point, {
                    eventListeners: {
                        featureadded: this.nearf,
                        scope: this
                    }
                })
            }, actionDefaults))
        ]);
    }, this);
},

/** Handler function for splitting geometries */
   nearf: function(evt) {
 var wkt = new OpenLayers.Format.WKT();
 var pt=wkt.write(evt.feature);
//var f =JSON.parse(this.request.responseText);
//var myline = OpenLayers.Geometry.fromWKT('point(117 22)');
 var g = new OpenLayers.Format.GeoJSON();
 var f=g.read(this.request.responseText);
 this.wpsClient.execute({
                server: 'local',
                process: 'gs:Nearest',
                inputs: {features:this.layer2, point:pt},
                success: this.addResult
            });

},

/** Helper function for adding process results to the vector layer */
addResult: function(outputs) {
    alert('Hello World');
}
});

Ext.preg(test.prototype.ptype, test);


texts: Georeferencing Image using saved Link Table from another Image?

texts:
I had a scanned map that I did did a georeferenced a few weeks ago and saved the link table. Now I have two more scanned map that need to do the same thing. It is the same area and one of them I did the second and it worked but I could not get the third scanned map worked.  The third scanned map has the TIFF file but has no coordinate system and no extent referenced.

Do they have to set up in coordinate system first before you do the image registration ?
Do I need to do a few links and then save the link table and then launched the Image registration and use the saved link table to apply it ?

What might I go wrong here ?

I'm using ArcGIS 10.1 for Desktop, or ENVI 5.0/5.1 or ERDAS 2013.


texts: ESRI AddFeatures call on rest endpoint with attributes

texts:
I can add a line feature via the rest endpoint with my hand crafted call from C#. However, if i add any attributes to the call it will fail and say unable to perform operation.
All of the fields in the sde feature class are nullable.


texts: R Clip Simple Features Multiple Polygons with a Polygon (or another multi-polygon)

texts:
I have two polygon layers, a set of aquifer polygons and a set of district boundaries.  I'm trying to clip the aquifer layers to be in only the districts that I want.

From examining the other posts on the forum I saw that st_crop almost achieves what I want except that it only takes a bbox, and I found that st_intersection is again nearly the exact solution except that SF doesn't like one of the two multipolygons because the boundaries between the polygons touch so I get the Topology Exception.  Does anyone know how to handle this?  This seems like a pretty straightforward thing, but despite my efforts, I'm unable to overcome it.

I also thought to loop through each element of the aquifer polygons, but I wasn't sure if this would work without dissolving the adjoining district boundaries first.  Either way it feels like a clumsy solution because eventually I'd have to rejoin the finished product anyways to one single SF object.

for (i in length(aquifers)){
  aquiferslist[i] <- st_intersection(aquifers[i], dist.bound)
}


texts:
I am a complete beginner to OpenLayers and web mapping in general. I am trying to change the layers' order of my map by modifying the layers' index value, but I cannot get my code to work.

Any hint on what the problem is?

Here is the code:

<!doctype html>

<title>Simple example</title>
<link rel="stylesheet" href="../assets/ol3/css/ol.css" type="text/css" />
<link rel="stylesheet" href="../assets/css/samples.css" type="text/css" />

<button onclick="doSwitch();">Switch layer</button>

Edit

This works on OL 3.10.

        /* Switch function */
    function doSwitch(){
        var satIndex = satLayer.getZIndex();
        if (satIndex === 1) {
            osmLayer.setZIndex(1);
            satLayer.setZIndex(0);
        } else {
            osmLayer.setZIndex(0);
            satLayer.setZIndex(1);
        }
    }


texts:
Could someone explain how to export from QGIS a 16bit image?
I have imported data and coloured it as I want, but need to export it as a 16-bit image, as 8-bit is giving a terracing effect. I believe I need to use this code in OSGeo4W Shell, but I don't know how to use it.
gdal_translate -ot Int16 -srcwin xoff yoff xsize ysize -outsize xsize ysize src_dataset dst_dataset

Here is a screenshot of my map, which has the following extent:
Xmin 510000, Ymin 156000, Xmax 528000, Ymax 174000


texts: Extracting certain attributes from raster layer in QGIS

texts:
I have a raster layer which illustrates land use in Rwanda. I would like to be able to extract the cropland and make it a raster by itself. I have tried to extract it using the raster calculator, however it does not work for me.
I tried using these two formulas:
(9 <= "Landcover_raster" <= 10)*1 + ((9 > "Landcover_raster") AND ("Landcover_raster" > 10))*0

and
("Landcover_raster" = 0.21)*1 + ("Landcover_raster" != 0.21)*0

I was unsure whether I could extract it based on the value of the attribute or the label of the attribute.
Am I using the raster calculator wrong or is there another way to extract a certain attribute from a raster file?


texts: How to install QGIS-3 (2.99) on Ubuntu 17.10?

texts:
I tried to install QGIS 3 (2.99) on LUbuntu 17.10, but run into errors.
I tried to follow/adapt the instructions on QGIS website.

If I add artful entries to /etc/apt/sources.list:

deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu artful main
deb http://qgis.org/ubuntugis-nightly artful main

I get 404  Not Found errors with sudo apt-get update:

Err:6 http://qgis.org/ubuntugis-nightly artful Release
  404  Not Found [IP: 104.27.139.220 80]
...
Err:10 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu artful Release
  404  Not Found

If I use xenial entries in /etc/apt/sources.list instead:

deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main
deb http://qgis.org/ubuntugis-nightly xenial main

Then

$ sudo apt-get install qgis

I get errors:

Reading package lists... Done
...
 The following packages have unmet dependencies:
 qgis : Depends: libgsl2 but it is not installable
        Depends: libqgis-analysis2.99.0 but it is not going to be installed
        ...
        Depends: qgis-providers (= 1:2.99.0+git20171103+c9ee3ef+24xenial-ubuntugis) but it is not going to be installed
        Recommends: qgis-plugin-grass but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Any suggestions on how to install QGIS3 on Ubuntu 17.10?

-- Edit --

By the way, I've also tried to use Debian directly:

deb     http://qgis.org/debian jessie main
deb-src http://qgis.org/debian jessie main

But it also gives an error:

$ sudo apt-get install qgis
Reading package lists... Done
...
Some packages could not be installed.
...
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 qgis : Depends: libgdal1h (>= 1.8.0) but it is not installable
        Depends: libgeos-c1 (>= 3.4.2) but it is not installable
        Depends: libgsl0ldbl (>= 1.9) but it is not installable
        ...
        Depends: python-qgis (= 1:2.18.14+13jessie) but it is not going to be installed
        Depends: qgis-providers (= 1:2.18.14+13jessie) but it is not going to be installed
        Recommends: qgis-plugin-grass but it is not going to be installed
        Recommends: qgis-provider-grass but it is not going to be installed
E: Unable to correct problems, you have held broken packages.


texts: Is it possible to build QGIS with qt5 without changing the code?

texts:
I wish to build QGIS using qt5.
As told here (Can I use QGIS with Qt5?) it is possible with GIS 2.10.

So i've loaded sources from here git://github.com/qgis/QGIS.git and switched to remotes/origin/release-2_10 branch.

During the compile process i've got lots of errors.

The first is:

.../QGIS/src/core/geometry/qgsgeometry.cpp: In member function ‘void QgsGeometry::detach(bool)’:
.../QGIS/src/core/geometry/qgsgeometry.cpp:110:17: error: no match for ‘operator>’ in ‘((QgsGeometry*)this)->QgsGeometry::d->QgsGeometryPrivate::ref > 1’

Any suggestions?
Is it realy possible to build QGis using qt5, without changing code?


texts: How do I configure QGIS Web Client on Ubuntu/Debian for remote access

texts:
I am having issues with accessing the QGIS Web Client on a remote web browser despite getting a working GetCapabilities request.

I have been able to install QGIS Server and QGIS Web Client on the localhost with success using Ubuntu/Debian. As a result, on the local server, I am able to open up a web browser and go to the url: qgis-web-client.localhost and access the default client landing page and open up the local maps, helloworld and naturalearth_110million, with success. Further, I am able to insert new QGIS project files into the same folder where helloworld and naturalearth_110million reside and update the client landing page with success on the localhost.

However, when it comes to a remote browser, I am not able to access the client landing page with all of the created QGIS projects.

I have tried a few different combinations for the installation of QGIS Web Client to enable the remote web browser to no avail:
1. I installed QGIS Web Client on my local directory "/home/johndoe" by performing "git clone https://github.com/qgis/qgis-web-client.git" and then entering in "sudo ./install.sh ~/qgis-web-client/projects"
2. On a separate server machine, I also attempted to install QGIS Web Client on my the directory "/var/www/html" by performing "git clone https://github.com/qgis/qgis-web-client.git" and then entering in "sudo ./install.sh /var/www/html/qgis-web-client/projects"

Are there any tips for configuring QGIS Web Client via Ubuntu/Debian so that a remote web browser may access the data accordingly?


texts: Set default style for QGIS Composer Items

texts: When creating a Composer Layout in QGIS, it is useful to add multiple items such as text boxes, shapes and arrows.  Once I have formatted an item (eg an arrow line) is it possible to set it as a default so that subsequent items are created with the same default parameters?


texts: Add TileCache Schema Layer to Leaflet Map

texts:
I am trying to get Leaflet to display a TileCache Schema tileset. One example:

http://example.com/tiles/Admin/06/000/000/357/000/000/158.png

As far as I can tell, Leaflet only supports TMS style tiling schemas such as:

http://a.tile.openstreetmap.org/15/16938/11166.png

I tried to find an extension of a L.tileLayer that supports the TileCache tiling schema, but no such luck.


texts: Automated clearing /tmp using QGIS batch processing?

texts:
I'm currently batch processing a bunch (~200 x 200MB) of ascii grid surfaces using some SAGA and GDAL algorithms in QGIS and have been running into "out of storage" errors. The issue is that between runs of the model, the /tmp folder fills up after 7-8 surfaces are processed. Performing an "rm -r /tmp/*" between runs clears up space to restart the model. The /tmp folder isn't abnormally small (4g).

I'm not sure how unorthodox it would be to have QGIS send a command between runs to clear the /tmp folder but I'm curious to know how this could be automated (perhaps in python?) to run at the end of a model run. Any other solutions for processing lots of grids would be welcome


texts: How is Topographic Position Index calculated?

texts:
My understanding of how topographic position index is calculated is:
TPI = cell value - (mean of cell values within defined neighborhood)
But, I see that Weiss' original poster (http://www.jennessent.com/downloads/tpi-poster-tnc_18x22.pdf) was a little bit different than this.
tpi = int((dem - focalmean(dem, annulus, irad, orad)) + .5)
This part is essentially what I described - (dem - focalmean(dem, annulus, irad, orad). The annualus, irad, and orad terms just allow for an annulus of a defined size to be used rather than a continuous neighborhood.
Why is the "+.5" included and the "int()"? Weiss stated, "This poster presents an algorithm, implemented in GRID." I'm not familiar with GRID, was "int()" a function to integer-ize a value?
SAGA cites Weiss' posted for the calculation of TPI, does that mean that the algorithm in SAGA uses the "int()" and "+.5"?


texts: How to tell which QGIS plugins are slow to load?

texts:
We have new users of QGIS in our office that are dismayed immediately by the startup time of QGIS - which hangs on the 'Restoring Loaded Plugins' message on the splash screen.

Is there a way to tell which plugins take long to load and are causing QGIS to load slowly? This can sometimes take ~1minute!

The only solution so far is to disable almost every plugin that comes with the default installation and bring back the plugins one by one as you need them - but so far we haven't figured out which default plugin is causing the slow load time.


texts: Finding the type of object in MapBasic (MapInfo)

texts:
I am trying to write a MapBasic function to check whether or not an object can be used with the Overlap/AreaOverlap functions - I need to tell whether it's a closed shape or a line/arc/point/text object.

I have two questions.

Is there an existing function that will do this?
Why doesn't this work?

Function IsObjectRegion(ObjAlias As Alias) As Logical
    Dim ObjectType As SmallInt
    Note OBJ_TYPE_POINT    ' This popup is displayed correctly
    Note "Crash Now."      ' This doesn't display.
                           ' Instead you get an error that says "could not convert data".
    ObjectType = ObjectInfo(ObjAlias, OBJ_INFO_TYPE)
    Do Case ObjectType
        Case OBJ_TYPE_REGION
            IsObjectRegion = True
            print "Object WAS a region"
        Case OBJ_TYPE_RECT
            IsObjectRegion = True
            print "Object WAS a region"
        Case OBJ_TYPE_ROUNDRECT
            IsObjectRegion = True
            print "Object WAS a region"
        Case OBJ_TYPE_ELLIPSE
            IsObjectRegion = True
            print "Object WAS a region"
        Case Else
            IsObjectRegion = False
            print "Object was NOT a region"
    End Case
End Function


texts: Is it possible to solve Differential Equations in ArcMap and/or ERDAS Imagine?

texts: I would like to know if it is possible to solve differential equations and run them directly in either ArcMap or ERDAS Imagine, similar to the raster calculator in ArcMap?


texts: Column "tags" is missing in PostgreSQL table created with osm2pgsql

texts:
I downloaded osm2pgsql for Windows from AppVeyor (https://ci.appveyor.com/api/projects/openstreetmap/osm2pgsql/artifacts/osm2pgsql_Release_x64.zip?tag=0.96.0&job=Environment%3A%20arch%3Dx64) and osm-data from Geofabrik (http://download.geofabrik.de/europe/germany/bayern-latest.osm.pbf).

I tried to use osm2pgsql to transfer that data to a local PostgreSQL database by running

osm2pgsql.exe -d <my_database> -c -k -s -S <my_stylefile> -P <my_port> -U <my_username> -H <my_hostname> bayern-latest.osm.pbf

Prior to running this command I made sure to store my password in the PGPASS environment variable.

My PostgreSQL database has the following extensions: hstore, plpgsql, postgis. I used the slim-option (-s) when calling osm2pgsql because I need access to the temporary data stored in the planet_osm_nodes table.

The tags specified in the style file are:

# OsmType  Tag          DataType     Flags
node,way   power        text         polygon
node,way   cables       text         linear
node,way   voltage      text         linear
node,way   wires        text         linear

After the successful execution of osm2pgsql, each of the tables "planet_osm_line", "planet_osm_point" and "planet_osm_polygon" inside my PostgreSQL database contain the columns "osm_id", "power", "cables", "voltage", "wires", "tags" and "way". The table "planet_osm_ways" contains the columns "id", "nodes", "tags".

My problem is that the table "planet_osm_nodes" only has the three columns "id", "lat", "lon" but no column "tags".

I am calling osm2pgsql from within a tool called GridKit (https://github.com/bdw/GridKit) and that tool absolutely needs the "tags" column to further process the data.

Do you know why this column is missing in the table "planet_osm_nodes" and what I can do about it?


texts:
I want to read GPX track points with their time stamps into QGIS. I try GPS Tools, GPX Conversions, Waypoints from a track.

This fails on my PC at office (QGIS code revision d94c044). Sometimes QGIS stalls with high CPU usage, but most times I get an error "The layer C:/Daten/CurrT.gpx?type=waypoint is not a valid layer and can not be added to the map".

It works on my Laptop at home (QGIS code revision ebebdf3), but the created features don't contain timestamps. Fields are name, elevation, comment, description, source, url, url name.

How should I proceed?

BTW both versions of QGIS insist "You are running the current version of QGIS" and don't offer updates. Is it reasonable to re-install the (apparently) same version of QGIS from time to time?


texts: Creating survey from existing point service layer using Survey123?

texts:
I'm creating a road sign inspection survey, and I'd like the field crew to be able to select the sign they want to inspect from the map (or a drop down) then fill out the survey based on their selection.

I see that it's possible to create a survey from an already existing service feature, but I can't get the points to actually show up.

Is Survey123 capable of doing this?


texts: Shortest path through complex vector layer?

texts:
I have a vector layer with complex geometry with many dead ends and breaks.

I want to find the shortest path that will go through all segments of that vector.

Here is a sample of how my vector looks like:

I used the pgr_TSP from the pgRouting module, but the result does not satisfy my need. The solution I got really does not seem to be the shortest... The path jumps from one side of the vector to another, and after going through one segment goes back to the previous segment, 50km away. I've tried to prepare the vector data for pgr, but I could make mistakes.

Here is core of the code I used:

    CREATE TABLE TSP_solution_fc AS
    SELECT * FROM pgr_TSP('
    SELECT node_id as id, ST_X(ST_GeometryN(geom, 1)) AS x,
    ST_Y(ST_GeometryN(geom, 1)) AS y  FROM vertices
    ',34345,38770);

The problem is also that not all segments are connected, ie. I have 100km connected in one area, and 100km ten kilometers away, and I need the path to go through all that.

Also, it requires points as an input, so I densified vertices to 1m distance (from many tries I did, it is the max distance between vertices, otherwise the route will skip parts of my vector on junctions). It is problematic itself because my vector is more than 1200km long, so I have over 1.2 million of points to calculate, and it takes hours to calculate. So I do my attempts only on the 70km part of the vector, but I will have to make it faster somehow at some point.

Ideally, the path would take into account that it is possible to go not only through the vector, but that it can jump from one end of a segment to another close segment, and that sometimes it would be possible to go multiple times through one segment, which sometimes could make the path shorter.

Does anyone have any idea how can I approach this problem?

I'm not a coder, but I can deal with some PostgreSQL (PostGIS especially) and Python commands.


texts:
I'm creating a map layout. One of the layers is a point layer of villages, and because of the scale of the map and the clustering of the villages, I think the easiest way to provide the name of the villages is to use a 'key numbering' approach - giving each symbol a number and then giving the names in the legend. "Name" is a field in the shapefile.

My first thought was to label with 'Name' but use the key numbering option within the label engine. However, currently, labelling sees key numbering as a last resort. Using mostly default options, it results in a handful of villages numbered but others with the name given as a standard label. It's a mess. I've found a way to 'trick' the Maplex labelling engine to use the key numbering strategy for all features by setting the offset to a very high number (i.e. forcing the preferred location outside the visible map). However, the resulting key is then automatically placed within the map frame, and is in my case broken into several mini-key scattered around the map, rather than in a legend I can manipulate. Again, it's a mess.

The other option I've considered is:

Change the symbology from a single symbol for all villages to 'Unique
Values' and choose the Name field. Automatically classify all unique
values.
Manually change the symbol for each village back to be the same
colour (so the symbols are the same).
Manually add a shape marker layer to each symbol, offset it to the side, and manually set this to a unique number for each village

This would create a uniquely numbered symbol for each village, and a standard legend would show these symbols with the corresponding names (as that is how the symbology is defined). However, I haven't done that yet because it seems like a massively tedious exercise to manually modify each symbol, and there must be a better way! Also the legend would display the whole symbol for each village, not just the number.

Any ideas? I would have thought this would be a standard feature of mapping software but apparently not! Using ArcGIS Pro 2.2.4


texts: In the current QGIS versions 2.18.6, 2.18.3 and 2.14 my top layer conating svg markers is not shown.  When trying the same on 2.99 nightly build, the layer is shown correctly. I find no issue / bug report about this, so I am turning to you pro's: Can you think of a reason for the layer not showing in the composer? In QGIS desktop it shows correctly, and no scale dependent visibility is used.


texts: How to get a signal when the geometry to a line in QGIS is changed

texts:
I am working on a plugin in QGIS and want to get a signal when the geometry to a feature(in this case a polyline) in my layer is changed. For example if I use the node tool to drag one of the nodes.

In the qgis-api-documantion(http://qgis.osgeo.org/api/classQgsVectorLayer.html) i see that the line:
void geometryChanged (QgsFeatureId fid, QgsGeometry &geom) is listed under signals.

So I used this command:
QObject.connect(self.iface.activeLayer(),SIGNAL("geometryChanged(QgsFeatureId,     QgsGeometry)"),self.changedGeometry)

I have a method called changedGeometry:

def changedGeometry(self, intValue, qgsGeom):
    QMessageBox.information(self.iface.mainWindow(),"Message", "Changed geometry. intValue: " + str(intValue) + "qgsGeom: " + str(qgsGeom))

When executed I get this error:

TypeError: C++ type 'QgsFeatureId' is not supported as a slot argument type

I have also tried QObject.connect(self.iface.activeLayer(),SIGNAL("geometryChanged(int, QgsGeometry)"),self.changedGeometry).

Then the program do not crash, but I don't get the message about changed geometry

I am using QGIS version 1.8.0-Lisboa. Compiled against Qt 4.7.1 and these

import statements are in the top:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qgis.gui import *

Edit:
I tried using qint64 instead QgsFeatureId, but it still don't work.

QObject.connect(self.iface.activeLayer(),SIGNAL("geometryChanged(qint64,QgsGeometry)"),self.changedGeometry)

Edit2:
I also tried using the new style of connecting signals and slots.
self.iface.activeLayer().geometryChanged.connect(self.changedGeometry)
But it gave me this error message:

TypeError: connect() failed between geometryChanged(qint64,QgsGeometry) and unislot()


texts: Openlayers Custom Renderer - Multiple polygons

texts:
I want to render more than one polygon for a feature in a vector layer. So, for example given a polygon render it as normal, then render it again with a different colour and offset by a Y value. I may also need to operate on the additional geometry to clip it.

This would give a pseudo 3D effect.

I know I can do this by using multiple layers but this seems really inefficient.

I looked at extending the SVG renderer to do this and have successfully rendered multiple polygons from the drawPolygon method. BUT the style is fixed as this method simply adds the SVG path to a created node.

Is there a better way to achieve this. Ideally, I want to render a wall, floor and roof for a feature, all will have differing geometries and colours. But I don't want to have to pull the geometry from the server 3 times which is what will happen if I use three layers.


texts:
I have osm data imported into PostgreSQL with osm2po tool (which makes the data routable). Also I have imported data relationed with nodes and node_tags with osmosis tool.

I need to obtain a set of nearest nodes from a given location (maybe 30 or 40). Then I need to calculate the shortest path from the given node from each others. It means to execute shortest_path query multiple times in a row, which takes about 2 seconds (1 query 2 seconds: 30 queries 60 -> too long).

SELECT * FROM shortest_path('
   SELECT id AS id,
          source::int4 AS source,
          target::int4 AS target,
          cost::float8 AS cost
   FROM tt_2po_4pgr',
275742,
274494,
false,
false)

What would be the best way to do this in a reasonable time?

Please excuse my English

Edited:

In accordance to dkastl answer, I tried with wrapper functions and effectively I obtain better results 2 or 3 times better, but isn't acceptable for me yet.

With the following query:

explain analyze SELECT *
    FROM dijkstra_sp_delta('dr_2po_4pgr', 278174, 289786, 0.3);

I obtain this results: explain


texts: How to load memory output from QGIS processing?

texts:
Many processing algorithms have an option to save output as memory. If ran from toolbox, this works fine, because you can tick the "Open output file after running algorithm" box.

Looking at the source code for QGIS, the code for loading the memory layer seems to be defined in the function Postprocessing.handleAlgorithmResults. The function uses access to an alg.outputs list, and does the following:

for out in alg.outputs:
    progress.setPercentage(100 * i / float(len(alg.outputs)))
    if out.hidden or not out.open:
        continue
    if isinstance(out, (OutputRaster, OutputVector, OutputTable)):
        try:
            if out.value.startswith('memory:'):
                layer = out.memoryLayer                                # NOTE!!
                QgsMapLayerRegistry.instance().addMapLayers([layer])   # NOTE!!
            else:
                # ...

When you run processing algorithms from the console, is there a way to load the layer without access to this object? I can run

processing.runalg("qgis:intersection", layer1, layer2, "memory:")

or even

processing.runalg("qgis:intersection", layer1, layer2, "memory:myLayerName")

I can however not find a way to grab the resulting output.


texts: How to load GeoJSON from GeoServer to define a variable in Leaflet?

texts:
How can I load a GeoJSON file from GeoServer in Leaflet? There are lots of suggestions out there, but none of them work for me.

Currently my app loads a js file from the server that starts like this:

var boundaries ={ - followed by the geojson file content

To speed things up (and make it work in older browsers) how do I define variable boundaries = { - GeoJSON from GeoServer?

All I have so far is (not working):

var owsrootUrl = 'http://185.19.29.22:8080/geoserver/cresh/ows';

var defaultParameters = {
    service : 'WFS',
    version : '1.0.0',
    request : 'GetFeature',
    typeName : 'cresh:datazone_popup',
    outputFormat : 'json',
    format_options : 'callback:getJson',
    SrsName : 'EPSG:4326'
};

var parameters = L.Util.extend(defaultParameters);
var URL = owsrootUrl + L.Util.getParamString(parameters);

var boundaries = null;
var ajax = $.ajax({
    url : URL,
    dataType : 'json',
    jsonpCallback : 'getJson',
    success : function (response) {
        boundaries = L.geoJson(response, {
            style: function (feature) {
                return {
                    stroke: false,
                    fillColor: 'FFFFFF',
                    fillOpacity: 0
                };
                }
        });
    }
});

Geoserver is installed on the same server as my webapp and WFS is running.


texts: Problem with import CSV files to QGIS 2.0.1


texts: Does Geolocation Understand Global Variables?

texts:
I am using navigator.geolocation.getCurrentPosition(success, error); to get the user's location in an https web page. I have also defined
var map;
...as a global var.

The success function gets called, but inside that function it doesn't seem to recognize "map" as a global variable. I can initialize the map and set the location of the map inside the success function, but after the success function ends, "map" is undefined again. That causes any other events with map to fail.

How can I get the map variable to be recognized inside of the success function, or return
position.coords.latitude
...and
position.coords.longitude

...from the success function so I can initialize the map?


texts: Losing projection Infomation in standalone PyQGIS

texts:
I'm new to PyQGIS and I have been stuck with this for quite some time. I'm trying to run processing script in standalone PyQGIS. My script is working fine and giving the result that I want when running it in Python Console of QGIS 3.16.3 (Hannover) (Ubuntu), but when I run it as a standalone script in Python 3, the result is weird. I noticed that my processing result will loss its projection information.
For example, this line of script below to project my SHP file to Sinusoidal projection will work fine in QGIS Python Console, but when running it as stand alone script, the result's projection will be undefined and the output geometry will remain as input (unprojected/undefined CRS):
processing.run("native:reprojectlayer", {'INPUT':'/home/input.shp','TARGET_CRS':QgsCoordinateReferenceSystem('EPSG:54008'),'OUTPUT':'/home/output.shp'})
{'OUTPUT': '/home/output.shp'}

This is also happening with other processing/algorithm. The output will gives undefined projection result.
Can some one point me where I might be doing something wrong?
Note: Below is the full script that I run in as standalone Python 3 in case there is something that causing this problem:
import sys
sys.path.append('/usr/share/qgis/python')
sys.path.append('/usr/share/qgis/python/plugins')
sys.path.append('/usr/share/qgis/python/plugins/processing')

from qgis.core import *
QgsApplication.setPrefixPath("/usr/share/qgis/", True)
qgis = QgsApplication([], False)
QgsApplication.initQgis()

from qgis.analysis import QgsNativeAlgorithms
QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())

import processing
from processing.core.Processing import Processing
Processing.initialize()

processing.run("native:reprojectlayer", {'INPUT':'/home/input.shp','TARGET_CRS':QgsCoordinateReferenceSystem('EPSG:54008'),'OUTPUT':'/home/output.shp'})
{'OUTPUT': '/home/output.shp'}


texts:
I am new to PostGIS and I need to do DBSCAN by commune.
I have the base dir_v2:

id_dir
geom
commune

I need to process clustering at least 1000 points in a radius of 1000 meters per commune but it doesn't work
CREATE TABLE cob_fibra_cluster_2 AS (
  SELECT id_dir,geom,
    ST_ClusterDBscan (ST_Transform (geom,32719),1000,1000) OVER () AS id_cluster
  FROM dir_v2
  GROUP BY commune);


texts: Creating best fit line from point data using ArcGIS for Desktop?

texts: I have GPS points that show the locations of surface bubbles from a research dive along a transect. Wind, waves, and currents have conspired to add error to these data. I want to create a single best fit line from the points highlighted in blue in the attached picture using ArcGIS 10.3 but I do not know how to do that.


texts: How to give elevation information to a polygon feature class using existing TIN file ? (geological mapping)

texts:
I'm an ArcGIS 10.1 user.

My issue: I have a printed form of a map which depicts geological bodies being surface rock occurence. Additionaly, there are elevation contour lines. I digitized the map by creating a polyline feature class which includes an elevation field (double), a point feature class which includes an elevation field (double) representing the highest spots and a polygon feature class which includes a rock type field (text).
At the moment, I have created a TIN file using the elevation shapefiles (polyline and point as I mentioned). After that, I applied TIN to Raster and used this for a topographic cross-section.
An idea came to mind which is: I'd like to see rock types in my DEM. My polygon feature class does not include any elevation information. How could I give elevation information to my polygon f.class? Ask me for more details...


texts: Authentication in Geoserver 2.4.x from a web application

texts:
I am trying to build a web application using html and javascript from which I want to login to geoserver hosted at: https://weaveprod.ucdp.utah.edu/geoserver/web/
I have written the following code for authentication using javascript.But it is always giving login failed.Kindly help me out.

HTML code:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>

<link rel="stylesheet" type="text/css" href="login.css">

<form>
    Username:
    <input type="text" id="username" name="username">
    Password:
    <input type="password" id="password" name="password">

        <input type="checkbox" id="checkbox" name="checkbox">Keep me logged
        in
        <input type="submit" value="Login" onclick="login(option)">

</form>

Javascript code:

function login (options) {
// url del servlet del geoserver
var url = options.server;
// parametros para el login
params = "username=" + options["user"] + "&password=" + options["password"];

var contentType = "application/x-www-form-urlencoded";
//se inicializa la petición ajax
var ajax = $.ajax({
    data : params,
    type : "GET",
    crossDomain: true,
    dataType: "jsonp",
    contentType : contentType,
    url : url
});
// se ejecuta cuando la peticion finaliza
ajax.done(function() {

    if ($.cookie("JSESSIONID") != null && options && options.success) {
        options.success();
    }
});
// si ocurrio un error al realizar la peticion
ajax.fail(function() {
    if (options && options.failure) {
        options.failure();
    }
});
// se ejecuta siempre al final de la petición, sin importar que esta
// haya fallado
ajax.always(function() {
    if (options && options.always) {
        options.always();
    }
});
};

NOTE: Earlier in the javascript code, I used a POST request.But it is still giving a login failed message.The webpage and the server are in different domains and I do not have access to the source code of the server.

Thanks,
Sayan


texts: manipulate file geodatabase like an access personal geodatabase?

texts:
Is there any way to interface with features, but more specifically their attributes, in a file geodatabase like you can in a personal geodatabase?

Frequently I will just open a personal geodatabase in MS Access and use straight SQL (not the query wizard but raw SQL - I think quicker and work much more quickly this way) to manipulate attributes in their tables, do table field updates, drop records based on whatever criteria, etc.
This works and it works well and is a heckuva lot easier than trying to jockey with attributes through ArcGIS (e.g., the Intersect tool) like if I want to just append one field etc. I've been doing this for a couple of years on multiple projects with no problems.

Is there any recourse for this approach with a file geodatabase? I'm guessing not but am hoping I'm wrong...and am wondering if ESRI may deprecate the personal geodatabase format all together since they really push the file geodatabase format...

thanks
Tom


texts: Viewing Edit Tracking History on Feature Service hosted at ArcGIS Online?

texts:
Is there a way to view the edit history of a specific feature service or feature?

I have enabled edit tracking and have been doing fieldwork for 2 weeks now.  I want to see how the data has changed each day I go out.  I want to see how a specific feature has changed each day (I have revisited several points).


texts:
I'm trying to run a second workspace using python command in "Shutdown Python Script" in the first workspace using the following command. But its giving me an error. Is there anything I need to do different? I am using FME 2012 SP 2

Thanks,
Sam

So as suggested by Safe tech support, I created a batch file with the following code:

fme.exe c:\test2.fmw --SourceDataset_ARCGIS_LAYER C:\ScratchParcel\DevEnv.gdb\AddressPoint --DestDataset_SHAPE C:\temp

and added the following code in the shutdown python script window:

import os
os.system("C:\\temp\\test.bat")

When I run it, although it says transaction was successful, I don't get any results i.e., the output shapefile is not created.


texts: toggle visibility of a Layer in Openlayers 3(!) with a Checkbox

texts:
I have some vector layers on top of a tiled layer and a checkbox for each vector layer. I want a layer to be visible if its checkbox is checked and vanish if it gets unchecked.

I tried to call a function with the onchange attribute of the checkbox. It should set the visibility of the layer according to the (un)checked state of the checkbox.

This is my fiddle but unfortunately the checkboxes don't change anything.

edit: updated the code..


texts:
Using the OSGeo4W Shell and working with the code provided by Gene, I am trying to get both latitude and longitude from a .shp file; but am running into errors re the definition of "shape" or "x."  For example, starting at the top of what Gene offered, I am able to:

from osgeo import ogr
from osgeo import osr
reader = ogr.Open("a_shape.shp")
layer = reader.GetLayer()
spatialRef = layer.GetSpatialRef()
spatialRef.ExportToProj4()

(And my projection is NAD83 California zone 5, also confirmed by SB County).  This much of the fiona code also works:

import fiona
c = fiona.open('a_shape.shp')
c.crs
{u'lon_0': -118, u'datum': u'NAD83', u'y_0': 500000.0000000001, u'no_t_2': 35.46666666666667, u'lat_1': 34.03333333333333, u'lat_0': 33.5}
first = c.next()
print first

But with the next line:

x,y = shape['geometry']['coordinates']

I get the error: NameError: name 'shape' is not defined.  Going on, the following works:

from pyproj import Proj, transform
ori = Proj(c.crs)
dest= Proj(init='EPSG:4326')

But again, with:

transform(ori, dest,x,y)

I get an error: "NameError: name 'x' is not defined."  Moving on, this works:

from osgeo import osr
spatialRef = layer.GetSpatialRef()
latlong = osr.SpatialReference()
latlong.ImportFromProj4('+proj=latlong +datum=WGS84')
latlong.ImportFromEPSG(4326)
transform = osr.CoordinateTransformation( spatialRef, latlong  )

With the next line, I also get the same error: "NameError: name 'x' is not defined."  "NameError: name 'x' is not defined."

What do these errors mean?

NOTE: I am using windows 7, 64 bit. Previously, I was unable to install some packages because of the error "no vcvarsall.bat file."  Upon installing qGIS, the installations worked for fiona, osgeo, and pyproj! I installed them, using the OSGEO4w Shell: "pip install xx.whl", using 64-bit wheels from Christoph Gohlke's site. I could then import them in python.


texts: Merging WMS with another layer type using ArcMap

texts:
I loaded in Soil Organic Carbon data into ArcMap from SoilGrids through WMS and then added in a layer of coordinates. The idea here is that I extract the soil carbon data at each coordinate point but I can't seem to use the Merge tool like normal. I think this issue is rooted in the fact that these two layers are not the same ~type~ of data. I am very much a beginner at ArcMap so I am not sure how to proceed.
UPDATE:
It didn't seem to work - loading it in as a WCS the same way still doesn't seem to let me use any sort of geoprocessing tools. It seems like the server keeps disconnecting after I load in the file (there's a red X over the specific server in the Catalog). Maybe this is the root of the issue?


texts:
I am trying to create a table from a tab delimited csv. I get this error:

Traceback (most recent call last):
  File "G:/GIS/DESIGN/ROW/testWorkspace.py", line 37, in <module>
    arcpy.TableToTable_conversion(inTable, outLocation, outTable, expression)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\conversion.py", line 2038, in TableToTable
    raise e
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Rows: Dataset WO_Export_2014.txt does not exist or is not supported
Failed to execute (TableToTable).

I am new to arpy and I don't get how to use arcpy.AddFieldDelimiters, I believe this may be the issues, but I can't tell where I went wrong.

import os

# create an empty list to hold the path to all of your txt files
document_list = []

#  Open a directory and list files
fpath = r"G:\GIS\PUBLIC\ROADS\Work_Order_XY_Export\From_SAP\to_GIS\current_files"
gdbpath = r"G:\GIS\PUBLIC\ROADS\Work_Order_XY_Export\From_SAP\to_GIS\current_files\SAPExport.gdb"

for path, subdirs, files in os.walk(fpath):
 for name in files:
    # Ensure it is a .txt file before adding to list
    if os.path.splitext(os.path.join(path, name))[1] == ".txt":
        document_list.append(os.path.join(path, name))
    print document_list
# loops through all files
for file in document_list:

    # Import system modules
    import arcpy
    from arcpy import env

    # Set environment settings
    env.workspace = gdbpath

    # Set local variables
    inTable = os.path.basename(file)
    outLocation = gdbpath
    outTable = os.path.basename(file)

    # Set the expression, with help from the AddFieldDelimiters function to select the appropriate field delimiters for the data type
    expression = arcpy.AddFieldDelimiters(env.workspace, "Work_Order") # "Work_Order" is the first field name.

    # Execute TableToTable
    arcpy.TableToTable_conversion(inTable, outLocation, outTable, expression)


texts: QGIS BadLayerHandler - setDataProvider()

texts:
I've made a bit of a plugin to handle badlayers (I'm aware that Change datasource plugin had something for this but the code appears to have been removed now?). I've followed the advice provided in How to set default bad layers handler in the python plugin? and I can get the handler to start when layers are missing.

I'm currently having trouble setting the new data provider. Currently I'm doing

handler = QgsProjectbadLayerHandler()

newPath = "C:\pathtomissinglayer"

handler.setDataSource(domNode,newPath)

where domNode has been passed in from handleBadLayers(self, domNodes)

This doesn't work as expected. The layers still disappear and setting the data source doesn't seem to change anything even though it executes properly.
Should I be passing in the newPath as a string or something else? And how do I stop the layers from disappearing?

Edit: There appears to be a new class as a part of 3.6?? called QgsStoreBadLayerInfo. Description says it stores layer IDs of bad layers. The ID could be useful to get the position of the map layer in the layer explorer and then just create a new layer with the correct file path. As is extends from QgsProjectBadLayerHandler could this class just be used in place of QgsProjectBadLayerHandler? Will it be called when layers are missing? I tried but couldn't get it too work


texts:
My problem is the following, I cannot find a reasonable method to clip 2 vector based shapefiles using python (without ArcPy or QGIS API).

I tried using the geometry.intersections method, but that would return a lake that should have been mostly clipped away (~2% of the lakes surface should stay after clipping with a boundary), so I figured the intersection method does not return what I want.

What I want to do is to import .shp files from my drive which I achieved using geopandas:

import matplotlib.pyplot as plt
import matplotlib.lines as mlines
from matplotlib.colors import ListedColormap
import geopandas as gpd
import os

boundary = gpd.read_file(boundary_within_features_of_the_other_layers_should_stay)

water = gpd.read_file(water_layer)

water_clipped = water[water.geometry.intersects(boundary)]

so this method didn´t work as I wanted. I want to clip more features, but I cant figure out how to do it or which library to use.

I also tried:

import os

wd = r"C:\Users\blablabla"

list_of_files = os.listdir(wd)

file_that_clips = r'C:\Users\blablabla.shp'

for file_to_clip in list_of_files:
    if file_to_clip[-3:] == "shp":                          # If file is a shapefile
        clipped_file = file_to_clip[8:-4] + "_clipped.shp"   # New name for output
        os.system("ogr2ogr -clipsrc " + file_that_clips + " " + clipped_file + " " + file_to_clip)
        print(clipped_file + 'got clipped')

Which should have worked according to the last print statement, but the clipped layers couldn´t be found anywhere. So this doesn´t seem to work for me as well.


texts: GetFeature request with polygon intersecting polygons

texts:
My task is very straightforward: a user draws a polygon and queries all parcel polygons. The query string extends the URL limit. So I am posting XML to WFS. However, GeoServer always returned 0 feature, but I knew the query polygon overlapped several tax parcels. If I passed a single point, it worked fine. Did I miss anything for sending a polygon? I used the OpenLayers buildGeometry to create the polygon GML. I can't figure out what's wrong.

Please Help.

Here is my code:

var gml = new OpenLayers.Format.GML();
var polygonGML = gml.buildGeometry.polygon.apply(gml,[taArray[0].geometry])
console.log(polygonGML);
var plgGMLString = (new XMLSerializer()).serializeToString(polygonGML);

var geo_req_url = proxyHost + "http://localhost:8080/geoserver/wfs";
var query_xml = '<?xml version='
    + '<wfs:GetFeature service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">'
    + '<wfs:Query typeName="topp:tax_parcel"><Filter><Intersects><PropertyName>geom</PropertyName>'
    + plgGMLString
    + '</Intersects></Filter></wfs:Query></wfs:GetFeature>';

$.post(
    geo_req_url,
    query_xml,
    function(data) {
        geoResults = data.features;
        remove_selected_features();
        draw_sel_features();
    },
    "application/json"
);

Here is the printout of plgGMLString.

<gml:Polygon>
   <gml:outerBoundaryIs>
     <gml:LinearRing>
        <gml:coordinates decimal="." cs="," ts=" ">-74.00567761405651,40.546826958183715 ...</gml:coordinates>
     </gml:LinearRing>
   </gml:outerBoundaryIs>
</gml:Polygon>


texts:
I've been reading in this forum for a while and it helps me lot of times. Now I think it is the time to help me again but maybe other people too. So I try to describe a problem I have with OpenLayers 2.13 dev and the drag feature control.

First of all. I'm working on a bigger GIS Application and the most libraries are bound to this. So I can't change them.

The Problem:

//=>layer for the control was created correctly (controlled with firebug)
var dragCtrl = new OpenLayers.Control.DragFeature(editLayer);
app.mapPanel.map.addControl(dragCtrl);
dragCtrl.activate();
//=>if i use console.log at this time I can see the control was created correctly and
//looks like any other drag control on the map

//=>Just for explanation: the record element is from a geoext feature store
var lonlat = record.data.feature.geometry.bounds.getCenterLonLat();
var xy = lonlat.toShortString();
var xyArray = xy.split(', ')

var point = new OpenLayers.Geometry.Point(xyArray[0],xyArray[1]);

var feature = new OpenLayers.Feature.Vector(point);
editLayer.addFeatures(feature);
//=>at this time I expect that it should be possible to drag the added feature on the
//layer

The snippet of code is used in a listener which is executed each time I select a row in a table where some features are stored. So each time there will be a new element of OpenLayers.Control.DragFeature. This is only for testing. Now the strange thing. The first time I call this snippet above I can't drag the feature on the layer. Even if I zoom the map and redraw the layer.

But if I call the code again the new control is added to the map (I have now 2 new dragcontrols at the map => firebug) and a new feature on the layer the drag control works like a charm. For every feature. Also if I call it again and again (new control each time).

It doesn't matter where I create the control and where I add it (also if I creates it only one time at the init of the application). If I have only one control on the layer it doesn't work. Each new one works.

Only the first time it fails. What is the problem here?

It is a simple piece of code I think. But I banging my head for it about one week without any solution. I really hope that the solution is simple and I just missed a little detail. Maybe there is anybody out there who had the same problem?!


texts: How to limit UI in a web scene on ArcGIS Online?

texts:
I have a web scene created and on ArcGIS Online, however, there are a lot of things that the UI shows that I don't need. I am ultimately bringing this into a story map, and I have figured out how to reduce the UI by adding "&ui=min" to the end of the URL when embedding it, but doing so reduces the UI too much. I want a way to pick what UI is displayed and what UI is removed. Does anyone know how to do this in a web scene for story map purposes?

I would imagine that it can be limited in HTML to some degree, but how would I go about making that a permanent change?


texts: Applying a new colour scheme on GdalRasterLayer using SharpMap

texts:
I'm currently developing a surface water modelling system in C# (.NET) and am using the SharpMap control as my mapping component. It's all going well, but there's one thing I'm struggling with. I cannot seem to be able to change the colour scheme on some GdalRasterLayer layers. The data comes in the form of ESRI Ascii Grid files (.ASC) and loads fine if I don't change anything from default. I've tried changing the ColorBlend without any success; in fact applying a ColorBlend causes the layers to not be displayed.

The code I've tried:

string layerName = Path.GetFileNameWithoutExtension(filename);
GdalRasterLayer rasterLayer = new GdalRasterLayer(layerName, filename);
rasterLayer.ColorBlend = SharpMap.Rendering.Thematics.ColorBlend.DigitalTerrainModelMOHID;
Mapper.mymap.Layers.Insert(0, rasterLayer);
Mapper.mymap.ZoomToExtents();
RefreshMap(); // my own refresh method which calls the SharpMap control's refresh

I've also tried creating my own ColorBlend object and using that; no difference. Am I barking up the wrong tree? Is ColorBlend the right thing to be using?