I want to remove some layers from the osm map of an area. It has all the details like POI, offline routing and all. But I just want the map data. How can I remove this extra layer from the map?
Saturday, 24 August 2019
Merging DEMs in ArcGIS Desktop?
I'm trying to merge some DEMs downloaded from USGS. When I used ArcGIS 9.2 there was an expression to be used in raster calculator to do that. I used it again but, unfortunately, it doesn't work in ArcGIS 10.2.
What can I do?
I do not have the Production Contouring toolbar.
Answer
Start by converting them to raster formats (assuming they are in DEM format to start with): 
then use the 'Mosaic to New Raster' tool to combine the different rasters into a single one: 
Make sure that they are in the same units before mosaicing them or they will look really odd when you stitch them together.
That's the basic approach I use, I'm assuming the DEMs you have are all in the same coordinate system/projection/units/cell size/etc. If not, make sure you get all the rasters into identical formats before you start, it will make your life a lot easier.
shapefile - Convert SHP to GPX with predefined SHP style in QGIS
I had defined graduated style in QGIS for points contained in shp format. I had saved this style in sld and qpj format so now I am able to open shp in QGIS and it automatically loads its style (I am not sure if it would with other GIS software assuming I have sld).
But what I would like to do is to convert/save/export this shp with defined style to gpx, kml or kmz (preferably to gpx).
I have been trying...
- Right click on a layer
- Save as...
- In Save vector layer as...: Format: GPX, Choose File Name, Symbology export: Feature Symbology (and Symbol Layer Symbology), GPX_USE_EXTENSIONS=YES, FORCE_GPX_TRACK=YES + other default options.
...but I havent had any luck.
Can this be done?
My goal is to upload gpx to Google My maps.
Identify X Y coordinates of polygons and add them to the attribute table in QGIS?
I have a polygon shapefile which I have imported into QGIS, however it does not display X Y coordinates. Is there a way that I can identify the coordinate for the centroid of the polygon and display this in the attribute table?
Friday, 23 August 2019
arcgis desktop - Export to a Shapefile and maintain Domain Coded Values
I maintain a complex parcel fabric that uses coded value domains for a few fields. These are short integer fields with values from 1 - 6. These values represent say 1:Integrated Registered Survey Plan, 2:Survey Plan, 3:Geo-Referenced Air Photography, 4:Government Provided, 5:Expert Knowledge, 6:Unknown.
So I have several data requests and they need to be provided in Shapefile's. When I export my parcel fabric the fields obviously make no sense since they are numeric values representing accuracy codes from domains.
Is there any way to convert this field from a coded numeric field to its domain value? I know I can do this with some python programming, but I wonder if ESRI already has a solution for this.
Also I am managing the Parcel Fabric in a File Geodatabase.
Answer
You could do it with Python, but if you are unfamiliar with Arcpy, it's a simple field calculation. Add a new text field and use this in field calculator.
CODE BLOCK:
def domain(field):
if field == 1: return "Integrated Registered Survey Plan"
elif field == 2: return "Survey Plan"
elif field == 3: return "Geo-Referenced Air Photography"
elif field == 4: return "Government Provided"
elif field == 5: return "Expert Knowledge"
else: return "Unknown"
EXPRESSION:
domain()
In hindsight, it's actually easier to use field calculator than messing with dictionaries and cursors. If you had a large amount of domain values to code, then it would be worthwhile to dump the data in a .txt file and create your dictionary from that.
I only tested this on a shapefile, but it should also work on a GDB. This script takes a feature layer, list of fields, and text file as input and creates new fields to populate their domain values with.
import arcpy
shpin = arcpy.GetParameterAsText(0) #Input shapefile.
#String of field(s) to loop over, split into list.
fields = arcpy.GetParameterAsText(1).split(";")
#The text file containing comma separated find/replace values.
textfile = arcpy.GetParameterAsText(2)
values = [str(row[i]) for row in arcpy.da.SearchCursor(shpin, fields)
for i,field in enumerate(fields)]
repfind = dict([line.rstrip().split(",") for line in open(textfile, "r")])
replaced = [repfind.get(x,x) for x in values] #Use .get method to mimic find/replace.
rep_list = zip(*[iter(replaced)]*len(fields)) #Convert to list of lists.
#Add new fields, with name based on old field name with appended underscore.
[arcpy.AddField_management(shpin, "{0}_".format(field), "Text") for field in fields]
newfields = ["{0}_".format(field) for field in fields]
with arcpy.da.UpdateCursor(shpin, newfields) as rowout:
for x, row in enumerate(rowout):
for y, field in enumerate(fields):
row[y] = rep_list[x][y]
rowout.updateRow(row)
r - Different origin problem while merging rasters
I have two dem files downloaded via the getData function in the raster package. Here you can see the code:
I tried to make the example reproducible so there you have it.
library(raster)
dem_n1<-getData("SRTM",lon=26,lat=43)
dem_n2<-getData("SRTM",lon=31,lat=43)
demALL<-merge(dem_n1,dem_n2)
While attempting to perform the merge, the following error appears:
Error in compareRaster(x, extent = FALSE, rowcol = FALSE, orig = TRUE, :
different origin
Answer
This works as expected for me:
> demALL
class : RasterLayer
dimensions : 6000, 12000, 7.2e+07 (nrow, ncol, ncell)
resolution : 0.0008333333, 0.0008333333 (x, y)
extent : 25, 35, 40, 45 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source : c:\Temp\R_raster_rhijmans\r_tmp_2015-10-22_102651_340_06019.grd
names : layer
values : -37, 2573 (min, max)
However, there is a small difference in the origin due to floating-point imprecision
origin(dem_n1)
#[1] 0 0
origin(dem_n2)
#[1] -3.552714e-15 0.000000e+00
but that should not matter
So I wonder if you are using the current versions of R and raster? If you are, you could probably get around this by setting
rasterOptions(tolerance = 0.1)
(That is actually the default value) or perhaps
.Machine$double.eps <- 0.000000001
or something like that
arcgis desktop - How do you remove isolated roads from a bigger network?
I'm trying to perform an OD Cost Matrix calculation on a set of points using a road network from OpenStreetMap data. The network contains lots of roads that don't connect to the rest of the network. In the case where a point snaps to such a place on the network, it can't reach any other sample points.
How do I remove these sections of road? Or if that's not possible, how could I systematically identify those areas and connect them to the rest of the network?
Answer
My solution to this was kind of a kludge, but then I was doing a small class project working with a subset of one county's roads so the network wasn't that big and I didn't need to do it as a common task. I just ran a service area analysis with the time set large enough that in theory everything should be reachable. That highlighted everything that was connected, thereby showing what wasn't. Some of them I added new connections because I needed to preserve those areas, others I simply selected and deleted the isolated roads from the dataset.
10.1 help has reference to a Find Disconnected tool on the Utility Network Analyst Toolbar if you have access to that.
10.2.1 also has a new tool that might do what you want, if you have access to that version or higher: Find Disconnected Features In Geometric Network (Data Management)
arcpy - Changing output name when exporting data driven pages to JPG?
Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...
-
I am trying to make a map using US census data showing vacant housing to total housing on the same map. I came across the "multiple att...
-
My guess is that I'm doing something wrong with QGIS, but here goes. I have multiple point data layers in WGS84, mostly of UK locations,...
-
How does one add a field to an ArcGIS feature class with a boolean data type? That is an attribute where the allowed value is only one of a ...