Watershed / drainage network analysis; floating point or integer raster for input?

I am a little desperate to find a solution to my problem. As I have detailed in this post I am unable to create a detailed drainage network (and catchments) from high resolution LiDAR data. I think I narrowed down the issue to the use of **integer raster vs floating point raster** as the input for my analysis. Both methods yiled dramatically different results, both methods are unasable for a detailed model. Using an integer raster as input yield a very generalized stream network and using a floating point raster yield a detailed, very disconnected and clustered stream network. **Which type of raster should I be using for input and why?** Current method:   1. convert to integer raster    2. fill sinks   3. flow direction   4. flow accumulation   5. stream network /stream links   6. stream order   7. watersheds (stream link input)


QGIS 2.0 Plug In Repository - How to Set Parameters to qgis=1.8

A number of very useful QGIS plug ins available in 1.8 are not available in 2.0. Is there a way to set the parameter page in "Repository Details" to 1.8 so I can access the 1.8 plug ins and check functionality? The option is grayed out as shown in the screenshot below. ![enter image description here](http://i.stack.imgur.com/wUlhw.png)


How to randomly subset X% of selected points?

What methods are available in ArcGIS 10.2 to randomly subset a selection of points. For example, in the attached screenshot I am interested in keeping 20% of the selected points and deleting the rest. ![enter image description here](http://i.stack.imgur.com/poqtj.jpg)


QGIS intersect "NameError: global name 'exceptions' is not defined"

While trying to use the vector intersect feature with two area shapefiles, I get:               An error has occured while executing Python code:          Traceback (most recent call last):       File "C:\OSGEO4~1\apps\qgis\python\plugins\fTools\tools\doGeoprocessing.py", line 308, in run         geos, feature, match, error = self.intersect()       File "C:\OSGEO4~1\apps\qgis\python\plugins\fTools\tools\doGeoprocessing.py", line 907, in intersect         fields = ftools_utils.combineVectorFields( self.vlayerA, self.vlayerB )       File "C:\OSGEO4~1\apps\qgis\python\plugins\fTools\tools\ftools_utils.py", line 78, in combineVectorFields         fieldsB = testForUniqueness( fieldsA, fieldsB )       File "C:\OSGEO4~1\apps\qgis\python\plugins\fTools\tools\ftools_utils.py", line 162, in testForUniqueness         fieldList2[j] = createUniqueFieldName( fieldList2[j] )       File "C:\OSGEO4~1\apps\qgis\python\plugins\fTools\tools\ftools_utils.py", line 178, in createUniqueFieldName         except exceptions.ValueError:     NameError: global name 'exceptions' is not defined      Python version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] QGIS version: 2.0.1-Dufour Dufour, d94c044 If someone can help me with this error, it'll be greatly appreciated.


Export Polygons from Service Area tool using ModelBuilder?

I have created a service area in ModelBuilder. I have assigned a polygon to the "facilities". How do I export the service area polygon to a shapefile in ModelBuilder?


Is there simple way to calculate radius of curvature along polyline?

I am digitizing a sinuous linear alignment (in this case a water pipe) and would like to get the radius of curvature of the various bends along the alignment. The main reason is that the minimum curvature allowable for the exercise is of 200m (or approx 28 degrees along a 200m section). I am using ArcGIS 10.1 for Desktop.


How do I separate OpenLayers methods from my own, while using inheritance?

I am working on a GIS API, that uses OpenLayers. I initialize the map lke this:               xgis.map = OpenLayers.Class(OpenLayers.Map, {         var mapOptions = {};         mapOptions.allOverlays = false;         /*             more mapOptions here         */         OpenLayers.Map.prototype.initialize.apply(this, ['map', mapOptions]);     });      Of course, I do this because I want to create my own methods, like this one, for example.               xgis.map.prototype.zoom(action) {         switch(action) {             case 'in:                 this.zoomIn();    // Uses the OpenLayers zoomIn method                 break;             case 'out:                 this.zoomOut();    // Uses the OpenLayers zoomOut method                 break;     };      The problem is this 'zoom' method I created is not recognized as a function (I get: number is not a function), because OpenLayers has a 'zoom' numeric value where it stores the zoom. Is there a way to use inheritance and access the parent's methods like this?               this.parent.zoomIn()      This would definitely fix the 'zoom' name problem.


Avoiding schema lock cannot be acquired because of existing lock on File Geodatabase?

I am having a problem with a Schema Lock in ArcMap for Desktop Advanced 10.2. The license that I have is Concurrent use for two computers. On Computer 1, I created an MXD Map File and a File Geodatabase for my map in the ArcCatalog Window. I have everything saved on the a shared folder in the E Drive over the Network.   1. I close ArcMap on this computer then open up ArcMap on Computer 2.    2. I open the MXD Map File and then open the ArcCatalog Window to add more Feature Classes to my created File Geodatabase.    3. When I try to expand the File Geodatabase on Computer 2 an error comes up stating "A schema lock cannot be acquired because of an existing lock." and the GeoDatabase will not expand for editing feature classes.  Are there any solutions to this problem?


Not able to register spatial view with sde

I am using 10.2 ArcGIS and SOL Server 2008 R2. I have created a cross database spatial view in sql server using following syntax:               USE [pipelines]     GO          SET ANSI_NULLS ON     GO          SET QUOTED_IDENTIFIER ON     GO          CREATE VIEW [gis].[parcels_test]      AS     SELECT     a.Shape, a.asmt as ASMT, meg_assor_rep.gis.megaview_ext.Owner, meg_assor_rep.gis.megaview_ext.StreetNum,              meg_assor_rep.gis.megaview_ext.StreetDir, meg_assor_rep.gis.megaview_ext.Street,  meg_assor_rep.gis.megaview_ext.StreetType,              meg_assor_rep.gis.megaview_ext.SpaceApt, meg_assor_rep.gis.megaview_ext.Community, meg_assor_rep.gis.megaview_ext.Zip,              meg_assor_rep.gis.megaview_ext.Mail1, meg_assor_rep.gis.megaview_ext.Mail2, meg_assor_rep.gis.megaview_ext.Mail3,              meg_assor_rep.gis.megaview_ext.Mail4, meg_assor_rep.gis.megaview_ext.Acres, meg_assor_rep.gis.megaview_ext.LandUse1,              meg_assor_rep.gis.megaview_ext.TRA, a.floor as Floor, a.OBJECTID, meg_assor_rep.gis.megaview_ext.Notes,              meg_assor_rep.gis.megaview_ext.StreetAddr,a.Shape.STArea() as Prcl_Size_SqFt,meg_assor_rep.gis.landuse.Descr     FROM       pipelines.gis.prcl a      INNER JOIN meg_assor_rep.gis.megaview_ext ON a.asmt = meg_assor_rep.gis.megaview_ext.Asmt     LEFT OUTER JOIN meg_assor_rep.gis.landuse ON meg_assor_rep.gis.megaview_ext.LandUse1 = meg_assor_rep.gis.LandUse.LandUseCode     GO      view created successfully however, when i am trying to register it with sde using following command it is giving me invalid entity(29) error.               sdelayer -o register -l pipeline_test,SHAPE -e a -k Geometry -t Geometry -i sde:SQLSERVER:GISDATA -D pipelines -p *** -u gis      This view includes a feature class of a parcel fabric dataset. The interesting fact is that when i am trying to register view created on different feature classes (other than parcel fabric) using above command its getting registered successfully. So, Its most probably the issue with parcel fabric. Is there any specific prerequisite to follow before creating view on a parcel fabric feature class?


Opengeosuite blank and postgresql errors

I had the unfortunate idea to upgrade opengeosuite from 4.0 to 4.1. I followed the docs found on opengeosuite site but something has gone wrong. I uninstalled opengeosuite and all connected packages and trying a brand new install but nothing seems to work anyway. The dashboard page works but I can't access the Geoserver admin page and the Geoexplorer demo page. All I get is a blank page ( **400 Bad request** ). I solved this problem by installing the single opengeosuite packages. I don't understand, I followed the upgrade instructions but something didn't work as expected. I had installed phppgadmin on the same server but now I can't login anymore. I get a login failed error. I solved the phppgadmin by running the following command:               setsebool -P httpd_can_network_connect_db 1      The command must be executed at each reboot of the server. I'm not sure if the 2 problems are linked together. The postgresql problem is probably related to a failure in `initdb` when I reinstalled opengeosuite (yum install opengeo) since there were databases in the data folder. But I have no clue about the geoserver/geoexplorer problem. Any suggestion is welcome.


Directional Flow Arrows for sewer lines

I am working for the Town of Yadkinville, NC and would like to know how to create a layer of directional flow arrows for sewer lines to be able to turn them on and off at will?


Programmatic raster-vector calculation

I currently use GRASS' r.mapcalc to find the difference between vector and raster data using a loop and temporary files and layers. Is it possible to do the core calculation between raster with a vector data more directly either within GRASS, in some external tool, or some python script?               #!/bin/bash      TOPO=mytopo     g.region -p rast=mytopo res=10     for file in INPUTS/* ; do       imbase=${file#INPUTS/}   # strip off the directory prefix       v.in.ogr input=$file output=temp_a --overwrite       v.to.rast in=temp_a out=temp_b use=attr column=elev --overwrite       r.mapcalc "temp_c" = "(if( "temp_b" <= "$TOPO" ,null(),if( "$TOPO" <0,0, "temp_b" - "$TOPO" )))"        r.out.gdal input=temp_c -c  format=GTiff type=Float32 output=OUTPUTS/$imbase     end     g.remove temp_a     g.remove temp_b     g.remove temp_c      I like GRASS' the ability to do the mapcalc on resolutions and extents other than my source data. but although this works, the process seems seems awkward and slow for numbers of files in the hundreds. Ideally, I'd like something like the below:                gdalogr_diff.py mytopo.tif PG:dbname=warmerda -sql "SELECT elev[${timeslice}] from temp_output" -f GTiff out_${timeslice}.tif


Programmatically creating a vector feature in OpenLayers

I want to create a vector feature, programmatically, on my map. It's supposed to be in the A4-paperformat, for showing a sort of print preview. I've created a control for handling this, but now I'm at the point where I need to create the feature. And I have no idea of how I can do it. Any ideas?


Generate cache tiles for EPSG:27700 for use with OpenSpace

I am using GeoServer 2.1.0 (windows jetty local install for dev), open layers and Ordnance Survey openspace api and have a set of shape data that I am using as an overlay. Everything is working as expected and drawing correctly but I need to create cached tiles to increase drawing speed. In understand that the default cache tile generation is either EPSG:4326 or EPSG:900913 and to add EPSG:27700. I understand that this is achieved by creating a geowebcache.xml file containing the definition. Unfortunately I haven't found an example of a geowebcache.xml file and so if any one could help me I would be most grateful. BTW: I'm not a cartographer just a developer!


arcpy.geometry __geo_interface__ and AsShape() function: loss of precision and holes

I'm serializing my arcpy geometries as geojson so that I can 'hydrate' them back as geometries later and I'm having 2 problems in the cycle.: **PROBLEM 1: Precision**                   R0 = arcpy.SearchCursor(self.shpTest, "FID=0").next().getValue("Shape")                   geojson = R0.__geo_interface__                                 R1 = arcpy.AsShape(geojson)         self.assertTrue(R0.equals(R1)) <<< THIS FAILS      If I check the string representation, the coordinates have slightly changed:                   geojson2 = R1.__geo_interface__         print geojson         print geojson2                {'type': 'Polygon', 'coordinates': [[(442343.5516410945, 4814166.6184399202), (442772.17749834526, 4811610.7383281607), (441565.67508534156, 4811499.6131059099), (440772.50052100699, 4814184.7808806188), (442343.5516410945, 4814166.6184399202)]]}         {'type': 'Polygon', 'coordinates': [[(442343.55169677734, 4814166.6185302734), (442772.17749023438, 4811610.73828125), (441565.67510986328, 4811499.6130981445), (440772.50048828125, 4814184.7808837891), (442343.55169677734, 4814166.6185302734)]]}      **PROBLEM 2: Holes** If the polygon has holes, **geo_interface** generates an error:                   R0_WithHoles = arcpy.SearchCursor(self.shpTest, "FID=0").next().getValue("Shape")                   geojson = R0.__geo_interface__  <<< generates this ERROR:              File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\geometries.py", line 68, in __geo_interface__             return {'type': 'Polygon', 'coordinates': [[(pt.X, pt.Y) for pt in part] for part in self]}         AttributeError: 'NoneType' object has no attribute 'X'      Any ideas on how to solve these problems? Thank you


Converting X,Y coordinates to lat/long using pyproj and Proj.4 returns the wrong coordinates

I'm writing a python script that reads multiple XML files containing x and y coordinates and combines them all into a single csv file. Latitude and Longitude are required fields in the csv, but I am having difficulty converting the x,y coordinates in Ohio North State Plane usFt to WGS84.               >>> p = Proj(r'+proj=lcc +lat_1=41.7 +lat_2=40.43333333333333 +lat_0=39.66666666666666 +lon_0=-82.5 +x_0=600000 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=us-ft +no_defs') #Nad83 State Plane Ohio North US Feet Proj object using parameters     >>> p(739400.91,2339327.3,inverse=True)     (-80.138057868777224, 60.278230707978487)     >>> p1 = Proj(init="epsg:3734") #Nad83 State Plane Ohio North US Feet Proj object using EPSG code     >>> p1(739400.91,2339327.3,inverse=True)     (-80.138057868777224, 60.278230707978487)      Both methods above return the same result, however this lat long is somewhere in Hudson Bay. When I plot the coordinates in ArcMap, the correct lat long is: -81.142311,41.688205. *Notice all lat longs are provided long,lat as this is the order Proj uses Does anyone know why I would be getting the wrong coordinates from Proj.4 and pyproj?


Python in ArcGIS: How to add a space between upper and lowercase letters in TOC

I'd like to use python to update the TOC by adding a space (white space) for layer names that are like this: "BoundaryBuffer" or "WaterEdge" and replace them with "Boundary Buffer" or "Water Edge". I'm new to python and could use some assistance so far I've gotten to this but I can't get it to work correctly:                   import arcpy     >>> import re     >>> mxd = arcpy.mapping.MapDocument("CURRENT")     >>> df = arcpy.mapping.ListDataFrames(mxd)[0]     >>> layers = arcpy.mapping.ListLayers (mxd)     >>> for lyr in layers:     ...     re.findall('[A-Z][a-z]*', lyr.name)     ...     arcpy.RefreshTOC()      I've looked at this post as well but I don't know how to integrate it with lyr.name in ArcGIS. **EDIT: I solved it myself! If anyone is interested or wants to comment:**               import arcpy     ... import re     ... mxd = arcpy.mapping.MapDocument("CURRENT")     ... df = arcpy.mapping.ListDataFrames(mxd)[0]     ... layers = arcpy.mapping.ListLayers (mxd)     ... for lyr in layers:     ...     tempName = re.sub(r'([a-z])([A-Z])', r'\1 \2', lyr.name)     ...     lyr.name = tempName     ...     arcpy.RefreshTOC()


Using the projection of a layer variable to project another in Model Builder in ArcGIS

So in model builder I would like to have one input feature class projected to match the projection of another layer (a raster layer) that is a variable in the model. Can anyone help me achieve this?


REST backend framework for routing?

I'm looking for a framework in Java or PHP to use it as backend for a mobile application. It should (if possible) implement REST services, geo functions for routing and CRUD services. I found the Java framework GeoMajas, but I'm not quite sure to understand all it's functionnalities and for which type of project it should be used. Any advices and ideas on which framework to use for this type of project ? Is GeoMajas a good one or isn't it designed for this case ?


QGIS create point data attribute as the name of the polygon it falls in

I'm working in QGIS with a point data set overlaying a farm with 140 fields. While I can analyse the points from each field individually, I would rather use an awk script to calculate statistics I need. The problem is that I am unable to import the containing polygon_id as an attribute into the point table. Any suggestions would be greatly appreciated.


MapBasic | Objects Combine

Can anybody tell me how I can combine the geo objects of one relation to one single object? I reckon the Object Combine function is right one, but I have no idea how to specify the code... Thanks, Agnes


How to convert shapefile to tpk using python(ArcGIS 10.1)?

I'd like to convert shapefile to tpk using Arcpy.I surf in ArcGIS 10.1 help but i couldn't find any desire reference to help me . How can i convert shapefile to tpk using arcpy ? which function i need to convert shp to tpk ? Note : I don't have ArcGIS server. thanks for advance


QGIS and SpatiaLite database: Setting user access permissions

SpatiaLite databases seems to match all my desires to store GIS layers and table. But an important question is: is it possible to limit writing to only one user ? If yes, what is the way to do it? I read the cookbook and searched the internet without finding an answer. I know that PostGIS is better for multi-access purposes but there are only three cartographers in my company and they don't have enough needs in GIS to switch to PostGIS, which is much more complicated than SpatiaLite... Thank you.


How to change name of layers in tree

I'm trying to change the name of the layers in the tree. This is part of my code:               var layer_group1 = new OpenLayers.Layer.WMS("layer_group1",                          url,                         {                             LAYERS: ['namespace:layer_a','namespace:layer_b','namespace:layer_c'],                             format: "image/png",                             transparent: "true",                             projection: 'EPSG:4326'                         },                         {                                      buffer: 0,                              displayOutsideMaxExtent: true,                             isBaseLayer: false,                             displayInLayerSwitcher: false,                             yx : {'EPSG:4326' : true}                              }                      );          var layer_group2 = new OpenLayers.Layer.WMS("layer_group2",                          url,                         {                             LAYERS: 'namespace:layer_d',                             format: "image/png",                             transparent: "true",                             projection: 'EPSG:4326'                         },                         {                                 opacity:0.5,                             buffer: 3,                             displayOutsideMaxExtent: true,                             displayInLayerSwitcher: false,                             yx : {'EPSG:4326' : true}                              }                      );                   mapPanel = new GeoExt.MapPanel({             border: true,             region: "center",             // we do not want all overlays, to try the OverlayLayerContainer             map: mapa,             center:[-6613943,-3793944],             zoom: 7,             layers: [ capaBase, layer_group1, layer_group2, gmap,gsat,vector]         }         )      I get the tree:               layer_group1        |_ namespace:layer_a        |_ namespace:layer_b        |_ namespace:layer_c          layer_group2        |_namespace:layer_d      But I want to expect:               layer_group1        |_ Layer a        |_ Layer b        |_ Layer c          layer_group2        |_ Layer d      How can I change the name of the layer in the tree? PS: don't hesitate if you need more code.


How to add additional HTTP response headers?

I installed recent MapProxy (1.7.1) on Ubuntu 14.04 LTS following this guide. Everything works - I can get test OSM layer's tiles through proxy. But in order to use this layer on my web page I have to add additional response header:               Access-Control-Allow-Origin: http://my-domain      If found headers option in the documentation but it's meant to > add additional HTTP headers to all requests to your sources but not response headers of proxy itself. So my question is: **how can I add additional HTTP headers to my MapProxy's responses?**


Calculating distances from points to the centre of cells

I am using QGIS 1.8.0 (using older version because I need the Qmarxan plugin which is not available for 2.4.0). I have a study area that has a vector laying of "planning units", or cells over the top (several thousand cells). Each planning unit has an individual ID and a couple of other fields in the attribute table. I then have a vector point layer with 8 points (ranger stations). I need to calculate the distances from the centre of every cell to the nearest point, and have this as a new column in the attribute table. Later, I will need to do the same calculation but from the centre of each cell to the nearest road. I've searched for ages now and can't find a solution on any forum - any advice would be greatly appreciated.


How to query postgres with gis to get GeoJSON for GeoJSON tile layer?

I have a postgres database with one table like the following:               CREATE TABLE post_pl     (       gid serial NOT NULL,       zip character varying(5),       zip_n integer,       city character varying(50),       geom geometry(MultiPolygon),       CONSTRAINT post_pl_pkey PRIMARY KEY (gid)     )      In this table there are stored polygons as geometry. I want to get all polygons from that table within a bounding box. I use an htaccess file to route all requests to one PHP file. Then I use params of the url to create a bounding box. Example: URL: polygons.php/{z}/{x}/{y}.json Creating bounding box(see: osm slippy tilenames):               function tileCoord2BBox($url)     {         $parsed = explode("/",$url);              $z = $parsed[3];         $x = $parsed[4];         $y = $parsed[5];              $n = pow(2, $z);              $lon1 = $x / $n * 360.0 - 180.0;         $lat1 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n))));              $lon2 = ($x + 1) / $n * 360.0 - 180.0;         $lat2 = rad2deg(atan(sinh(pi() * (1 - 2 * ($y + 1) / $n))));              $bbox =  array();         $bbox['lon1'] = $lon1;         $bbox['lat1'] = $lat1;         $bbox['lon2'] = $lon2;         $bbox['lat2'] = $lat2;              return $bbox;     }      I used those return value in ST_MakeEnvelope to limit the results. **What i want to know is:** How should a postgres statement look like to get all polygons within those bounding box and that I can use the result as GeoJSON Tile Layer like this one: GeoJSON Tile Layer? If possible with a JSON attribute that I can identify each polygon by "zip" on client side. I want to have a similiar one like that one in the link above with my own geo data in Leaflet. Hope someone can help. Thx


Extract elevation data from Landsat / MODIS imagery?

Just curious, have anyone tried to extract elevation data from LANDSAT or MODIS imagery? So far, I came across one journal by Toutin who did so using adjacent LANDSAT 7 imageries. Results seem pretty decent. Anyone have any ideas???


QGIS show gdal_polygonized file in EPSG:54004 instead of EPSG:3857

I am polygonizing a TIFF with the gdal_polygonize.py and the resulting Shape is shown in QGIS in the wrong projection - EPSG:54004 instead of EPSG:3857. I have a TIFF in EPSG:3857 and polygonize it with               gdal_polygonize.py input.tif -f "ESRI Shapefile" output.shp      After doing this, the corresponding .prj file looks ok to me and I also checked it with various other sources like this               PROJCS["WGS_84_Pseudo_Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1],PARAMETER["standard_parallel_1",0.0]]      When I load the `output.shp` into QGIS it automatically detects the file in EPSG:54004 which results in an offset compared with the source. After changing the Shapes projection in QGIS manually to EPSG:3857 both files, the TIFF and the Shape, do align. Could this be a problem with QGIS or a problem with GDAL? ![Offset](http://i.stack.imgur.com/docn8.png) _Offset between TIFF and Shape in the red rectangle_ **Update** `gdalsrsinfo` on the original TIFF shows               PROJ.4 : '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs'          OGC WKT :     PROJCS["WGS 84 / Pseudo-Mercator",         GEOGCS["WGS 84",             DATUM["WGS_1984",                 SPHEROID["WGS 84",6378137,298.257223563,                     AUTHORITY["EPSG","7030"]],                 AUTHORITY["EPSG","6326"]],             PRIMEM["Greenwich",0],             UNIT["degree",0.0174532925199433],             AUTHORITY["EPSG","4326"]],         PROJECTION["Mercator_1SP"],         PARAMETER["central_meridian",0],         PARAMETER["scale_factor",1],         PARAMETER["false_easting",0],         PARAMETER["false_northing",0],         UNIT["metre",1,             AUTHORITY["EPSG","9001"]],         EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs"],         AUTHORITY["EPSG","3857"]]


ArcGIS Viewshed without Observer Points

I want to create a viewshed around a LineFeature. The problem is, I have no observer points. I would like to create them with a gap of 10m around the line feature. The LineFeature should be 1m over the terrain model and the observer points should have a height of 1.5m. The height of the woods around the Linesegment are estimated with 20m, which hinders the view of the objects that lay behind it. Ultimately I would like to calculate the total surface around the lineFeature from where at least a part of the Line is visible. Anybody knows a away how I should approach that task?


Project tiles from custom imagery in transverse mercator with OpenLayers

I have the following parameters of a custom imagery and I need to set-up a layer in OpenLayers with which I would project the tiles properly from this imagery.    TransverseMercator   ellipsoidName=WGS84   equatorialRadius=6378137.0   inverseFlattening=298.257223563   falseEasting=500000.0   falseNorthing=0.0   origin=[latitude = 0.0 longitude = -117.0]   scale=0.9996      I apologize that I did not provide you with enough information. I do not understand how projections work and will appreciate any information that could lead me to a solution. Do not hesitate to tell me what other information would be useful.


How to create a map with states by attribute value?

I'm using Qgis, but I am quite familiar with R and python. So I could use any of these. I want a map of mexico but want to color the stats according to a certain variable. It goes from 0 to 100. So it would be like a heatmap of Mexico. What would be the best way to do this? I just have the names of the states and the corresponding value... I would therefore need an already made "empty" map with the states already defined or something... I'm also looking for it to be as pretty as possible :). Thank you!


How can I uninstall Quantum GIS that was installed using OSGeo?

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


Layer use too big for the coordinate in GE

I've got a problem here. I already changed the format from Tab file into Shp file using MapInfo suggested by friends here. My question is, after we set all the layer into the right coordinates, even using Google Earth to set the coordinates, but when added as a new layer, the size of the layer added seems bigger than the one in the google earth layer (meaning that the Google Earth layer is so small when it extent) How can I change the size of the layer so that the point in Google Earth matches the one with the layer added afterward? Do I need to re-size the layer or another way? Someone please help! Thank you... 1 ![enter image description here](http://i.stack.imgur.com/gnCfQ.png) My 1st layer capture from GE using mapwindow GIS 2 ![enter image description here](http://i.stack.imgur.com/V8dlx.png) I didn't click the full extend button yet. This is my 2nd layer and it shows the 2nd layer was purple in color were actually a mega size layer. i think around more than 50 times bigger than the first layer. 3 ![enter image description here](http://i.stack.imgur.com/WyCOq.png) This layer after full extend. and i cannot manage to find the 1st layer at all because it is too small. Q: How can I change the size of the 2nd layer so that it will be the same size as the first layer with the same coordinate?


Write spatial operations to PostGIS from QGIS or ArcGIS

I need to write my spatial operations to a (new) postgis layer (as the data is to large for a shp file). Can this be done in the QGIS browser or from ArcGIS without SDE? When you go (for example) --> vector--geoprocessing--clip or geometry-- multipart to singlepart you can only save to a shp format eventhough the input data is from postgis. I have tried the postgis manager and you can edit tables, import/export data but I can't see any way of writing the data to postgis directly. I have qgis lisboa and postgis 2.5 as well as arcgis advanced (10.1) but not ArcSDE. If necessary a python solution is fine (maybe using @dimitris response in Writing a plugin for Qgis using python to access PostGIS and write geometries === POSTGIS Attempt I am new to Postgis. So as a test I have run the following from http://postgis.net/docs/ST_Dump.html               SELECT (ST_Dump("LowRez_HighHz".the_geom)).geom AS the_geom          FROM        public."LowRez_HighHz";      It runs with the following output > Total query runtime: 68839 ms. 47591 rows retrieved. and then I get an output but has it really removed all the multiparts? I doesn't look like it's writing. So when I add the following               -- Break a compound curve into its constituent linestrings and circularstrings     SELECT ST_AsEWKT(a.geom), ST_HasArc(a.geom)       FROM ( SELECT (ST_Dump(p_geom)).geom AS geom              FROM (SELECT ST_GeomFromEWKT('COMPOUNDCURVE(CIRCULARSTRING(0 0, 1 1, 1 0),(1 0, 0 1))') AS p_geom) AS b             ) AS a;               st_asewkt          | st_hasarc     -----------------------------+----------      CIRCULARSTRING(0 0,1 1,1 0) | t      LINESTRING(1 0,0 1)         | f      I get > ERROR: syntax error at or near "st_asewkt" LINE 11:   >  st_asewkt | st_hasarc ^ > > _**_*** _**Error **_** _*_** > > ERROR: syntax error at or near "st_asewkt" SQL state: 42601 How do I correct this? The table details are ![enter image description here](http://i.stack.imgur.com/y2cV7.jpg) FROM http://www.bostongis.com/postgis_dump.snippet I also tried the following               SELECT "LowRez_HighHz", ST_Multi(ST_Collect(f.the_geom)) as singlegeom FROM (SELECT "LowRez_HighHz", (ST_Dump(the_geom)).geom As the_geom FROM "LowRez_HighHz" ) As f GROUP BY "LowRez_HighHz"      and I get > ERROR: out of memory DETAIL: Failed on request of size 15183219. > > _**_*** _**Error **_** _*_** > > ERROR: out of memory SQL state: 53200 Detail: Failed on request of size > 15183219. I have 16GB RAM and 1TB free space...what's happening? **=== Testing Micha's input** I can't seem to run the code in one go. I get > NOTICE: CREATE TABLE will create implicit sequence > "lowrez_highhz_single_gid_seq" for serial column "lowrez_highhz_single.gid" > ERROR: Table 'LowRez_HighHz_single' does not occur in the search_path > CONTEXT: SQL statement "SELECT AddGeometryColumn('','', $1 , $2 , $3 , $4 , > $5 )" PL/pgSQL function "addgeometrycolumn" line 4 at SQL statement But when I run               -- Create a new table     CREATE TABLE LowRez_HighHz_single (gid serial, Shape_Leng numeric, Shape_Area numeric);      It creates it as > NOTICE: CREATE TABLE will create implicit sequence > "lowrez_highhz_single_gid_seq" for serial column "lowrez_highhz_single.gid" > Query returned successfully with no result in 60 ms. When I then comment out the first line and add               -- Make it a spatial table     SELECT AddGeometryColumn('LowRez_HighHz_single','geom',4283,'POLYGON',2);      I get > ERROR: Table 'LowRez_HighHz_single' does not occur in the search_path > CONTEXT: SQL statement "SELECT AddGeometryColumn('','', $1 , $2 , $3 , $4 , > $5 )" PL/pgSQL function "addgeometrycolumn" line 4 at SQL statement What am I doing wrong? I also tried public."LowRez_HighHz_single" === Update on using all lower case. I tried it but fails...might be because the table has mixed case currently. ![enter image description here](http://i.stack.imgur.com/vdIyQ.jpg) the error code is > ERROR: relation "lowrez_highhz" does not exist SQL state: 42P01 Character: > 327 I also tried it on a dataset that is already all lowercase. ![enter image description here](http://i.stack.imgur.com/PCgZJ.jpg)


Is it possible to change the year range of time manager in QGIS?

I have a shapefile with a start and end time field, properly formatted. However my dates range from 1864-1995. When I try to use the shape file with the QGIS time manager plugin I keep getting this message: An error has occured while executing Python code:               Traceback (most recent call last):       File "C:/PROGRA~2/Quantum GIS Wroclaw/apps/qgis/./python/plugins\TimeManager        \timemanagerguicontrol.py", line 342, in updateTimeExtents         self.dock.horizontalTimeSlider.setMinimum(mktime(timeExtents[0].timetuple()))     ValueError: year out of range      I found that one limitation of time manager is: The range of manageable years is limited due to limitations in time.mktime. The exact range is platform dependent. Is there a way to find out what the exact range is or change it? When I tested a sample of my shapefile for 1977 and 1984 they worked fine. Thanks!


How to create something similar to GDB in QGIS?

I used to work with ArcGIS. There I had geodatabases in which I could store several shapefiles with defined layer styles. Is there a way to do something similar with QGIS? The background is: we are a team of 5-10 people, and would like to save all of our spatial data in one database, so that we can use them in different QGIS projects on several workstations, and when someone changes something it will be automatically updated in all projects. Before I started here, we had many different "local" shapes, and sometimes changes would effect other peoples' work without them getting to know the changes. Also it was quite comfortable that in ArcGIS you could just add a geodatabase to a project and then have dozens of shapes inserted at once, with defined layer styles. At the moment we are saving our shapefiles on a hard disk in our network, and have to add the shapes manually to our projects, but then we have to sort the shapes in different folders and adjust the layer styles manually every time.. Thanks in advance. Sorry for grammar mistakes, not a native speaker here ;)


pgRouting one way segment direction

How can one acquire information about direction of a one way road from OpenStreetMap data converted to a postresql database with osm2pgrouting?


Dividing a geographic region

I have a certain geographic region defined by the bottom left and top right coordinates. How can I divide this region into areas of 20x20km. I mean in practial the shape of the earth is not flat it's round. The bounding box is just an approximation. It's not even rectangular in actual sense. It's just an assumption. Lets say the bottomleft coordinate is given by x1,y1 and the topright coordinate is given by x2,y2, the length of x1 to x2 at y1 is different than that of the length between x1 to x2 at y2. How can I overcome this issue Actually, I have to create a spatial meshgrid for this region using matlab's meshgrid function. So that the grids are of area 20x20km.               meshgrid(x1:deltaY:x2,y1:deltaX:y2)      As you can see I can have only one deltaX and one deltaY. I want to choose deltaX and deltaY such that the increments create grid of size 20x20km. However this deltaX and deltaY are supposed to vary based upon the location. Any suggestions? I mean lets say deltaX=del1. Then distance between points (x1,y1) to (x1,y1+del1) is 20km. BUt when I measure the distance between points (x2,y1) to (x2, y1_del1) the distance is < 20km. The meshgrid function above does creates mesh. But the distances are not consistent. Any ideas how to overcome this issue? For finding point p(1,0)               deg = km2deg(20)          deg =              0.1799          >> reckon(25,-120,0.1799,-18)          ans =             25.1711 -120.0614      Function to calculate distance between two points               function [ distance ] = calculateDistance( latitude1,longitude1,latitude2,longitude2 )     radius = 6371;     dLat = degtorad(latitude2-latitude1);     dLon = degtorad(longitude2-longitude1);     a = sin(dLat/2) * sin(dLat/2) + cos(degtorad(latitude1)) * cos(degtorad(latitude2)) * sin(dLon/2) * sin(dLon/2);     c = 2 * atan2(sqrt(a), sqrt(1-a));     distance = radius * c;     end      Referring to whuber's suggestions               syms p(1,1).lat p(1,1).lon     solve ( calculateDistance(p(0,1).lat,p(0,1).lon,p(1,1).lat,p(1,1).lon), calculateDistance(p(1,0).lat,p(1,0).lon,p(1,1).lat,p(1,1).lon))


How to change the function of cost of osm2po?

As the column 'kmh' shows speed limits wrong for my city, and I didn't want to modify the configuration file of osm2po for each type of road, is there a way to change the cost function? I wish: cost= length and not cost= length/kmh


Coloring of features in ArcMap 10.1 changes randomly while zooming

I am using the sovereign states shapefile (ne_110m_admin_0_countries.zip) from http://www.naturalearthdata.com/ and joined the attributes with a spreadsheet file that codes many (but not all) country codes into 0,1,2, and 3. I would like to color each of these four codes with a different color using the Symbology->Unique Values tab, but the coloring is not correct. Furthermore, it seems to change randomly if I zoom in and out. The difference between the two screenshots is just the zoom level and you can see how the colors change. I had this problem several times already after joining tables, but I could never figure out the source of the problem. ![Screenshot 1](http://i.stack.imgur.com/CiGJo.png) ![Screenshot 2 with closer zoom and changed colors](http://i.stack.imgur.com/BlrEP.png)


Programmitcally Change Text Font for all Labels on MXD

I'd like to know if there is a way to change the text font for all layers and all label classes within a layer on a MXD. I use a font not often found on all computers for created maps. I love the font, but it becomes an issue when publishing or sharing MXD's. Usually before I share or publish a MXD I need to go through all the layers and set the font to be something found everywhere. Personally I'd like if the script auto found layers and label classes withing every layer in the TOC. I'm pretty good with python, but I haven't ever found a way to interact with the label's for a layer within ArcPy. Does anyone have an idea of how to due this?


Why does Append on large annotation layer give WARNING 000594: Input feature falls outside of output geometry domains?

I am trying to Append about 3,000,000 records in an annotation layer to another, empty annotation layer. I'm using ArcCatalog and I get the following error messages:               WARNING 000594: Input feature 4657048: falls outside of output geometry domains.     WARNING 000595: c:\temp\annotation.fid contains the full list of features not able to be copied.      Approximately 100,000 features do not transfer. I have:   * set the processing extent to Default and also Union of Inputs when running the Append tool   * tried running this tool in a Python script, all the records will transfer but most of the field values do not. At least some of the records that do not transfer are spatially in the midst of records that do transfer. Does anyone have some suggestions on how I can get all of the annotation records to transfer properly? Thanks & regards. ---- Update ----- When using the Append tool I set the schema type to test. Feel free to send along ideas, and I am going to try append the records in several pieces to see if that works. Thanks! **How did you create your empty annotation feature class?** I right clicked on my SDE database > new > feature class > annotation feature class **In particular what Coordinate System did you apply and how?** I applied the same coordinate system (State Plane Coordinate System, CA Zone V) as the annotation feature class I want to Append using the Import tool when I create the feature class.


Find duplicate vertices in SQL Server geometry line (ArcSDE)

I have a line in a ZM polyline featureclass that has a invalid geometry. My suspicion is that the line doubles back on itself somewhere, which I've found SQL Server doesn't like. Anyone know of a quick SQL method or query that could help me identify the suspect bad points that are jacking up my geometry? The string representation looks like this:               1835815.86 12887142.42 0 0, 1835816.72 12887142.68 170 170, 1835817.53 12887142.76 349.99 350, 1835817.52 12887142.76 559.99 560, 1835817.78 12887142.76 659.99 660, ....      Also, I'm wondering if I could use a regular expression and a look ahead and/or look behind to find duplicate numbers??


Convert shape file to KML on QGIS

I want to convert a shapefile to a kml using QGIS. When I do it, the output I obtain is without atributtes. And I want a similar product as it is provided by shape2kml of zonum solutions. Thanks in advance!!!


Get Country from GeoFeatureLayer

I'm currently using ArcGIS and I'm trying to create a basic application where I can click on a country and then get back information such as the shape, size, etc. I've looked at the code snippets and the documentation and up to date this is what I've come up with.               IPoint pt = new PointClass();     pt.X = e.X;      pt.Y = e.Y;          IGeoFeatureLayer layer = myMapControl.get_Layer(0) as IGeoFeatureLayer;     ESRI.ArcGIS.Geodatabase.IFeatureCursor cursor = GetAllFeaturesFromPointSearchInGeoFeatureLayer(1.0 , IPoint , layer , myMapControl.ActiveView)      So at this point I can click on the map, get the X,Y coords from the mouse - get the base layer from the map control and then get the FeatureCursor. Looking at the cursor info I do see things like CNTRY_NAME but nothing else of use. Am I going about this in the totally wrong direction? I've looked at http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html quite a bit lately in addition to this site, but I'm coming up blank.


Forest portals in the context of GIS and maps

Do you know any portals connected with forests and forestry in the context of GIS and maps? The best for me will be portals where the data is served via WMS, WFS or WCS services. The only portals i know are from Poland: Regional Directorate of State Forests in Krakov Regional Directorate of State Forests in Zielona Góra I found a new one- it is the map of nature conservation in the forests of north-eastern Polish


3D snapping in open source platforms

I'm looking for tools and extensions in open source platforms (gvSIG, QGIS, uDig, etc) that allows 3D snapping. In the last years, most of the projects my company is working on required the editing of 2.5D cartography. 3D snapping is a crucial feature for these projects. And the designers fell more comfortable using CAD tools (like Microstation Geographics) for digitalizing and editing on this projects. ArcGis 9.3 with a 3D snap plugin is used in the second half of the editing part (soon will use ArcGis 10). Now my company wants to start working with open source platforms (hooray!), and the 3D snapping seems to be one of the main holes in the open source GIS platforms. Do you know anything could be useful on this subject? Tools, extensions, initiatives, etc.


Where is the Heatmap Plugin

I have read the questions about creating heatmaps but I cannot find the Heatmap Plugin in any of the repositories or using the fetch python plugins, it simply is not there. Could someone please tell me how to install it.


Looking for a trajectory similarity measure

For my final academic work I have developed a compression algorithm for GPS trajectories. I can estimate the quality of the spatio-temporal compression by computing the syncronized euclidean distance (SED) between the compressed and the original trajectory and evaluate my algorithm's performance against a well-known compression algorithm. A spatio-temporal algorithm, like mine, reduces the trajectory trying to maintain as much temporal information as possible. Spatial algorithms (e.g. Douglas-Peucker algorithm) realize the compression referring only to the spatial characteristics. What happens now? Considering a spatio-temporal aspect, my algorithm is better than DP. I can assure this by SED measurements. If I plot the three trajectories (original, mine and DP compressed), the trajectory compressed with DP has a better fitting with the original trajectory. The eye-only measurements don't satisfy my need: I need, indeed, an error metric that numerically demonstrates how the DP algorithm is better than mine in a spatial manner. So I could write: "Referring to the spatio-temporal factor, my algorithm is better than DP, because it has an SED factor less than DP's SED factor. Alas, simple spatial factor awards DP algorithm because its (name of the new metric) is better than mine". I have been thinking of perpendicular euclidean distance, but I really don't know if this could be useful. Dynamic Time Warping? What metric could I use for this?


align tool on Arcview 3.2 Window Seven missing

after following the necessary procedure to install arcview 3.2 on my windows seven... I activated all extensions on including the spatial tool, make it as default, then applied. But i still got an error saying that some spatial... script is missing. hence i dont see the align tool on the toolbar. i guess this tool is used to enter co-ordinate or georeferencing based on the online tutorial have been watching. Pls how can i overcome this error


Why are some features missing from Raster menu in QGIS for linux?

I am running QGIS 1.8 in Ubuntu/Linux (13.04), with GDAL 1.10 installed. There seem to be features missing from GDAL tools that are present in Windows version. For example, I can't find Rasterize or Contour options in the menue, and Clipper only has "extent" option - no "mask to layer", which is what I need! Am I missing something? How do I get these additional functions? Thanks


How to render a transparent raster layer on top of one or more vector layers with PyQgis?

I been trying to render a map with a 3 vector layers and one raster layer. The idea is that the raster layer should be on top of the other 3 vector layers. The problem is that even when I add the transparency parameters to the Raster Layer I can't visualize the vector layers. In other words, the Raster Layer completely covers the area.               #!/usr/bin/python     # -*- coding: utf-8 -*-     from qgis.core import *     from qgis.gui import *     from qgis.utils import *          from PyQt4.QtCore import *     from PyQt4.QtGui import *     from PyQt4.QtCore import QFileInfo, QSettings               QgsApplication.setPrefixPath("/usr", True)          QgsApplication.initQgis()          # raster layer     filename = "points.png"     file_info = QFileInfo(filename)     base_name = file_info.baseName()          l_raster = QgsRasterLayer(filename, base_name)     l_raster.setCrs( QgsCoordinateReferenceSystem(4326, QgsCoordinateReferenceSystem.EpsgCrsId) )     l_raster.setTransparency(20)           l_a = QgsVectorLayer("a.MIF", "Layer A", "ogr")     l_b = QgsVectorLayer("b.MIF", "Layer B", "ogr")     l_c  = QgsVectorLayer("c.MIF", "Layer C", "ogr")          if not l_raster.isValid():       print "Raster Layer failed to load!"            if not l_a.isValid():       print "A Layer failed to load!"          if not l_b.isValid():       print "B Layer failed to load!"          if not l_c.isValid():       print "C Layer failed to load!"            QgsMapLayerRegistry.instance().addMapLayer(l_raster)     QgsMapLayerRegistry.instance().addMapLayer(l_a)     QgsMapLayerRegistry.instance().addMapLayer(l_b)     QgsMapLayerRegistry.instance().addMapLayer(l_c)          # create image     img = QImage(QSize(800,600), QImage.Format_ARGB32_Premultiplied)          # set image's background color     color = QColor(255,255,255)     img.fill(color.rgb())          # create painter     p = QPainter()     p.begin(img)     p.setRenderHint(QPainter.Antialiasing)          render = QgsMapRenderer()          # set layer set     # add ID of every layer     lst = [l_raster.getLayerID(), l_a.getLayerID(),  l_b.getLayerID(), l_c.getLayerID()]       render.setLayerSet(lst)          # set extent     rect = QgsRectangle(render.fullExtent())     rect.scale(1)     render.setExtent(rect)          # set output size     render.setOutputSize(img.size(), img.logicalDpiX())          # do the rendering     render.render(p)          p.end()          # save image     img.save("render.png","png")          QgsApplication.exitQgis()


Reverse querying

Is it possible to run a reverse query? In other words, I have a master shapefile and a derived shapefile containing data extracted from the master file, but don't know what criteria the extraction was based on. Is there a tool or process that will tell how the master shapefile was queried to produce the derived shapefile?


Writing shapefile metadata (shp.xml) programmatically

I want to write the Metadata for a Shapefile, which are saved in the ".shp.xml"-File. I know, I can look at and write those Metadata with ArcCatalog, but I want to do this programmatically. Is this possible with c# and arcobjects? Or do I have to write directly to the XML-File parsing the Content? If that's the case how can I create the "shp.xml"-File? I have a bundle of Shapefiles, which do not have this File. So maybe I could create the shp.xml-File and write to it using XElement or something like this ...   Do you have any suggestions, how to solve this Problem?   I use ArcGIS 10.1.


With QGIS, how can I create a layer from a .csv file?

I have a .csv file with ~16k points with lat and long to plot onto a map. I'm completely new to both QGIS and GIS in general and have got to a point where I have downloaded the OpenLayers and Georeferencer plugins and have a raster satellite image, but my data points are all collected off the coast of Africa at a much smaller scale than the map itself. However, when I try to use the Georeferencer plugin it only lets me add a raster image from my local files (unless there is an option I haven't seen), yet the image I am using is from a plugin; I'm not sure if there is any way of finding it from my home directory to load it into the Georeferencer. How do I georeference a map loaded with OpenLayers?


Qgis - raster values become integer when Polygonizing

When using the GDAL plugin, "Polygonize (raster to vector)" any values in the resulting vector layer is truncated to integer. I have a raster showing windspeeds in squares of 500*500 meters, in the metadata-field i read that the lowest value is 2.5899999142 and the highest value is 12.6599998474. Then when polygonizeing, the result layer only has values: 0, 1, 2, 3... and so on. No decimals. I have googled the issue and found this: http://trac.osgeo.org/postgis/ticket/650 Don't know if it helps though.


How can I use WFS from Geoserver with OpenLayers 3?

I have tried with different setups and formats, but no success. With firebug, I can see that the json data is loaded, but nothing shows up on the map. Have anyone experience with geoserver and wfs in openlayers 3?               var layer_ojd_vector = new ol.layer.Vector({      source: new ol.source.Vector({       parser: new ol.parser.GeoJSON(),       url: http://SERVER:8080/geoserver/NS/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=NS:LAYER&maxFeatures=50&outputFormat=json      }),      style: new ol.style.Style({rules: [       new ol.style.Rule({        filter: 'geometryType("point")',        symbolizers: [          new ol.style.Shape({            fillColor: '#013',            size: 40          })        ]      })     ]})       });


arcpy.mapping.Layer error when working with files over multiple dataframes

I can get the following code to run in an mxd with a single dataframe. I need it, however, to run and loop through an mxd that has multiple dataframes with identically named files and data sources to those in my lyrlist. EDIT **Additional Info** - The intent of the last if statement was to provide a workaround for the inability of arcpy to set the Display Expression in the layer properties dialog by re-adding a file with a name field. So, the crux of the question is how best to update a layers Display Expression in an automated a way as possible (preferably with python as I have no familiarity with ArcObjects).               import arcpy     lyrlist = ['Inset Bridges','Bridges', 'Transportation Points', 'Transportation Lines']     mxd = arcpy.mapping.MapDocument("Current")     dflist = arcpy.mapping.ListDataFrames(mxd)     for df in dflist:        if df.scale <= 126720:           for lyr in (arcpy.mapping.ListLayers(mxd, "", df)):              if lyr.supports("DEFINITIONQUERY"):                 if lyr.name in lyrlist:                     NewFile = arcpy.mapping.Layer(lyr.dataSource)                     OldFN = lyr.name                     NewFile.name ="NewFi"                     lyr.name = "OldFi"                     arcpy.mapping.InsertLayer(df, lyr, NewFile, "AFTER")                     #the following line results in the ValueError when run in an                     #mxd that has multiple dataframes with filenames from lyrlist                     updateLyr = arcpy.mapping.Layer("NewFi")                     sourceLyr = arcpy.mapping.Layer("OldFi")                     arcpy.mapping.UpdateLayer(df, updateLyr, sourceLyr, True)                     updateLyr.name = OldFN                     arcpy.mapping.RemoveLayer(df, lyr)     arcpy.RefreshTOC()     arcpy.RefreshActiveView     print "script complete"     del mxd      The code works well until it gets to the where I assign the updateLyr variable. That gives me the following error: > Runtime error Traceback (most recent call last): > > File "", line 44, in > > File "c:\program files > (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects\mixins.py", line 389, in > **init** super(LayerMixin, self). **init** (lyrfile) > > File "c:\program files > (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects_base.py", line 47, in > **init** for arg in args)) > > ValueError: Object: CreateObject Layer invalid data source


Can't send an array via Protocol.HTTP()

I'm trying to send a JSON file to my Node.js app via Protocol.HTTP. The file is correctly sent, but I can't access to an array. Here is the relevant code : Client side               (...)         var vectorProtocol = new OpenLayers.Protocol.HTTP({                         url: '/getcoords',                         format: vectorFormat,                         readWithPOST: true,                         params: {                             "code_company": "8501",                             "data_company": [                                 {                                     "origin": "2013P00109",                                     "type": "LJ",                                     "naf": "5610A",                                 },                                 {                                     "origin": "2013P00110",                                     "type": "FJ",                                     "naf": "5481"                                 }                             ]                         }                     });     (...)      Server side, I try to build an array with only the "origin" field of my array "data_company":               function getCoords(params, callback) {           var arrOrigin = params.data_company.map(function(d) {              return d.origin;           });           (...)     }      And I get this error : > TypeError: Object [object Object] has no method "map" It seems that my "data_company" array is not parsed. Is there a reason for that ? And a workaround ? Thanks


How to generate a DEM from a contour Shapefile?

I want to create a DEM from depth contours (shapefile) in QGIS. I've been trying to work out how to do this based on this previous question, notably from this link from that page, however I'm stuck, and was hoping someone could help. My progress/process so far:   1. open new map in QGIS, import the contour shapefile   2. set GRASS extent, set new GRASS mapfile, etc   3. try to 'import' the shapefile into grass by converting it into a grass file, based on a hunch from the wording in this page (search in page: 'use of qgis and grass'): file management, import into grass, import vector into grass, import loaded vector (v.in.ogr.qgis), then view output. This creates an identical looking layer.   4. try to use r.surf.contour on this - doesn't allow layer to be selected.   5. try to use r.surf.contour2 on this - either crashes QGIS or produces a full block of colour. Any thoughts/tips on what I should be doing differently? * * * Update: Interpolation failing, tried everything in GRASS & in GRASS plugin, failed, could problem be due to source shapefile? Something I learnt from elsewhere was 'geometry tools > check geometry validity' which I ran on the contour shapefile and it found loads of errors. I'm wondering if this could be the reason that all my efforts to create a DEM are failing? Would anyone do me the huge favour of having a look at my shapefile to see if I'm just being useless, or if it's a problem that a relative novice would be excused for not anticipating? Thanks in advance!


Efficiently identifying overlapping polygons with Python

I'm parsing the NOAA severe weather alert feed and using it as a datasource for a weather alerting system. In the feed, I occasionally find a polygon entry for an alert. Unfortunately, counties that fall under these polygons are not always identified in the FIPS/UGC codes section of the alert. In cases where I come across a polygon entry, I need to interate over all my county polygons to make sure all counties potentially affected by weather are included in my output. Here's an example of a polygon entry from today:               <cap:polygon>41.38,-97.93 41.40,-97.81 41.45,-97.69 41.40,-97.69 41.36,-97.92 41.38,-97.93</cap:polygon>      With 3200+ US County polygons that I have stored, I need to find the most efficient way of iterating over them and comparing the county polygon with the alert polygon to see if they overlap. (I'm not sure if I'm looking for overlap, intersection, or union?) Does anyone have suggestions on the best way, using Python, to compare a polygon against a list of polygons to identify areas that overlap?


Problem connecting to localhost PostGIS

When I try to connect to a small localhost PostGIS database using QGIS, I get the error message: FATAL: no pg_hba.conf for host "fe80::4528:3236:418a9e7b%10" user "postgres", database "nyc", SSL off The file pg_hba.conf contains               # TYPE  DATABASE        USER            ADDRESS                 METHOD          # IPv4 local connections:     host    all             all             127.0.0.1/32            md5     # IPv6 local connections:     host    all             all             ::1/128                 md5     # Allow replication connections from localhost, by a user with the     # replication privilege.     #host    replication     postgres        127.0.0.1/32            md5     #host    replication     postgres        ::1/128                 md5      I can connect just fine using pgAdmin. I noticed that a few others have asked similar questions here, but I can´t find a solution using localhost. Any suggestions on what to try? QGIS 1.8.0 and PostgreSQL 9.2/PostGIS 2 on Win Vista 64 bit. ![PostGIS Connection](http://i.stack.imgur.com/FECia.jpg)


How does Mbtiles store raw image data in the tile_data field?

Looking at the MBtiles spec, the tile_data field of the tiles table is just a blob of a tile image. With this information, I expected to be able to take a data URI, string it of everything except the base64 encoded string, and decode it for storage in the tile_data field. For instance:               var dataURI = "data:image/jpeg;base64,[some_encoded_data]";     var unencodedBytes;     if (dataURI.split(',')[0].indexOf('base64') >= 0) {         unencodedBytes = atob(image.split(',')[1]);     } else {         unencodedBytes = unescape(dataURI.split(',')[1]);     }      At this point, my unencodedBytes variable should have raw jpeg image data, and as such, I should be able to insert it into a tile_data field, correct? Is there an additional step I need to take? The data looks like belongs there, based off my observations of other valid mbtiles files, however all the mbtiles viewers I try to view this either do not show the data, or say they cannot figure out what type of data it is (jpeg or png). What am I doing wrong? This is all being run in javascript in a browser, and I am using WebSQL to create the mbtiles file, since it is (supposedly) compatible. Thanks in advance


Desktop client symbolozing a WMS layer by sending SLD to the WMS server?

Objective is simple: finding 'desktop software' (such as ArcGIS, QGIS, etc) that can load a WMS layer, and then send its own SLD to apply to the WMS server in order to get the WMS layer back with the end-user specified symbology. I haven't found any desktop client that can do that. Any clue? I am looking for desktop software that can be easily used by non-developers. This software would created SLD, send it to the WMS server and then display the resulting WMS layer with the SLD applied. I know QGIS 1.8.0 can load/save layers in SLD and that there are plugins expanding SLD capabilities, but I haven't found any way yet to change the symbology of a WMS layer from within QGIS. Thanks! -- Alex Related questions (which don't answer my specific question):   How to style a WMS layer?   Is it possilbe to change SLD from client side?


How to generate xml for use with geoxml3

I have a kml and shp I would like to convert to an xml to use with geoxml3. How would I go about doing such a thing? The xml I generate should look something like this:               <?xml version="1.0" encoding="UTF-8"?>     <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"     xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">     <Document>     <name>Districts</name>


Assigning Raster Value to Point Data

I have a large raster layer with wind speed values assigned to each cell. I also have point data that displays locations where wind farms have been constructed. I would like to add the raster values to the wind farm location data. The goal is to figure out when each wind farm was built over each wind speed value. Any ideas? Thanks


Image does not display after clipping raster

I am using ArcGIS 10. I am trying to clip an NLCD layer from a vector polygon. I have used the Clip Raster tool in Data Management and Extract by Mask tool in Spatial Analyst among other things. My problem is that the processing completes without an error message but the image does not appear. I have zoomed to the layer and I have also checked in ArcCatalog.


how can I obtain the areas where my rasters overlap, using Qgis?

I have a bunch of raster files showing the distribution of different species of mammals, and I would like to obtain the areas where they overlap, the areas in whitch more than one species can be found


Using Google Maps with OpenLayers for some zoom levels

I've had a search on here to see if this has come up but I've not found anything, sorry if this is a duplicate. I'm trying to use the Google Maps layers with an OpenLayers site, but not for all zoom levels. What I want to do is use the NASA global mosaic from my own map server (which works) but once I'm zoomed in far enough, switch to Google for lower level imagery from them. So far I've set Google as a base layer and used my own tiles as an overlay, but doing this means a request to google for all the zoom levels that are covered by my tiles. It seems wasteful to get tile data from google which will never be visible to the user. What I want to do is limit the available zoom levels for the Google Layer to those zoom levels that are not covered by NASA, while not restricting the zoom levels available to the map as a whole. My best guess was to create a dummy base layer covering the correct resolutions and zoom levels, and set a restricted set of Google as an overlay, but this is proving very difficult. Any pointers would be much appreciated. Thanks.


Is there a way to replace just a specific character in a variable?

Here is an example township = township[3].replace("0", "") My goal being that if 10.0 is the current value for township I want to remove the zero after the . but not the one after the 1 with the end result being 10. The code above doesn't seem to work.


Network Analyst: How to sum cost attributes without length with closest facility tool

I am working on Safe Routes to School, and have created a network dataset. Each segment of the newtork has a 'walk_score' assinged (0,1,3,5,10), based upon street classification and sidwalk condition. I am using the Closest Facility tool, and have set Impedance and the Accumulation to use the 'walk_score' (together & seperately). However, it appears it is taking the score and dividing it by the route length, instead of simply adding the total. Am I missing something? Is there a way to get the sum for each route? Thank you


GeoNetwork: How to reset the admin password?

I am unable to log on with the admin account to a certain GeoNetwork instance, but I do not recall ever changing the password. How can I reset (or change) the admin password without logging on to the web interface?


Separating distinct lines in PostGIS

I have a table of linestring segments in Postgis. These segments make up distinct non-intersecting lines as shown by the diagram. To add confusion the direction of the linestrings are not uniform. I want to create a simple set of linestrings that are uniformly joined in a single direction, this will enable me to shorten them if required using ST_LineInterpolate(). So, looking at the diagram you can see three lines which is what I want to get out of the query. I tried a recursive query but this ran forever on a table of only 10 linestrings:-               WITH RECURSIVE line_join(ogc_fid,wkb_geometry) AS (           SELECT ogc_fid, wkb_geometry FROM TABLE.tll_lines_selected WHERE ogc_fid=47     UNION ALL          SELECT n.ogc_fid, n.wkb_geometry FROM TABLE.tll_lines_selected n, line_join lj          WHERE ST_Intersects(n.wkb_geometry,lj.wkb_geometry)          ) SELECT ogc_fid FROM line_join;      Therefore I think something is not right. Is there a better strategy? ![enter image description here](http://i.stack.imgur.com/fEgf2.png)


In ArcMap, when using Add Surface Information, why are all avg_slope values positive?

I've got a polyline shapefile and a LIDAR elevation dataset. I've successfully used Add Surface Information (from 3D Analyst) to calculate the average slope (avg_slope) of each line segment. The problem is that all values are positive, no matter if the line is heading downhill or uphill. I've checked the geometry of the line segments to ensure that the starting points of the segments I believe are heading downhill are indeed at a higher elevation than the end points...and they are. When building a contour graph using the spatial analyst, it tells me the slope is downhill. I'm working with a large set of lines, and I don't want to manually check each segment to see if it should have a positive (uphill) or negative (downhill) slope value. So,   1. why doesn't this tool assign negative values for downhill lines, and    2. what is an automatable process that will compute downhill segments as having negative slope values? An alternative way of stating the question is: if a polyline had a segment running from point A (elevation 200 ft) to point B (elevation 100 ft) and another segment running back from point B to point A, the Add Surface Information tool would return the exact same value for avg_slope, when one should be positive (B to A, going uphill) and one should be negative (A to B, going downhill). How do I achieve this result?


Is there a programmatic way to swap attributes on a feature?

I am still pretty new to python (and programming for that matter) but I believe there must be an easier way to do a certain task. My task is to flip road centerline directions. The centerlines have address ranges in the attributes, and I need to flip them, from left to right. _Basically I am swapping the value of some attributes_. Is that something I could accomplish with some scripting? I have a Python book on my desk that I've been reading through. I'm eager to tackle new problems with code.


Mismatch in area calculation using Field Calculator vs Group Stats in QGIS 2.0

I have two polygon files (A being my area of interest and B being a categorised land cover layer). Both layers were in the same projection (projected and not geographic). Using QGIS 2.0, I used the Intersect tool (Vector > Geoprocessing tools > Intersect) to extract and pair the information from my land cover layer (layer B) to my area of interest (layer A). I then opened the attribute table for my newly created layer and enabled editing. A new column was made (using a decimal field type) and I then used the Field Calculator to calculate the area for each of my table rows. The "preview output" at the bottom of the Field calculator showed a realistic number. However, when I clicked ok the resulting output was generally nonsensical with illogical values produced. I then toggled editing and saved the values. Then using the Group Stats plugin, I used my intersected layer but used the plugin to calculate the area of my intersected attributes and it produced the correct answer. Apologies for the long-winded description but can someone tell me why the area calculation using the Field Calculator failed to produce the correct answers? As I said, both layers were projected and matched the projection projection so I don't see this being a projection issue.


What is Python equivalent of ModelBuilder's Iterate Feature Selection?

My data consists of two featureclasses:   1. Points = points representing trees   2. Polygons = Polygons representing % canopy area by area. Each polygon in the FC has a % canopy measurement in the attributes. I am trying to accomplish the following:   1. Select points underneath polygon features   2. For the points under each polygon, delete X% of the points based on the polygon attribute The screenshot (Figure 1) shows a ModelBuilder only tool called Iterate Feature Selection. **What is the correct Python scripting method to iterate through features in a feature class in order to pass the feature off to the SelectLayerByLocation_management command?** Figure 2 shows the output of the select by location. All 4 layers are the same, which will be a problem when I try and delete points by the canopy % measurement. This is what I have tried so far:               import arcpy     from arcpy import env          env.overwriteOutput = True     env.workspace = r'C:\temp_model_data\OutputData'     outWorkspace = env.workspace          # The polygons have canopy % data in attributes     polygons = r'C:\temp_model_data\CanopyPercentages.shp'     points = r'C:\temp_model_data\points_20_2012.shp'          if arcpy.Exists("pointsLayer"):         print "pointsLayer exists already"     else:         arcpy.MakeFeatureLayer_management (points, "pointsLayer")         print "pointsLayer created"          count = 1          #Create a search cursor to step through the polygon features     polys = arcpy.da.SearchCursor(polygons, ["OID@", "SHAPE@"])          for poly in polys:              # Create a name for the polygon features         count = count + 1         featureName = "polygon_" + str(count)         print featureName              # Select points that lie under polygons         arcpy.SelectLayerByLocation_management('pointsLayer', 'intersect', polygons)         arcpy.SaveToLayerFile_management('pointsLayer', outWorkspace + featureName + ".lyr", "ABSOLUTE")              # Add the random point selection script here...              # Delete selected points within each polygon based on the % canopy cover...      **Figure 1** ![enter image description here](http://i.stack.imgur.com/OPsHU.jpg) **Figure 2** ![enter image description here](http://i.stack.imgur.com/cePSK.jpg)


How to do regression analysis out-of-memory on a set of large rasters in R?

I am trying to do a regression analysis on a set of large rasters (254,004,000 cells each). Ultimately, I want to run something like the following (or a bit more complex, but let's start simple!): model<-lm(dv ~ iv1+iv2+iv3... data=df,na.action=na.exclude) where "dv" is the values from one raster and "iv1", "iv2" "iv3" ... are values from other rasters (up to 10 variables) with the same extent and resolution. It seems I should be able to do this out-of-memory using the Raster package, but I am confused how. Whether I create a brick, stack, or set of individual Raster objects, I cannot figure out how to send the variables to the lm function without using getValues and thus calling everything into memory (mine cannot even handle two variables). A point in the right direction would be much appreciated!


ogr2ogr specify lat/long order on conversion to GeoJSON

When using `ogr2ogr` to convert a polyon from a `.shp` file to `GeoJSON`, I noticed that it writes the coordinates in order lat, long. I noticed this because whenever I tried to view the `GeoJSON` on a map, it would place the polygon in the middle of nowhere; I then read a bit more about `GeoJSON` and realized that the format requires the `(x,y,z)` order `(long,lat,altitude)` [source]. Is there a way for me to specify that ogr2ogr should write the GeoJSON in that order? Or is there any other way for me to get around this problem? I'm 100% open to the possibility that I'm misunderstanding GeoJSON and that it doesn't actually have to be in long,lat,altitude order.


seeking "Available Sky" implementations

I'm looking for implementations of an algorithm called "Available Sky". ArcGIS (Spatial Analyst or GRID) is preferred, but solutions in GDAL, SAGA GIS or others are perfectly acceptable. The description I have is _"a method to quantify the influence of terrain on GPS radiocollar performance by creating a variable called "Available Sky" (Rodgers et al. 1997). ...`AS` is the proportion of sky available to GPS radiocollar through direct line of site in all directions and at all angles without terrain obstructions (disregarding forest cover). ... locations on mountain tops have high AS values ... conversly locations in valley bottoms are low due to mountain ridges on either sides [lateral obstructions]"_ -- paraphrased from 'GPS radiotelemetry error and bias in mountainous terrain', Robert G. D'Eon, Robert Serrouya, Graham Smith, Christopher O. Kochanny; Wildlife Society Bulletin 2002. The paper goes on to describe, in outline only, a process of comparing a base elevation model with a coarser "sky" raster set x100m higher than the highest point of the dem. The process is to calculate direct line of sight for each dem point to each Sky point, arriving at an _`AS` value is the proportion of the total number of sky points visible from that location._


Adding bullet points to text boxes

I need to be able to add bullet points to a text box so I can display a list on my map. The work-around that I tried was to format the font differently and use a Wingdings character that looks like a bullet point. This will work in the meantime, but instead of a top-to-bottom centered dot, the dot was situated more to the top. It will work if need be, but I thought maybe someone else might have encountered the same problem. Any suggestions would be helpful. Using 10.0 desktop


GeoNetwork: Exception when deployed to Tomcat 7

I deployed GeoNetwork 2.10 to a Tomcat 7 instance, replacing the ROOT application. GeoNetwork is accessible from the command line, returning the usual HTML message requiring JavaScript. But when it is accessed with a graphical web browser it sends back the exception below. The various log files reporting exactly the same without adding any further information. Any clues on what may be causing this exception are welcome. > **type** Exception report > > **message** > > **description** The server encountered an internal error () that prevented > it from fulfilling this request. > > **exception** > > javax.servlet.ServletException: Exception raised > jeeves.server.JeevesEngine.init(JeevesEngine.java:236) > jeeves.server.sources.http.JeevesServlet.init(JeevesServlet.java:91) > javax.servlet.GenericServlet.init(GenericServlet.java:160) > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) > org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) > org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) > org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309) > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > java.lang.Thread.run(Thread.java:701) > > **root cause** > > java.lang.StringIndexOutOfBoundsException: String index out of range: -1 > java.lang.String.substring(String.java:1949) > java.lang.String.substring(String.java:1916) > jeeves.monitor.MonitorManager.(MonitorManager.java:76) > jeeves.server.JeevesEngine.init(JeevesEngine.java:141) > jeeves.server.sources.http.JeevesServlet.init(JeevesServlet.java:91) > javax.servlet.GenericServlet.init(GenericServlet.java:160) > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) > org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) > org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) > org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309) > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > java.lang.Thread.run(Thread.java:701) > > **note** The full stack trace of the root cause is available in the Apache > Tomcat/7.0.26 logs. **Update** : Following Délawen's answer, this is now issue 443 at GitHub. For now I will leave this question marked as unanswered.


How to Install GRASS Addons to use in QGIS

WIN 7 QGIS 1.8.0 GRASS 6.3.4 I want to use r.viewshed in QGIS. therefore i want to install it in GRASS by using the GRASS interface. Followin Error appears. g.extension.py extension=r.viewshed svnurl=https://svn.osgeo.org/grass/grass- addons/grass6/ Downloading precompiled GRASS Addons (r.viewshed)... ERROR: GRASS Addons (r.viewshed) not found (Wed Oct 02 10:51:24 2013) Befehl ausgeführt (1 Sek) thank you


How to select all values by default in arcgis tool's multivalue parameter using python?

I am using ArcGIS 10.2 and have three parameters, Feature class, field and a multivalue parameter respectively in ArcGIS tool. I populate multivalue parameter with unique values of feature class on selection of feature class and field. Here is the code snippet:               def updateParameters(self):              if self.params[0].value and self.params[1].value:             fc = str(self.params[0].value)             col = str(self.params[1].value)             self.params[2].filter.list = sorted(                                              set(                                                  row[0] for row in arcpy.da.SearchCursor(fc, [col]) if row[0]                                                 )                                                )      By default, none of the value is checked in the tool. ![Unselected values](http://i.stack.imgur.com/x37uR.png) How can I check all values of multivalue parameter through **ToolValidation class** using python 2.7? ![All selected](http://i.stack.imgur.com/Vsko6.png)


where to perform principal components analysis and tasseled cap transformation

I want to perform a principal components analysis (pca) and a tasseled cap transformation (tasscap) for a classification.Should i perform pca and tasscap on the original bands of my image or on the corrected (topographic and atmospheric correction)bands?


Any ideas to display SLD TextSymbolizer property in Open Layers

I'm trying to display the SLD TextSymbolizer property for a vector layer in Open Layers but i found that ít's not supported. Has anyone ever dealt with this issue? I found these links but I have not ideas about how to implement them http://trac.osgeo.org/openlayers/ticket/1542 http://trac.osgeo.org/openlayers/ticket/2816 Many thanks,


Basemap issues in ArcGIS 10

I am using ArcGIS 10 and using street basemap in arcmap. there are places where the basemap doesn't show up smooth. Tiles does not appear in the uniform size. any helps will be appreciated. ![basemap tiles in non-uniform size](http://i.stack.imgur.com/LG1uV.jpg)


How do I link OGR with spatialite?

**Problem & Evidence:**   I'm trying to create a spatialite file with the code snippet below. However the outDataSource object gets assigned NoneType and all subsequent (unshown) code fails. I'm thinking the problem is with the spatialite installation for two reasons: 1) When I choose 'ESRI Shapefile' as the driver and leave out the options=['SPATIALITE=yes'] the outDataSource is created correctly and all subsequent codes works as anticipated. 2) When I leave the driver as 'SQLite' but take out the options=['SPATIALITE=yes'], the non-spatial sqlite tables are indeed created. So, any ideas on what I am missing or might have done incorrectly to establish the link between OGR and spatialite? **Environment:**   I'm developing on Spyder 2.3.0rc, with Python 2.7.7 32bits, Qt 4.8.6, PyQt4 (API v2) 4.10.4 on Windows, as delivered by the Anaconda-2.0.1-Windows-x86 executable. Additionally, the development comments at the end of the code describe the steps I took to install spatialite. **Code:**               # standard modules     import os          # third party modules     from osgeo import ogr               ##############################################################################     # create a new spatialite output file     ##############################################################################          outputGridfn = os.path.join(os.getcwd(), 'grid.sqlite')     outDriver = ogr.GetDriverByName('SQLite')     outDataSource = outDriver.CreateDataSource(outputGridfn,                                                options=['SPATIALITE=yes'])               ##############################################################################     # Development notes     ##############################################################################          # SPATIALITE functionality requires the following work     # Step 0: Download DLL's from     # latuviitta.org/documents/Spatialite_4.0_test_with_jre_1.6.zip     # Step 1: Unzip and copy the spatialite DLL into the Python DLL library          # Recompile the sqlite3 DLL from the amalgamation as follows     # Step 0: Add '#define SQLITE_ENABLE_RTREE' to the sqlite3.c file     # Step 1: gcc -c sqlite3.c     # Step 2: gcc -shared -o sqlite3.dll sqlite3.o     # Step 3: Place the DLL in the python DLL library          # Add libgeo-3-3-1.dll to python DLL library


Evaluating map projection scale error

This is related to a previous question I posted. I am trying to quantitatively evaluate scale distortion associated with choosing different projection center, center azimuth, and scale factor values for a Hotine Oblique Mercator (HOM). **1)** Is the following method a reasonable approach?: Using the same concept as the spreadsheet whuber created for evaluating Albers scale distortion, create a spreadsheet filled with Snyder’s equations for the HOM (ellipsoid formula, “alternative B”, page 74 in “Map Projections – A Working Manual”). The user inputs the chosen ellipsoid parameters (a and e), and values for the "customized" projection parameters (lat/long of projection center, centerline azimuth, scale factor, and false easting/northing). The rest of the projection constants are then automatically calculated. The spreadsheet also contains cells for each lat/long pair (in half-degree increments, or whatever increments are desired) across the projection area. The scale factor and rectified coordinates at each lat/long point are automatically calculated when changing any of the projection parameters. Now, the scale factor can be numerically evaluated 1) by computing an overall average and range of scale distortion across the projection region, and 2) the point coordinates and their associated scale factors can easily be imported into ArcMap to create a visual picture of how the scale distortion is distributed. Obviously the results are just a sample and will vary depending on how many lat/long locations are evaluated, but does this sound like a valid methodology? Spreadsheet looks like this: ![Example of HOM scale error spreadsheet](http://i.stack.imgur.com/NbVGY.jpg) **2)** I've also been using a distortion analysis tool created by Michael Braymen that calculates scale (and area and angular) distortion for any given projection using an "asterisk analysis" that approximates a Tissot's Indicatrix. The tool's Python script can be viewed or there is a also Powerpoint available that describes the tool. I have modified the script to create 50 meter asterisk lines (i.e., a 50 meter ellipse "radius"), instead of the default 5000m. When I compare the results from this tool against what is produced by the spreadsheet method in #1 above, the numbers do not agree very well. For example: Sampling approximately the same number of locations (~400) across the same projection extents yields: > **Avg Scale Error using method under #1 above =** 0.9997200465 (0.027995%)   >  **Max "compression" scale error, Method 1 =** 0.9994254755 (0.057452%)   >  **Max "expansion" scale error, Method 1 =** 1.0006580056 (0.065801%)   >  **Range scale error, Method 1 =** 0.0012325301 (0.123253%) > > **Avg Scale Error using method under #2 above =** 1.0001550206 (0.015502%)   >  **Max "compression" scale error, Method 2 =** 0.9998956844 (0.010432%)   >  **Max "expansion" scale error, Method 2 =** 1.0010584928 (0.105849%)   >  **Range scale error, Method 2 =** 0.0011628084 (0.116281%) Can anyone think of a reason the results would be so different? Can I interpret the scale factor at a point (method 1) as the scale distortion of an "infinitely small circle" at that point? Also, I am aware of the many discussions on creating Tissot's Indicatrices, so I don't need to be pointed to those ... unless there is some vetted tool out there that accurately, quantitatively evaluates distortion for user-defined regional (i.e., not global) areas, accepts the HOM, is easily implemented, and is nearly free :)? Actually, assuming the tool used in Method 2 is accurate, it work's great for my purposes. The drawback is it takes about 9 hours to run on my PC for each evaluation. If you made it this far, congratulations and thanks.


GeoDjango - DatabaseError: no such table: spatial_ref_sys with Spatialite

Im going through the GeoDjango Tutorial. I have loaded the WorldBorders shapefile into Spatialite. I can do spatial queries such contains, intersects, but I have a DatabaseError: no such table: spatial_ref_sys when I'm trying to use GeoQuerySet method such this one:               qs = WorldBorder.objecs.filter(name='Canada')     qs.area()      I have created the database using Spatialite 4.0 GUI. so the SELECT InitSpatialMetaData(); was performed on creation. SELECT * from spatial_ref_sys return all spatial_ref_sys objects. Can the problem be that the WorldBorders table is in WGS84 and GeoQuerySet method such area() can only be performed with projected SRID? Thanks for your help Edit: The tutorial is the following: https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/ django version: 1.4.3 sqlite3 version is: 3.7.14.1 spatialite version is: 4.0.0 Performing: SELECT * FROM spatial_ref_sys LIMIT 3 -1|NONE|-1|Undefined - Cartesian||Undefined 0|NONE|0|Undefined - Geographic Long/Lat||Undefined 2000|epsg|2000|Anguilla 1957 / British West Indies Grid|+proj=tmerc +lat_0=0 +lo n_0=-62 +k=0.9995000000000001 +x_0=400000 +y_0=0 +ellps=clrk80 +units=m +no_defs |PROJCS["Anguilla 1957 / British West Indies Grid",GEOGCS["Anguilla 1957",DATUM[ "Anguilla_1957",SPHEROID["Clarke 1880 (RGS)",6378249.145,293.465,AUTHORITY["EPSG ","7012"]],AUTHORITY["EPSG","6600"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901 "]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG", "4600"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PAR AMETER["central_meridian",-62],PARAMETER["scale_factor",0.9995],PARAMETER["false _easting",400000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG", "9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","2000"]]


How do you create Revision Table in Arcmap for OSM contribution?

I have created the following detailed file for upload to OSM in ArcMap but don't know about creating a OSM Revision Table to be able to put the data into OSM. At 1:10,000 ![enter image description here](http://i.stack.imgur.com/C2UkX.jpg) At 1:1000 ![enter image description here](http://i.stack.imgur.com/SGxku.jpg) The tool ![enter image description here](http://i.stack.imgur.com/bL8cT.jpg) What do I do? I searched but found nothing about how to create the revision file. http://esriosmeditor.codeplex.com/wikipage?title=Tools&referringTitle=Documentation...mentions > The second parameter is the local revision table storing the changeset > information that is submitted to the OSM server. This table also stores the > upload status, i.e. if the data upload was successful or if the upload > resulted in conflicts. The conflict editor will use the same table to guide > you through the conflict resolution. The table name has the schema of > osmrevision where is the name of the feature dataset where the OSM data > resides. but doesn't mention what fields this table needs, the format etc. When I try the OSM Download Tool I get ![enter image description here](http://i.stack.imgur.com/OpRx4.jpg)


Converting MXD file to earlier version/release?

I upgraded from 10.0 to 10.1 for a few days. Due to conflicts with other packages, i had to downgrade back to 10.0. Now I cannot open any .mxd file I opened with 10.1. I did not create any with 10.1, they were all 10.0 mxds that ArcGIS "upgraded" for me, so it's not an issue of unsupported features. How can I "downgrade" the mxds? 10.0's MXD Doctor can't find any layeres in the MXDs opened and saved with 10.1.


How to Calculate length of polyline geometry for several tables in PostGIS?

PostGIS database contains several geometry (polyline) tables (with names "D1_r", "D2_r", "D3_r"). I calculate length for one "postgis layer" use request:               SELECT      sum(ST_Length_Spheroid(the_geom,'SPHEROID["WGS 84",6378137,298.257223563]'))/1000 AS km_roads      FROM      "D1_r";      How to make a request to get a result for each table ("D1_r", "D2_r", "D3_r") and the total result for all tables ("D1_r"+"D2_r"+"D3_r")? Thanks!


How do I set label to rotate with segment in QGIS?

> **Possible Duplicate:**   >  How to create curved labels in QGIS In MapInfo Pro I have an option to rotate a label with segment (this is nice for labeling roads for example). How do I do the same in QGIS ?


Multiple-machine deployment scenario. Solutions?

I have a virtual machine (let's call it machine no.1) on which I have installed Microsoft SQL Express 2008 R+ ArcSDE 10.0+ ArcGIS Desktop 10.0 +ArcGIS Server 10.0. Everything is connected and works just fine. Now I've installed ArcGIS Desktop 10.1 on another machine (machine no.2) and I want to connect to the Database Server on machine no.1. What exactly should I do? Install ArcSDE 10.1 on machine no.1? If I try to Add a NEW Database Server on machine no.2, I get the error " Failed to connect to Database Server". Thank you,


Is there a decent algorithm in QGIS Process Modeller to create a grid?

I am using Process Modeller to automate merging several vector layers and then creating a grid to cover the extent of the merged layer. There are functions which already exist which are not listed in the modeller such as : Vector -> Research Tools -> **Vector Grid** MMQGIS -> Create -> **Create Grid Layer** The QGIS geoalgorithm **Create grid** in the modeller is not useful to me as I have to manually determine the position and set the CRS etc beforehand. Is there any other plugin or function which allows me to accomplish this? Thank you. UPDATE: I am now trying to get the Processing plugin (formerly Sextante) to recognise the **Vector Grid** script. The file is named "doVectorGrid" which I renamed to simply "VectorGrid". I followed this advice: http://planet.qgis.org/planet/tag/sextante/ where it mentions at the bottom how to add your own modified algorithm. I have added the new terms into the QGISAlgorithmProvider.py (the equilavent to FToolsAlgorithmProvider.py) but I get the following error: _ImportError: cannot import name VectorGrid_ I'm guessing I have to change the code of the **Vector Grid** script but I am new to Python. I have copied the ui_frmVectorGrid.py file into the same directory. Any ideas please?


Is there a widget/service to put a marker and send data?

I need to ask people where they want to go in the city, and as a response I need either geocoded location, or a marker on a map. Although everyone knows his home address, not everyone knows the address of a building they go to, most likely they don't. So, the best option, I think, would be a slippy map integrated in a web page. Is there such a reusable widget for Leaflet/OpenLayers or proprietary?


arcgis server 10.1 site url

should my "site manager" url contain "localhost:6080"? or should it be "(my pc name):6080"? After giving arcgis server account permissions to proper folders I created my site, but it has the name "localhost:6080", will I still be able to link published services with REST Url when making web maps? I am on ags server 10.1. I have a .com registered and I am making a subdomain at the moment. How do I point my arcgis server to this domain? (the process to making my files accessible outside my network) or do I need a webserver and arcgis for server installed to do what I wish to do?(making web maps accessible to people on the internet). I do not have a web server installed. I am trying to install arcgis for server 10.1 on my windows 7 ultimate machine. According to Branden, using "http://gis.mycompanywebsite.com/arcgis/rest/services/101/my_service_name/MapServer" Will point my javascript to my services, using this will it matter if I have localhost in my url, if so, how do I avoid having a localhost site?


Show raster data in WEB

I have downloaded Landsat8 image and use matlab to processing temperature and vegetation. Then I insert data into PostGIS. I used QGIS to display the results but i want show in web. How to display the Web ? Help me . I use postgresql to store data from raster image Lansat8 ![enter image description here](http://i.stack.imgur.com/fy7C5.png)


Need help with ArcMAP API to find coordinates of points in point shape file

I need to find some reference or even C#.Net example code of how to use the ArcMAP 10.2 programmers API. I have got a CSV file with X, Y and Elevation coordinates of soil samples and I want to write an extension to import the point data and save it as a shape file in a project. I hope that i do not offend by asking a primary programmers question here but any reference or suggested links will be really appreciated. It seems that the current API documentation is a bit 'cloudy' :) I have been through it and I am a bit lost.


Displaying buses from a transport network (newbie)

First of all, I'm noob in this subject so please give me some advice. I'd like to develop something like http://traintimes.org.uk/map/london- buses/#73 but with my own city. Unfortunately our MTA doesnt provide TFL-like feeds, but I can get some data in realtime such as: "Line 1, Stop 1, next bus is at 500m, another at 1000m." 1- I'd like to know how do I store and display lines and stops (using leafleat or another tool you could recommend) 2- How do I show buses, if I have the distance in meters the bus from any stop. The page will reload manually at first. Thanks!!