texts: Find Mapping of Place Codes to County Codes

texts:
I have two datasets with columns described below:

A list of all "place" names derived from here (US Census):

And this one, a list of county FIPS codes, also derived from the US Census (here)

I need to match the placefp codes (shown above in the first able) with the countyfips codes (shown above in second table), e.g. get the county for every "place." I can't seem to find a mapping of the place FIPS to the county FIPS, and it doesn't appear that the counties are included

Where could I find a mapping of the "place" FIPS codes to the county FIPS codes?


texts: How to break multilinestring into constituent linestrings in PostGIS

texts:
I have a multilinestring in PostGIS which I need to divide into segments that break anywhere there is an intersection. So in the below example, the lines need to be split at the each point, since that's where more than two parts converge.

Example:

o--       o
   \      |
    o-----o---o
   /     /
  o      |
         o

This a simplification of my data. I've tried ST_LineMerge() but that just returned most of my multilinestrings back to me as is. One complicating factor is that there are many parts in the multilinestring that begin or end at the intersection of only two parts. So in the example below, ST_Dump() breaks the geometry into two parts, but I want them to be stitched together as a single linestring (since only two parts are converging).

     o
    /
   o------o

What is a good strategy for approaching this problem?


texts: Why do the values of fields change after choosing unique identifer , SDE

texts:
I have a large dataset table from an SDE (SDE is the term my company uses to refer to this .under its properties (Oracle Enterprise Geodatabase).

When initiated adding the table dataset to my ArcMap. I do this by using the ArcCatalog and dragging and dropping the table into my map.

I am then prompted to set a Identifier
This is using ArcGIS 10.3

As detailed here

http://desktop.arcgis.com/en/arcmap/10.3/manage-data/databases/choose-unique-identifier.htm

So this was not an issue. But I noticed that when I pulled SDE and checked the records in the attribute table.

The field I picked for the Unique Id is retained. But some other fields that were Long Int with values like 456677 have no changed to -4. If I pick this fields as the Unique Identifier. Then there values will be fine. But it will change the others. I was wondering if anyone has seen or knows what might be the root of this issue

The Data location of the SDE is locked down, so there is not much I can do to analyze it.


texts: arcpy.da.UpdateCursor updating field based on the previous row

texts:
I am quite new to python.

As you can see from the image attached to this post. I have polylines with  From junctions (fnode) and to junctions(tnode) field. My goal is as following:

To update  draw order field of the path of the line from start point (from Links description field), through good links until I come across bad links.
I wrote the following code but the loop stops at draw order 3 and doesn't continue, any idea what is wrong?

import arcpy # import moudle
from arcpy import env # import env
env.workspace = r"F:\onedrive\gtfsfilescut\3.3.16\bus289.gdb"
env.overwriteOutput = True

fcName = "LINKS_FREQ_TEST"
fields = ['FJUNCTION','TJUNCTION', 'freq_fnode' , 'freq_tnode','Links_Description','Draw_Order','Was_Used','Test_Field' ,'USERID' ]

ctr = 1

with arcpy.da.UpdateCursor(fcName, fields) as cursor:

for row in cursor:

    if (row[4] == "Start"): # check if link description is start
        row[5]  = ctr # update draw order
        row[6] = "Yes" # update was used
        cursor.updateRow(row)

        for row2 in cursor:
            if (row[8] != row2[8]):
                if (row[0] == row2[0] or row[0] == row2[1] or row[1] == row2[1] or row[1] == row2[0]):
                    row2[6] = "Yes"
                    ctr = ctr + 1
                    row2[5] =  ctr
                    cursor.updateRow(row2)

  with arcpy.da.UpdateCursor(fcName, fields) as cursor2:

for row in cursor2:

    if (row[4] == "Good" and row[5] == ctr): # check if link description is start

        for row2 in cursor2:
            if row[8] != row2[8]:
                if (row[0] == row2[0] or row[0] == row2[1] or row[1] == row2[0] or row[1] == row2[1] or row2[0] == row[0] or row2[0] == row[1]):
                    row2[6] = "Yes"
                    ctr = ctr +1
                    row2[5] =  ctr
                    cursor2.updateRow(row2)

alsot tried this code based on @richard suggestion to use a dict key but it doesn't seem to work for me the code does nothing when I run it:

 fields = ['FJUNCTION','TJUNCTION','freq_fnode','freq_tnode','Links_Description','Draw_Order','Was_Used','Test_Field' ,'USERID','OBJECTID' ]

def rows_as_update_dicts(cursor):
   colnames = cursor.fields
   for row in cursor:
       row_object = dict(zip(colnames, row))
       yield row_object
       cursor.updateRow([row_object[colname] for colname in colnames])

with arcpy.da.UpdateCursor(fcName, fields) as cursor:
    for row in rows_as_update_dicts(cursor):
       if (row['Links_Description'] == "Good" and row['Draw_Order'] == ctr):
         for row2 in rows_as_update_dicts(cursor):
           if row['USERID'] != row['USERID']:
              if (row['FJUNCTION'] == row2['FJUNCTION'] or row['FJUNCTION'] == row2['TJUNCTION'] or row['TJUNCTION'] == row2['FJUNCTION'] or row[1] == row2['TJUNCTION'] or row2['FJUNCTION'] == row['FJUNCTION'] or row2['FJUNCTION'] == row['TJUNCTION']):
                row2['Was_Used'] = "Yes"
                ctr = ctr +1
                row2['Draw_Order'] =  ctr
                cursor.updateRow(row2)

here is the data table:


texts: Perform OpenLayers methods when outside images are clicked

texts: I'm trying to set up my OpenLayers map controls (e.g ZoomIn, ZoomOut) when images elsewhere on the page are clicked. Is this an issue of formatting a control panel to display the buttons as my images (if so how should I set up the CSS to use the images), or would I be better to set up a listener on the image, that then runs the method ZoomIn on the when clicked (and if so what sort of code do I need)?


texts: What is the visualization technology behind cartoDB?

texts: What is the technology behind cartoDB visualization, does it use MapServer, GeoServer, or something else?


texts: How to generate geodesic linestring from two points in C#

texts:
I'm looking for a FREE C# class, library or set of functions that will allow me to generate a geodesic linestring (or array of vertices, whatever) from two decimal degree points.

I've found javascript functions that do what I want, but no luck with C# ones.

I suppose I could translate it from the above javascript. But I'd prefer to use something tried and tested.

Anyone know of such functions, classes or libraries?


texts:
I run the following query and irrelevant of the point coordinates and radius I always recieve all the records of the table I'm querying. Can anyone point out what the problem could be with this query?

SELECT * FROM Buildings WHERE ST_DWithin(geom, ST_Buffer(ST_GeomFromText('POINT(0 0)', 26918), 2000, 'quad_segs=8'),0);

Just to be clear, my aim is to select all buildings that fall into a selected circular buffer.  Here the (0,0) are the coordinates of the center of circle and 2000 is the radius. No matter what value I put for these, the query returns all the records of table.

Please help!

The following image shows the results of 12 records:


texts: Changing projection back and forward correction

texts:
I Have an orthophoto which is set on a local CRS (EPSG:2039)
I also collect data with a WGS84 Application (Fulcrum)
In order to use the orthophoto in the app I had to reproject it from the local CRS to WGS84 (EPSG:4326).
Later on I exported the vector data (points) which is of course in WGS84 and again reprojected it back to the local CRS.
For some reason the new vector data does not match the map and has an offset of a few meters. I'm searching for a way to correct it and move the points so all of of them would fit the original orthophoto.
In short what happened is
I Took a raster and reprojected it from one CRS to another
I I used it to collect vector data and when I switched the vector data back to the original CRS, It was offset
In the photo you can see that the points that were supposed to be on the poles are in the middle of the road


texts:
I tried to load base map from OpenLayers, but it doesn't work at all. QGIS popped up an error message showed below. What I noticed the slash foreword different way. I guess something wrong with the connect to Python.

How can I re-set it?

  An error has occurred while executing Python code:

  Traceback (most recent call last):   File
  "C:/Users/.qgis2/python/plugins\openlayers_plugin\weblayers\weblayer.py"

  ......

  Python version:

  2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]

  Python path:
  ['C:/PROGRA~1/QGISPI~1/apps/qgis/./python/plugins\processing',

  ......


texts:
I'm looking for the ZCTA of a relatively newly created Zip Code: 49685 just outside of Traverse City, MI. When I punch that Zip Code into Google Maps, it somehow comes up with a polygon that it shows me on the map. However, I cannot find this particular ZCTA anywhere within the Census Bureau geographic products.
So where and how did Google Maps come up with the polygon that's associated with the Zip Code 49685?


texts: How do I get a set of lat/lon points into OSMAND?

texts: I have a lat/lon points that I want to get into OSMAnd. What format do I need to put this in?


texts: I'm trying to turn data in a Microsoft Access file into an ArcGIS-10 layer. The table contains a column labeled "shape." Each line in this column reads "long binary data." What's that?


texts: Is PostGIS geography type EPSG:4326 only?

texts:
I was under the impression that the geography type only uses the lat,long based coordinates EPSG:4326. And I didn't remember having to specify a CRS for a geography column.

However, from this boundless example:

SELECT * FROM geography_columns;

          f_table_name    | f_geography_column | srid |   type
--------------------------+--------------------+------+----------
 nyc_subway_stations_geog | geog               |    0 | Geometry
 airports                 | geog               | 4326 | Point

It can have other SRIDs such as 0 as shown above.

Does geography type use 4326 only?


texts: Checking whether file already exists using while loop with ArcPy?

texts: How do I check whether a file with a user-defined prefix already exists, using the while loop and if it is a case to request another prefix?


texts: Is there a way to see the coded value domain list of possible values from arcmap 9.3.1?

texts: Is there a way to see the possible values of a specific  coded value domain in arcmap 9.3.1 (I have no access to the SDE which holds all the data in arcCatalog)?


texts: Shapefile reprojection with "sf" R package doesn't work

texts:
I am using the sf R package to work with a shapefile (with a species distribution).

> sp #this is the shapefile

returns:

Simple feature collection with 1 feature and 1 field
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: -11539950 ymin: 4933183 xmax: 11985800 ymax: 8012809
epsg (SRID):    NA
proj4string:    +proj=moll +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs
            scntfcN                       geometry
3096 Myodes rutilus MULTIPOLYGON (((5070195 797...

These are the shapefile crs and plot:

> crs(sp) #show the original crs
[1] "+proj=moll +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs"
> plot(sp) #plot the original shapefile

I want to reproject the shapefile from the Mollweide projection to the WGS84 geographic crs:

> sp_reproj <- st_transform(sp, 4326) #reproject the shapefile

> crs(sp_reproj)

returns:

[1] "+proj=longlat +datum=WGS84 +no_defs"

but when I try to plot it, I get this error:

> plot(sp_reproj)
Error in CPL_geos_is_empty(st_geometry(x)) :
  Evaluation error: IllegalArgumentException: point array must contain 0 or 1 elements.

Furthermore, if I write the shapefile

> st_write(sp_reproj, "Reprojection.shp")

and open it with QGIS, I have this:

Strangely, the holes (lakes) seems to have been filled.

Further notes:
1) the original sp shapefile seems to be valid and not empty

> st_is_valid(sp)
[1] TRUE
> st_is_empty(sp)
[1] FALSE

2) My final aim is not just to plot the reprojected shapefile, but to intersect it with a raster. However, I get the same error as when plotting, so the problem should be in the shapefile not in the operation.

3) Actually, the sp shapefile come from a bigger shapefile with thousand of sf features. This one is the only one that gives me that error.

4) Here the original and reprojected shapefiles

Why I get this error? And why the reprojection fill the holes in the original shapefile?


texts: Getting source bounds when filtering LAS using PDAL?

texts:
I'm using PDAL to filter out non ground points to create a DTM along with a DSM also made through PDAL to create a Canopy Height Model using this method.

My workflow looks like this.

#!/bin/sh
# name=output name, i=filetype (LAS or LAZ)

name="$1"
i="$2"

mkdir DTM
mkdir DSM

for f in *.${i}
do
JSONFILE="{
  \"pipeline\":[
    \"${f}\",
     {
      \"type\":\"filters.range\",
      \"limits\":\"Classification[2:2], Classification[9:9]\"
    },
    {
      \"type\":\"writers.gdal\",
      \"resolution\": 0.5,
      \"radius\": 1.0,
      \"filename\":\"DTM/${f}.tif\",
      \"output_type\":\"min\"
    }
  ]
}"

echo "$JSONFILE" > ${f}_dtm.json

done

ls *.json | parallel pdal pipeline {}

rm *.json

for f in *.${i}
do
JSONFILE="{
  \"pipeline\":[
    \"${f}\",
    {
      \"resolution\": 0.5,
      \"radius\": 1.0,
      \"filename\":\"DSM/${f}.tif\",
      \"output_type\":\"max\"
    }
  ]
}"

echo "$JSONFILE" > ${f}_dsm.json

done

ls *.json | parallel pdal pipeline {}

rm *.json

ls DTM/*.tif | sed -e "s'DTM/''g" | parallel gdal_calc.py -A DSM/{} -B DTM/{} --outfile=DTM/{}_CHM.tif --calc="A-B" --NoDataValue=0

Note, I'm using parallel to be able speed up things using more cpu cores.

This workflow works well with most files, but sometimes when there aren't any
ground points (Classification 2) all the way out to the file's extents, the output TIF gets cropped and will not have the same dimensions as the original LAS file (and DSM). When the DSM and DTM extents doesn't match I get an error in gdal_calc.py.

Now I wonder how I can solve this.

Either if PDAL could write a TIF with the same bounds as the original LAS file regardless of the extents of the filtered points. I've seen the bounds flag in writers.gdal but I have no idea how I extract these from the LAS file in a simple way.

Another option would perhaps be changing the extent of the TIFFs afterwards so it fits with the DSM file's extent. Not sure how to achieve this either. Perhaps by extracting extents from the DSM and then "applying" to the DTM tif.

Example images covering the same area. As you can see the bottom DTM is cropped because there isn't any non ground points in the southern part.


texts: How to merge multiple KML points into one file?

texts:
I made 20 KML points in Google Earth, and put it in gis - I want to save it in a single file, right now they are 20 different files. How can it be done?

What I want to have is a single gpx file.


texts:
Recently I have this really weird bug :
I have a new graphics-layer, that I build on runtime, with a point-graphic in it.
On higher extent - ever thing's great, on lower extent (zoom-in) the graphic disappears.

I found, while debugging, that the graphics "_shape" & "_offsets" properties are null when it disappears.

I also noticed that the layer's properties "minSacle" & "maxScale" are both 0 and "visibleAtMapScale" & "visible" are true.

Beside that, everything looks as usual - the graphic stays visible and at the layer's graphics array.


texts: Intersection of drawn polygon with WMS layer features. Better of two methods?

texts:
Scenario:

Several WMS layers with polygon features.

Objective:

Draw a polygon with OpenLayers and allow it only if doesn't not cut any features in WMS layer. It can contain the features as a whole though.

Possible solutions:

1) Send drawn geometry server side via AJAX and return a validation response.

select count(id) FROM wms_layer_1_table,
    where ST_Intersects(<drawn geom>,the_geom)
    and ST_Contains(<drawn geom>,the_geom)=false;

if above count is zero then the drawn polygon is valid.

2) I intend to send geometries of all WMS features as text(ie,. POLYGON((x y,x1 y1)) etc) to the client side when the application loads in the browser and on addition of new ones.

With this in mind, I would like to know if and how I could validate the drawn polygon with these geometries just with OpenLayers/Javascript alone?

Thanks.


texts: How to create a layer over a surface with mayavi?

texts:
I made a program with python which displays an animation of the propagation of a fire spreading in a forest in 2D (the forest is an array):

no tree = 0.0
a tree = 1.0
a tree in fire = 2.0

Here is an example (without wind and relief):

And I also made a surface plot with mayavi, python and gdal using this post (DEM plot with matplotlib is too slow).

Now I want to know how to put the propagation that I made with an array (in 2D) over the surface of the mountain as if it was a kind of layer that will be able to move and grow on the surface like a fire growing in a forest.

I am not asking for an algorithm that can make a simulation of a forest fire.

I am asking for a way to create this kind of layer over the surface plot I made.

For instance, in the next photo you can see a red layer (the spreading fire) on the surface:

Source: https://www.researchgate.net/figure/48202796_fig11_Fig-11-The-finest-domain-in-the-Meadow-Creek-fire-simulation-5-h-after-ignition


texts: Snapping does not work for WFSLayer in ArcGIS JavaScript API 3

texts:
I have a web application that I now need to use WFSLayer for some of the map layers. The problem is that snapping does not seem to work for WFS layers.

The layer I use for drawing is a FeatureLayer. I need to be able to snap to features in other layers.

I have this code:

var snappingOptions = {
    tolerance: 20,
    alwaysSnap: true
};

snappingOptions.layerInfos = [];
var layerIds = map.graphicsLayerIds;
layerIds.forEach(function (layerId) {
    var lyr = map.getLayer(layerId);
    if (lyr instanceof FeatureLayer || lyr instanceof WFSLayer) {
        var isLyrSnappable = true;
        if (snappableLayerUrls) {
            isLyrSnappable = snappableLayerUrls.some(function (layerUrl) {
                if (layerId.toLowerCase() === layerUrl.toLowerCase() || (lyr.url && lyr.url.toLowerCase() === layerUrl.toLowerCase())) {
                    return true;
                }
                return false;
            });
        }
        var layerInfo = { layer: lyr };
        if (isLyrSnappable) {
            if (lyr.geometryType === "esriGeometryPolygon") {
                layerInfo.snapToEdge = false;
                layerInfo.snapToVertex = true;
            } else if (lyr.geometryType === "esriGeometryPolyline") {
                layerInfo.snapToVertex = true;
            } else if (lyr.geometryType === "esriGeometryPoint") {
                layerInfo.snapToPoint = true;
            }
            snappingOptions.layerInfos.push(layerInfo);
        }

    }
});
console.log('snappingOptions', snappingOptions);
map.enableSnapping(snappingOptions);

When I look at the snapping options at the end, I se that my WFS layers are present in the snappingOptions.layerInfos array.

When I activate a draw tool, the other FeatureLayer layers are snapped to, but not the WFSLayer layers.

Is not snapping supported for the WFSLayer?

How can I get around this?


texts: Normalizing values in single Field (from table) in ArcGIS for Desktop?

texts:
have encountered a problem, in Field Calculator.

The situation : I have a polygon feature with a table, comprised of a single Field ("Field1"). There are 675 records in this field. The minimum value is 0.24, and the maximum value is 2546.

What I want to do: Add a new field ("Field2"), in which I want to generate the normalized values in "Field1". By normalization, I am referring to re-scaling all the values, from 0 to 1.

What functions / expression can I use in Field Calculator, to obtain these normalized values?


texts: Add georeferenced png layer to map automatically

texts:
Using ArcGIS Desktop v10.2 with an Advanced level license we have georeferenced our engineering drawings in PNG format.
Next we have created a polygon layer for every single drawing to see the Area of Interest depicted in the drawing.
Is there an automated way to bring individual PNG layers by clicking on their respective polygon?
I want a simpler way to add the georeferenced PNG into the map without having to use the classic "add layer" tool, where a user has to find the respective layer in their location on the network.


texts: Label placement in PyQGIS - cant find Centroid options in API but can set them in the UI

texts:
Using 3.10.1-A Coruña on Windows 10

I want to adjust my label placement options in a Python script.

I've had a look at the QgsPalLayerSettings Class Reference and similar questions here QGIS Set Label Placement in Python and here Setting placement labels on "Offset From Point" with OffsetX,Y parameters in PyQGIS? but can't find where I can set the Centroid options in PyQGIS like I can in my UI shown in the pic below.

My UI looks very different to the one in the similar question

I'm guessing it will be in the settings class. I have added settings.placement = 0 as I understand that is Around, but not sure how to set placement to Centroid:Whole Polygon and Force visible point inside polygon with PyQGIS

settings = QgsPalLayerSettings()
settings.fieldName = 'POA_CODE16'
settings.placement = 0


texts: Selecting features by characters contained in a text string

texts: Is there a way to select the features of a map by finding text within an attribute table? For example, if several features are listed as "Nature preserve" under a column called "Category", can I select all these features using an expression like, "Category" contains '*nature*', or something similar?


texts: How to Prevent Data Driven Pages From Hanging on Subsequent Export?

texts:
I am working in ArcMap 10.3.0 and exporting through Data Driven Pages (DDP).  The DDP export works as expected the first time and for immediate subsequent exports, but if I use DDP to export again after more than a minute or so (the time varies) from the same MXD, the program hangs and I have to shut it down through the Task Manager.

I can tell if it is going to hang up as soon as I click "Export" because the Export window does not show "Page x of x" text.  See screenshots here: https://geonet.esri.com/message/536459#536459.  Even if I let the computer run for awhile, the "Page x of x" text never appears and the export does not happen. This only happens on subsequent exports after more than a minute from an MXD.

This seems to happen whether I export a single page or the entire document the first time.  However if I resave the MXD with a new name and then export, it always hangs up and requires ArcMap to be restarted.  The problem seems to occur whether I am creating a new PDF file or overwriting an existing PDF file.

Other information:

My map consists of an ESRI aerial basemap (no other raster layers), with five 10000' x 10000'  lidar contour shapefiles and about 10 other small vector shapefile layers.
My export settings are: 300 dpi resolution & output image quality/resample ratio 1:2.
I am working from a data server located in this building, but the connection speed varies.
Another co-worker is having the same problems with the same MXDs on his machine.

Edited to add this error message: It appeared after ArcMap was hung up on a subsequent export, and hit "end task" in the Task Manager.  This is only the 2nd or 3rd time I've gotten this error message, but I thought it might be relevent.  (Also, I don't have an f:/ drive as shown in the error message.)

Someone else had this problem as asked on GeoNet here: https://geonet.esri.com/thread/161564
No solutions were presented to her question so I wanted to ask again here.

Is there any way to prevent ArcMap hanging up on a subsequent DDP export?

Edited to add this code snippet, which produces multiple exports without hanging:

import_path = r"R:\Projects\Project\GIS\MXDs\Project_property_maps.mxd"   # Path of .mxd
export_path = r"C:\Users\user\Desktop\test\Test"   # Path of output file
field_name = "Project_INDEX.Pg_num" # Name of field used to sort DDP
pg_name = "Project_INDEX.Desc_" # Name of field used in PDF file name

mxd = arcpy.mapping.MapDocument(import_path)
for i in range(1, mxd.dataDrivenPages.pageCount + 1):
   mxd.dataDrivenPages.currentPageID = i
   row = mxd.dataDrivenPages.pageRow
   print row.getValue(field_name)
   arcpy.mapping.ExportToPDF(mxd, export_path + row.getValue(pg_name) + ".pdf")
del mxd


texts: Selecting only part of slope image and then converting it into polygon using Google Earth Engine

texts:
I have computed as an EE example the slope map.
 var srtm = ee.Image('CGIAR/SRTM90_V4');
    var sIm = ee.Terrain.slope(srtm);
    Map.addLayer(slope);

Now I want to take only the area with slope <5% and transform it into a polygon. How can I do? I tried like this but it doesn't work.
var fcArea = ee.Geometry.Polygon([[
[9.784130646592173,46.11176966991991],
[9.977764679795298,46.11176966991991],
[9.977764679795298,46.31323245639384],
[9.784130646592173,46.31323245639384]
]]);
var srtm = ee.Image('CGIAR/SRTM90_V4');
var sIm = ee.Terrain.slope(srtm);
//
var sStart =sIm.eq(0);
var sInt = sStart
.add(sIm.eq(1))
.add(sIm.eq(2))
.add(sIm.eq(3))
.add(sIm.eq(4))
.add(sIm.eq(5))
;
var sSlope = sInt.updateMask(sInt.gt(0));
var vSlope = sSlope.reduceToVectors({
  geometry: fcArea,
  geometryType: 'polygon'
});
print (vSlope, 'vSlope');
Map.addLayer(vSlope,{color: 'FF4500'},'SLOPE <5%');


texts:
I'm looking for the GRASS module r3.out.vtk. It's featured on the GRASS GIS manual :
http://grass.osgeo.org/grass64/manuals/r3.out.vtk.html

But it's nowhere to be found, and neither are r.out.vtk and v.out.vtk. All I could find is a dead link on this web page :
http://osdir.com/ml/grass-development-gis/2005-06/msg00287.html


texts: Access Geoprocessing results in Flex Viewer (Enhanced) Search Widget

texts:
I have Robert Scheitlin's Enhanced Search Widget up and running successfully with my MapService using ArcGIS Server and Flex Viewer 2.3. I also have a geoprocessing service that returns a point layer as part of my map. This works great-- the points display properly and I am able to query them individually.  However, I would like the user to be able to select all or a subset of results and view the table in a DataGrid. I am fairly new to both ArcGIS Server and Flex (I have poked around the uncompiled code, but haven't gotten into it yet).

In order for the Search widget to work, the URL of the GP service endpoint is required.  This URL includes a unique JOBID.  The Geoprocessor Widget gets the JOBID, but I don't know how (or if it is possible) to pass that JOBID to the Search Widget XML file to build the URL dynamically as the JOBID changes with each instance of the map.

Essentially, all I'm trying to do is allow the user to interact with the point and attribute table a la ArcMap. Any ideas or guidance would be greatly appreciated!
-Erik


texts: Generating regular points on 3d polygon surface?

texts: I have some CityGML buildings and I imported them into postgis database using 3d citydatabase. I want to generate points on buildings surfaces just like in the shown image. Building surfaces are stored as polygonz surfaces in Postgis. How can I generate points on these 3d polygon surfaces? Are there any function of postgis for this? Or are there any algorithm for this purpose ? Can I create a function in postgis for this purpose?


texts:
This code used to work...

if (File.Exists(@"C:\Roads.shp"))
{
  mapControl.AddShapeFile(@"C:\", "Roads.shp");
}

I have Roads.shp on the C:\ drive

I also have Roads dot {sbn, sbx, shp.gcd, shp.xml, shx} in the same place, c:\

The program throws an "The specified filename is invalid" exception with no Inner Exception.
Could it be related to installing ArcEngine 10 SP1?  That's the only thing I can think of...
Really appreciate any ideas, thanks in advance.

Using ArcEngine 10 with SP1 with C# VS2010

I guess I was making a Noob mistake it looks like I forgot to copy Roads.dbf to the target directory.

Too bad the error message isn't slightly more helpful.


texts: Auto-Refresh Field that has been Calculated with Python in ArcGIS Pro

texts:
Is there a way to get a calculated field to auto-refresh?

For example, I have an expiration date field with dates filled in. I have another field that I will use to show the number of days left till the expiration date. When I update the expiration date to a new date, is there a way to get the calculated fields to auto-refresh with out having to rerun the Field Calculation - GeoProcessing Tool python script?

Below I've provided a screen shot of my attribute table.


texts: How to label streetnames that were convertes from dxf (CAD) in ArcMap?

texts:
i have not yet worked with CAD data in ArcMap so my question is:

I need to display street names from dxf files that were converted to shp. Now I have a large number of shapefiles that were converted from CAD-datasets (in ArcMap 10.1). I want to label the street names fitting to the street-lines. Usually I would simply label the streets by their names by using street address placement style but I dont know how to do that now.


texts:
What coordinate System can I apply to South Africa in GE Smallworld 5.1?The CS  units should be in meters.
1.I understand that the datum used is 'hartebeesthoek_1994' , Is it necessary to create 'WGzones' from WG17 to WG31 as mentioned online?Can I create a single coordinate system for the entire country?
2.As Smallworld Doesn't support TM south based projection, I was wondering if I can apply Traverse mercator projection? If yes, what should be the parameters?


texts: change XSD definition value of minoccurs maxoccurs

texts:
How can I change the XSD definition  values of the 'Feature Type Details'' attributes minOccursand maxOccursof a Layer, either in Geoserver or in OpenJump?

(as in <xsd:element maxOccurs="1" minOccurs="0" name="MyElement" nillable="true" type="xsd:string"/>)


texts: Generate Random Lines Python Error 000732

texts:
I am trying to generate random lines within a polygon using ArcMap 10.6.1, in the Python window.  I have entered the code that was supplied in this post and changed the relevant file paths.

Here is the error message:

  Runtime error  Traceback (most recent call last):   File "",
  line 15, in    File "c:\program files
  (x86)\arcgis\desktop10.6\arcpy\arcpy\management.py", line 3435, in
  AddField     raise e ExecuteError: ERROR 000732: Input Table: Dataset
  in_memory/rand_points does not exist or is not supported

I'm new to python and can't figure out the error.

Here is the code in it's entirety with error message at the end:

>>> import arcpy, os, random
...
...
... arcpy.env.overwriteOutput = 1
...
...
... outws = r"C:\Users\Leo\GIS\e53f4ad724884ee8a0c033396db0c4f4.gdb"
...  # Where the output feature class and table will go. This assumes a file geodatabase
...
...
... polygon = r"C:\Users\Leo\GIS\e53f4ad724884ee8a0c033396db0c4f4.gdb\Humuula" # The study area polygon (Note this is in a feature dataset)
... transect_distance = 50 # The transect distance
... n_lines = 20 # How many transects
...
... # Create random points offset from study area boundary by X distance
... arcpy.Buffer_analysis(polygon, "in_memory/buffer", -transect_distance) # negative buffer study area to get correct offset
... arcpy.CreateRandomPoints_management("in_memory", "rand_points", "in_memory/buffer", "", n_lines)
...
... # Add fields x, y, distance, and bearing
... arcpy.AddField_management("in_memory/rand_points", "x", "DOUBLE")
... arcpy.AddField_management("in_memory/rand_points", "y", "DOUBLE")
... arcpy.AddField_management("in_memory/rand_points", "distance", "FLOAT")
... arcpy.AddField_management("in_memory/rand_points", "bearing", "FLOAT")
...
... # Run cursor to update attribute table with pertinent data for bearing distance tool
... with arcpy.da.UpdateCursor("in_memory/rand_points", ["SHAPE@XY", "x", "y", "distance", "bearing"]) as cursor:
...     for row in cursor:
...         row[1] = row[0][0]
...         row[2] = row[0][1]
...         row[3] = transect_distance
...         row[4] = random.randint(1,360)
...         cursor.updateRow(row)
...
... # Create a table to feed to Bearing Distance to line tool
... arcpy.TableToTable_conversion("in_memory/rand_points",outws,"out_table")
...
... # Generate the transects
... arcpy.BearingDistanceToLine_management (os.path.join(outws, "out_table"), os.path.join(outws, "transects"), x_field = 'x', y_field = 'y', distance_field = 'distance', bearing_field = 'bearing', spatial_reference = "in_memory/rand_points")
...
... # Clean up
... arcpy.Delete_management(os.path.join(outws, "out_table"))
...
... print "Processing complete."
...
Runtime error  Traceback (most recent call last):   File "<string>", line 20, in <module>   File "c:\program files (x86)\arcgis\desktop10.6\arcpy\arcpy\management.py", line 3435, in AddField     raise e ExecuteError: ERROR 000732: Input Table: Dataset in_memory/rand_points does not exist or is not supported
>>>


texts: How to write route with measure to PostGIS with FME?

texts:
I have calibrated route in file geodatabase (ArcGIS). I have line coordinate (kilometre) in the start and the end point.
I try export this route with M-value to PostGIS in FME.
But in result I have line without M-value.
Do you know how it works?


texts: Importing ESRI:102091 Monte Mario reference system

texts:
I am trying to import a dataset generated by my local council (Turin, Italy).

The data appears on the map but it's slightly shifted and it doesn't match the Open Street map layer that CartoDB uses as a default.

Is there any way I can easily convert all my datasets to match CartoDB standards? By opening the .prj file I have it looks like I am using Monte Mario reference system.. This is what is says:

PROJCS['Monte_Mario_Italy_1',
    GEOGCS['GCS_Monte_Mario',
        DATUM['D_Monte_Mario',
            SPHEROID['International_1924', 6378388.0, 297.0]],
        PRIMEM['Greenwich', 0.0],
        UNIT['Degree', 0.0174532925199433]],
    PROJECTION['Transverse_Mercator'],
    PARAMETER['False_Easting', 1500000.0],
    PARAMETER['False_Northing', 0.0],
    PARAMETER['Central_Meridian', 9.0],
    PARAMETER['Scale_Factor', 0.9996],
    PARAMETER['Latitude_Of_Origin', 0.0],
    UNIT['Meter', 1.0],
    AUTHORITY['EPSG', 3003]]


texts:
In a point vector layer, how to compute area for 4 defined ranges of values of one attribute?
On the example below, I want the total area for each of the 4 colours.


texts: Error while importing networkx module in QGIS 2.18.16

texts:
I am trying to import networkx module in QGIS 2.18.16 but getting the error message. Any suggestions?

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python\qgis\utils.py", line 607, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\networkx\__init__.py", line 74, in <module>
    from networkx import release
ImportError: cannot import name release


texts: Geographic scale of model and covariate significance using ArcGIS Spatial Analyst and R?

texts:
A few months back I created a spatial logistic regression model of terrestrial skunk rabies in Arizona/Colorado/New Mexico/Utah. A link to the project can be found here (https://docs.wixstatic.com/ugd/0a0a58_4a5a522e0ee944e7a186e8d1f106010d.pdf)

I'm attempting to run the model for Colorado only. Aside from only modeling for Colorado the changes to the model include:

A higher sampling ratio. 3:1 controls/cases
More sample points 578 positive specimens
More years of sampling. 2008 - 2017
More years of independent variables averaged. (e.g. monthly surface temperature averaged 2008-2017 vs 2013-2017)
reduction in the # of rabies positive species (there are fewer species in CO positive for rabies than in the four states)
changing from the range of species to the modeled habitat of a species based on USGS Gap View

The results for Colorado are very similar to the Colorado results in the Four Corners model. The same non-autocovariate variables seem to be significant, However the estimates as well as predicted risk are infinitesimally smaller:

I also tried standardizing my variables given the wide variety of scales. The results were the same as using non-standardized variables.

What is going on? My only hypotheses are that the slight changes in the variable definitions altered the results.

Also that the heterogeneity of the landscape in four states maybe teases out more differences than just in one state?

E.g. You don't find rabid skunks in the barren desert of Utah compared to prairie of CO, but you can find rabid skunks in the prairie steppe of Colorado and the scrubland of Western Slope.

I used Spatial Analyst for some map algebra and cell statistics functions and multi-values to points. The first go around I used ArcGIS/QGIS/R. This go-around just ArcGIS and R. – BenW 33 mins ago


texts:
I have been using the same code for my field calculator for the last 7 years.
However 2 days ago it is giving a strange result.
The code is for changing a String number to Text.
1000 into 1 + 000 or 3000 into 3 + 000 or 5230 into 5 + 230
But now it makes a code 1 + 1000 or 3 + 1000.
Very Strange. See attached image.
INT( [ET_STATION] /1000) & " + " & ROUND(((([ET_STATION] /1000) - INT( [ET_STATION] /1000))*1000),0)

I can not work out why it is doing this.


texts: Seeking Esri tools to design geodatabase?

texts:
There is a confusing multitude of tools written by Esri and others (some supported, some unsupported) for designing and diagramming a geodatabase.

Here is an attempt at creating a definitive list of where to find them.

Related to What are convenient uml tools to create geodatabase models?


texts: pg_ksp is extremely memory intensive for k>1

texts:
I am using pg_ksp (from the pg_routing extension for postgis) on a subset of the OpenStreetMap database with 400.000 nodes, if I set k=1 to find the best path the query takes about a second and around 100 MB of RAM

SELECT * FROM pgr_ksp('SELECT gid as id, source, target, cost FROM ways',12,7,1)

If I set k=2 or greater the ram usage skyrockets to 16 GB crashing my pc before even returning any result.

SELECT * FROM pgr_ksp('SELECT gid as id, source, target, cost FROM ways',12,7,2)

Am I using the command pgr_ksp incorrectly or is this drastic difference between k=1 and k=2 expected (if so why?) ?


texts: Foreach loop gives error message: task 1 failed - "cannot use this function"

texts:
I have maximum daily temperature data (raster format) from E-OBS for the period 1980-2019. I have reduced this to 1985-2014 and only kept the months April-October (30 years, 214 days). Now I want to calculate a 90th percentile rasterlayer for each day from 1st May until 30th September (153 days). So for each day calculate the 90th percentile across the 30 years and with a 15-day centered window.
I have called the rasterstack RP:
RP <- setZ(RP, as.Date(names(RP), format = "X%Y.%m.%d")) # Set the time dimension using the rasterlayer names
RP <- subset(RP, which(getZ(RP) >= '1985-01-01' & (getZ(RP) <= '2014-12-31'))) # Keep only 1985-2014
RP <- subset(RP, which(substr(getZ(RP),6,7) %in% c('04','05','06','07','08','09','10'))) # Keep only April-October

I have used a foreach loop, because the for loop took too much time.
P90 <- stack() # Create empty rasterstack for the 90th percentile layers

registerDoParallel(makeCluster(detectCores()-1))

P90 <- foreach (d = 1:153, .packages = "raster", .combine = addLayer, .init = P90, .inorder = TRUE) %dopar% {
  Raster_1 <- stack() # Create empty rasterstack to store all the layers needed for the calculation (30 years x 15 days = 450 layers)

  for (i in 0:29) { # Calculation is done for all 30 years

    for (j in -7:7) { # Moving window of 15 days is used, 7 days before and 7 days after the chosen day
      Raster_1 <- addLayer(Raster_1, RP[[30 + d + i*214 + j]])
    }
  }

  P90 <<- addLayer(P90, calc(x = Raster_1, fun = function(x) quantile(x, probs = c(0.90), na.rm = TRUE)), forceapply = TRUE) # 90th percentile calculation
}

stopCluster()

I am getting the following error:
Error in { : task 1 failed - "cannot use this function"

Could anyone please tell me what I am doing wrong?
The strange thing is also, using the exact same code on a different dataset (not from E-OBS, but from the ESGF data portal) the code works perfectly fine and I receive a P90 rasterstack with 153 layers.


texts: Using Coordinates how to find if a point feature exists at that location in QGIS

texts:
I have multiple coordinates stored in list collection.Using those coordinates i am trying to find if a point feature exists at particular location using python.

i tried the following code but not working

coordinates = []   #contains multiple coordinates

for feats in Layer.getFeatures():
    Geom = feats.geometry().asPoint()
    for cords in coordinates:
        if Geom ==  coords:    #from here am not able get it

i tried another method too

for feats in Layer.getFeatures():
        Geom = feats.geometry().asPoint()
         if Geom ==  coordinates[0]:
          #from here its not working

I have gone through all the references but none works

can anyone help me this ....


texts: Why does QGIS ignore letter or word spacing in exports?

texts:
My line label have letter spacing of 3px (Layer Properties -> Labels -> Text -> Spacing -> Letter). In print composer everything is drawn like I want it but after export to svg, pdf, or image the letter spacing is simply ignored; the label is drawn without any spacing.

Is that a known issue? Is it a bug? Or am I doing something wrong?


texts: Creating a square buffer around a shapely polygon

texts:
I have a list of polygons in a shapefile that I transform into a geopandas dataframe:
polygons = gdp.read_file(polygon_file)

then I would like to create the smallest possible square buffer (in lat-long coordinates) around each of them :
squares = polygons['geometry'].envelope

But of course as they are not circles I get rectangles. Is there an way to create squares instead?


texts: Label related records in ArcMap from enterprise geodatabase

texts:
Two questions related to labeling 1:M related records in ArcGIS 10.2.

I have successfully built an Advanced Label expression in Python to label records from a related table.  I am currently working from a local file geodatabase as a datasource.  I need to migrate my label expression to work with an enterprise geodatabase.  Result of the label expression code should be as follows:

 FacilityID  (data from parent table)
 RatedKVA    (data from parent table)
 EquipID1    (data from related table)
 EquipID2    (data from related table - may not exist)
 EqiupID3    (data from related table - may not exist)

Code:

def FindLabel( [GlobalID], [FACILITYID] , [RatedKVA] ):
   strWhereClause = '"TransformerGlobalID" = \'{0}\''.format([GlobalID])
   strpTable = "C:\GIS\ArcFMViewer\Data\ElectricArcFMViewer.gdb\TRANSFORMERUNIT"
   cursor = arcpy.da.SearchCursor(strpTable, "EquipID", strWhereClause)
   result = [FACILITYID] + "\n" + [RatedKVA] + "\n"
   for row in cursor:
        strLabel = str(row[0])
        result += strLabel + "\n"
   return result.rstrip()

Question 1:  How do I point the code to find the object table in the SQL Server based geodatabase and not the local?

Question 2:  This code works perfectly if there is only one EquipID related record.  If there are two or three related EquipID records the feature fails to label.  No error or "!", just no label at all.  Code will label all related records if I remove the FacilityID and RatedKVA arguments (result = "" in code).  I don't understand why this occurs.

Note:  I do have a version of this working in VBScript as well if that makes a difference for the data connection to the enterprise geodatabase.

Thanks!


texts:
The following script is suppose to do the following, similar to what was done here:
Renaming field using ArcPy?.

Create a fieldlist.
Read thru the fieldlist and create a new field named "OLD_" + field.name.
Copy the values in field to new field.

import arcpy, os

intable = arcpy.GetParameter(0)

fields = arcpy.ListFields(intable)

try:
    for field in fields:
        if field.name == "OBJECTID" or field.name == "Shape" or field.name == "Shape_Length":
            pass
        else:
            field_name = field.aliasName
            old_field = field_name + "OLD_"
            field_precision = field.precision
            field_scale = field.scale
            field_length = field.length
            field_type = field.type

            arcpy.AddField_management(intable, old_field, field_type, field_precision, field_scale, field_length)

            arcpy.CalculateField_management(intable, old_field, "!"+field+"!")
except:
    print arcpy.GetMessages()

del intable, fields, field

Two problems:

The script stops upon reaching the CalculateField_management code, which is one iteration, but there are approximately 50 more fields in the list that are ignored.
The newly create field is empty, the values are not copied across.

I have tried everything and followed the example given in the link above, but nothing has fixed these two problems.


texts:
I need to extract the acres from the legal description.  I have tried
"(!Legal!.split(" AC")[-1])" but it gave an error. I am using ArcGIS 10.2 using python in the field calculator. I realized why my scrip wouldn't work but can't quite figure it out. Any thoughts?


texts: Python with ArcCatalog for Table or Geography view?

texts:
Is there a way to automate the preview tab in Arc Catalog using Python?  Say if I wanted to preview the geography of a feature class where I have the path and just don't really want to connect to the folder or database, is this possible?

This preview would access the preview tab in ArcCatalog for desktop. Since the application has to be open, I was wondering if there is a way to automate these workflows, kind of like arcpy.mapping.


texts: How to display a map from geoserver on a mobile device

texts:
I am attempting to display a map from geoserver on mobile device, for example an Android Smartphone.

I have already set my map to geoserver via localhost, but I really don't know how to call the map with my mobile device.

My friend told me to use wifi from my computer to transfer the map to my mobile device, but I am unsure how to do this

Can anyone help me?

Thank you


texts: Mapbasic code runs but no output is generated

texts:
My code (from previous questions here) to generate a list runs but there is no output...

Include "MapBasic.def"

Declare Sub Main

Sub Main
Dim path_to_temp_tables As String
path_to_temp_tables = ""

'Run the Dos Command
Run program "Cmd.exe /c dir """+path_to_temp_tables+"*.tab"" /b /w  > """+path_to_temp_tables+"List.txt"""

End Sub

Also even if I run the cmd manually and get the List.txt file I get a file not found error on running the code

    Include "MapBasic.def"

Declare Sub Main
Declare Sub ReadTextFileToArray(ByVal txtFilePath as String, myArray() as String)

Sub Main()
Dim myArray() as String    '// create an array to store the table paths
Dim tabName, tabPath, txtFile as String
Dim i as Integer

'// test file
txtFile = "List.txt"

'// create your list of paths text file... then:

Call ReadTextFileToArray(txtFile, myArray) '// populate your array with the table paths from the text file

For i = 1 to UBound(myArray)
    If right$(myArray(i), 3) = "tab" then   '// check that this is a tab file path
        tabPath = myArray(i)    '// get path from array
        Open table tabPath      '// open table
        tabName = TableInfo(0, TAB_INFO_NAME)   '// get table name
        Alter table tabName(drop igds_class,igds_color,igds_graph,igds_style,igds_weigh add elevation_text Char(10) order elevation_text,elevation,contour_le,tile_name,contour_type)   '// alter table
        Update tabName Set elevation_text = elevation+"m"
        Pack table tabName  Graphic Data    '// pack table
    End if
Next    '// go to next element in array

End Sub

Sub ReadTextFileToArray(ByVal txtFilePath as String, myArray() as String)

Dim i as Integer

    i = 1

    Open file txtFilePath for input as #1   '// open text file for input (to read) as #1
    Do Until EOF(1)             '// do until the end of file #1 is reached
        Redim myArray(i)        '// resize array to i
        Input #1, myArray(i)    '// read value from text file
        i = i + 1               '// increment i
    Loop                        '// return to Do Until...

End Sub


texts: Filtering GeoJSON by properties time value

texts:
I have a GeoJSON with weather data from several weather stations. The problem is that each station is listed 3 times, because the GeoJSON contains data from 3 different readings for each station: 3 hour ago reading, 2 hour ago reading and 1 hour ago reading. The url where I get this GeoJSON from, lists data by the -3h, -2h, -1h sequence as shown in the picture, and as you can see, the same station is listed 3 times according to the hour of the readings.

Here is the main part of the script, where I get temperature:
<script>
  map.on('load', function () {
    map.addSource('points', {
      'type': 'geojson',
      'data': 'https://api.ipma.pt/open-data/observation/meteorology/stations/obs-surface.geojson',
    });
    map.addLayer({
      'id': 'Temp (ºC)',
      'type': 'symbol',
      'source': 'points',
      'layout': {
        "visibility": "none",
        'text-field': ['get', 'temperatura'],
        'text-font': ['Open Sans Semibold', 'Arial Unicode MS Bold'],
        'text-offset': [0, 0],
        'text-anchor': 'top',
        "text-size": 15
      });

    ...
</script>

I would like to filter (ignore) older data and just get the -1h weather data.
I have a very little knowledge of JS and I have tried to adapt one filter option I found here in GIS, but it didn't work for me.
 var yourLayer = L.geoJson(yourJson, {filter: yourFilter}).addTo(map);
 function yourFilter(feature) {
   // 1 hour ago expressed in milliseconds
  var lasthour = new Date().getTime() - (1 * 60 * 60 * 1000);
   // filter logic
  if (feature.properties.time > lasthour) return true;
  }

Is there any way to filter just the -1h option of my GeoJSON and display those values?


texts: Is there a way to programatically get the FeatureClass's alias name?

texts:
I'd like to get the alias name of a FeatureClass, but I can't find an interface  exposing that field.

UPDATE:

using IClassSchemaEdit, I'm able to specify an alias name, but I'm still unable to retreive it.


texts: What is ArcGIS 10 definition query to select max value from table?

texts:
I want to select max date from may layer by below query in my Web GIS but I cannot.

(SELECT MAX( GregorianDate ) FROM DrillingProgress WHERE Crew = 'c-Chabock')


texts: I have Django app that handles an uploaded shapefile and extracts the geom using shp2pgsql. As the Django app and the PostgreSQL(PostGIS) are in different docker containers, I cannot call shp2pgsql directly from Django container. Is there a way to install shp2pgsql without installing postgresql in the Django container?


texts: How to get the value of specific pixels in Google Earth Engine

texts:
I want to extract the value of some pixels.
I have already select the pixels that I want to extract the value with this code:
         var pixel_snowcover = glacierfilled_M1.select('albedofill1').map(function(image){
         return image.set('snowcover' ,image
                   .updateMask(image.gte(0.6))
                   .reduceRegion({ reducer: ee.Reducer.count(), geometry: glacier, maxPixels: 1e12})
                    .get('albedofill1'))
          } )
         print(pixel_snowcover, 'glacier snow cover set at 0.6')

I add to this collection a band named 'elevation' and I want to get the value of elevation for those pixels.
Thanks for your help.


texts: How to install osm2pgrouting on Windows?

texts:
I've only done networking using ArcGIS, but am now trying to set up with OpenSource software in a Windows environment.  I have PostGIS installed and found a Windows binary for pgRouting (although I'm not clear on how to install this).  I now need to get OSM data ready for pgRouting and osm2pgrouting seems to be the way to go.  However, I can only find instructions for installation on Ubuntu.  Can anybody help me with an idiot's guide to compiling and installing osm2pgrouting on windows please?

Many thanks!


texts: Speed of reading a GeoTIFF using geotiff.js

texts:
I am have created my own API to return elevations from GeoTIFF files using geotiff.js (https://geotiffjs.github.io/), but it is slow compared to public APIs.  For example, table below shows the tests I ran on my API showing that for 250 data points I can return elevations in 1250ms (ish), while a call to elevation-api.io (limited to 250 data points) with the same data is returning in just 200ms.

┌─────────┬─────────┬─────────┬─────────┬────────────────┐
│ (index) │ nPoints │ nPixels │ nImages │      time      │ elevation-api.io
├─────────┼─────────┼─────────┼─────────┼────────────────┤
│    0    │   250   │   70    │    1    │ '00:00:01:281' │    204ms
└─────────┴─────────┴─────────┴─────────┴────────────────┘

When I scale this up, 2000 data points takes around 30s - too long for the intended application.

When I spew out approx elapse timings for all the functions for a single data point, I get:

00:00:00:005 start
00:00:00:010 getPixelPosition
00:00:00:016 getFileName
00:00:00:018 getImage
00:00:00:027 finished getImage
00:00:00:031 readPixels  <-- readPixels takes the bulk of the time
00:00:00:078 finished readPixels
00:00:00:078 finished

So the bulk of the time is spend reading the GeoTIFF - about 45ms.  Is this reasonable?  Here is the code for readPixels:

const GeoTIFF = require('geotiff');

function readPixels(img, px, py, id, boo) {

  return new Promise( (rs, rj) => {

    // check if we have the required data in the CACHE already; if not load it
    if (id in CACHE.pixels) {
      promise = Promise.resolve( CACHE.pixels[id] )
    } else {
      const shift = boo ? 2 : 1;
      promise = img.readRasters({ window: [px, py, px + shift, py + shift] });  // this line is the problem
    }

    // when thats done, save result to CACHE and return result
    promise.then( (result) => {
      CACHE.pixels[id] = result;
      rs(result);
    })

  })

}

My questions: Am I using geotiff.js in the best way?  Are there alternative algorthims that are faster?

Data being read is from: https://lpdaac.usgs.gov/products/astgtmv003/

See also linked question here: Improving speed of geotiff.js algorithm on large number of points


texts:
I have created a Mapbox custom style map and want to use it in Leaflet. All the examples on this site and the web refer to a map ID that doesn't seem to be used anymore.

For example:

https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}

Mapbox seems to currently only provide a "Leaflet URL".
For example:

https://api.mapbox.com/styles/v1/myusername/cj7v3234324/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoiYWltZWVfvevervCIsImEiOiJjajdrvevrjQwNGx4MndudjVqbGd1ZG1xIn0.5j60jT7XVIkSKpw7vdvsdJXA

This URL includes what looks like a style reference and an access token but no .png.

I cannot make this work in any way with Leaflet L.tilelayer. I have tried various ways of editing the URL.


texts: want to make all poygons have z values as 0

texts:
I have polygons which stores different z values as vertices in Arcgis. I want that all z values must be equal to zero.
How can I make this possible??


texts: How to use leaflet-search for a geojson feature property?

texts:
I'm trying to use the leaflet-search plugin to search for a specific geojson property (i.e. 'Name'). The trick part of this is I want to perform a search on a Geojson file thats loaded in via the FileLayerLoad plugin for leaflet.

So far my code is:

 var map = L.map('map').setView([43.7001100, -79.4163000], 17);
    mapLink = 'OpenStreetMap';
    mapquestLink = 'MapQuest';
    mapquestPic = '';

    //Main map layer:
    L.tileLayer(
        'http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
        attribution: '&copy; '+mapLink+'. Tiles courtesy of '+mapquestLink+mapquestPic,
        maxZoom: 18,
        subdomains: '1234',
        }).addTo(map);

    var style = {color: "green", opacity: 1.0, fillOpacity: .5, weight: 2, clickable: true ,smoothFactor:10,noClip:true,lineCap:"round"};
    L.Control.FileLayerLoad.LABEL = '';

    //Loads external geojson file:
     var control = new L.Control.fileLayerLoad({
        fileSizeLimit: 5000,
        fitBounds: true, //MOVE THE CENTER OF THE SCREEN
        layerOptions: {style: style,
        onEachFeature: function(feature, layer) {
            layer.bindPopup( "Name: " + feature.properties.Name );
        }
        }
    }).addTo(map);

    //Search within specified layer:
    map.addControl(L.control.search({layer: control, propertyName: 'Name', circleLocation:true}));

The problem in the above code is in the L.control.search({layer:control... line, it calls the 'control' variable, which interprets this as a new fileLayerLoad call. I'm wondering how do I search within the layer thats already loaded ?


texts: Bring KML via localhost url into ESRI js app also hosted locally

texts:
I have brought over one of the demos ESRI javascript apps and hosted that on my local IIS instance.

I also have a folder I have turned into an application via IIS, so I have the following:

The file at location http://localhost/TEST_KML_FILES/Volcanoes_of_the_World.kmz is fine, I can put it into a browser fine and it downloads, I can also load it into Googe Earth so the kml is good.

It is basically a copy of the results of this URL: http://sites.google.com/site/geined13/tours/Volcanoes_of_the_World.kmz?attredirects=0&d=1

My relevant code is as follows:

var kmlUrl = "http://localhost/TEST_KML_FILES/Volcanoes_of_the_World.kmz";

var kml = new KMLLayer(kmlUrl);

map.addLayer(kml);

kml.on("load", function() {
  domStyle.set("loading", "display", "none");
});

The layer coming from the URL http://sites.google.com/site/geined13/tours/Volcanoes_of_the_World.kmz?attredirects=0&d=1 works fine when used as follows:

var volcanoesOfTheWorldKmlUrl = "http://sites.google.com/site/geined13/tours/Volcanoes_of_the_World.kmz?attredirects=0&d=1";
var volcanoesOfTheWorldKml = new KMLLayer(volcanoesOfTheWorldKmlUrl);
map.addLayer(volcanoesOfTheWorldKml);

So I am guessing that to avoid cross site attacks it's like the Silverlight ESRI control, and you have to use a proxy (I have the same link http://localhost/TEST_KML_FILES/Volcanoes_of_the_World.kmz working fine in my Silverlight sandbox app, but using a proxy) or is it wrong?

EDIT :: Sorry my original post was a last minute rush job before I finished work last night.
The basic problem is that it cannot see the kml file:

The text is : dojo.io.script.jsonp_dojoIoScript1._jsonpCallback({"error":{"code":400,"message":"File not found. Wrong url or out of memory.","details":[]}});

The same url works fine just via a browser:
http://localhost/TEST_KML_FILES/Volcanoes_of_the_World.kmz


texts: Is there an easier way to refresh a joined CSV?

texts:
I'm working with data that gets updated sporadically.  Essentially, I have a CSV which defines which postal codes belong to certain sales reps, and these postal codes might shift around.

I made multiple layers that represent different role types, that way I can switch on the layer easily.

The problem is, that if something changes.. I have to recreate the CSV Layers all over again, and then rejoin the CSV to the Shapefile layer, and then reclassify the colorings for all the sales reps.

I wish I could just hit "refresh" on the source data!  I notice in the properties it's still looking at the original file, why can't it simply reload it?

UPDATE:  I've discovered that if I set the file to "Watch" it does actually update the CSV!  However, the "Join" that I did on the Shapefile is out of date and it seems I need to delete it and manually rejoin it?  That seems unnecessary.  Any ideas?


texts:
I managed to successfully import the spatial features from the MSSQL into QGIS and would like to know if the following is possible and how would I go about doing it:

Edit the attributes (without first saving it as a shapefile) in order to make changes to the database, and
Reproject the SQL spatial features and export back into the database.


texts: Converting Personal geodatabase to GML format using ArcGIS Desktop?

texts:
I am working on ArcGIS 10.3.

Does anyone know how to convert a personal geodatabase into a GML format?


texts:
Does anybody know of a SheetSet-type functionality in QGIS (similar to Autocad), i.e. a function capable of exporting several different QGIS layouts and merging them to 1 file (pdf)?
There is of course the Atlas generation tool, but that runs on features of a specified layer, not on layouts. And the layout's 'Add item/page from Template' tool is also not an ideal solution, since working on complicated models with many (raster) layers means having 10+ huge (A1 or A0) pages in a single layout is hardly practical to scroll or work with.


texts: CORS Policy issue with ESRI WFS Services

texts:
I am getting the below CORS policy issue when I am trying to load a simple WFS Feature Service using Esri/WFSLayer using https://js.arcgis.com/3.27/

Access to XMLHttpRequest at
'https://ons-inspire.esriuk.com/arcgis/services/Other_Boundaries/National_Parks_December_2018_Boundaries_GB_BFC/MapServer/WFSServer'
from origin test.html:1'http://localhost:8080' has been blocked by
CORS policy: Response to preflight request doesn't pass access control
check: No 'Access-Control-Allow-Origin' header is present on the
requested resource.

Please find below the source code I'm using to load the map.

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
  <title>WFS Layer</title>
  <link rel="stylesheet" href="https://js.arcgis.com/3.34/esri/css/esri.css">

When I analyzed the network calls, the initial GET request is successful, but the subsequent preflight request is failing due to the CORS issue. Is this due to the namespace server reference points to different servers? Could anyone please help us with this issue?
Note:
For local testing, I am disabling the WebSecurity in chrome and it worked, but wanted to get a permanent solution for this issue.
The above code is referred to from link.
The code referred from link also didn't work as the service URL seems to be broken.


texts:
So this is a data acquisition questions:

I have data retrieved from OSM, QGIS2.0.  It's a region of Qatar.  Of the 13 thousand or so roads, I only pulled in about 1 thousand road names.  The roads do have names, I've researched it.  And the names are necessary for a network dataset that will use the street names for routing purposes.

This is just the beginning to my problem, but I'll only ask this question here...
I don't want to bombard this post with multiple inquiries.

Is there a way, or a plugin, or a data source somewhere I do not know about that will let me "append" road names to my current data I already have?  I have already manipulated what I have so I really don't want to hunt down another source unless absolutely necessary.

Thanks,
Logan


texts: Census Data Mapper - what tool they used to do it?

texts:
The Census Data Mapper is a web mapping application of the Census Bureau used to create instant web maps out of the Census data which are stored in the Census databases.

I was wondering what tools are they using to make that service? For example, what mapping server, what client, and so on.

Here is the link to the Data Mapper: http://datamapper.geo.census.gov/map.html


texts: QGIS Error Loading Shapefile with Database Manager

texts:
I am a new QGIS user and have downloaded version 2.18.2 onto my PC (Windows 10). I'm trying to import a shapefile (using Database Manager) into a spatialite database that I created.

However, I keep getting the following error:

  Error 8 loading of the layer "layer name" failed

Can anyone help me understand what the problem might be? I can add the shapefile to QGIS desktop as a layer without any trouble.


texts: Gdal_translate raster from *.ecw to have arguement [-of GeoTiff] but saving the output as *.jpg

texts:
I am saving a raster from Qgis using gdal_translate lib.
I put in the argument "-of GeoTiff" but the output has been defined as suffix = *.jpg

It does not throw any errors.. Is the final result a band-layered hybrid of a compressed image?


texts: Can Survey123 have a select_one create another respective select_one that repeats

texts:
Per boss's request, I need to make a survey that is broken into 3 different Test Well sections, where each Test Well has an associating list of Monitoring Wells. Basically, field tech will choose the Test Well 1 and fill out a few sections of different field measurements. After they fill out that info, they need to go to each Monitoring Well associated with Test Well 1 and fill out more field measurements. So which Test Well they are working on determines what Monitoring Wells will appear in the survey.
Originally, I thought about just creating 3 separate groups within one survey (Test Well 1, Test Well 2, Test Well 3) and then within each group will be its respective Monitoring Well options, but I am worried about how that may export to AGOL and Excel (I wouldn't want one long, continuous row of data each time the survey is submitted, I would want the excel sheet breaking it up into 3 separate rows or sheets.
I was trying to figure out a way to use pulldata() or begin repeat or if, then statements to set this survey up, but I haven't been able to figure out how to have a select_one TestWell lead to select_one Monitoring Well respective to that Test Well and not all 3 Test Wells.
Is the best way just to do 3 separate surveys and then do begin repeat with pulldata() from an excel file?


texts:
I created very high dense point cloud of some forest plots using terrestrial laser scanner. Then removed points above 1.3 meter to see the coarse woody debris (Fallen dead trees). Attached is the shaded DEM of the sample plot with coarse woody debris inside red ellipse.

Plot also consists of small trees, part of the stems of trees below 1.3 meter, ground and small rocks. From the image woody debris is discernible with its continuous shape.
I am looking for the tool to extract woody debris from this image. Arcmap, Envi or any open source software would be perfect, and I also have basic Python knowledge if coding is helpful.


texts: How to format and use historical traffic data and to create a traffic enabled network?

texts: I have speed factors for road segments collected at time intervals of one hour daily for a whole week. But I dont know how to format the data so that I can relate it with my digitised road segments in ArcGIS and later create a traffic enabled network.


texts: I have many points (the points have elevation) I want to remove some points that are too close together

texts:
How can I select several points in a buffer to just each buffer them and among them to choose a point that has the highest elevation using ArcMap?

Each point can be in several buffer and as each buffer can have multiple points.

I have many points that has elevation and I want to remove some points that are too close together. WhatI would like to keep a point that has more elevation among them. what do I have to do?


texts: OpenLayers 3 - only call code on geolocation in IE11 if user allows it

texts:
I have a geolocation control in OpenLayers 3. The problem is that when clicked in IE11, the user is prompted for permission to geolocate. I want to pan to the geolocation position if and after that permission is granted. I think what happens with my code now is that it tries to pan before permission has been granted:

geolocation.setTracking(true);
map.getView().setCenter(geolocation.getPosition());

How can I do this?


texts: Upload Dataset failed with CartoDB in Ubuntu 12.04 VM

texts:
I have tried installing CartoDB in Ubuntu 14.04 LTS first on which I could not import datasets. I have raised the question on this viz., Import Files failed with cartoDB installed in Ubuntu 14.04 LTS. But could not find a solution.

As an alternative, I have tried installing the CartoDB following the instructions from the manual "http://cartodb.readthedocs.io/en/latest/install.html" in Ubuntu 12.04 VM. But again when I try to import any file (CSV or shapefile in zip format), I am getting same import error which is decribed as follows.

Error Code : 2001

Error Description : Unable to load data

Imports Log:

{"user":"development","state":"pending","tables":0,"imported_tables":0,"failed_tables":0,"error_code":null,"import_timestamp":"2018-01-30T21:13:16-08:00","queue_server":"ubuntu","database_host":"localhost","service_name":"public_url","data_type":"file","is_sync_import":false,"import_time":0.001509,"file_stats":{},"resque_ppid":null,"user_timeout":13981,"error_source":null,"id":"0a0952bb-b387-48f5-8fbb-e7b5c5be04c5","total_size":0,"cartodbfy_time":0.0,"import_throughput":0.0,"cartodbfy_throughtput":null,"cartodbfy_import_ratio":0.0,"extra_options":{},"retrieved_items":0}
{"user":"development","state":"failure","tables":1,"imported_tables":0,"failed_tables":1,"error_code":2001,"import_timestamp":"2018-01-30T21:13:18-08:00","queue_server":"ubuntu","database_host":"localhost","service_name":"public_url","data_type":"file","is_sync_import":false,"import_time":2.67401697,"file_stats":[{"filename":"sample_csv.csv","type":".csv","size":201,"file_rows":null,"imported_rows":null,"error_percent":null,"fallback_executed":null}],"resque_ppid":9926,"user_timeout":13981,"error_source":"user","id":"0a0952bb-b387-48f5-8fbb-e7b5c5be04c5","total_size":201,"cartodbfy_time":0.0,"import_throughput":75.16781017287262,"cartodbfy_throughtput":null,"cartodbfy_import_ratio":0.0,"extra_options":{},"retrieved_items":0}

CSV File to Import:

lon,lat
-50.09765625,38.95940879245421
-50.09765625,38.95940879245421
-50.09765625,38.95940879245421
-50.09765625,38.95940879245421
-50.09765625,38.95940879245421
-50.09765625,38.95940879245421

Also, I am getting a warning like:

  "ignoring statsd, because there were a error loading the config"

while starting the server. Do we need to perform any additional configuration for "app_config.yml" or "database.yml" in cartodb?


texts: I am using the print layout on QGIS 3.10 and I am trying to add a scalebar to my map. The CRS I am using is ESRI:54030 - World_Robinson. The map's scale is on 164176648. When I set the scalebar to kilometers all that shows is 0.  I had this issue before on another project when using ESRI:2163 - US National Atlas Equal Area. I found that switching the map away from the default ESRI:4326 on the main QGIS window caused this same issue and it was resolved when I switched the CRS only on the print layout. However, this isn't working for me this time. Does anyone know how to resolve this?


texts: Using ArcObjects, how to convert an Access table into a proper geodatabase table?

texts:
I have inherited an ArcGIS application that creates a number of access database tables.  I'd like to use ArcObjects to convert them to proper geodatabase tables, which I understand to mean simply adding on an ObjectID.

I found an example showing how to do this with Python but couldn't locate one for C#.  Could someone point me in that direction, or explain to me what needs to be done?


texts: Creating custom map projection based on mathematical formula

texts:
For example, the formula for the Mercator projection is as follows:

Suppose I want to create a map using my OWN formula.
What are the tools I can use to achieve this?
I seek a solution using Python, such as the GeoPandas library or cartopy, but I do not mind if I need to use something else.
Is it possible to create it with a proj4 string? (because if so then I can add that to GeoPandas).


texts: Statistics of slope in individual polygons (asset) on Google Earth Engine

texts:
I have a single shapefile with multiple polygons, uploaded to GEE as an asset. I am trying to find the mean slope (using SRTM elevation imagery) in each of the polygons, on GEE. However, I get only one mean slope value for all the polygons.

My code is as below. Do I have to use .filter() when importing the asset? If so, which one and how do I indicate the regions to be the different polygons? Or do I change the parameter for the Geometry: when calculating mean slope?

// Load the SRTM image.
 var srtm = ee.Image('USGS/SRTMGL1_003'); //Calling SRTM 30m images

// Apply slope algorithm to an image.
var slope = ee.Terrain.slope(srtm);

//Scale and Projection
var scale = srtm.projection().nominalScale();
print('SRTM scale in meters', scale); //see Console tab in the right section
of screen- 30.92208 m
print('Projection, crs, and crs_transform:', srtm.projection()); //EPSG:4326
is WGS 1984, look at right section of screen in the Console tab

// Load polygon shp border
var x= ee.FeatureCollection('ID')
Map.addLayer(x)

//Displaying slope for country
var elevregion= srtm.clip (x);
var slopecountry= ee.Terrain.slope(elevregion); //Slope is in degrees
//var slopecountry_radians= slopecountry.divide(180).multiply(Math.PI)
//converting to radians 'divide the slope by 180, multiply the result of
that by π
Map.addLayer(slopecountry); //to view

// Compute the mean elevation in the polygon.
var meanDict = slopecountry.reduceRegion({
reducer: ee.Reducer.mean(),
geometry: x,
scale: 30
});

// Get the mean from the dictionary and print it.
var mean = meanDict.get('slope');
print('Mean slope', mean);


texts:
How do I get utm data converted into wgs84 all within Python27?

Does anyone know how to import the QGIS Lyon 'reproject' tool I to Python27?

I have a Python script that writes utm Into a text file but I require it to write wgs84 lats and longs instead. All I need (I think) is a module that outputs lats and longs before getting written to the file.

I tried to install Proj and matplotlib and other suggested solutions I found online but the imports seem to fail. I need guidance how to do this successfully but that's for another question.

I have QGIS Lyon installed and I am familiar with reprojecting layers into wgs84 using the reproject tool built in. I know that it works and therefore there is something on my pc that does what I want to achieve. I am hoping that I'm able to simply import the module that is used in QGIS reproject tool.


texts: How to join Shapefile and Excel data without unique ID column?

texts:
I have one huge shapefile with lots of roads (polylines) along with various attributes and I have an Excel file containing some of these roads by three same attributes (road no., section no., length) - but no geometry.

I want to select this smaller group of roads from the big shapefile and save it as a new Shapefile. Note:  I don't have any unique index number or such for any particular piece of road: so for example road3 might consist of 100 pieces with road3 as road3 attribute and 1 to 100 as the section number. So the problem is that I don't want all the sections of every road, only specific sections - but if Ii JOIN by road no., then it joins ALL sections of that particular road. Joining by section no. is of course no better as there are plenty duplicate sections no. (for different roads naturally).

What do you think is the best way to accomplish this?

Is this finally the time I should start looking into "SQL/Spatialite for dummies"?

If possible, I'd like to survive with QGIS and M$ Office, but if necessary i can get my hands on arcgis and mapinfo at work.

Thanks!


texts: Shortest line for a bunch of points in postgis

texts:
I hava a very interessting problem, which I'm working on right now. I hava a dataset with a few points, and I'd like to know the shortest LINE to interconnect every point. No needs for routing etc. The result should be a sorted list with points or a linestring...

I'd realy appreciate your input, I have an idea about the concept but I don't know where to start. This nut is hard to crack. It's like a dijkstra-one-to-many problem, but without the routing, so should be easier and faster....

Thank you!
Martin

edit:


texts:
I need to load a raster file from the provided file path. I wish to use it further in the Raster Calculator.
I wrote a function which converts string (I assume it is a file path) to a raster object.

from qgis.core import QgsRasterLayer
from PyQt4.QtCore import QFileInfo
def StringToRaster(raster):
    # Check if string is provided
    if isinstance(raster,basestring):
        fileInfo = QFileInfo(raster)
        baseName = fileInfo.baseName()
        path = fileInfo.filePath()
        if (baseName and path):
            raster = QgsRasterLayer(path, baseName)
            if not raster.isValid():
                print "Layer failed to load!"
                return
        else:
            print "Unable to read basename and file path - Your string is probably invalid"
            return
    return raster

I have no idea why, but raster.isValid() always returns False.
When I take exactly the same path which I provided to my function, I am able to add this layer to QGIS from the interface (from the menu Layer --> Add layer ---> Add raster layer).

My layer is a Float32 GeoTIFF with one band only.


texts: Why aren't a layer's serviceProperties exposed if the data source is broken?

texts:
In ArcObjects you can get the service properties of a map layer by looking at its IWorkspaceName.ConnectionProperties property set, even if the layer is currently invalid due to a broken connection.

Why are these properties not exposed through arcpy.mapping's Layer.serviceProperties dictionary if the layer's data source is broken? Is this any different in 10.1 (I am using 10.0 SP5 at the moment)? Just tested at 10.1 SP1, it's the same story.

This ESRI forum post states that they are not exposed, but not the reason it was implemented this way or whether it is going to be improved.


texts: parse_address Error when using Street2 splitter '@'

texts:
I'm trying to use parse_address to parse client data and am finding that the split code "@" to tell it where to split address 1 and 2 gives erroneous results when used.  If used, the street number is not parsed and stays in the street name field.

Query without street2 spit (street number works as expected):

SELECT num, street, street2, city, zip, zipplus FROM parse_address('1 Devonshire Place ATTN:AR DEPT, Boston,MA 02109-1234') AS a;

Results:

 num |            street             | street2 |  city  |  zip  | zipplus
-----+-------------------------------+---------+--------+-------+---------
 1   | Devonshire Place ATTN:AR DEPT |         | Boston | 02109 | 1234

Query with split used to get street2:

SELECT num, street, street2, city, zip, zipplus FROM parse_address('1 Devonshire Place @ATTN:AR DEPT, Boston, MA 02109-1234') AS a;

Results:

     num |       street       |   street2    |  city  |  zip  | zipplus
-----+--------------------+--------------+--------+-------+---------
         | 1 Devonshire Place | ATTN:AR DEPT | Boston | 02109 | 1234

Note the '1' does not parse into the num field as expected, while the street2 is parsed correctly.

I found the '@' to be used to split referenced in the repo.  Is there an alternate manner to split the street2 and get num parsed?

VERSION INFO:

PostgreSQL 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0, 64-bit POSTGIS="2.4.3 r16312" PGSQL="100" GEOS="3.6.2-CAPI-1.10.2 4d2925d6" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.3, released 2017/11/20" LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.2.1" RASTER
(1 row)


texts: Reading CSV in loop stops at row that does not match?

texts:
I am trying to read a CSV then iterate through an sde to find matching features, their fields, and then print them.
There is a table in the list and I'm not able to skip over it and continue reading the CSV.
I get the "IOError: table 1 does not exist" and I only get the features that come before the table.

import arcpy
from arcpy import env
import sys
import os
import csv

with open('C:/Users/user/Desktop/features_to_look_for.csv', 'r') as t1:
    objectsinESRI = [r[0] for r in csv.reader(t1)]

env.workspace = "//conn/features@dev.sde"
fcs = arcpy.ListFeatureClasses('sometext.*')

for fcs in objectsinESRI:
    fieldList = arcpy.ListFields(fcs)
    for field in fieldList:
        print fcs + " " + ("{0}".format(field.name))

Sample CSV rows (can't seem to post a screenshot of the excel file)

feature 1
feature 2
feature 3
feature 4
table 1
feature 5
feature 6
feature 7
feature 8
feature 9

Result

feature 1
feature 2
feature 3
feature 4

Desired Result

feature 1
feature 2
feature 3
feature 4
feature 5
feature 6
feature 7
feature 8
feature 9


texts: Copying ArcSDE geodatabase to file geodatabase using ArcPy?

texts:
I would like to make an exact copy (domains, feature datasets, feature classes, etc.) of an SDE database to a file geodatabase.

I have tried several possibilities, including:

using the Copy (Data Management) process
creating a new GDB and manually copying each feature dataset from
the SDE
exporting an xml workspace document from the SDE and importing it
into the GDB

The Copy_management process does not seem like it would work for copying an SDE to a GDB, since the input and output data types must match.

The process of importing each feature dataset into a new GDB could probably be automated using Copy_management as well by iterating through each feature dataset, though it seems this could cause problems of an incomplete copy if there was an error with one of the processes.

Exporting and importing xml workspaces seems to work, though this process creates incredibly large files when the process is used on large geodatabases.

Is there a more straightforward way to copy the contents and schema of an SDE to a GDB than the ways mentioned, in a way that can be automated?

If not, are there any reasons that the above possibilities should not be used in this process?


texts: Summarizing one field using another as summary statistic using ArcPy?

texts:
I'm trying to replicate, using arcpy, the 'right-click - Summarize' function in ArcMap.
I want to specifically summarize column 'A' of my attribute table (this is a point layer), to get the count. But I also want to use column 'B' (area), and sum that for each category in A.

So far I've only found how to summarize A on it's own.

Any help?

This is the only related script I have found, but only does half the job:

def SumStats(shapeFile, fieldName):
sumDict = {}

with arcpy.da.SearchCursor(shapeFile,[fieldName]) as scurse:
    for row in scurse:
    if row[0] in sumDict:
        sumDict[row[0]] += 1
    else:
        sumDict[row[0]] = 1

tbl = arcpy.CreateTable_management("in_memory","MuchGIS")[0]

arcpy.AddField_management(tbl,"Item","TEXT")
arcpy.AddField_management(tbl,"Count","SHORT")

with arcpy.da.InsertCursor(tbl,["Item","Count"]) as icurse:
for k,v in sumDict.iteritems():
        icurse.insertRow((k,v,))


texts: How to insert a variable into a tool script

texts:
I am a bit new when it comes to Python programming.

I'm trying to run the GRASS r.sun plugin tool to calculate the global irradiance for my chosen area for the whole year. The problem is that r.sun calculates the irradiance for a day. The GRASS program isn't an option for me becouse it doesn't work properly on my computer.

So the solution that I am looking for is a script that puts every number from 1 to 365 into the tool and makes a .tif raster result with the number of the day in its name.
The numbers that have to change are in bold.

Basically this but in python:

https://grasswiki.osgeo.org/wiki/R.sun#Automation

Example of script taken from History:

  import processing

  dir(processing)

  elev_raster = "C:\Qgis_proj\data\DSM.tif"

  aspect_raster = "C:\Qgis_proj\pod\aspect.tif"

  slope_raster = "C:\Qgis_proj\pod\slope.tif"

  irradiance_raster = "C:\GRASS\results\glob_irr_1.tif"

  processing.runalg("grass7:r.sun",elev_raster, aspect_raster,
  slope_raster,None,None,None,None,None,None,1,0.5,0,1,False,False,"454999.5,457000.5,95999.5,98000.5",
  0,None,None,None,None, irradiance_raster)


texts: How to read XY, get raster value and then update field?

texts:
I've written a script to run through a point layer, using the SearchCursor in the data access module and then read the XY values.  Within the with statement, I then use GetCellValue to get the elevation values and print them.

What I'd like to do is go one step further and write the value to a field in the row.  Is there a way to do this?  I can use CalculateField, but that'll be slow as it'll have to use a query to limit itself to the current row.  I can also possibly use a list to write the values to and then run through the list and update the fields using the UpdateCursor, but I think that'll be slow too.

Is there a way to do this inside the with statement?

import arcpy

##arcpy.AddField_management('C:\Data\Surveyed.shp', 'Z', 'DOUBLE')

with arcpy.da.SearchCursor('C:\Data\Surveyed.shp', ['SHAPE@XY']) as cursor:
    for row in cursor:
        result = arcpy.GetCellValue_management('Database Connections\DC_SDEEBG_gisp.sde\SDEEBG.GIS.SRTM_DEM_NSWVICTAS_1SEC', str((row[0])[0]) + " " + str((row[0])[1]), "1")
        CellValue = float(result.getOutput(0))
        print CellValue


texts: Transfering height information from DEM to line feature to use in profile with ArcGIS Pro?

texts:
I am using ArcGIS Pro 2.4.

I want to make a height profile of a line segment. The line has no height information, so I want to transfer height information to the line from a dem.

How can this be done?


texts: GTA V coordinates transformation to WGS84

texts:
I'd like to use GTA V coordinates in leaflet to show some markers on the map.

How to do a transformation between the (unknown) coordinate system of GTA V to WGS84 (leaflet)?

I already tried to write a function for that. Sometimes the coordinates are correct but not always. I'm not sure what I did wrong. Is there a more simple way to achieve this? Perhaps with leaflet's Transformation system?

function convertCoords(x, y) {
    var game_1_x = 1972.606;     // random lng point (GTA)
    var game_1_y = 3817.044;     // random lat point (GTA)
    var map_1_lat = 80.751791;   // same lng point (WGS84)
    var map_1_lng = -121.717529; // same lat point (WGS84)

    var game_2_x = -1154.11;    // random lng point (GTA)
    var game_2_y = -2715.203;   // random lat point (GTA)
    var map_2_lat = 71.3602;    // same lng point (WGS84)
    var map_2_lng = -144.30542; // same lat point (WGS84)

    var rLat = map_1_lat + (y - game_1_y) * (map_1_lat - map_2_lat) / (game_1_y - game_2_y);
    var rLng = map_1_lng + (x - game_1_x) * (map_1_lng - map_2_lng) / (game_1_x - game_2_x);

    return L.latLng(rLat, rLng);
}

Here is a gridded map of GTA V: https://drive.google.com/file/d/0B-zvE86DVcv2MXhVSHZnc01QWm8/view


texts: Altering RoadClass Driving Directions for Walking Network in ArcGIS Network Analyst?

texts:
I'm using ArcGIS 10 Network Analyst Extension to try and incorporate their driving directions functionality into a walking network. I am wondering if there is any way to alter the RoadClass Values to be more suitable for a Walking Network. For example:

RoadClass Value: 3

Type of Road Class: Ramps

Example: Take ramp and go on US-59 N

Is there any way that I can modify or add a RoadClass value to be "Stairs" and instead of saying "Take ramp..." it says "Traverse stairs..." or "Elevators" saying "Use elevator"?


texts:
I wanted to check the cell size of a DEM I downloaded from http://bhuvan.nrsc.gov.in/bhuvan_links.php# cartosat cartodem version3.

I wanted to check its resolution and on opening layers properties, it showed 0.0002777778 as you can see in this picture. What size resolution does this mean, and why is it that it's not showing the resolution in meters?


texts:
I have SAR images of a region on the Moon in GeoTIFF format.
When opened in ArcMap, an image looks like:

With the metadata:

How can I geo-reference them to visualize properly?
I also have an Excel sheet with the lat/long info of all the pixels, can it be used ?

Update1:
I tried using the "project raster" for projecting it to GCS_Moon_2000 with following parameters:

But the following error is coming


texts: Are there any 90m DEMs out there for regions north of where the SRTM dataset ends? I looked at ASTER, but it seems to have a lot of unfilled voids, and it's important that the resolution matches the datasets I already have.


texts:
It seems quite simple thing to me, but I get an error.

map declaration

map = new OpenLayers.Map('map_element', {...
projection : _projObj.mercator,
displayProjection : _projObj.wgs84
}

layer declaration

uses_layer = new OpenLayers.Layer.Vector("US Layer", {
    strategies : [new OpenLayers.Strategy.Fixed()],
    projection : _projObj.wgs84,
    visibility : true,
    protocol : new OpenLayers.Protocol.WFS({
        version : '1.0.0',
        url : '[...]wfs.map&service=WFS',
        featureType : USType
    })
});

center to layer extent

After the layer gets successfully loaded, I want to zoom to the vector layer extent:

map.zoomToExtent(uses_layer.getDataExtent());

and I get:

Uncaught TypeError: Cannot call method 'getCenterLonLat' of null
OpenLayers.Map.OpenLayers.Class.zoomToExtentOpenLayers.js:512
addSelectedLayermap.js:87
(anonymous function)46.105.19.68:36
f.event.dispatchjquery-1.7.2.min.js:3
f.event.add.h.handle.i

When I pass the same commands from JS debug command line (embedded in Chrome), the map get zoomed correctly; nonetheless,

uses_layer.getDataExtent();

from command line, gives me

bottom: 5134852.1720288
centerLonLat: null
left: 1744085.9879363
right: 1787837.9987162
top: 5150209.4139235

Now, centerLonLat is null, but in the docs it is said that the only reqested value is a bound with coordinates array, that IMHO fits with the uses_layer.getDataExtent(); request.

Any hint?
Thanks :)


texts: OpenLayers.Format.SLD - Ignores 'matchCase'?

texts:
I've trying to use OpenLayers to construct an SLD element to include in a WMS layer's parameters.

This SLD document can contain a number of filters. This works fine and resultant SLD does work to filter the layer.

However, the matchCase=false property of the filter(s) are being stripped out on formatting the SLD.

Example:

var filter    = new OpenLayers.Filter.Comparison(
{
  type:       OpenLayers.Filter.Comparison.EQUAL_TO,
  property:   'my_property',
  value:      'A Value',
  matchCase:  false
});

var rule = new OpenLayers.Rule({
  filter: filter,
  symbolizer: {"Polygon": {}}
});

var style = new OpenLayers.Style();

style.addRules([rule]);

// Create the SLD
var sld_body = new OpenLayers.Format.SLD().write({
  namedLayers: [
    {
      name: 'myLayer',
      userStyles: [style]
    }
  ]
});

I think I know what the problem is, but I have no idea how to fix it.

If I check the output of OpenLayers.Format.Filter({version: "1.1.0"}).write( filter ); then I see correctly formatted XML, which includes my matchedCase property.

If I do the same with version 1.0 (the default), I see the same XML but without the matchedCase parameter.

The documentation for OpenLayers.Format.SLD states that it inherits from OpenLayers.Format.Filter.v1_0_0, which explains why it won't read the matchedCase parameter.

I'd hoped using OpenLayers.Format.SLD({version: "1.1.0}).write() would work, but it just throws an error about a driver not being available for that version.

So, how should I deal with this? I need to generate an SLD document and it needs to acknowledge the matchedCase property.

Thanks,

Tom


texts: How to make one checkbox that shows multiple layers in QGIS or qgis2web?

texts: I need to create one checkbox in QGIS (and qgis2web) that than will show two other layers. So basically I don't want to check two checkboxes in the layerlist, but I want to simplify this process by just checking one checkbox. I want to do this without having to merge multiple layers in one shapefile.


texts: Which projection is being used in this figure?

texts:
I would like to use the projection being used in this figure. Does anyone know which one it is? Esp helpful if it is available in ArcGIS.
From plant stress page

thanks!


texts: Turning degrees into square kilometres (km2)?

texts:
After running raster layer unique value report I have got pixel number and area in degree.

How can I turn it in square kilometres (km2)?


texts: Is there any systematic way to pick two colors for a chloropleth showing a candidate's margin of victory

texts: I have a simple 2-color map showing which candidates won in which precinct. Now I want to make one showing margin of victory within a precinct. So if candidate A won by a lot it would be dark green, if candidate A won by a little it would be light green, if candidate B won by a lot it would be dark yellow and if candidate B won by a little it would be light yellow. (These are local elections so red and blue don't make sense). I used color brewer to pick my initial two color scheme. I have zero design sense. How do I go about picking the colors for the margin of victory map?


texts: Returning polygon attributes intersecting a buffer

texts:
I am trying to return attributes of polygons (from the SAC feature) that intersect the buffer created around the route, but I keep getting:

Uncaught Error: geojson must be a valid Feature or Geometry

Here is my code:
/*OVERLAYS*/
var SAC = L.geoJson({{ sac }} , {

 style: function(feature) {
return {
  color: "black",
  fill:'url(img/image.gif)',
   weight: 1,

  opacity: 0.8
};
},

onEachFeature: function(feature, layer) {
   const p = feature.properties
p.title  = p.SAC_NAME || p.name
layer.on('mouseover', function() {
  this.setStyle({
    'fillColor': '#0000ff'
  });
});
layer.on('mouseout', function() {
  this.setStyle({
    'fillColor': 'transparent'
  });
});
//mouse tooltip properties
if (p && p.name) {
  layer.bindTooltip(p.name, {
    closeButton: false,
    offset: L.point(0, -20)
  });
  layer.on('mouseover', function() {
    layer.openPopup();
  });
  layer.on('mouseout', function() {
    layer.closePopup();
    });
  }
 }
  })

Add buffer layer around route:
document.getElementById('radius').onchange = function() {
 var radius = parseInt(document.getElementById('radius').value);
  //  if (isNaN(radius)) radius = 500;
 var buffered = turf.buffer(PreferredTerrestrialRoute.toGeoJSON(), radius , {units: 'kilometres'});
 map.removeLayer(roadbuf);/* remove existing laer*/

roadbuf = new L.GeoJSON(buffered, {

style: function(feature) {
return {
  color: "green",
  fill:"green",
   weight: 1,
       //  fillColor: "transparent",
       //   color: "blue",

  opacity: 0.8
};
 },
})
map.addLayer(roadbuf)

var polyintersect = turf.intersect(SAC.toGeoJSON(), roadbuf.toGeoJSON());
    console.log( polyintersect.features.length +" points in this poly");
    alert("results "+JSON.stringify(ptsWithin4));

}


texts:
I have downloaded a DEM from digmap and have opened it in ArcMap.

I now want to transfer elevations from each gridsquare into excel to be used in a water routing model.

Do you have any ideas how to do this?


texts: Facilities all showing as Unlocated in ArcGIS Network Analyst

texts:
I have a list of facilities that I have imported based off their addresses.  I matched all the points in the Esri geocoder based off USA street address locators.  These points are all accurate, and contain location data as well as street name, city, state, zip, etc.

I am using a network dataset that was included with Esri Streetmap Premium V10.2, called Routing_ND.  When I run my facility points through other network datasets, such as the Esri Tutorial San Fransisco Data, I do not receive any errors and it runs just fine.

The problem I am having is that when I create a service layer based off "Routing_ND" and add these locations to my Facilities class, the points all show up as "Unlocated" and I am unable to change/have them located in order to run on my "Make Service Area Layer".

The "Routing_ND" also appears to not show any edges or traffic data even when checked on in the symbology tab.  This is one of the only differences I am able to find when comparing to other network datasets.

I have my Network Analyst extension checked off in both my ArcMap session as well as ArcCatalog, and I have the active license installed for SMP (.sdlic file).

Any ideas?


texts: ArcGIS Server 10 installation in Red Hat Enterprise Linux (RHEL)

texts: The ArcGIS Server 10 system requirements page says that it supports Red Hat Enterprise Linux (RHEL) AS/ES 4 and RHEL 5. I have RHEL WS 4, RHEL WS 6, and RHEL Desktop 5. I am not sure if any of these version works well with ArcGIS Server 10 without any problem.


texts: PHP MapScript get feature / shape by index in layer

texts:
I upgraded my MapServer version from 5.6.x to 6.2.0 (yes, big version jump here!) and I am stuck with getting a shapeObj from a layer by simply using its Index (or FID for shapefiles or GID in case of PostGIS).

In the old version I used the following:

$layer->open();
$shapeOjbect = $layer->getFeature($fid);
$bounds = $shapeObject->bounds;`

which returned to me the rectangular bounds.

Everything has changed in the new version of MapServer/MapScript. GetFeature() is not enabled any more, and $layerObj->getShape($resultObj) can be used instead BUT getShape requires the resultObj(nth result) from a $layerObj->queryByXXX , but there is no XXX = Index (e.g. $layerObj->queryByIndex($fid)   ).

There is a $mapObj->queryByIndex(layerIndex, tileIndex, $fid, [$addToquery]), but I have not seen any examples using that function.

I hope I explained clearly.

Does anybody have any experiences on using this function?


texts: Loading tiles while interacting for a single layer

texts: loadTilesWhileInteracting option applies to ol.Map. Is it possible to have that effect only apply to a selected layer?