texts: Performance loss for OpenLayers EPSG transformation? Storing GeoJSON coordinates in lat/lon or in native map projection?

texts:
For a project the map projection is EPSG:32468 (tiles). On top of the map, two or three GeoJSON LineStrings should be displayed using OpenLayers. Each LineString has about 1500 coordinates.

Actually, I would like to store the coordinates of the GeoJSON in lat/lon (EPSG:4326) and then reproject them using OpenLayer's internalProjection and externalProjection, as lat/lon is more "natural"/"human" to think about positions. That is, something like:

var format = new OpenLayers.Format.GeoJSON({
  'internalProjection': new OpenLayers.Projection("EPSG:32468"),
  'externalProjection': new OpenLayers.Projection("EPSG:4326")
});

Are there any performance issues to be expected if doing so? Or should I instead rather reproject the GeoJSONs in advance, e.g. by using ogr2ogr, that is having them already in the special map projection? I do not yet know how many coordinates a LineString will include in future, and importand: the map should also work nicely on iOS 4 (webkit) and recent Android phones.


texts: Exporting heat map / texture maps as SVG without referenced PNG files?

texts:
When I create a map in QGIS and export it to SVG format, if there is a heat map or topographical texture map layer, those layers are exported as PNG files referenced by the SVG file.

Is there any way to avoid this?

This is annoying in its own right, but the greater problem is that I need my maps in EPS format. When I convert from SVG to EPS, the links between the SVG file and PNG layer are broken.


texts: Is it possible to create an editable app with an ArcGIS Online Public Account?

texts:
I have been experimenting with creating apps from templates in an ArcGIS Online Public Account. While I can create apps that let me view my web map, I have yet to find a way to create a map that works with the edit tools in the app templates.

My web map has one shapefile that was loaded into the map as a zip file. When I try to configure the Find, Edit, Filter or GeoForm templates from this web map, it tells me there isn't an editable layer to work with even though I have editing enabled.

I suspect the problem lies with the way my shapefile has been uploaded. Is there a way to upload a shapefile that will let me edit it in the app? Loading it as a zipped shapefile or geodatabase doesn't work. Should I try to publish it from ArcGIS for Desktop? Is there a way to do this with a public account? Or is it just not possible unless I upgrade to an organizational account?


texts: Very slow loading of PostGIS raster layer in qGIS

texts:
I'm trying to use big raster dataset with PostGIS 2.5 on PostgreSQL 11 on Linux for the purpose of serving a base map organization-wide. My dataset is 2TB of TIFFs. I created 8GB test table (including pyramids) from TIFFs with original resolution of 10240x10240, tiled at 200x200, 8 levels of pyramids, default constraints and index created by the raster2pgsql tool using command:

raster2pgsql -d -I -C -Y -N 0 -l 2,4,8,16,32,64,128,256 -s 32635 -M -P -t 200x200 *.tif rasters | psql -h -U postgres -d testdb

My issue is with loading speed of the layer in QGIS. Every time I load the layer or open saved QGIS project with the raster layer it request layer statistics or something from PostGIS that produces full table scan. With my 8GB test database it take about 5 minutes to load. With 30GB test data it took several hours to load. I tested with different tiles from 32x32 to 2048x3048 pixels in sizes, but with minor differences in loading time. The data is in UTM.

The query that is executed by QGIS is:

select srid, nbband, st_xmin(geom) as xmin, st_xmax(geom) as xmax, st_ymin(geom) as ymin, st_ymax(geom) as ymax, scale_x, scale_y from (select st_srid("rast") srid, st_extent("rast"::geometry) geom, max(ST_NumBands("rast")) nbband, avg(ST_ScaleX("rast")) scale_x, avg(ST_ScaleY("rast")) scale_y from "rasters" group by st_srid("rast")) foo;

using explain I get:

"Subquery Scan on foo  (cost=58862.06..192304.46 rows=162240 width=56)"
"  ->  GroupAggregate  (cost=58862.06..187437.26 rows=162240 width=89)"
"        Group Key: (st_srid(rasters.rast))"
"        ->  Sort  (cost=58862.06..59267.66 rows=162240 width=580)"
"              Sort Key: (st_srid(rasters.rast))"
"              ->  Seq Scan on rasters (cost=0.00..14717.00 rows=162240 width=580)"

explain analyze returns:

"Subquery Scan on foo  (cost=58862.06..192304.46 rows=162240 width=56) (actual time=208240.590..208240.591 rows=1 loops=1)"
"  ->  GroupAggregate  (cost=58862.06..187437.26 rows=162240 width=89) (actual time=208240.588..208240.588 rows=1 loops=1)"
"        Group Key: (st_srid(rasters.rast))"
"        ->  Sort  (cost=58862.06..59267.66 rows=162240 width=580) (actual time=68488.704..68588.816 rows=162240 loops=1)"
"              Sort Key: (st_srid(rasters.rast))"
"              Sort Method: external merge  Disk: 94512kB"
"              ->  Seq Scan on rasters  (cost=0.00..14717.00 rows=162240 width=580) (actual time=19.640..68370.097 rows=162240 loops=1)"
"Planning Time: 0.056 ms"
"Execution Time: 208243.197 ms"

Any idea how to load the raster without this delay?


texts: Using weighted species distribution data to create a scored grid map

texts:
I'm currently working on a project within ArcGIS Pro, I have a large dataset (>40000 points) comprising a list of ~120 indicator species as point data that are assigned numerical scores (1-10) based on rarity. I also have a hectad (2km square) map of England. My objective is to calculate the score for each 2km square based on the presence of unique species within each one.

The species list is like so:

Spp  Score
__________
Spp1 5
Spp2 4
Spp3 2
Spp4 9

And I envisage an output like this:

Grid Spp1 Spp2 Spp3 | Grid score
________________________________
1    5    4    2    | 11
2    5         2    | 7
3         4         | 4
4         4         | 4
5              2    | 2

What is the most effective way to do this? I would like to avoid having to manually add multiple fields for each of the species if possible.


texts: Distinct styling of two merged layers lost

texts: I merged two shape files of K-12 school districts and intermediate school districts in MI. Basically an ISD contains many K-12 districts within it. There is a field in the attributes table that distinguishes whether the district is a school or an ISD and I've created different symbols for both, however, I can only see one or the other, not both at the same time. What I want is a thick white border around the ISDs and regular black borders for the school districts contained within.


texts: Aggregate points with same values to polygons

texts:
I have a shapefile with 2M measurement points (each measurement point has a resolution of a 1/10). How can I aggregate points around each other if and create polygons out of it?

They do not have to match a grid, polygons should not overlap.
In addition, I would like to reduce the resolution, e.g. aggregate all points around a 1/2 resolution.

Can I do this with QGIS or in PostGIS?

I have tried convex hull, but it seems that the polygons overlapped. Also, some answers are referring to ArcGIS 10, which I do not have.


texts:
I am trying to find alternative symbology for GIS maps and web apps I occasionally produce. Esri has done a great job collecting and categorizing thousands of symbols, markers, line and polygon styles. For instance, here one can find all 9.3 symbology available in ArcGIS. They are available as individual categories here, too. I have also seen a great resource page on Esri Mapping Center with lots of additional styles. Quite many links on symbology standards here, too.

I am however looking for any good resources with symbology that can be not necessary related to mapping/physical geography, but rather something that describes world around us. The one I liked really much is available here, which is part of this library. I fully understand that there are plenty of resources like mapicons. Any other website worth visiting when looking for icons for map symbols?


texts: Reprojecting raster from lat/lon to UTM in R?

texts:
i have to turn it into a  UTM in order to make the buffer functional.

wets<-readOGR(dsn=".",layer="shapefile")
r.raster <- raster()
extent(r.raster) <- extent(wets)
res(r.raster) <- 100

wets.r <- rasterize(wet,r.raster)
plot(wets.r)
wetsbuf<-buffer(wets.r,width=500)

During the buffer creation which is the last line of code, it gives this warning:

Warning message:
In couldBeLonLat(x) :
  raster has a longitude/latitude CRS, but coordinates do not match that

here's the info

  summary(wets.r)
          layer
 Min.        1
 1st Qu.     1
 Median      2
 3rd Qu.     9
 Max.       11
 NA's    52629

summary(wets)

  Object of class SpatialPolygonsDataFrame
Coordinates:
      min       max
 x  683705  714088.8
 y 4326266 4343768.0
 Is projected: TRUE
 proj4string :
 [+proj=tmerc +lat_0=0 +lon_0=24 +k=0.9996 +x_0=500000 +y_0=0 +datum=GGRS87
 +units=m +no_defs +ellps=GRS80 +towgs84=-199.87,74.79,246.62]
 Data attributes:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
    0.0     2.5     5.0     5.0     7.5    10.0

 wets.r

class       : RasterLayer
dimensions  : 175, 304, 53200  (nrow, ncol, ncell)
resolution  : 100, 100  (x, y)
extent      : 683705, 714105, 4326268, 4343768  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source : in memory
names       : layer
values      : 1, 11  (min, max)
attributes  :
   ID FID
 from:  1   0
 to  : 11  10

I have to change the prjection in order to be possible to do the buffer.


texts: Export data of points and polygons which are intersected

texts:
I have a shp file of roughly 100 Polygon. I also have a corresponding list (including X,Y data) of about 3000 points, in a csv file. Overlayed within QGis the 100 polygons contain about 90% of the points. I would like to  export the data of the points and polygons which are intersected into a flat file.

Data Description:

points
 - X
 - Y
 - Point Name

Geometry
 - Geometry Data
 - Geometry Name

Output (for all point which are contained within a polygon)
 - Point Name
 - Geometry Name


texts: QGis - From highway mileage to longitude latitude

texts:
I'm using QGis and would like to convert the progressive mileage of a highway into latitude/longitude coordinates, but I have no idea how to do it.
I have a Csv dataset where there are several "geo-referenced" information with the progressive mileage of the highway. The Dataset takes this aspect:
+--------------+---------------------+----------+
| Highway name | Progressive mileage | FeatureS |
+--------------+---------------------+----------+
| A            |               400.1 |      ... |
| A            |               430.2 |      ... |
| A            |               520.5 |      ... |
| B            |                22.8 |      ... |
| B            |                50.3 |      ... |
+--------------+---------------------+----------+

What I am trying to do with QGis (or welcome if there is an easier way) is to translate the progressive kilometers of the highway into latitude and longitude coordinates. This in order to subsequently represent each feature of the dataset on the map.
About the progressive kilometers of the highway, I know that is known the latitude and longitude of the initial mileage (km 400).
My goal is to have the possibility to make geographical queries in which reporting the name of the highway and the progressive mileage, I get the latitude and longitude of the point
How could I fix this?


texts: TIFF with TFW not opening and NO spatial reference

texts:
I will receive TIFF files with the associated TFW. I always thought that these would open correctly in Arc. When I check the spatial reference on the TIFF it states undefined. So I try to add it myself, it doesn't take. I have a work around, I bring the TIFF into arc, right click and I can export with the correct projection(From dataframe) and it works.

I receive these TIFFs and TFWs from companies that use a lot of CAD software. Why would someone send TIFFs with no spatial reference and TFW files? I'm not saying you all would no that but why wouldn't the TFW work, because no spatial reference. The files come in via a zip drive is there some way that the spatial reference would be removed or if someone sends me a TIFF with the spatial reference via a zip it should stay?

I know my question is all over but I can't see all companies being wrong and sending a TIFF, with a TFW but the TIFF has no spatial reference and nothing opens. So I am thinking its more human error on my part.


texts: How can I change the "NoData" value for a raster column in PostGIS?

texts:
I have a raster column with "NoData" value of 3.40282346638529e+038 in PostGIS.
I want to change the NoData value to 100.
I used the following code:
SELECT ST_Reclass(ukc,1,'3.40282346638529e+038:100', '32BF', 3.40282346638529e+038) rast
INTO for_delete1
FROM raster_table

but it changed all pixel values to 3.40282346638529e+038 and it changed non of the NoData pixels!!
then, I used the same query and just changed '3.40282346638529e+038:100' to '100:3.40282346638529e+038'.
This one also made some strange changes but the NoData value is still the same.
How can I change the NoData value for a raster column in PostGIS?


texts: PyQGIS search and replace text using regex

texts:
This is based on Run regexp in PyQGIS script? and Search and Replace text in All Fields in QGIS 3

I am trying to modify the code to allow more complex replacements using regex but am unsure how to structure the re.sub function

See https://regex101.com/r/OX1W3b/2/ for one example...

1. DIMENSIONS:  | ORIGIN: | Position corrected and IL (0) was changed based on RPS: 3482 -230
2. DIMENSIONS: 2 x 1350 RCP | ORIGIN: PCD13180 | Position corrected and IL (0) was changed based on RPS: 1390 -20800/1350RCP
3. DIMENSIONS: 3 x 375 RCP | ORIGIN:
4. DIMENSIONS:  | ORIGIN:
5. Review attribution | DIMENSIONS:  | ORIGIN:

Where there is no value after DIMENSIONS or ORIGIN it should be deleted so...

1. Position corrected and IL (0) was changed based on RPS: 3482 -230
2. DIMENSIONS: 2 x 1350 RCP | ORIGIN: PCD13180 | Position corrected and IL (0) was changed based on RPS: 1390 -20800/1350RCP
3. DIMENSIONS: 3 x 375 RCP
4.
5. Review attribution

Here's the current code - see line 10 and 33 for the regex based commands.

#Use in QGIS 3 python console
#Search and replace text in all fields of all layers
#Also allows regex use
import re

#Based on https://gis.stackexchange.com/questions/317855/search-and-replace-text-in-all-fields-in-qgis-3

#set text to search for and replace with.
searchText = "DIM"
regexText = ".*(DIMENSIONS:  \|)"
replaceText = ""

#run on all layers
layers = QgsProject.instance().mapLayers()

for layer_id, layer in layers.items():
    i=1
    print("Layer: %s" % (layer.name()))
    # get data provider
    dpr = layer.dataProvider()
    for field in layer.fields():
        fieldName=field.name()

        for feature in layer.getFeatures():
            inText = str(feature[fieldName])
            # get field index
            fieldIndex = layer.fields().indexFromName(fieldName)
            #print ("Checking %s" % (inText))

            if searchText in inText:
                # change inText
                print ("%s . REPLACED: %s in %s with %s in column: %s" % (i, searchText, inText, replaceText, fieldName))
                #outText = inText.replace(searchText, replaceText)
                outText = re.sub(fieldName, regexText, replaceText)
                i+=1
                # save changes
                dpr.changeAttributeValues({feature.id(): {fieldIndex: outText}})
print ("Completed")

UPDATE when using regexText = ".*(DIMENSIONS:  )(\| ORIGIN: ?\|? ?)"

I think we need to deal with each key (DIMENSIONS:, ORIGIN: etc) without value separately as there are others and it overly complicates the regex. So forget about ORIGIN: and need to look at code that will just clean up DIMENSIONS as per the examples. The same can then be used for ORIGIN once we get it right.

Basically we just need to get rid of the key (DIMENSIONS:) when it doesn't have text after it and before the | seperator. Any text before or after should be retained as per the examples.

I think the issue is in the use of "outText = re.sub(fieldName, regexText, replaceText)" because the value in replaceText should be the capture string from the regex not the string in replaceText.


texts: ArcObjects: IMapEvents.FeatureClassChanged doesn't fire if the layer's previous data source was invalid

texts: Is there any other event besides IMapEvents.FeatureClassChanged that will be fired when a layer's data source changes? FeatureClassChanged doesn't seem to fire if the layer's previous data source was invalid (red exclamation mark next to the layer in the TOC).


texts: Converting WGS84 to ETRS89 in ArcGIS Desktop?

texts:
I have a data which has no projection and has WGS84 as a coordinate System. I need to Import this data and Analyse it other data which have ETRS_1989_UTM_Zone_32N as a projection System.

I have tried to give the first data the same projection System through "Define Projection" but it goes to a wrong place.

What other possibility is there to fit these data?


texts: Simple Example Wanted - Add SQL Layer to a basemap

texts:
I am very new to CartoDB. I have a set of tables uploaded and am able to create the visualization and it works fine in the CartoDB web site.

However, I want to use a simple basemap and then add my layer from the SQL query. But I cannot seem to find a simple example of how to do this in an HTML web page.

I found an example that used a leflet map (not sure what that is) but it does not display the basemap behind the data, just displays blank white.


texts: Uninstalling QGIS that was installed using OSGeo

texts:
I installed QGIS using OSGEO4W, and would love to know how to uninstall it, because when I go to "Control Panel > Programs > Uninstall" the program does not appear in the list of installed programs.

How can I do this?


texts:
I am trying to point all layers in MXD files to a different database server. Databse server is Oracle type. Most of the layers consist of views. After changing the datasource programatically for all layers, when I try to open attribute table for layer, attribute table is empty. But if I save MXD and open it in ArcMap, I can see data in attribute table. I tried below code but it didn't work.

                ITableWindow pTableWindow = new TableWindowClass();
                pTableWindow.Application = ArcMap.Application;
                ITableWindow3 pTableWindow3 = pTableWindow as ITableWindow3;
                ISet pTableSet = new SetClass();
                pTableWindow3.FindOpenTableWindows(out pTableSet);

                pTableSet.Reset();
                ITableWindow pTableWindowTemp = pTableSet.Next() as ITableWindow;

                while (pTableWindowTemp != null)
                {
                    pTableWindowTemp.Refresh();
                    pTableWindowTemp = pTableSet.Next() as ITableWindow;
                }


texts:
I have a GeoTiff image which I wan't to use to build tile pyramid and serve it via geoserver. In most cases it works well but fails to publish a layer if tiled images have NO_DATA (transparent) pixels.

Can I serve images with NO_DATA as pyramid from geoserver? Or I need some workaround?

P.S. I can imagine a workaround to replace transparent values with some color and then make it transparent again by InputTransparentColor coverage parameter (in layer settings)


texts: Symbology Displays Incorrectly When Sharing Service to ArcGIS Online

texts:
Some of my symbols are displaying incorrectly in AGOL. This is a new problem - yesterday they displayed fine and suddenly they are coming in, for lack of a better word, garbled. This is a street sign layer in ArcGIS, and a few of the sign classes display poorly online, but look just fine in ArcGIS Desktop (see attached images - looking in particular at the yellow left turn sign, roughly centered).

Things I've tried to do to fix the problem: remove and re-add the AGOL layer. Reapply in ArcGIS the symbology from the layer file I originally used to symbolize. Re-share the .mxd as map and feature service to my ArcGIS Server site.

Between each troubleshooting idea I've cleared my browser cache as well.

ArcGIS Desktop

ArcGIS Online


texts:
Something a lot like this happens every time I open something up in Q-GIS, regardless of the file type, location, or even the projection: they are all too wide.

Note: I am using the WGS-84 "reference" system, which the program has carried by default, but have tried over a fifty-dozen different, other projections: some centered, some regional, some worldwide. But none of them happen to display properly on top of the application.

What may be causing this? I would like to be proportional, like-say Google Maps, any generic atlas, the available visualization tools, or ArcGIS would have it.

EDIT: a few people have referred me to the following link. However, besides the fact that it doesn't even address the question as intended, only the WGS and a few variations thereof even show up on the map-files that I have created: as soon as I switch the layer/overall CRS over to literally anything else, the whole editor's usage-made screen goes blank, and only re-appears to pop out once I flip it back. Maybe, something-that is (unrelated) though, I don't know?

To clarify, and respond to @user's questions:


texts:
I have to set up a server for querying JSON tiles coming from OSM data. Hosting the data myself is a requirement as the load is expected to become quite high.

I spent the last days looking for solutions but can't find one that allows scaling and returns JSON tiles - I absolutely don't need raster maps. Note that I don't need to edit the tiles or anything, the server only needs to serve the tiles as they are.

I already have a database with the required OSM data.

Could anyone with experience point me towards the right technology to use to serve these JSON tiles?


texts: Need a vector format that is editable in QGIS and supports >10 character column names

texts:
For reasons, I need to create a new column in a vector shapefile with a name longer than 10 characters, and export to mapinfo TAB format.  I know .shp's don't support >10 character column names, so I'm looking for an intermediate format that's both editable in QGIS, allows addition of columns after features have been added, and supports >10 character UPPERCASE column names.  All of the vector formats seem to support some combination of these, but not all three.

Anybody have this problem in the past, and/or know of a format that supports this use case?


texts: Using two Python Addin Combo Boxes to choose feature class first then field from chosen feature class?

texts:
Last night a student from my Udemy course about writing Python AddIns asked for:

  some tips for using a combo box to filter another combo box. What I am
  trying to do is use a combo box to select my [feature class], which I've managed
  to do. Once that combo box is selected, I want the second box to show
  all the fields in that [feature class], which I can then go ahead and select to
  perform further analysis on.

I think the key to doing this may be found in code from @sur's answer (with help from Freddie Gibson of Esri) to Dynamically adding items into one python addin Combobox from another?:

import arcpy
import pythonaddins

class ComboBoxClass1(object):
    """Implementation for TestCombo_addin.combobox (ComboBox)"""
    def __init__(self):
        self.items = ["cb1item1", "cb1item2"]
        self.editable = True
        self.enabled = True
        self.dropdownWidth = 'WWWWWW'
        self.width = 'WWWWWW'
        ComboBoxClass1._hook=self
    def onSelChange(self, selection):
        pass

class ComboBoxClass2(object):
    """Implementation for TestCombo_addin.combobox_1 (ComboBox)"""
    def __init__(self):
        self.items = ["cb2item1", "cb2item2"]
        self.editable = True
        self.enabled = True
        self.dropdownWidth = 'WWWWWW'
        self.width = 'WWWWWW'
    def onSelChange(self, selection):
        ComboBoxClass1._hook.items.append(selection)

but how do I use the _hook property of a ComboBoxClass to achieve what my student has asked for?


texts: Create non trivial join/view via PyQGIS in a QgsProcessingAlgorithm

texts:
In the context of QgsProcessingAlgorithm, what is the best way to take information from several layers and output based upon that combination of layers? or: What is wrong with my layer creation?
The overall task/procedure I am trying to accomplish is to take several QGIS layers combine them with a query, then output some files based upon that view/join. I have chosen a processing algorithm above a plugin because it seemed to be better fitting than a plugin.
What I have tried.
Given:
A non-trivial SQL select and join (three tables, one geometry, two attribute) named sql_query. I am mentioning that it is non-trivial to say that QgsVectorLayerJoinInfo is not something that can be used easily.
A geo package with all the tables used in the query at location: /path/to/test.gpkg
The tables of the above geo package placed into a QGIS project.
A joined layer can be created via:
The DB Manager plugin/tool's "SQLWindow". The sql_query can be entered into the Query tab, executed, then "Load as new layer"
Or in the python console:
spec = f'/path/to/test.gpkg|layerid=0|subset={sql_query}'
layer = QgsVectorLayer(spec, 'joined_layer', providerLib='ogr')
QgsProject.instance().addMapLayer(layer)

Or via ogrinfo:
ogrinfo -q test.gpkg -sql <sql_query>
In the context of QgsProcessingAlgorithm using same code as what was used in the python console I get:
ERROR 1: failed to prepare SQL: <echo of sql_query>
In the meantime, I will be using a workaround. I am guessing I am missing some minor thing. At the very least this should help others not take so long to get SQL layers working using PyQGIS.


texts:
By using the code below, we can query featureSet to ArcGIS Sample Server.

queryTask = new esri.arcgis.gmaps.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3");

I have published data on Geoserver by REST service.
1. Can I make this type of query (QueryTask) to Geoserver ?
2. What URL string should I use?

As I understood, the URL should be ("http://localhost:8080/geoserver/rest/"), but I don't know the complete URL. I mean what should I append with the URL after /rest/..... Can anybody explain the complete format of the URL?


texts: Making a map with a legend in map composer with PyQGIS 3.0

texts:
I am trying to make a map in map composer with PyQgis (API-3)
Anyway, I have the color-ramped multipolygon and I want to display it with a legend and to save it as .jpg. Here is my code, with no error, but on the output I get nothing.

#path to qgis
QgsApplication.setPrefixPath("/usr/lib/qgis", True)
app = QgsApplication([], True)
app.initQgis()

saveAsSHP = 'MYFILE.shp'
layerInput = QgsVectorLayer(saveAsSHP,"Legend", "ogr")

#color ramp
population = (
    ("0 - 10055", 0.0, 10055.0, "cyan"),
    ("10055 - 20055", 10055.0, 20055.0, "blue"),
    ("20055 - 30055", 20055.0, 30055.0, "green"),
    ("30055 - 50055", 30055.0, 50055.0, "yellow"),
    ("50055 - 60055", 50055.0, 60055.0, "orange"),
    ("60055 - 70055", 60055.0, 70055.0, "red"),
    ("70055 - 80055", 70055.0, 80055.0, "pink"),
    ("80055 - 90055", 80055.0, 90055.0, "silver"),
    ("90055 - 12055", 90055.0, 12055.0, "purple"),
    ("12055 - 280055", 12055.0, 280055.0, "white")
    )
ranges = []

for label, lower, upper, color in population:
    sym = QgsSymbol.defaultSymbol(layerInput.geometryType())
    sym.setColor(QColor(color))
    rng = QgsRendererRange(lower,upper,sym,label)
    ranges.append(rng)
field = 'Total-Traf'
renderer = QgsGraduatedSymbolRenderer(field,ranges)
layerInput.setRenderer(renderer)

QgsProject.instance().addMapLayer(layerInput)

#CREATING A MAP

reg = QgsProject.instance()
reg.addMapLayer(layerInput)
mr = iface.mapCanvas().mapRenderer()
qc = QgsLayout.MapComposer(qmlr=reg, qmr=mr)

#legend
qc.legend = QgsLayoutItemLegend(qc.c)
qc.legend.model().setLayers(qc.mr.layerSet)
qc.legend.setItemPosition(5, qc.y)
qc.c.addItem(qc.legend)
qc.output("PATH/map.jpg", "jpg")

#closing qgis
app.exec_()
app.exitQgis()


texts: How to remove marker lines in print composer QGIS

texts:
I seem to have stumbled on a really excellent useful feature in qgis print composer which is to add in marker lines to line up content if you click in the x, y coordinates on the side of your layout (the parts with the measurements).

My question is, once i've used them, how to get rid of them.

The marker lines are the red lines on the image below.


texts: Why different results of mean calculations with focal in R and Esri ArcGis

texts:
I want to calculate the ratio of two different classes in a raster with a circular moving window. My classes are 0 and 1 (I do not want to include the NAs). The radius should be 5 meter. I thought my code would work in R until i tried it out in Esri with focal statistics in order to compare the results and got completely different (but a lot more plausible) results. What might be the problem with my code in R? As far as I can see they should be doing the same thing. Unfortunatley I could not figure out the exact code that Esri uses...

My raster contains only integers of 1, 0, NA

fw <- focalWeight(modell, 5,
type='circle')

result <- focal(modell, w = fw ,fun =
mean, pad=TRUE, padValue = 0, na.rm = TRUE)

I was not 100% sure how the mean-function would handle 0s and NAs, so I also tried to write a function myself and change all the NAs in my code to -1 . It did not improve the output though.

modell[is.na(modell[])] <- -1

fw <- focalWeight(modell, 5, type='circle')

RatioFun <- function(fw){
  NCells <- sum(fw >= 0)
  SumCells <- sum(fw[which(fw >= 0)])
  if (NCells == 0){
    SumCells <- 0
  } else {
    Ratio <- SumCells/NCells
}
return(Ratio)
}

focal(modell, w = fw ,fun = RatioFun,
pad=TRUE, padValue = 0, na.rm = TRUE)

This is how i use the focal statistics in ArcGis.

This are the two different results.


texts: Save numpy array as raster in a Processing toolbox QGIS3

texts:
I am trying to convert an QGIS3 plugin to the Processing Toolbox in QGIS3 but I am getting stuck on how to save my processed numpy array back to a raster file in the end.

How can I save the variable "test" back to a raster in the code example below?

class ProcessingWallHeightAscpetAlgorithm(QgsProcessingAlgorithm):

    OUTPUT_HEIGHT = 'OUTPUT_HEIGHT'
    INPUT_LIMIT = 'INPUT_LIMIT'
    INPUT = 'INPUT'

    def initAlgorithm(self, config):
        self.addParameter(
            QgsProcessingParameterRasterLayer(
                self.INPUT,
                self.tr('Input building and ground DSM'),
                None, False))

        self.addParameter(QgsProcessingParameterNumber(
            self.INPUT_LIMIT,
            self.tr("Lower limit for wall height (m)"),
            QgsProcessingParameterNumber.Double,
            QVariant(3.0)))

        self.addParameter(QgsProcessingParameterRasterDestination(
            self.OUTPUT_HEIGHT,
            self.tr("Output Wall Height Raster"),
            None, False))

    def processAlgorithm(self, parameters, context, feedback):
        output_path_raster_height = self.parameterAsOutputLayer(parameters, self.OUTPUT_HEIGHT, context)
        raster = self.parameterAsRasterLayer(parameters, self.INPUT, context)
        provider = raster.dataProvider()
        filepath_dsm = str(provider.dataSourceUri())
        gdal_dsm = gdal.Open(filepath_dsm)
        raster = gdal_dsm.ReadAsArray().astype(np.float)
        limit_val = self.parameterAsDouble(parameters, self.INPUT_LIMIT, context)

        test = raster * limit_val

        results = {}
        results[self.OUTPUT_HEIGHT] = test

        return results

    def name(self):
        return 'Urban Geometry: Wall Height and Aspect'

    def displayName(self):
        return self.tr(self.name())

    def group(self):
       return QCoreApplication.translate('Processing', string)

    def createInstance(self):
        return ProcessingWallHeightAscpetAlgorithm()


texts: Openlayers Select Feature: avoiding the on/off aspect of selecting a feature: want to be able to click, then click again

texts:
Map here: http://tinyurl.com/potjxlu

I can click an orange icon, popup appears, hit the X button to exit out of the popup.That is OK.

But if I want to bring that popup again for the same point, I have to click it twice, not once.

Also, sometimes the X button in the popup becomes disabled. It's not a consistent error so not sure what's going on there.

Looking at the OL docs for SelectFeature, I thought highlightOnly may be the solution but it is not.

The current code for my select feature control:

var selector = new OpenLayers.Control.SelectFeature([wfs, vectors_origin, vectors_destination], {
            clickout: false,
            toggle: true,
            hover: false,
            autoActivate:true
    });

Any input on how to achieve my desired functionality is appreciated.

Edit: If I just use the default vectors (the little orange circles), what's basically happening is:

-I'll click the orange circle, the orange circle becomes highlighted with a dark purple: the popup now appears.

-The popup has an X button. I click this to exit out and that aspect works.

-Now at this point: the orange circle is still highlighted the dark purple: in other words it is still selected.

-So what happens is I have to click WITHIN the orange circle (currently highlighted dark purple) to UNSELECT it. Now that dark purple has turned back to the initial orange.

-Now I can click it again and the popup should appear correctly: which it does.

-So how do I skip this middle step? Note that my issue is only for points that you want to click again: if I click the Austin, TX feature then the Los Angeles, CA feature, there are no issues with the popups. But I basically want to cut out this middle deselection step as it seems unncessary for what I want to achieve.


texts: OpenLayers API Documentation vs. Developer Documentation

texts:
The OpenLayers web site provides two sets of reference documentation:

API Docs: http://dev.openlayers.org/apidocs/
Developer Documentation: http://dev.openlayers.org/docs/

For most classes, the API Docs contain a small subset of what is in the Developer Documentation. I find that I usually can't get much done using just the features described in the API Docs, so I use the Developer Documentation (and I read the source and examples).

What is the official distinction between these two documentation sets?  Do the API Docs describe interfaces that are expected to be stable?  Am I risking future breakage if I use features described only in the Developer Documentation?


texts: Error loading GeoTIFF using raster2pgsql: “Error 1: PROJ: Cannot find proj.db”

texts:
I am attempting to load a GeoTiff into a PostgreSQL database using the PostGIS extension raster2pgsql. When running the executable, I receive the following error: Error 1: PROJ: Cannot find proj.db. The only file with that name resides in the path C:\Program Files\PostgreSQL\13\share\contrib\postgis-3.0\proj. I've added that path to my Path variable in my environment settings, but running raster2pgsql still returns the same error. I then get a message saying the program raster2pgsql has stopped working.
This is the command I'm running in Command Prompt. I've put placeholder user/database names in quotes. If any syntax is incorrect or doesn't make sense please inform me:
raster2pgsql -I -C C:\Users\Administrator\Desktop\arcgis-data\ "tifname".tif | psql -h "hostname" -p 5432 -d "database name" -U "username"


texts: Showing percentage symbol in ArcGIS map labels?

texts:
I'm trying to show percentage poverty per municipality on the map I'm working on, and I have the percentage values displayed on the map, but I don't know how to get the percentage symbol itself to show.

I've already tried to format labels and clicked 'number represents a percentage', so under labels it shows that the values are in percentages, but doesn't display that on the map.

Does anyone know how to do this?


texts: Using Google Earth as view with SQL Server or Postgres Database

texts: How do I connect Google Earth with any relation database? I have live database containing spatial co-ordinates i.e latitude and longitude. User should be able to view these live data on google earth.


texts: Error in selecting data from attribute table QGIS

texts:
First of all, I'm not sure why all the data points from my csv file do not show up on QGIS. I enabled custom delimiters to commas and still have no clue, it worked for my other vector layers except this one.

Next, I seem to encounter an error selecting data. I want data from rainfall of higher than 46.5mm and temperatures of 29.5 mm to show up but it shows an error message.

I typed this

"Average temperature"  >= 29.5 AND  "Total Rainfall (mm)"  >= 46.5

but receive an error for this

Parser Error:
syntax error, unexpected COLUMN_REF, expecting $end

Eval Error:
No root node! Parsing failed?

52  26.7    16.5    17179.3 46712.2
52  25.6    21.4    29670.4 28489.8
52  25.9    27.5    25703.5 30676.4
52  26.7    26.9    34384.5 32161.3


texts: I am currently slowly mapping field boundaries of old agriculture map areas using QGIS. Has anyone designed a magic plugin or method so that the black outlines of the boundaries are automatically detected. A bit like finding edges in photoshop. I realise that some manual editing would be required, but I thought I would ask.


texts:
First time install and use for QGIS, running windows 7

In QGIS browser or through project>open I can not see any raster files/data, only vector data is shown. I do see them in ArcMap.

When I try to load raster data that is displayed from sample data included with installation I get the following error

  Invalid Layer: GDAL provider Cannot open GDAL dataset
  C:/Users/Izak/Documents/GIS
  DataBase/spearfish60/PERMANENT/cell/elevation.dem:
  `C:/Users/Izak/Documents/GIS
  DataBase/spearfish60/PERMANENT/cell/elevation.dem' not recognized as a
  supported file format. Raster layer Provider is not valid (provider:
  gdal, URI: C:/Users/Izak/Documents/GIS
  DataBase/spearfish60/PERMANENT/cell/elevation.dem

I've tried both QGIS 3.4 and 3.6 with standalone installer and the OSGeoW4 Network installer.

Could someone please help. I really do want to make the shift from Arc to Qgis


texts: Scale-based Sizing for Hatch Fill in ArcGIS Pro?

texts:
In ArcGIS Pro I'm trying to implement scale-based sizing on a hatch fill of a polygon. I simply want the line width of the hatch to change as you zoom in. The polygon is Single Symbol, parameters as in the pictures.

I am able to do it for the outline (and for various other vector layers in this project) but not for the hatch fill.

Any advice?


texts: Legend hangs with large featurelayers at startup of ArcGIS API for JavaScript?

texts:
My problem is that I created an app with a lot of services that the user can use. The problem is that when I implement the legend widget and the code goes over startup(), the app becomes stuck and it is impossible to do nothing. I start thinking that it is possible that legend is working as synchronous but rest is asynchronous.

This happens with JavaScript API v 3.6 or upper but with 3.4 is working right. (But I want to migrate to 3.10)

Then I can't understand the reason of that stuck.


texts: Link to network folder drive in a pop window in Flex or ArcGIS Online Apps

texts:
I have a published service with links to folders that are for internal network drive use only. For example, the network folder path in windows explorer on my desktop is I:\Street Tree\Permits(permit number). I ran a field calculator on to show the field as file://I:\Street Tree\Permits(permit number). If I open that link in a web browser, it will open the folder.

My goal is to show the hyperlink and open the folder in Flex Viewer or an ArcGIS online web app template, but these applications will not recognize the file://I\Street Tree\Permits(permit number) as a web URL. I tried specifying in Flex Viewer the field as a hyperlink, and the web browser does not recognize as a link.

I am aware that the link will not work outside the internal network, which is fine for my purposes.


texts: DXF Export - Layers in same GIS file import to AutoCAD in different locations

texts:
I'm still pretty new to QGIS, so I may be missing something basic here.

I'm trying to export several layers from a GIS project to DXF so we can create a base map in AutoCAD. However, even though all the layers are aligned correctly in QGIS, each layer shows up in a different physical location in AutoCAD. That is, each individual layer is spread all through the model space in CAD. This occurs whether I export each layer separately or in a group.

Can anyone help figure out why this might be happening, and how to correct this?


texts: R tmap: how to remove blank space when using `tm_facets()`?

texts:
I am using R package tmap to plot maps with multiple facets, using tm_facets().

It seems like space is not maximally used: there is a lot of blank/unused space on the resulting plot. Is that a constraint due to the specific size of my maps, or can I adjust it with some parameters?

library(tmap)
library(tidyverse)
data(metro)
metro_long <- metro %>%
  gather(year, population, starts_with("pop"))

metro_long %>%
  mutate(population = log(population)) %>%
  filter(year %in% c("pop2010", "pop2020", "pop2030")) %>%
  tm_shape()+
  tm_dots("population", size = 0.2, legend.is.portrait = FALSE) +
  tm_facets("year") +
  tm_layout(legend.outside.position =  "bottom" )
#> Linking to GEOS 3.6.2, GDAL 2.2.3, PROJ 4.9.3


texts: Nearest Pixel Value from Point Dataset Google Earth Engine

texts:
I'm trying to extract the raster value of the nearest pixel for a group of points.

I want the value for each point rather than the mean for example. Also, some of the points are in masked areas, hence the nearest pixel value.

//import Pekel data
var gsw = ee.Image('JRC/GSW1_0/GlobalSurfaceWater');
var change = gsw.select("change_abs");

//points
var p1 = ee.Geometry.Point([89.74319458007812,22.076065830651526])
var p2 = ee.Geometry.Point([89.87743377685547,22.0827468707419])
var p3 = ee.Geometry.Point([89.95536804199219,21.943622724707772])
var pts = ee.FeatureCollection(ee.List([ee.Feature(p1),ee.Feature(p2),ee.Feature(p3)]))

//////////////////////////////////////////////////////////////
// Constants
//////////////////////////////////////////////////////////////

var VIS_CHANGE = {
    min:-100,
    max:100,
    palette: ['red', 'black', 'limegreen']
};

//////////////////////////////////////////////////////////////
// Map Layers
//////////////////////////////////////////////////////////////

//Change in water intensity
Map.addLayer({
  eeObject: change,
  visParams: VIS_CHANGE,
  name: 'occurrence change intensity',
  shown: true
});

Map.addLayer(pts, {'color': 'blue'}, 'points');


texts: Visualizing a LiDAR point cloud in 3D with GRASS?

texts:
I'm new with QGIS and GRASS so I'm sorry if there is a straightforward answer for this question but I can't seem to get it done.

I've imported a point cloud into QGIS from a datafile. Now I'd like to plot these data points into 3D by using GRASS.

First of all, I couldn't import the QGIS file into GRASS. What is the type of file I need to save the point cloud in QGIS, in order for it to be imported into GRASS?

Second, is it possible in GRASS to add multiple layers in order to create a 3D point cloud?

I really tried everything but the way I'm doing it doesn't quite seem to work.


texts: Import only specific attributes to nominatim

texts:
I'm trying to set up my own nominatim server. For this I used a Dockerimage (https://github.com/helvalius/nominatim-docker/issues).

So I want to import all the german data but this seems to be a huge amount of data.

So according to my special needs I don't need all information which is stored. I only will send requests to the server with a street, a house number, a city and a zip code.

Because the request comes from our database I know that this information is available.

So I hope there is a way I could only import the needed data to save some disk space and server power too.

Is there a way to do this? Or is there a way to get predefined data with my needs?


texts:
I have spent some time reading the numerous threads about setting the identify task to work with layer toggling and I seem to have it working properly except for one small issue. The identify task will continue to work even though all of the layers are turned off. The Pop-Up dialogue will show "searching" for some time, until the JavaScript times out. The more problematic issue is that the task will lock up a SOC process until it times out as well, which is much longer than the JavaScript time out. This gives the user the ability to use the identify task again, repeating the process above, and locking up another SOC process. Since 2 SOC processes are the default this means that the service is useless until one of them times out.

Click below to view an example of this behavior. This is hitting the ArcGIS.com sample server so you will have to take my word on the "hung" SOC processes.
http://geoville.org/viewers/identifytoggle/

My question is two fold.
1: Could this be a bug?
2: Any ideas on how to keep the identify task from executing when there are no layers visible?

Thanks for your help.

I have also posted this question in the Esri forums here.
http://forums.arcgis.com/threads/35860-Identify-with-Layer-Toggling?p=120915#post120915


texts: Exporting features with attachments for use outside ArcGIS?

texts:
ArcGIS 10 features the new ability to add attachments to individual features to feature classes stored in a geodatabase. One use of this would be to add multiple pictures to a specific location, fire hydrants seem to be a popular example (important to know if you're a dog on the internet in need of a pit stop I suppose).

In the database the structure of an attachment enabled feature class is trifold:

the feature class itself,
a table holding the attachments and associated metadata (filename, size, etc), and
a relationship class defining the 1-to-many relationship between the two.

My question is: how to export this data -- feature class, attachments, attachment metadata -- for consumption outside of Arcgis?*

Exporting the FC is easy, FeatureClassToFeatureClass works the same as on a non-attachment enabled FC. Exporting the table of attachments? Not so much. TableToTable to output.dbf extracts the attached file metadata only, to output.csv errors out with unsupported field type, and to output info table fails with a general field error.

This isn't all that surprising as those file types don't support a binary blob datatype. I was expecting/hoping to find a tool which would convert the attached binaries into their native format, e.g.

So, how about it? What do I need to do to get the data out?

* ironically my project of the moment which spawned this Q is to export for use within Arcgis, just not Arcgis Desktop...


texts: GeoServer WPS python script example does not work without yield

texts:
I am using GeoServer 2.5.1, geoserver-2.5.1-wps-plugin and geoserver-2.5.SNAPSHOT-python-plugin.

I want to write a WPS process that calculates and returns some data ( a 2d array) at a point.

I have started with the example here http://suite.opengeo.org/opengeo-docs/processing/scripting/processcreate.html

The example suggests I should get back features with the interesting data in the properties section i.e.

{
  "type":"Feature",
  "geometry":{
    "type":"Point",
    "coordinates":[
      6,
      3
    ]
  },
  "properties":{
    "distance":6.708203932499369,
    "bearing":63.43494882292201
  },
  "id":"fid--ad4a787_1394a31a374_-7bba"
},

however I get back an empty properties i.e.

{"type":"Feature","geometry":{"type":"Point","coordinates":[1,2]},"properties":{},"id":"fid-46aa2cd3_1468a3a8846_-7fee"},

I have also tried this using OpenGeoSuite-4.0.2 with exactly the same result.

So am I doing something wrong?

Update...

OK my fault.  I have found what was wrong but I don't understand why.

In my efforts to return some interesting data, not just a geometry, I edited the script so that the run method did not use yield i.e.

run((origin, features):

  layer = Layer()
  for f in features.features():
    ...
    layer.add(Feature({'point' : p, , 'distance': d, 'bearing': b})

  return layer

This resulted in the empty properties.
I understand that the yield will return an iterable of Features which I think somehow gets translated into a org.geotools.Feature.FeatureCollection.  But I don't understand why the above code doesn't work correctly.

I have also tried returning a list of Features i.e.

f = []
  ...
  f.append(Feature({'point' : p, , 'distance': d, 'bearing': b})
return f

but this results in the exception

An error occurred while encoding the results of the process
org.python.core.PySingleton cannot be cast to org.geotools.feature.FeatureCollection


texts: Drawing an Ellipse in Openlayers 4 with interaction

texts:
In OpenLayers 2, I could easily create a Control to draw an ellipse like this:

           new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.RegularPolygon, {
                handlerOptions: {
                    sides: 40,
                    irregular: true
                },

            });

In OpenLayers 4, as I assume, it must be done like this:

            new ol.interaction.Draw({
                source: source,
                type: 'Circle',
                geometryFunction: geometryFunctionThatCreatesEllipse
            });

Am I right and if yes, how does the geometryFunctionThatCreatesEllipse look like?


texts: How do you show help for a parameter in an ArcGIS python toolbox?

texts:
I have created a python toolbox, the interface is shown below:

How do you edit the parameter description so that when you click in the boxes, a relevant description will show up in the tool help?


texts: Converting a FeatureCollection to ImageCollection in Goolge Earth Engine?

texts:
I created a Feature Collection of Ndvi (mean, min, max) from Image Collection. Now i want to convert FeatureCollection in ImageCollection in order to have a three bands (mean,min,max).How can help me?

var NDVI_POST= ee.ImageCollection(ETM_L7.merge(OLI_L8));
print(NDVI_POST)
var reducers=  ee.Reducer.mean().combine({
  reducer2: ee.Reducer.minMax(),
  sharedInputs: true
});
var ndvi = NDVI_POST.map(function(image) {
  return image.select('NDVI').reduceRegions({
    collection: fire_2007,
    reducer: reducers,
    scale: 30,
  tileScale: 16
  }).filter(ee.Filter.neq('mean', null))
    .map(function(f) {
     return f.set('imageId', image.id());
    });
}).flatten();


texts: How to access Sentinel-2 L2A Scene Classification Layer (SCL) with GDAL

texts:
I have a Sentinel-2 L2A and was able to access it with:

In[1]:
image = gdal.Open(s2l2a_image.zip)
subdatasets = image.GetSubdatasets()

Out[1]:
[('SENTINEL2_L2A:/vsizip/s2l2a_image.zip/S2A_MSIL2A_20190620T100031_N0212_R122_T33UXQ_20190620T131720.SAFE/MTD_MSIL2A.xml:10m:EPSG_32633',
  'Bands B2, B3, B4, B8 with 10m resolution, UTM 33N'),
 ('SENTINEL2_L2A:/vsizip/s2l2a_image.zip/S2A_MSIL2A_20190620T100031_N0212_R122_T33UXQ_20190620T131720.SAFE/MTD_MSIL2A.xml:20m:EPSG_32633',
  'Bands B5, B6, B7, B8A, B11, B12 with 20m resolution, UTM 33N'),
 ('SENTINEL2_L2A:/vsizip/s2l2a_image.zip/S2A_MSIL2A_20190620T100031_N0212_R122_T33UXQ_20190620T131720.SAFE/MTD_MSIL2A.xml:60m:EPSG_32633',
  'Bands B1, B9 with 60m resolution, UTM 33N'),
 ('SENTINEL2_L2A:/vsizip/s2l2a_image.zip/S2A_MSIL2A_20190620T100031_N0212_R122_T33UXQ_20190620T131720.SAFE/MTD_MSIL2A.xml:TCI:EPSG_32633',
  'True color image, UTM 33N')]

This is great, however, official GDAL documentation for Sentinel-2 driver (here) talks about L2A-specific layers, such as Scene Classification Layer (SCL) and others. I tried a lot, inspected subdatasets and such, but found no way to access them.

Any help appreciated!


texts: Resampling 1000m resolution Aqua MODIS images to 30m resolution

texts:
I am trying to resample the MODIS (aqua) image from 1000m resolution to LandSat image resolution which is of 30m for applying ESTARTFM technique.
So you need to do preprocessing (Resampling and Reprojection) before applying the algorithm. But when i read here it is suggested not to go from finer to coarser resolution.  So, my first question why it is not recommended secondly how to achieve the same using QGIS 3.6.
Also, I tried resampling MODIS image using pyMODIS using the following script

modis_convert.py -s "( 1 )" -o outputmodis.tiff -e 32630 -g 30 MYD11A1.A2019133.h17v03.006.2019150001731.hdf

So, my final TIFF size increased from 2 MB to 3.4 GB. Is there something wrong I am doing here? Though When I resampled it to 500 m size increased from 2MB to 10 MB.


texts: Convert OpenStreetMap to AutoCAD/DXF/DWG with LAYERS

texts:
Spatial Manager for AutoCAD would be the best, but it has an associated cost.
Are there any other methods? I tried using QGIS without useful results. OpenStreetMaps appears all on one layer.

How can I get maps with layers like /buildings/roads/trees/parkings/ in AutoCAD?


texts: Get Features from OpenLayers Layer.Vector not working

texts:
polygon_layer = new OpenLayers.Layer.Vector("Polygone", {
            projection : projLonLat,
            strategies : [ new OpenLayers.Strategy.Fixed() ],
            protocol : new OpenLayers.Protocol.HTTP({
                url : 'polygons.geojson',
                format : new OpenLayers.Format.GeoJSON()
            })
        });

        getFeatures(polygon_layer);

    function getFeatures(maps_layer) {

    alert(maps_layer.features.length);

    var features = new Array();
    for (var i = 0; i < maps_layer.features.length; i++) {

        if (maps_layer.features[i].cluster) {
            for (var j = 0; j < maps_layer.features[i].cluster.length; j++)
            features.push(maps_layer.features[i].cluster[j]);
        } else {
            features.push(maps_layer.features[i]);
        }

    }
}

Output for alert = "0";

What am i doing wrong getting the features? There should be 6 Features, which are also correctly appearing in the application.

The (valid) *.geoJSON looks like this:

    {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [...]]]}....


texts: Why does PSQL ignore spatial index in "where NOT ST_Contains", but uses in "where ST_Contains"?

texts:
I'm creating a new table of trips in my PostgreSQL/PostGIS database, where trips are comprised of a series of individually identified points, based on where the points within each trip are. The idea is to select any trip which has at least one point that is NOT within a certain area. So that means filtering through every point to see if it's in or out of a certain spatial realm, and if any point is outside of the realm, then I put the trip_id of that point (multiple points make up a single trip, and all points within a trip share a trip_id) into this new table. The query is written as follows:
CREATE TABLE main.trips_gps_validity_21 as
    SELECT DISTINCT t.trip_id
    FROM main.points t, main.sfoutline y
    WHERE not(ST_Contains(y.geom, t.geom_met))

Here, y.geom is the spatial polygon that designates my area of interest, and the t.geom_met is the geometry for each point within a trip.
When I run the inverse, i.e. the bottom line is "WHERE ST_Contains(y.geom, t.geom_met)" instead of "WHERE NOT", the spatial index is used. When the "NOT" is applied, the spatial index is ignored. Why would this be happening? Running the "NOT" query with a "limit 10" addendum takes 2.953 seconds, while the query without "NOT" takes only 90 msecs, so it seems like an index would help speed things along.


texts: How to save just some mxds through 'if' in python?

texts:
I have a simple code, that changes a picture in the layout, based on the element name. It works fine, for all MXDs in the same folder of the script.

The problem is, the script saves every single .mxd file int the folder, not just the ones it actually changed the picture i wanted.

How can i make it to save just the ones it actually changes?

import arcpy, os

inputPath = os.curdir

#Loop through each MXD file
for filename in os.listdir(inputPath):
    fullpath = os.path.join(inputPath, filename)
    if os.path.isfile(fullpath):
        if filename.lower().endswith(".mxd"):

            mxd = arcpy.mapping.MapDocument(fullpath)
            for elm in arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT"):
#find the element, and change it
                if elm.name == "logo":
                    elm.sourceImage = r"C:\logo\newlogo.jpg"
            print fullpath
            mxd.save()
            del mxd


texts: Does arcpy.GetParameterAsText() have a data type?

texts:
import arcpy
# Retrieve input parameters
inX = arcpy.GetParameterAsText(0)
inY = arcpy.GetParameterAsText(1)
inDescription = arcpy.GetParameterAsText(2)

incidentsFC = "C:/Data/Yakima/Incidents.shp"
descriptionField = "DESCR"

# Make a tuple of fields to update
fieldsToUpdate = ("SHAPE@XY", descriptionField)

# Create the insert cursor
with arcpy.da.InsertCursor(incidentsFC, fieldsToUpdate) as cursor:
    # Insert the row providing a tuple of affected attributes
    cursor.insertRow(((float(inX),float(inY)), inDescription))

I came across this script tool in an online course which shows an example for using the Insert Cursor where we insert a row in a point shapefile. I couldn't understand something here. Do we somehow specify what 'type' of input we will provide when we use GetParameterAsText()?

If yes, then why do we need to specify again in the last line that the coordinates given earlier are float type?

Can't we just write cursor.insertRow((inX, inY), inDescription) and if No, then how does Python understand the input in the variable inDescription is a string/text without using the double quotes anywhere?


texts: All OSM points/polygons with address string

texts:
How do you list all the polygons and points in qGIS in such way their full address shows up. My understanding is that an address is always constructed by looking at the 'building's or POI's adjacent street or building exit.

Is there such a tool that was already designed with this use case in mind, to ingest the polygons while constructing their addresses (and possibly multiple addresses for the same location)?

I would like to avoid the Overpass API and do this preferably on-fly during the ingestion phase via osm2pgsql.


texts: WFS version issue with DWITHIN CQL_FILTER in GeoServer

texts:
If my WFS version is 1.0.0 as below:
    service=WFS&request=GetFeature&version=1.0.0&typename=XXXX&outputFormat=json&srsname=EPSG:3857&cql_filter=DWITHIN(geometry,POINT(63.92449515625001 16.18202625967993),2.0185062969678143,meters)&

I get the data properly, but if the WFS version is 1.1.0 the data is not coming properly.
    service=WFS&request=GetFeature&version=1.1.0&typename=XXXX&outputFormat=json&srsname=EPSG:3857&cql_filter=DWITHIN(geometry,POINT(63.92449515625001 16.18202625967993),2.0185062969678143,meters)&

The returned JSON does not have the data it has proper totalFeatures count only.

{
type: "FeatureCollection"
totalFeatures: 1
features: [0]
crs: null
}


texts: How to calculate driving distance/time between two points

texts:
I am doing some analysis for our fire rescue department where we are comparing actual response times to fires vs predicted response times.

The actual response time analysis is straight forward as I have the data and have created the charts.

The predicted response time analysis is a little trickier and what I'm a little unsure about. Essentially, we need to determine the driving distance from the closest 3 fire stations to each fire, and then determine the response time from each station to the fire driving at 40mph.

I have network analyst and can assume this is what I'll need to use (arcgis 10.1).

There are roughly 480 fires I need to do this with so I'm looking for a way to do this programatically, if possible.

Is it as easy as getting a total distance in one field and then creating another field that calculates distance x speed?


texts: How do I compute uncertainties in the positions transformed using Helmert transformation?

texts:
I am familiar with Python, MATLAB and Mathematica. My data is given by Cartesian coordinates (positions in X,Y,Z (meters), standard deviations XX, YY, ZZ (meters) and a correlation matrix (XY, YZ, ZX).

For the Helmert transformation I will probably use Geodetic toolbox in MATLAB.


texts: Enable QGIS Core Plugin with Python Code

texts:
Kind of a follow on from this related question:
Installing QGIS Plugin with Python code
Within QGIS, how using Python can I list the keys of the core plugins and enable/disable them?
When listing the keys (with code below), some core plugins for example: Georeferencer GDAL; Coordinate Capture, are not listed, but I see the db_manager one is - should I use another variant of this for core plugins?
pyplugin_installer.installer_data.plugins.all().keys()

Assuming I can get the keys to refer to the specific core plugins, what Python code should I use to enable / disable them in a QGIS session?


texts:
I was wondering how I could extract "crown area" of single trees in a forest from a high-resolution image with only 3 band (RGB) in ArcMap. ( No NIR to use NDVI as any threshold).

I need a fast easy-to-do way to come up with a shapefile with polygons (made of several pixels depending on size of each individual tree).
Here was I was thinking : Focal Statistic - Conditional (Raster calculator)- Extracr Attributes- Convert to polygon

I just need trees (to calculate their diameter at the end) in the forest. No matter the species or whatever.

I am using eCognition but I want to try ArcMap/ ( It's ok if its not 100% accurate!!! )


texts:
Description of the issue:

Building GDAL from sources after having build proj in its latest version is failing at the configure step because it's not finding proj 6.

Details to reproduce:

Work environment:

I'm working on Ubuntu 18.04 64 bit (4.18.0-16-generic x86_64 GNU/Linux).

Installing proj.4 version 6:

I recently and freshly clone the master branch of proj version 6 from github: https://github.com/OSGeo/proj.4 in order to build it:

git clone https://github.com/OSGeo/proj.4.git /opt/proj.4
cd /opt/proj.4/
mkdir build/ && cd build/
cmake-gui ..
[configure] & [generate]
make
$ sudo checkinstall

Everything went fine, then:

$ proj -V
Rel. 6.1.0, September 1st, 2019
<proj>:
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated

$ which proj
/usr/local/bin/proj

Installing GDAL:

In a second stage, I downloaded gdal from GitHub as well: https://github.com/OSGeo/gdal to build it from its master branch:

git clone https://github.com/OSGeo/gdal.git /opt/gdal
cd /opt/gdal/gdal
./autogen.sh
./configure --with-python=python3

The error:

And here is the tail of the result of the ./configure step in the terminal:

checking for PROJ >= 6 library... checking for proj_create_from_wkt in -lproj... no
checking for internal_proj_create_from_wkt in -lproj... no
checking for internal_proj_create_from_wkt in -linternalproj... no
configure: error: PROJ 6 symbols not found

Questions:

Is there a special way to tell gdal where to find the previously installed proj in its version 6.x.x?
If yes, how?

Documentation:

https://proj4.org/install.html#cmake
https://trac.osgeo.org/gdal/wiki/BuildingOnUnix
http://osgeo-org.1560.x6.nabble.com/gdal-dev-PROJ6-td5393781.html
https://trac.osgeo.org/gdal/wiki/rfc73_proj6_wkt2_srsbarn

Updates:

The same error appears if I try with release 6.0.0 from OSGeo:
http://download.osgeo.org/proj/proj-6.0.0.zip
[ MD5 (proj-6.0.0.zip) = e0c6290f18852b963dabe5961c6f97d5 ]

[2019-10-04]

Some time passed, I used the following as simple as possible procedure - using releases - to install GDAL and still encounter some error:

Download and unzip PROJ release 6.2.0 from https://github.com/OSGeo/PROJ/releases.
cd proj-6.2.0
mkdir build && cd build
cmake-gui [configure] and [generat] with default except I changed PYTHON_EXECUTABLE from /usr/bin/python to /usr/bin/python3
make -j4
sudo checkinstall

Everything went fine.

Then, GDAL:
 1. Download and unzip GDAL release 3.1.0 from https://github.com/OSGeo/gdal/releases.
 2. cd gdal-3.1.0
    ./configure --enable-shared --with-python=python3 --with-proj=/usr/local CXXFLAGS="-Wall -std=c++17"
    make

=> Error:

...bunch of:
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_stuff`
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_crs_get_sub_crs'
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_crs_get_coordinate_system'
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_create_conversion_wagner_vi'
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_coordoperation_get_param_index'
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_coordoperation_get_param_count'
collect2: error: ld returned 1 exit status
GNUmakefile:82: recipe for target 'gdalinfo' failed
make[1]: *** [gdalinfo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/opt/gdal-3.0.1/apps'
GNUmakefile:112: recipe for target 'apps-target' failed
make: *** [apps-target] Error 2


texts: pgRouting：routing problems using reverse_cost

texts:
I saw this post：Routing issues with pgrouting, and try the ability of reverse_cost.

As the result of this post, if there is only one way to go from one node to another, even though the reverse_cost is very huge, pgRouting can still give the result the same as the one that I do not use reverse_cost(but this time the cost is drastically huge), but apparently it's unreasonable.

Then I try to set the reverse_cost to negative value, unfortunately under Win7 the error occurs：

Can someway I can do to solve this problem？

Or under this condition can pgRouting return one acceptable and operable result like "route not found" or "route not connected"？


texts: How can I intentionally corrupt the geometry of a shapefile?

texts: I am in need of a few shapefiles with bad geometry for testing some Python code. How can I intentionally create bad geometry in a shapefile? Preferably I would be able to create three (point, line, polygon).


texts: Importing back GIS made grid from Excel?

texts:
I have the following problem: We created a grid and used it's squares as quadrates with an also attached attribute table. As the working areas were far fom each other, we created different sites cutting the grid into pieces, containing different amount of quadrates. Every quadrate contains different data. I used XY tools to export the attribute tables to excel, where joined them into one attribute table. every line contains of cours the 4 coordinates (x min x max y min y max) and would like to import it back to qgis!

Any idea how to do that?


texts:
I would like to display images in a marker popup but I get the following error:

The image does display when I write:

var picURL2 = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
    imageBounds = [
        [55.1, 11.6],
        [55.0, 11.74644]
    ];
L.imageOverlay(imageUrl, imageBounds).addTo(map);

But when I try to add it in a marker popup like so:

var picURL2 = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg';

shelter1.bindPopup("<img src=" + picURL2 + "/>");

, I get the 404 error.


texts: How to get the specified point coordinates of a Polyline

texts:
lines_cursor = arcpy.da.UpdateCursor(lines,["From_id","To_id","SHAPE@"])
for lines_row in lines_cursor:
    from_id = lines_row[0]
    to_id = lines_row[1]
    if from_id in points_dict.keys():
        print from_id
        for point in lines_row[2].getPart(0):
            print point.X, point.Y

This will return a coordinates array of all point objects, but i just want to get the first point coordinates(or the second, the third, etc.) and give it to a new value.

How do I get this work?


texts: Using search cursor to determine renaming of feature class

texts:
What I am trying to do is create a list of shapefiles based on field name values. From there I would like search on 1 field (each shapefile will only contain 1 row) and if the value in that field is greater than X have the code rename the shapefile. What I have so far is:

polyFCs = arcpy.ListFeatureClasses("*_Value.shp", "POLYGON")
for polyf in polyFCs:
    field = "Area"
    with arcpy.da.SearchCursor(polyf, (field)) as cursor:
        for row in cursor:
            row.getValue(field)
            if field > X:
                arcpy.Rename_management(polyf, polyf.replace('.shp','') + "_NewValue")

When I run my code (and I'm pry missing or misunderstanding something) I get a runtime error stating 'A column was specified that does not exist'. I am in 10.1. Thanks for your help.


texts: Selection of duplicate values of column and update of another column based of selection using ModelBuilder?

texts:
How to select a row in ModelBuilder if a number appears again in the column "MyName_C"?

For the selected features the column "Ausrichtung" should be added with 180.

I am working with ArcGIS Desktop 10.6.


texts: Using a field to define font size in ArcGIS 10.x

texts:
Is there a way to use label expressions in ArcGIS 10.x to specify the font size for a label from the values in a field?

So as an example, I have a point dataset which I wish to label, and within the attribute table there is a numeric field called "size" which holds the size I want the label for that feature to be.

I've managed to use an expression to specify a font and a single size for the whole dataset

"<FNT name = 'Arial' size = '12' >" & [gml_id] & "</FNT>"

But if I try to replace the number 12 with the name of the field which holds the font sizes, the code doesn't work i.e.

"<FNT name = 'Arial' size = [size]  >" & [gml_id] & "</FNT>"

The above expression prints the expression as the label, rather than the values from the "gml_id" field.  So this made me think that it was interpreting the whole thing as a string because it's all in double quotes, however removing the quotes gives me a syntax error.

"<FNT name = 'Arial' size = '[size]'  >" & [gml_id] & "</FNT>"

The above expression gives me no label.

"<FNT name = 'Arial' size = "[size]"  >" & [gml_id] & "</FNT>"

The above expression gives me a syntax error.

Anybody know where I am going wrong or even if this is possible?


texts: Load shapefile with different FTypes into a GDB Feature class with different sub types

texts:
I have a contour shapefile with different FTypes (FTYPE_CODE) data type is text my task is to load this contours shapefile into a GDB Feature class (Contour50K) with different sub types (FeatureCode).

I just started to explore FME by downloading the trial version.


texts: Programmatically setting ui for QGIS via setEditForm()

texts:
I've been following this thread in attempts to configure my ui preferences programmatically. I've had no issues with loading styles (which subsequently sets the custom ui if I saved it this way), but I am unable to setEditForm solely. The following things do not work (result is that the properties stay on Autogenerate default option) both in the python console and in my plugin. I've tried with both QGIS 2.0 and 2.4.

layer.setEditForm('C:/my/full/pathname/with spaces/form.ui')
layer.setEditForm('C:/my/full/pathname/withoutspaces/form.ui')
layer.setEditForm("C:/same/as/above")
layer.setEditForm("C:\same\as\above")
layer.setEditForm('C:\same\as\above')


texts: Performing IDW for multiple Z field from attribute using ArcPy?

texts:
I have data with multiple columns as 1996_1, 1997_1, etc. I need to perform IDW for each column values and save it. I am a beginner with arcpy. Please help!
The code is as follows:

import arcpy, os

from arcpy import env

from arcpy.sa import *

arcpy.env.parallelProcessingFactor = "100%"

arcpy.env.overwriteOutput = True

env.workspace = "F:\Python\Arcpy"

inPointFeatures = "F:\Python\Arcpy\fluctpnt_UTM.shp"

zfield = ["1996_1","1997_1"]

for z in zfield:

    outIDW_1 = Idw(inPointFeatures, zfield,0.002298707671,2,RadiusVariable(10,15000))
    outIDW_1.save("004_{}.tif".format(z))

but i get this error as follows:

Runtime error
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\sa\Functions.py", line 2632, in Idw
    in_barrier_polyline_features)
  File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\sa\Utils.py", line 53, in swapper
    result = wrapper(*args, **kwargs)
  File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\sa\Functions.py", line 2624, in Wrapper
    in_barrier_polyline_features)
  File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\geoprocessing\_base.py", line 506, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Object: Error in executing tool

Refer_data


texts: Transforming shapefile into raster file in QGIS?

texts:
I'd like to transform a shapefile into raster file in QGIS and the opposite way back also (raster to shapefile).

Can you help me?


texts: Illustrating the average utilization of trails by hikers

texts:
I have a question about illustrating the average utilization of trails by hikers.

I have made a survey where I asked the participants which trail they used for hiking.There are a lot of trailoptions (stretches) that can be used.

For example "hiker 1" used trail 1 (stretches A,B,C and D). "Hiker 2" used trail 2 (stretches A,E and D). Is there a tool to map all these used trails in one shapefile and to calculate how many of the hikers used stretch A, stretch B, etc. (in percantage terms) or is it only possible to analyse the use of stretches in excel and to map the ratios in the shape in QGis (2.6)?


texts: What does the Join button in the categorized style tab do?

texts:
I'm just studing gis, and I use QGIS. I have found in the layer properties some JOIN and don't understand how can I use It?

Maybe someone can help me to understand it.


texts:
I'm trying to update or change the symbology for two files that were created in a different part of a script. My understanding is that I can't change the symbology directly, but that I can update it from another file that has the same symbology. My code is below:
mxd = arcpy.mapping.MapDocument(r'C:\ArcGIS\Hurricanes\Analog Years Script\analog_years_script.mxd')
df = arcpy.mapping.ListDataFrames(mxd, "Layers")

This is for a point file:
in_layer_01 = arcpy.mapping.ListLayers(mxd, "ana_years_01_proj", df)[0]
in_symbology_layer_01 = arcpy.mapping.Layer('Storm Strength')
arcpy.mapping.UpdateLayer(df,in_layer_01,in_symbology_layer_01, symbology_only = True)

This is for a raster:
in_layer_02 = arcpy.mapping.ListLayers(mxd, 'outKernelDensity', df)[0]
in_symbology_layer_02 = arcpy.mapping.Layer('2020anayears')
arcpy.mapping.UpdateLayer(df,in_layer_02,in_symbology_layer_02, symbology_only = True)

I don't get any errors, just nothing happens. I thought maybe the issue was that the renderer was not set correctly, so I tried to set it first as follows (I think I'll have to update my code above with new variable names if below is what I need to do):
lyr_01 = arcpy.mapping.ListLayers(mxd, 'ana_years_01_proj', df)[0]
sym_01 = lyr_01.symbology
sym_01.updateRenderer('GraduatedColorsRenderer')

I get this error with lyr_01:

AttributeError: 'GraduatedColorsSymbology' object has no attribute
'updateRenderer'

lyr_02 = arcpy.mapping.ListLayers(mxd, 'outKernelDensity', df)[0]
sym_02 = lyr_02.symbology

And this with `lyr_02':

NameError: The attribute 'symbology' is not supported on this instance
of Layer.

I think I would also have to add lyr_01.symbology = sym_02 and lyr_02.symbology = sym_02 if the above ever works and if it's needed.
When I run type(sym_01) I get "<class 'arcpy._mapping.GraduatedColorsSymbology'>."
When I run 'sym_02_t = lyr_02.symbologyType' and the 'sym_02_t' I get "u'OTHER'" which I think is an issue.
I also tried the arcpy.ApplySymbologyFromLayer_management(in_layer_01,in_symbology_layer_01) method with the same results. I can always change in manually, I just thought it'd be nice to code it if possible.


texts: ArcMap calculate statistics every time I open jp2

texts:
I have jp2 raster files, every time i open one of these files ArcMap caluclate the statistics and histogram. Can I stop this
I am using ArcGIS Desktop 10.3.1


texts: QGIS: reopen project with empty attribute table

texts:
I have creat a Grid layer by Vector grid on QGIS 2.18. Then I saved this project and reopen it, the Grid layer just cannot be shown and its attribute table becomes empty.

May I know what is going wrong here?


texts: GIS storage format for better performance - Android device

texts:
We have developed an android application which loads different eco-zones and does geo-fencing based on current GPS location.

We have converted a shapefile to KML, then to JSON format, for loading in the Android app.

The zones had 1000+ vertexes, so performance was an issue. I then tried splitting the polygons, this deforms zone boundaries.

Is there a better approach to this, while respecting zone boundaries, in which the performance could be improved? I.e. less vertices using some other algorithm? or a better GIS data format ?


texts: How to get street names from OpenStreetMap?

texts:
I have some SHP layers that contain some streets and buildings data, and i'm showing it with openLayers (by GeoServer).
they are not contain the names of the streets or the numbers of the buildings.
there is a way to get from OSM list with the streets names and the numbers of buildings with the location of theme, its can be in any format(kml, shp, gml, text etc)?


texts:
I wonder is there any open-source application that can query a PostGIS-enabled database and render the resulting OSM map in 3d.

The only thing I have found so far is Navit, but it renders only from an .osm file, but not a database.


texts: Are there any plugins for QGIS 3.x versions to search for places or addresses? I know about "OSM place search" in QGIS 2.x, but I can't find a plugin in the repository doing the same job for QGIS 3.x.


texts:
I am writing a plugin that offers to open a CSV. I know the local path to the CSV but I don't know if it contains spatial data nor which name the X and Y could have.

The best way I can think of, is to utilize the QGIS Delimited Text Widget and set the path to the file, so it is possible to choose X and Y (if existing) from the native dialog (and use the other functions if needed).

My only problem is, that I can't find a way to set the path to the file inside the widget. Is there a way I can do this?

The code to open the widget:

delimited_dlg = QgsProviderRegistry.instance().selectWidget("delimitedtext", self.main_win)  # use iface.mainWindow() in console

QObject.connect(delimited_dlg, SIGNAL( "addVectorLayer( QString, QString, QString )" ),
           self.main_win, SLOT( "addSelectedVectorLayer( QString, QString, QString )" ) )

delimited_dlg.show()

The native Class QgsDelimitedTextSourceSelect uses the variable txtFilePath to store the path and the Class QgsDelimitedTextProvider takes the const QString& uri as argument. Is there any chance I could set those?


texts:
I try to make something like this site but I don't know how. I have found Google API for animation but how do I combine the animation site because I don't have the coordinates of the routing of this service?

This site is like what I'm trying to make.

Added after ymirsson's answer: I try to make a custom SVG icon, to convert a PNG icon to SVG. The other problem I have is I can't stop it in end destination.  I try with the following code, like you wrote.

createPolyline(response,leg.end_location);

function createPolyline(directionResult,end) { //same if(directionResult.routes[0].overview_path==end)
 stopCircle(); };

function stopCircle() { window.clearInterval(this.offsetId); this.setOptions({ icons: null }); };


texts: Split classes in corine land cover raster

texts:
I have a raster with 44 classes of land cover.
How can I split this raster in 44 rasters, each one with one class of land cover?

I am working with ArcGIS 10.2.2


texts: Why do arcpy.GetCount_management and arcpy.ArcSDESQLExecute yield different row counts?

texts:
I was benchmarking which method was faster for counting the number of rows in a table, when something curious happened:

import arcpy
import os
import time

test_tuple = ("path\to\connection", "feature_class_name")
fc = os.path.join(*test_tuple)

i = 0
while i < 3:
    # Method 1
    time.sleep(5)
    start_time = time.clock()
    count = int(arcpy.GetCount_management(fc).getOutput(0))
    end_time = time.clock()
    print("Method 1 ({count}) finished in {time} seconds".format(count=count, time=(end_time - start_time)))
    print("The count was: {count}".format(count=count))

    # Method 2
    time.sleep(5)  # Let the cpu/ram calm before proceeding!
    start_time = time.clock()
    query = """SELECT COUNT(*) FROM {}""".format(test_tuple[-1].upper())
    execute_object = arcpy.ArcSDESQLExecute(test_tuple[0])
    result = execute_object.execute(query)
    count = int(result)
    end_time = time.clock()
    print("Method 2 ({count}) finished in {time} seconds".format(count=count, time=(end_time - start_time)))
    print("The count was: {count}".format(count=count))
    i += 1

This gave the following results:

Method 1 finished in 5.018752999999999 seconds
The count was: 22645
Method 2 finished in 0.24905560000000015 seconds
The count was: 21473
Method 1 finished in 0.7440046999999996 seconds
The count was: 22645
Method 2 finished in 0.7023353000000014 seconds
The count was: 21473
Method 1 finished in 0.7402944999999974 seconds
The count was: 22645
Method 2 finished in 0.684015500000001 seconds
The count was: 21473

Why are the counts different between the two methods?


texts: Joining table of single house layer to zone layer by location using ArcGIS Pro?

texts:
I have a layer which shows all the single house polygon. I also have a zone layer which shows the boundary of different regions.

I would like to see which region each single house polygon is in, like having a field in single house polygon attribute table, stating which region does it fall to.

If the polygon falls under 2 regions' boundaries, i want it to belong in the region with the larger section of the house polygon.

Tried spatial join however there are no matching fields to do so


texts:
I've set up Full-Text searching on a table in my SDE database (ms sql backend).  I can perform the full-text commands from SQL queries, but it doesn't seem to work in ArcMap or any rest services.  I full-text supported at all in arcgis server?

ie: if i run this SQL query on my server, it returns all trail names that have trail in it (trail, Trail, Trails, etc)

SELECT * FROM dbo.TRAILS WHERE CONTAINS(Webname, '"trail"');

if i add

CONTAINS(Webname, '"trail"');

to the "WHERE" section in arcmap, querying the same table, it gives me an error, saying full-text indexing is not set on that table.

EDIT: i've got it so it doesn't give me the error anymore, but the CONTAINS(Webname, '"trail"') doesn't search for any iteration of trail in the field, it only returns the exact text i was looking for (webnames with "trail" in it, not "trail", "Trail, "Trails", etc)

and ideas?


texts: PostGIS St_AsGeoBuf: how to handle Boolean type?

texts:
I am using ST_AsGeoBuf function in a query like that one:
SELECT ST_AsGeoBuf(t.*, 'geom')
FROM table t

After decoding the geobuf to a legible JSON the boolean types show up as strings with values "f" or "t".
I also tested encoding and decoding GeoJSONs with Boolean attributes and it worked properly, so now I know that the issue lies within PostGIS and not the decoder or the format. I need to get a geobuf with proper Boolean types. Any workarounds for this?
PostGIS v3.0


texts: Intersection between two line shapefiles into Boolean in model builder (QGIS 3.6)

texts: I have been trying to find intersections between two line shapefiles (roads and telecom cables). I've only been able to extract the lines where there is an intersection using the extract by location. I want the result to appear in a another shapefile where I already created a field for intersection (1 or 0). Any idea how to achieve this ?


texts: Creating average geometry for lines whose buffers intersect

texts:
I am learning SDO. I have started new project with SDO geometry. Here is some problem we have faced. We want a script where the x and y geometries in the intersecting buffers will be updated with the center geometries in the SDO geometry, but only for the part of the geometry array that have intersecting buffers. The part of the array that do not have intersecting buffers should not be touched.

The output should be like below after update the geometry.


texts: Creating a New Shapefile from Joined Access Table

texts:
I'm dealing with a very large amount of polygons. Once I join the land use access table to the parcel shapefile, it takes forever for Arc to draw  the polygons. I'm trying to select all residential polygons in Harris County, TX from the land parcels.shp joined to the residential table.

Once the polygons I want are selected, I try to export these polygons to a new shapefile. I will not have to deal with any other from the land parcels. The problem is that Arc will create the residential shapefile I badly need for my project , but all it does is create the fields with no attributes in them.

I'm trying to create the Shapefile by right clicking the parcels.shp and trying to export the selected features into a new shapefile.

Any suggestions on why this is happening, and how to get a shapefile of the residential areas with the attribute polygons?


texts: How to replace null values in attribute table ArcGIS 10.2

texts: I have a string field 'Oneway' with three values '+' '-' and Null showing a street accessibility, I would like to replace them with values 'F' 'T' and null as the script for  Network dataset expect these values.However it seems that it is not possible to replace values if Null values are present. I tried also changing the field type to double or text  but the field properties are not editable somehow (I tried this in arc catalog). I am only able to replace value '+' and '-' with numbers using the field calculator but need to replace them with letters.


texts:
I am using leaflet 1.0.3 with bootstrap 4 and I need to set a better styling for the popups, I'm thinking in probably a bootstrap modal or in a sidebar in which every time someone clicks the geoJSON layer the information is showed in the sidebar, I'm not an expert in formatting the ugly white popup into some good looking table, is there a way to do it.

I use the default way stated in the leaflet documentation:

function popUp(f,l){
            var out = [];
            if (f.properties){
          for(key in f.properties){
          out.push(key+""+": "+f.properties[key]);
            }
          l.bindPopup(out.join("
" +"
" + "- " + "" ));
                    }
        };

My reasoning is not enough, I understand that doing the JS join I can do some formatting, still, i am a bit lost in wich line should I begin, I can grasp some hints, like there is an array and some joining.

continuing(today) with the idea and understanding better the function, the GeoJSON data is transformed into an array, then it gets into an if to check the KEY and the properties(attributes) of each KEY, after this process using the javascript array.push() the data can be formatted using some HTML, finally, the using the leaflet bindPopup the array gets joined with another formatting, such as a
.

that's what I have learned so far, I'm looking into transforming the array into an HTML table, for now, if I find the answer I will gladly post it in here.

I'm learning to code just since March, so I'm still not very good yet.


texts:
I'm trying to setting up pycsw on xampp.

In the pycsw's default.cfg I've the following configuration:

[server]
home=C:\Users\masa\xampp-201405\htdocs\pycsw
url=http://localhost:8000/pycsw/csw.py
...
[repository]
# sqlite
database=sqlite:///C:\\Users\\masa\\xampp-201405\\htdocs\\pycsw\\tests\\suites\\cite\\data\\records.db
...

When I start the csw.wsgi and go to the address localhost:8000/?service=CSW&version=2.0.2&request=GetCapabilities then I get the following error:

Could not load repository (local): (OperationalError) unable to open database file None None

I think the problem is caused by the insufficent permisions configure on apache . I added to httpd.conf the following lines:

<Location /pycsw/>
Options +FollowSymLinks +ExecCGI
Allow from all
AddHandler cgi-script .py
</Location>

<Directory "C:/Users/masa/xampp-201405/htdocs/pycsw">
  Order deny,allow
  Allow from all
</Directory>

But I get the same error.

Can you give me any advice?? I'm not fluent about apache configuration.


texts: How to prevent plugins from loading at start?

texts: I'm trying to set plugins to unchecked at start in QGIS-3.10, I thought it could be possible at the "Manage and install plugins" menu; if I uncheck the plugins they disappear from the menu, but whenever I restart they get loaded again, I'm trying with the purpose of a faster start and a cleaner look


texts: R (spatstat, sp, sf): Grid a single polygon, divide, alphanumeric labels based on column/row

texts:
I am trying to take a polygon and add grid lines over top, then divide the polygon into many polygons based on the grids. I've accomplished this through st_make_grid() and raster::intersect().

The outcome is correct:

But I would like to later reference each cell (now individual polygons in a SpatialPolygonsDataFrame) with alphanumeric labels, in which the letter references the row the cell is in and the number references the column the cell is in. I can't find any way to do this via st_make_grid() or anything else.

library(spatialEco)
library(raster)
library(dplyr)
library(sp)
library(maptools)
library(sf)
library(rgdal)
library(rgeos)

#owin2Polygons is just for conversion
owin2Polygons <- function(x, id="1") {
  stopifnot(is.owin(x))
  x <- as.polygonal(x)
  closering <- function(df) { df[c(seq(nrow(df)), 1), ] }
  pieces <- lapply(x$bdry,
                   function(p) {
                     Polygon(coords=closering(cbind(p$x,p$y)),
                             hole=is.hole.xypolygon(p))  })
  z <- Polygons(pieces, id)
  return(z)
}

tess2SP <- function(x) {
  stopifnot(is.tess(x))
  y <- tiles(x)
  nam <- names(y)
  z <- list()
  for(i in seq(y))
    z[[i]] <- owin2Polygons(y[[i]], nam[i])
  return(SpatialPolygons(z))
}

owin2SP <- function(x) {
  stopifnot(is.owin(x))
  y <- owin2Polygons(x)
  z <- SpatialPolygons(list(y))
  return(z)
}
w3 <- owin(xrange=c(55,562), yrange=c(137,1436)) #dummy window

spatpoly3 <- owin2SP(w3)

grid<-st_make_grid(spatpoly3, cellsize = 100, square = TRUE)
grid
gr_t2 <- as_Spatial(grid, cast = TRUE, IDs = paste0("ID", 1:length(grid)))
gr_t2 <- gBuffer(gr_t2, byid=TRUE, width=0)
spatpoly3 <- gBuffer(spatpoly3, byid=TRUE, width=0)
newLines <- raster::intersect(gr_t2, spatpoly3)
plot(newLines)
getSpatialPolygonsLabelPoints(newLines)
class(newLines)

numb3 <- data.frame(number = 1:length(newLines))
( pid <- sapply(slot(newLines, "polygons"), function(x) slot(x, "ID")) )
( p.df <- data.frame( ID=1:length(newLines), row.names = pid) )

polygrid_numbered3 <- SpatialPolygonsDataFrame(newLines, p.df)

With help from @obrl_soil I'm very close, but for some reason, setting cell size in st_make_grid throws the labeling off:

If I remove cellsize but leave "square = TRUE", the labeling is correct but the cells are not squares:

Any ideas?


texts: How to model a graveyard - one point per deceased or one per grave?

texts:
This is a continuation of my previous question about our project on how to economically get away with the implementaion of a graveyard in a GIS system…

On the graveyard we can find

    Regular graves: up to 2 people
    Family graves: more than 2, some up to 20 (sisters from a Catholic congregation…)
    War Monument: about 30 people
    Ash Scattering Area: unlimitted, starting with 100 people
    Fields with Burial Urns: up to 2 per spot
    Walls with Burial Urns: up to 3 in height

So what’s the best way to go, defining:

    each person as a POINT object
    each grave as a POINT object, the persons are part of the attributes

I would choose for each person as a POINT object:

    One simple CSV file for all the persons.
    Columns could be for example: FirstName – FamilyName – YearDeceased
    Independent of the number of persons in a grave
    That way even the ASH SCATTERING AREA can go into the file
    Eventually some code has to be written to add to the results of a search the other persons burried in the same grave

Complications I see with each grave as a POINT object:

    Each ROW needs the columns for the maximum number of persons in a grave…
    That means that a lot of cells will be empty due to just a few graves with a lot of people
    But what with the ASH SCATTERING AREA? 100 persons  require all the additional columns in the table…
    It is not reasonable to have all the data in one CSV file, but having more files will highly complicate the matter.

So, comments are welcome: person or grave as POINT object?
Or none of this and do I need to do it another way?

In my town, 3 years ago, they had a bureau made SHP files for them.
I was handed over those files and I noticed that the graves are drawn as POLYGONS. This comes with a DBF file for the ”data of the graves”.
The normal graves have 4 sets of coordinates, seems logic.
But a few things seem absurd to me:

There is an “urn wall” with hexagonal columbaria’s drawn as a set of hexagonal figures… That means that each figure has 6 sets of coordinates…
In the “ash scattering area”, there is a pillar with little rectangular nameplates, they have drawn a rectangular POLYGON for each nameplate with 4 sets of coordinates…

To me, using POLYGONS in these cases seems so much overkill in the database.

Besides that, correct me if I’m wrong, using:

POLYGONS requires DBF files, so a DBF editor (extra costs)

POINTS only requires CSV files, so EXCEL is enough (no extra costs)

In most towns, the data of the deceased persons come in a CSV file:

made directly in EXCEL or
exported form a DOS based program, made when WIN95 was still around…

Continuing to manage the “data of the persons” in one CSV file and EXCEL avoids:

buying software that can edit DBF files
worrying about importing the “data of persons” into the DBF file
It seems not always to be without a hassle to import, edit and save data from CSV  into DBF files and have NO corruption of your data.
I read that this can be the case especially when working with ArcGis (ESRI).


texts: Errors encountered executing: tessera tmstyle:///

texts:
I am trying to follow demo provided here. Tessera (a Tilelive implementation) is supposed to serve .tm2 files created in Mapbox Studio Classic to localhost using node js.  The errors returned seem vague to me. I am posting here reaching out hoping someone else has experienced this and can provide some insight.  Here is what I have tried.

Install the dependencies...

 npm install -g tessera tl mbtiles mapnik tilelive tilelive-file tilelive-http tilelive-mapbox tilelive-mapnik tilelive-s3 tilelive-tmsource tilelive-tmstyle tilelive-utfgrid tilelive-vector tilejson

Set global environmental variable MAPBOX_ACCESS_TOKEN (windows, although I can use cygwin to echo and return correctly the correct mapbox token)

export MAPBOX_ACCESS_TOKEN=pk.eyJ1Ijoid3RnZW9ncmFwaGVyIiwiYSI6IlR2a2VuQWsifQ.U3TabizicU3kZ4LvkHyb0g

And finally execute the Tessera cmd...

tessera tmstyle:///path/to/terrain.tm2

Then it acts as if if is starting server on port 8080 but throws the following error...

$ tessera tmstyle:///path/to/terrain.tm2
Listening at http://0.0.0.0:8080/
C:\Users\wtgeo_000\AppData\Roaming\npm\node_modules\tessera\server.js:47
        throw err;
        ^

TypeError: Cannot read property 'class' of undefined
    at Renderer.render (C:\Users\wtgeo_000\AppData\Roaming\npm\node_modules\tilelive-tmstyle\node_modules\carto\lib\carto\renderer.js:117:25)
    at C:\Users\wtgeo_000\AppData\Roaming\npm\node_modules\tilelive-tmstyle\index.js:210:52
    at Immediate._onImmediate (C:\Users\wtgeo_000\AppData\Roaming\npm\node_modules\tessera\node_modules\tilelive-cache\node_modules\locking-cache\index.js:74:25)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

Following the returned msg I open the tessera server.js file and it is simply the throw error msg providing (to me atleast) little insight.


texts: Embedding python code on an interactive map

texts:
I'm looking to create a highly interactive map for the user. Not only an interactive map in the sense of visualization, where the user can move, zoom and click on the map to see a tooltip appear. But also where the user can for example click on an area (a polygon) and a python method is executed to cut the area into squares. A way to integrate the execution of python code in the map according to the user's interactions.
Is there a python solution to do this ? A tool or a specific library.


texts: ArcGIS 10.2 Model builder Spatial Join user input

texts: I have a model that runs a spatial join and then adds and calculates fields to that joined table output. The model is designed so that a user can change the target features and join features. I have also added the field map as a parameter. However, when changing the target features and join features (when ran as a model tool) no field map is generated, so no information is outputted. Thus, no fields are calculated afterwards, even if the model successfully ran.