title: ArcPy Clip Data Frame To Geometry

text: I have made an ArcPy add-in that assists a user by adding layers from a nominated fGDB to their map based on a nominated extent. I wish to add a button that changes the data frame properties to clip all the TOC layers to shape (the extent polygon). I can't find an ArcGIS Desktop function to do this. There is however a production mapping (PLTS Extension) function that might suit, but we don't wish to purchase a "solution" for a 9 click standard desktop process. **ArPyProduction Clip To Data-frame:** http://resources.arcgis.com/en/help/main/10.1/index.html#//010300000306000000 Any ideas?               class ButtonClass3(object):         """Implementation for Version1_Addin_addin.button_1 (Button)"""         def __init__(self):             self.enabled = True             self.checked = False         def onClick(self):         print "Limiting display of layers to your extent"                   mxd = arcpy.mapping.MapDocument('current')         df = mxd.activeDataFrame         global ExtentFC         ExtentFC = "C:\\Data\\ArcGIS\\SelectData.gdb\\ExtentFC"          global ExtentFCLayer         ExtentFCLayer ="Current_Extent"         global ExtentLyrPath         ExtentLyrPath = "C:\\Data\\ArcGIS\\ExtentLayerFile.lyr"                   ### Carto         arcpy.MakeFeatureLayer_management(ExtentFC, ExtentFCLayer"", "", "")         FeatureClassLayerMapping = arcpy.mapping.Layer(ExtentFCLayer)         ExtentLyr = arcpy.mapping.Layer(ExtentLyrPath)         arcpy.mapping.UpdateLayer(df, FeatureClassLayerMapping, ExtentLyr, True)                   ### Select Extent & Zoom         arcpy.SelectLayerByAttribute_management(ExtentFCLayer,"NEW_SELECTION","\"OBJECTID\" >0 ")         df.zoomToSelectedFeatures()         arcpy.RefreshActiveView()                   ### arcpyproduction EXAMPLE A:         arcpyproduction.mapping.ClipDataFrameToGeometry (data_frame, clip_geometry, {exclusion_layers})              ### arcpyproduction EXAMPLE B:         arcpyproduction.mapping.ClipDataFrameToGeometry (df, ExtentFCLayer, [0])                   del ExtentFC, ExtentFCLayer, ExtentLyr


title: How do I add a column in an attribute table using QGIS graphical modeler?

text: I have started to make a model in QGIS 2.2 graphical modeler. I have made a buffer around a polyline and used it to clip a polygon layer. So far i t works. But the next step is to add a new column to the clipped polygon layer, and get that column to include rownumber? I have done this outside of the model before, but I don't understand how to make it work inside the model? I tried using the algorithm 'Field calculator' but it doesn't work. How do I use the field calculator inside a model? EDIT: Is there any other way of adding a column with rownumbers to the attribute table inside the model? I got the tip to use the 'Advanced Python field calculator' in an answer below, but I don't understand how to use it. ![screenshot python field calculator](http://i.stack.imgur.com/6jH1F.jpg)


title: How to get feature for a given bbox from shapefile by ogr

text: I have some features point,line,polygon with shapefile format, now I want to get features for a given boundbox, is it possible to remove the features out of the bbox? And for a polygon, I think it is necessary to close it. I wonder if this is possible?


**What datum (reference ellipsoid) does Nasa Worldwind use?** I can't seem to find where Nasa Worldwind tells explicitly what datum they use. I need some sort of valid link.


title: Openlayers - Calculate distance between two points

text: I don't understand why I have two different results between Openlayers distanceTo () and Movable Type Scripts LatLng : **(43, 3)**   LatLng : **(42, 4)**   OL : **187.6**   Movable Type Scripts : **138.1** Any help appreciated.               var Geographic  = new OpenLayers.Projection("EPSG:4326");      var Mercator = new OpenLayers.Projection("EPSG:900913");     var point1 = new OpenLayers.Geometry.Point(3, 43).transform(Geographic, Mercator);     var point2 = new OpenLayers.Geometry.Point(4, 42).transform(Geographic, Mercator);            console.log(point1.distanceTo(point2)/1000);


title: Get a Shapefile Geometry Type

text: I am making a python code for Arcgis9.3. In this code I have an input feature and I create a Output feature. I want that the output feature is the same geometry type as the input feature. At the moment my code to create the output feature is :               gp.CreateFeatureclass("C:/Users/Desktop/Test/", NameOutFC, "POLYLINE")      But I would like to get the input feature geometry type and use it to create my output feature :               gp.CreateFeatureclass("C:/Users/Desktop/Test/", NameOutFC, GeometryLikeInput)      I found the code with ArcPy :               desc = arcpy.Describe('C:/shapefile.shp')     geometryType = desc.shapeType          if geometryType == 'polygon':     print 'Polygon'     elif geometryType == 'point'      But I can't use it with arcgis9.3. Thanks for your help


title: Problem with QGIS 2.2 joins between shp and csv

text: Didn't see question like this asked, so... I've joined csv to shp file and everythings seems ok. I've modified attribute form so that fields from joined csv appears in there. So far so good- it's there. Bet when I reopen the project and identify some feature, insted of joined fields there's "Error:Field does not exist in datasource" even though I see it when opening attribute table. If I open Layers properties and then press ok- attributes are back in my form. Is there any way to avoid this annoyance? Valdis


title: How to change the style of a point when clicked?

text: Sorry for this common question. I do succeed in changing the style of a polygon when clicked, like in this example. But I don't succeed with points, with the same code.               select = new OpenLayers.Layer.Vector("Selection", {styleMap:                  new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])     });      When I click on an area, an http request is send to geoserver and returns an xml with the caracterics of each points. But it does not display it. An idea ? Thks!


title: ArcPy method to determine ArcMap document version

text: Is there a way with **ArcPy** to identify the version of a Map Document (MXD). I am working on a solution to inventory our MXD's and would like to know if a document is 8.1, 9.2, 10.0, etc. I am currently using ArcGIS 10.0, but if there is an update in 10.1 that does not exist in 10.0, I would appreciate hearing that, too. I see there is a previous question of How can you find ArcGIS version programatically?, but it references all ArcObjects solutions (which I suppose I could call from python, but I would prefer not to).


title: Arcobjects .Net, suppress geoprocessing messages

text: I am executing the copy features tool via the geoprocessor inside my .net custom geoprocessing function tool. When the copy features tool executes it is writing it's messages to my tool's results. I want to stop these messages from being written and handle them myself. Is there a way to stop a geoprocessor from writing messages? I am writing .net on 10.1. This is the code I am running the tool with.                           IGeoProcessor2 gp = new GeoProcessorClass();                 IGeoProcessorResult results = new GeoProcessorResultClass();                 IVariantArray parameters = new VarArrayClass();                 parameters.Add(tempFC);                 parameters.Add(outFC);                 results = gp.Execute("CopyFeatures_Management", parameters, null);


title: How can I enable panning using Openlayers and a vector overlay with controls?

text: I am creating a map using the following code:               map = new OpenLayers.Map({         div: "map"     });      Then I load in a geojson polygon layer and add two controls               var highlightCtrl = new OpenLayers.Control.SelectFeature(geojson_layer, {         hover: true,         highlightOnly: true,                renderIntent: "temporary",         eventListeners: {                     beforefeaturehighlighted: unreport,                     featurehighlighted: report,                     featureunhighlighted: unreport                 }     });           selectCtrl = new OpenLayers.Control.SelectFeature(geojson_layer,         {clickout: true ,           renderIntent: "select",          onSelect: selected,           onUnselect: function(e){console.log('unselected)}     });              map.addControl(highlightCtrl);     map.addControl(selectCtrl);              highlightCtrl.activate();     selectCtrl.activate();        This layer covers the entire map div, and now I can no longer pan the map. Is there a way that I can enable panning when I have a layer with controls that cover the basemap?


title: How can I merge segments to one segment in QGIS (picture inside) and than get the center of each road?

text: I want to run a process that will make a table with lots of roads into distinct table of roads and than calculate the center of each road. How can I auto merge segments with same name to one long segment ? Attached example of 1 road built from 3 different segments , I want to make it one road and have it center point. (so I can zoom on it from OpenLayers) ![enter image description here](http://i.stack.imgur.com/7l2iZ.png)


title: How to manually break statement execution in python console of ArcMap

text: How does one break the execution of a long-running process in the python console of ArcMap? For example, how do you break a long iteration like the one below once it is started?               for i in range(1, 50):       # some long process which takes over a minute to complete      I want to stop the process at any time I want by pressing a keyboard combination, clicking a button or something similar **while the code I have input in the console window is running**.


title: Is the quadrilateralized spherical cube map projection the same as Snyder's cubic equal area map projection?

text: Is the quadrilateralized spherical cube map projection [1] the same as Snyder's cubic equal area map projection [2]? I know both are equal area polyhedral map projections ( http://www.progonos.com/furuti/MapProj/Dither/ProjPoly/projPoly.html ) based on the cube, but i can't access either publication to answer the question myself. Thanks. * * * [1] E. M. O’Neill and R. E. Laubscher, Extended studies of the quadrilateralized spherical cube earth data base, Tech. Report 3-76, Computer Sciences Corp Silver Spring Md System Sciences Div, 1976. [2] Snyder, J.P. 1992. An equal-area map projection for polyhedral globes. Cartographica 29(1): 10-21.


title: Can I export a polygon shapefile to a Garmin device?

text: I want to export the boundaries of a parcel to my GarminMap 60CSx. I downloaded a parcel map from the county, and I want to use it to walk the perimeter. Does the .gpx format support polygons? Or is there some other way? I'm on Mac, using QGIS 1.7.4.


title: Tilemill Styling Multiple feature Overlap some data

text: Please see the following Image. ![enter image description here](http://i.stack.imgur.com/nIkaG.png) I am using a single feature layer for road. Now I using the following code                   #roads {       [ROAD_TYPE = 1] {line-width:8; line-color:#194536;}       [ROAD_TYPE = 2] {line-width:8; line-color:#456321;}       [ROAD_TYPE = 3] {line-width:8; line-color:#785632;}       [ROAD_TYPE = 4] {line-width:8; line-color:#236485;}       [ROAD_TYPE = 5] {line-width:8; line-color:#FFFFFF;}       [ROAD_TYPE = 6] {line-width:8; line-color:#194536;}       line-join: round;       line-cap: round;       line-smooth: 0.1;       }      The problem is in the Black circles the white goes under the green road layer. But in the red circle the white layer overlap the green and other major layers. How can I solve it and make it a very nice style as Google or OSM map?


title: How to install SDA4PP plugin for Kriging in QGIS?

text: I am trying to do kriging in QGIS. I have loaded the SDA4PP plug in. Almost all of the items in the SDA4PP dropdown menu are not highlighted and are unresponsive when clicked on - including the kriging option. Any ideas? - I am very new to GIS. thanks...


title: Python, GDAL and building raster attribute tables

text: I have an integer raster for which I would like to build a raster attribute table using Python and GDAL. I can create a GDAL raster attribute table in Python as follows:               >>> rat = gdal.RasterAttributeTable()      This works fine, as we can see:               >>> rat     <osgeo.gdal.RasterAttributeTable; proxy of <Swig Object of type 'GDALRasterAttributeTableShadow *' at 0x0000000002A53D50> >      The table thus created has no rows or columns:               >>> rat.GetRowCount()     0     >>> rat.GetColumnCount()     0      I create a column called "Value" to store the unique values in the raster:               >>> rat.CreateColumn("Value", gdalconst.GFT_Integer, gdalconst.GFU_MinMax)     0      This is fine, and the column count is updated:               >>> rat.GetColumnCount()     1      Now I have to add values (records) to the column for it to be of any use. I can get a list of unique values from the raster's band like so:               >>> data = band.ReadAsArray(0, 0, dataset.RasterXSize, dataset.RasterYSize)     >>> vals = list(numpy.unique(data))     >>> vals     [3, 7, 8, 10, 11, 12, 13, 14, 17, 18, 20, 22, 23, 25, 27, 28, 41, 45, 52, 56]      What I would like to do is create a for loop to loop through `vals` and populate the column in the attribute table. I thought I could do something like this:               >>> for i in range(len(vals)):             rat.SetValueAsInt(i, 0, vals[i])      ...where `i` is the row (record), `0` is the field index and `vals[i]` is the integer value I want to insert. But it causes an error:               Traceback (most recent call last):       File "<pyshell#32>", line 2, in <module>         rat.SetValueAsInt(i, 0, vals[i])       File "C:\Python27\lib\site-packages\osgeo\gdal.py", line 1139, in SetValueAsInt         return _gdal.RasterAttributeTable_SetValueAsInt(self, *args)     TypeError: in method 'RasterAttributeTable_SetValueAsInt', argument 4 of type 'int'      The error is caused because I use `vals[i]` in the call to `SetValueAsInt()` rather than using an integer directly. For example, `rat.SetValueAsInt(0, 0, 0)` works fine, but is useless for populating the column if I just want to loop over the list of unique values. Is this a known issue? Google has so far not been very useful. What can I do to get around this problem?


title: Appending in Modelbuilder to a derived dataset

text: I have a simple model with a file gdb model parameter `InputGDB`, which contains a feature class `fc1`. Inside the model is a preset output folder and a template (empty) file gdb `TemplateGDB`, which contains a feature dataset `template_fds` and a feature class `template_fc`. A copy of `TemplateGDB` is made in the output folder and takes its name from `InputGDB` (using inline variables). I would like to Append `fc1` into `template_fc` with the schema set to `NO_TEST`. However, since the target dataset `template_fc` does not exist yet because the model hasn't run, the Append tool will obviously not validate. Is there a way for me to run the model without having to first run the first section, then validating to run the Append process?


title: Creating a new feature class with python and then adding attibutes

text: I am having trouble adding rows to a shapefile after it has been created. I'm not sure if I need to create the shapefile in memory and add the data or creating then re-open the file. While I've attempted to re-open the file, it will exit code 1 that file doesn't yet exist. Any and all suggestion would be useful. (except setting it on fire). I'm getting a "AttributeError: Row: Error in parsing arguments for SetValue" .... Please help.               for row in arcpy.da.SearchCursor(featureClass, ['FID','SHAPE@JSON','STREAM_ID','REACH_ID','SR_ID','STATION','INTERP','XS_ID','WSP001','WSP002','WSP003','WSP004','WSP005','WSP006','WSP007']):     featureClassData.append([row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9],row[10],row[11],row[12],row[13],row[14]])          outPutPath = "C:\\projectTemp\\FloodAnalysis\\output"     for i in range(0, len(featureClassData) -1):     FirstRowData = featureClassData[i]     SecondRowData = featureClassData[i+1]     FirstRowData[1] = eval(FirstRowData[1])          for cord in FirstRowData[1]['paths']:         for c in cord:             point = arcpy.Point(c[0],c[1])         dataSetCreate = arcpy.CreateFeatureclass_management(outPutPath, 'test_section_' + `i` ,"", featureClass)         dataSet = arcpy.InsertCursor(dataSetCreate)         row1 = dataSet.newRow()         row1.Shape = arcpy.geometries.Polyline(array1,spatialRef)         row1.setValue(FirstRowData[2], FirstRowData[3], FirstRowData[4],                       FirstRowData[5], FirstRowData[6], FirstRowData[7],                       float(FirstRowData[8]), float(FirstRowData[9]), float(FirstRowData[10]),                       float(FirstRowData[11]), float(FirstRowData[12]),                       float(FirstRowData[13]), float(FirstRowData[14]))         dataSet.insertRow(row1)


title: How to map districts without showing features in other districts?

text: We want to have a map of each individual district, with the shops on it, so that the person responsible for each district can have a map of their territory. The reason I want to merge them is so that I don't end up with a map of one district with lots of dots around it from other shops all over the state. I'm using QGIS 1.7.0. I have a shapefile that splits my state into districts, and a geoJSON that has a list of shop locations. I want to make a file of each district, with a dot at each shop. Is it possible to have QGIS put both pieces of information into one file (I haven't had any luck with merge shapefiles). After that, it would be wonderful if I could get it to split each section into it's own file, with the dots that it contains. If there is not a way to get it to do that automatically, would the most efficient thing to do be putting a mask layer over the map and just cutting out a hole for each district, one at a time? I'm mostly self-taught with QGIS, so I don't necessarily know some of the non- basic stuff. But I'd appreciate any help y'all could give me.


title: Passing attributes to neighbouring polygons

text: I have an ecosystem polygon layer that has been updated using a more recent tree cover layer (to remove cleared areas and also to re-align veg boundaries where growth has occured). Where the polygons have been 'grown out', not all values have been passed along to the new, neighbouring polygon (only the actual RE value itself). In other words, the existing polygon is in the data, with an adjoining polygon to represent the new area, which should be treated as the same RE unit). What would be the best approach to re-attribute these polygons?


title: Using of Document Properties>Hyperlink Base to prevent broken links when moving MXDs?

text: I am going to try this later this week (when I am back in office) but I thought I ask this here first. Can anyone advise if Using Hyperklink Base can indeed help prevent broken links (not hyperlinks) when moving of mxds to another location? I believed mxds are set to be on relative link type, and not full path. I seen someone claiming so but i thought Hyperlink Base is strictly for relative hyperlinks, especially when someone moves the MXD two levels above and hyperlinks will still work. Am I right to say that? ![enter image description here](http://i.stack.imgur.com/sk4og.jpg) So in this example, I key in Project Folder into "Hyperlink Base" box and I have a ABC.mxd sitting in DATED_1>_MXD with files sitting in various folders under DATED_1. I will copy ABC.mxd and paste it into DATED_2>_MXD. When I open DATED_2>_MXD>ABC.mxd, there will be broken link (but I will need to repair the links). Once done, I can copy and paste mxd to DATED_1 or _2 or _3 or_4 , and I will not have broken links, with data pointed to various folders under DATED_1. If I attempt to put this mxd anywhere else in any SHP / GEOREF / FGDB folder, all the links in mxd will be broken. My knowledge of relative links is that they are paths of files with location of mxd as base. Hence, any folders / structure "above" mxd does not matter. and my guess for the "Hyperlink Base" method is that the base is set when I key "Project Folder" into the box(?). And that mxds placed into any folders two levels below will not have broken links. So I can place my mxd in DATED_3>_MXD>ABC.mxd and it will be fine, since it is too two levels below. I might have got above example wrong but anyone who can advise me on this, pls enlighten me. Many thanks in advance. FYI, I am using 9.3.1 on Win7 x64. Also, can anyone advise how should I accept answers to questions that i posed out previously? I just couldn't find the buttons to do that.


title: How can I connect to a PostGIS database from ArcCatalog 9.3 via ArcSDE?

text: I have a problem connecting to my postgis database via ArcSDE in Arc Catalog. When i want to establish connection to my database i get an error: ![alt text](http://i.imgur.com/v6tQO.jpg)


title: Restrict panning in a map using CartoDB

text: I want to restrict the ability for someone to pan away from the extent the map has when it's loaded. I have a map of New Zealand to be viewed at a national and regional level but worried people will get lost if they pan out to sea as it is the only geography loaded. Ideally someone can pan around regions but not too far from New Zealand.


title: Cutting Polyline at the beginning and end by some unit

text: The problem is: I have got a IGeometry (polyline dimension) - let call it A. Given a ray and a center point (disk B, polygon dimension ) I would like to result in a IGeometry that does not have the disk B (filled one), (set definition A/B, polyline dimension). How to apply ITopologicalOperator to get VALID difference operation. I am interested in code.


title: extract edge of a line of a vector layer in a new point layer

text: I'm using python to build a plug-in in Qgis. I need to extract the edges of each line feature of a vector layer to create a new point layer of all edges. Someone can help me? My data input is a vector line shapefile that represent the roads of a city. Thanks, Raffaele


title: How to split a polyline into points at certain intervals?

text: I am trying to split a polyline into points with 2m intervals in ArcGIS but I don't have the necessary license. Is there a way that I can do this in QGIS? Context: I have drawn a hypothetical lake surface based upon a contour line and need to divide it. cheers


title: How to display OSM relations in Openlayers with tags as legend?

text: I would like to show this type of relations in a simple map with Openlayers. http://www.openstreetmap.org/api/0.6/relation/1637735/full I'm specially interested in being able to show tags as legend. Do you know how can I do it in the simplest way possible? I'm not sure if Openlayers has already a package to display relations.


title: Problem in long expression in field calculator

text: I am trying to compute the following expression with Field calculator. The input table values are around the size of this value: 562643580,7843, and the field name (the field of destination) is: double, precision=20, scale=20: `([Sum_Pri_17]*0.0669)+(([Sum_Pri_18]-[Sum_Pri_17])*0.0551)+(([Sum_Pri_19]-[Sum_Pri_18])*0.0306)` The destination field should therefore not be too short. When doing the calculation, no result is computed and no error appears either. I thought the expression was too long, so I tried to compute the following: `[Sum_Pri_17]*0.0669` The calculation's result was the same: no result is computed and no error appears either. What am I doing wrong? Thank you for your help!


title: How to set up QGIS Server on Win7?

text: I want to share QGIS files and maps which are made by me, to some of my friends trough a server. Then I want to know   1. how to establish a server and network to upload QGIS maps and files; My system is **Windows 7** , How to install or setting up server,   2. how to upload maps and QGIS files I refer your QGIS server instructions, but I couldn't get any favorable result. I want simply understandable instructions. Best Regards


title: How to install multiple versions of postgres in same os windows 7 64-bit?

text: I have already installed PostGIS along with opengeosuite and it is the latest version. Now I want to run pgrouting but the latest stable version does not compatible to the latest postgres versions. Can I downgrade the postgres from 9.2 to 8.3. I cant try some unstable versions of pgrouting that are compatible with postgres 9.1/9.2 because, there are issues in shooting star algorithm...or can I install another version parallel to this. I tried unistalling opengeosuite completely and installed only postgres 8.3 and postgis 1.4 but there are more and more errors I am getting and I am afraid to solve those as its for my mini project and I have only 3 days to prepare documentation.. So someone please help! I am trying but I am confused with these kind of installations.


title: How to use gdal_contour in QGIS Python console?

text: Is there a way to use the gdal_contour utility with-in the python console of qgis ? Thank you


title: geography, geometry, distance, and wkt - PostGIS

text: I'm trying to understand the data conversions that happen in PostGIS when calculating distances in SRID 4326. Why is it that when I run on my marin_jobs points table:               select cast (the_geom as geography), the_geom from      marin_jobs where blockid10 = '060411141001010' limit 1;      I get               the_geom      the_geom     geography     geometry     010100....    010100....      And the wkt output values are exactly the same? I came to this question because when I run a distance query (see below for code) on two points in my dataset, if I don't use `cast () as geography` I get out degrees, just like the Boundless Geography tutorial said I would. http://workshops.boundlessgeo.com/postgis-intro/geography.html But I don't understand how if the inputs are (seem to be anyway) exactly the same, the outputs are different. Or should I ask...are the outputs really different? Does that mean that the value of `0.0616262566763201` degrees and `6007.875564598` meters are the same, but just in different units? But this doesn't jive with what the Boundless Tutorial says, "On a sphere, the size of one “degree square” is quite variable, becoming smaller as you move away from the equator. Think of the meridians (vertical lines) on the globe getting closer to each other as you go towards the poles. So, a distance of 121 degrees doesn’t mean anything. It is a nonsense number." Any plain English claficiation would be _really_ helpful. This is keeping me up at night. Distance Queries:               select st_distance (                    (select the_geom from marin_jobs where blockid10 = '060411141001010' limit 1),                    (select the_geom from marin_jobs where blockid10 = '060411070005007' limit 1)                    );      output: 0.0616262566763201               select st_distance (                     (select cast (the_geom as geography) from marin_jobs where blockid10 = '060411141001010' limit 1),                     (select cast (the_geom as geography) from marin_jobs where blockid10 = '060411070005007' limit 1)                    );      output: 6007.875564598


title: using REST "delete features" in arcgis api for javascript

text: I am developping a web application that uses a feature service, what i want to do is save the data in the feature server, and then delete all the features at the start of the application. I am able to save data in the feature service, my problem is how to delete the features in the start of the application. I found a solution to that suggesting that I use the operation: "Delete Features" of the REST API, but I think I am making a mistake in the syntax, here is my code sample:               var theurl= "***/arcgis/rest/services/edt/FeatureServer/0/deleteFeatures"     var request = esri.request({          url: theurl,     // Service parameters if required, sent with URL as key/value pairs     content: {     f: "json",     where: "1=1"}      }); I don't know what I am missing can you please help


title: How do I programatically edit the layer 'Display Expression'

text: I'm wondering if someone has or knows where a tool is to edit the 'Display Expression' of a Layer, or more specifically, a TableView, in ArcGIS Desktop. I know that it can't be accessed with Python, but it should be editable with ArcObjects. But this isn't something I know how to do yet. I'm using a Python Add-in to add a Layer into ArcMAP which has a relate with a couple TableViews that I add at the same time. The trouble is that it always resets the field that is displayed in the identify window to something unhelpful. Thanks for any suggestions.


title: Unregistering OpenLayers events?

text: map.events.register('click', map, fucntion(e){alert('on')} );          map.events.unregister('click', map, fucntion(e){alert('off')} );       Looks easy enough but un-registering just won't trigger. I try nesting unregistering inside register function call back but still nothing. Here is how I created my map..                   var bounds = new OpenLayers.Bounds(                  146501.328125, 2420230.75,                  352670.46875, 2801126.25          );          var options = {                  controls: [],                  maxExtent: bounds,                  maxResolution: 1487.873046875,                  projection: "EPSG:3826",                  unit: 'm'          };          format = "image/png";          map = new OpenLayers.Map( 'MapPage_map-canvas2', options );               //SETUP MAP EVENT          event = map.events.register('move', map, function (evt) {                  document.getElementById('map-url').innerHTML = map.getCenter();          });               var county = new OpenLayers.Layer.WMS(                  "AllenProject:county",                  "http://localhost:8080/......./wms",                  {                          LAYERS: 'AllenProject:county',                          STYLES: 'AllenProject_BlackBorder_GreyBackground',                          format: format,                          tiled: true,                          transparent: true,                          //tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom                  },                  {                          buffer: 0,                          //displayOutsideMaxExtent: true,                          transitionEffect: null, //'resize',                          isBaseLayer: true                  }          );          map.addLayer(county);               map.events.register('click', map, function (evt) {                  alert('on');             });               map.events.unregister('click', map, function (evt) {                  alert('off');          });       I don't understand this.


title: QGIS API changes from 2.0 to 2.2

text: I have the same program running on two different machine, one with Qgis 2.0 and the other Qgis 2.2. The machine running 2.2 doesn't seem to render the map canvas. I thought it was how I has creating the layers but sorted all that out. As a test I have set the canvas colour to red, it still comes up white on the 2.2 version. The start of the code is as follows               class trackerMain(QtGui.QMainWindow, Ui_trackerMain):         def __init__(self):             QtGui.QMainWindow.__init__(self)             self.setupUi(self)                  # set the canvas to white and fix the panning             self.mapCanvas.setCanvasColor(QtCore.Qt.red)             self.toolPan = QgsMapToolPan(self.mapCanvas)             self.mapCanvas.setMapTool(self.toolPan)             self.mapCanvas.mapRenderer().setDestinationCrs(QgsCoordinateReferenceSystem(4326))             self.mapCanvas.mapRenderer().setMapUnits(QGis.DecimalDegrees)             self.mapCanvas.mapRenderer().setProjectionsEnabled(True)             # Custom map tools             self.auvGotoTool = AuvGotoTool(self.mapCanvas)      Is there some additional step needed in the 2.2 that I am not doing as nothing on the canvas will render. I also have a custom map tool that works, it gtes the correct coordinate. When I load my layers and set the canvas extent to that of the layer it also works so it is just a render problem? TIA Christian


title: What are the differences between 81989 and 27700 CRS for the British National Grid?

text: We are using applying Oracle Spatial to run point in polygon queries in Great Britain using Ordnance Survey MasterMap and point data. MasterMap is on British National Grid (BNG) and has the Coordinate Reference System (CRS) 27700 while our point data has the Oracle Spatial 'BNG version' 81989. Will it matter that we are using different systems? Thanks for your time.


title: Combining Feature Selection and Marker Clustering

text:
I am using the basic structure for layer toggling found in this CartoDB tutorial, with buttons wired to a ul navigation menu. In the meantime, I was happy to implement the Marker Cluster Leaflet plugin as instructed here. However, now the navigation won't work. Here is the js I have been trying:               var baseLayer = L.tileLayer('http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.jpg', {     attribution: 'Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.'     });     var markers = L.markerClusterGroup();     $.getJSON("http://username.cartodb.com/api/v2/sql?format=GeoJSON&q=SELECT * FROM table_name", function(data) {     var geojson = L.geoJson(data, {       onEachFeature: function (feature, layer) {         layer.bindPopup("
" + feature.properties.label + "

Address: " + feature.properties.address +  "

" + feature.properties.href);       }     });     markers.addLayer(geojson);          var map = L.map('map', {maxZoom: 18, center: [20, 40],     zoom: 2     });          baseLayer.addTo(map);     markers.addTo(map);     sublayers.addTo(map);          });          var sublayers = [];          cartodb.createLayer(map, layerUrl)     .addTo(map)     .on('done', function(layer) {     var subLayerOptions = {     sql: "SELECT * FROM table_name"     };          var sublayer = layer.getSubLayer(0);          sublayer.set(subLayerOptions);          sublayers.push(sublayer);     }).on('error', function() {     //log the error     });          $('.button').click(function() {     $('.button').removeClass('selected');     $(this).addClass('selected');     LayerActions[$(this).attr('id')]();     });               var LayerActions = {     group1: function(){     sublayers[0].setSQL("SELECT * FROM table_name WHERE group = 'Group 1'");     return true;     },     group1: function(){     sublayers[0].setSQL("SELECT * FROM table_name WHERE group = 'Group 1'");     return true;     },     category1: function(){     sublayers[0].setSQL("SELECT * FROM table_name WHERE category = 'Category 1'");     return true;     },          ...          }     };      Any insight into how to merge button toggling and marker clustering would be helpful. With thanks. UPDATE: I have a work-around, adding separate marker cluster groups for each 'Group 1', 'Group 2', ...                 var markers1 = L.markerClusterGroup();          $.getJSON("http://username.cartodb.com/api/v2/sql?format=GeoJSON&q=SELECT * FROM example_table WHERE group='Group 1'", function(data) {     var geojson = L.geoJson(data, {       onEachFeature: function (feature, layer) {         // ADD A POPUP WITH SOME INFO         layer.bindPopup("
" + feature.properties.label + "

Address: " + feature.properties.address );       }     });     markers1.addLayer(geojson);     });               var markers2 = L.markerClusterGroup();          $.getJSON("http://username.cartodb.com/api/v2/sql?format=GeoJSON&q=SELECT * FROM example_table WHERE group='Group 2'", function(data) {     var geojson = L.geoJson(data, {       onEachFeature: function (feature, layer) {         // ADD A POPUP WITH SOME INFO         layer.bindPopup("
" + feature.properties.label + "

Address: " + feature.properties.address );       }     });     markers2.addLayer(geojson);     // CONSTRUCT THE MAP     var map = L.map('map', {maxZoom: 18, center: [20, 40],     zoom: 2     });          baseLayer.addTo(map);     markers1.addTo(map);     markers2.addTo(map);     sublayers.addTo(map);          });      It's not a perfect solution—it basically separates the clusters so that you end up with overlapping cluster-dots. I'll probably need to use the leaflet layer selector instead of my current navigation menu for this project, like the DOC huts example provided on the thematicmapping site by Bjørn Sandvik. UPDATE: I am finding this answer helpful UPDATE: I have switched to the CartoDB clustering method and have added both the clustered layer (lyr0) and non-clustered layer (lyr1) to my map. Now I just want to turn on lyr1 only at a specific zoom level. I am currently unable to get zoom-based show/hide to work. Maybe someone will see the errors in the following ways:                     function main() {              // create leaflet map         map = L.map('map', {            zoomControl: true,           center: [40.79, -111.9],           zoom: 6         });              // add a base layer         L.tileLayer('http://tile.stamen.com/toner/{z}/{x}/{y}.png', {           attribution: 'Stamen'         }).addTo(map);              var gridsize = 48;         var baseSql = $('#sql_template').html().format(gridsize);         var cartoCss = $('#cartocss_template').html().format(gridsize);         var lyr0;         $("#cluster_size").on('change',function(){           $('.size').html($("#cluster_size").val());         });         $("#cluster_size").on('mouseup',function(){         lyr0.setSQL($('#sql_template').html().format($("#cluster_size").val()));         lyr0.setCartoCSS($('#cartocss_template').html().format($("#cluster_size").val()));         });         // add cartodb layer with one sublayer         cartodb.createLayer(map, {           user_name: 'username',           type: 'cartodb',           sublayers: [{              sql: baseSql,              cartocss: cartoCss,              interactivity: 'cartodb_id'           }]         })         .addTo(map)         .done(function(layer) {           sublayer = layer.getSubLayer(0);           sublayer.setInteraction(true);           addCursorInteraction(sublayer);         });              var lyr1 = [];         cartodb.createLayer(map, layerUrl)         .addTo(map)         .on('done', function(layer) {         // change the query for the first layer        if (zoom <= 10) {          layer.hide(lyr1);         } else if (zoom >= 10) {           layer.show(lyr1);         } else {           layer.show(lyr0);         }     var subLayerOptions = {     sql: "SELECT * FROM table_name"          };               lyr1.set(subLayerOptions);          lyr1.push(lyr1);     }).on('error', function() {     //log the error     });          $('.button').click(function() {     $('.button').removeClass('selected');     $(this).addClass('selected');     LayerActions[$(this).attr('id')]();     });               var LayerActions = {     group1: function(){     lyr0.hide();     lyr1.getlyr0[0].setSQL("SELECT * FROM table_name WHERE group = 'Group 1'");     return true;     },     category1: function(){     lyr0.hide();     lyr1.getlyr0[0].setSQL("SELECT * FROM table_name WHERE category = 'Category 1'");     return true;     },     ...      UPDATE: I've decided to return again to the Leaflet markerCluster option because I couldn't get the fitBounds option to work on the sublayers in CartoDB, alas. I have been adding a marker cluster layer for every item in the layers control menu. Is there a way to slim down the code for adding multiple cluster layers from geoJSON? Here's what I have:               var group1 = new L.markerClusterGroup();         $.getJSON("http://userid.cartodb.com/api/v2/sql?format=GeoJSON&q=SELECT * FROM table_name WHERE table_name.group='Group 1'", function(data) {         var geojson = L.geoJson(data, {           onEachFeature: function (feature, layer) {             // ADD A POPUP WITH SOME INFO             layer.bindPopup("
" + feature.properties.label + "

Address: " + feature.properties.address +  "

" + feature.properties.href);           }         });         group1.addLayer(geojson);       });          var category1 = new L.markerClusterGroup();     $.getJSON("http://userid.cartodb.com/api/v2/sql?format=GeoJSON&q=SELECT * FROM table_name WHERE table_name.category='Category 1'", function(data) {         var geojson = L.geoJson(data, {           onEachFeature: function (feature, layer) {             // ADD A POPUP WITH SOME INFO             layer.bindPopup("
" + feature.properties.label + "

Address: " + feature.properties.address +  "

" + feature.properties.href);           }         });         category1.addLayer(geojson);       });       ...


title: How to create a centerline from polygon in Arcgis 10

text: In Network Analyst, I want to create a center line from a road polygon layer of an area for shortest path creation. How do I do this in ArcGIS 10?


title: Disk space and numbers of tiles for world layer

text: I'm thinking about testing tiles generation of a world layer for webmapping. In this context, I want to know how I can calculate the number of tiles (256x256 for tilecache if I remember) I will need for n levels in WGS84 coordinates. Maybe I will use a composite solution with pregenerated tiles and on the fly generation but I have to know at the end the available disk space if every tiles are generated and the number of files it will represent. There are two goals, time it will take and disk space needed. Any informations are welcome **Edit:** I've found this script to calculate the number of tiles to generate depending on zoom levels and your data extent. See this gist https://gist.github.com/1675606


title: Combining MapInfo records with a duplicate value

text: I have a MapInfo table with a lot of points in it. The points are clustered together - they represent the first part of a post code, so they're in a similar position but not identical. What I would like to do is combine the duplicate rows and attach a single point to each row that represents the rough centre of the other points. In fact, making the centroid for a record is easy, so my real question is how do you combine rows that have a duplicate field? There are about 1.5 million rows so doing anything by hand is a no-no! Thanks in advance!


title: How do I programmatically create non-feature-linked, simple line callout annotation and set the anchor point?

text: Vitals: ArcGIS-ArcView 10.0, Python 2.6.5, PythonWin, comtypes I'll start with my main questions: **How, using ArcObjects, do I go about creating non-feature-linked geodatabase annotation features that have a simple line callout format, and how do I set the anchor point so that the leader line remains functional, i.e. remains anchored on the point feature it references even when the annotation is moved?** I have a standalone Python script that accesses ArcObjects through comtypes wrappings of ArcGIS OLBs -- works great. Overall, this ArcMap automation script cursors through a point feature class, creating complex vector graphics (in map units in the data view) from attribute info in the points and loads each of those graphics (an IGroupElement) into a non-feature-linked annotation feature as the anno's graphic element. I want to have functional simple line callout leader lines, but the latter graphics-containing anno features won't support a simple line callout. So my idea is to create, for each of the graphic anno features, an underlying, transparent dummy text anno feature that will carry the leader line. I've tried a bunch of things, but I can't get a leader line to show up. I have defined separate annotation classes within the target annotation feature class for storage of graphic versus dummy text leader line anno features. The leader line anno class was defined with transparent text and a simple line callout symbology. Now, below are code excerpts that include the function I call to create each annotation feature, be it graphic or leader line dummy:               #make front leader text element     ldrText = '|'     pFLdrTextElement = BuildTextElement(ldrText, 'Leader', 'null', annoRefScale, False, (fX, fY))  #returns ITextElement     pFLdrTxtElem = CType(pFLdrTextElement, esriCarto.IElement)     pFLdrTxtElem.Geometry = pTweakedTxtPoint     ...     ldrannoclass = 1     CreateAnnoFeature(annoFC, pFLdrTxtElem, fOID, ldrannoclass)          def BuildTextElement(s, signType, txtcolor, annoRefScale, has_outline, featPos=None):     ...         #separate out leader annotation text         if signType == 'Leader':             import comtypes.gen.esriGeometry as esriGeometry             pTextColor = GetRGBColor(txtcolor)             pSimpleLineCallout = NewObj(esriDisplay.SimpleLineCallout, esriDisplay.ISimpleLineCallout)             anchorPoint = NewObj(esriGeometry.Point, esriGeometry.IPoint)             anchorPoint.PutCoords(featPos[0], featPos[1])             pSimpleLineCallout.AnchorPoint = anchorPoint             pSimpleLineCallout.AutoSnap = True             pLeaderLineSymbol = NewObj(esriDisplay.CartographicLineSymbol, esriDisplay.ILineSymbol)             pLineColor = NewObj(esriDisplay.RgbColor, esriDisplay.IRgbColor)             pLineColor.Red = 0             pLineColor.Green = 0             pLineColor.Blue = 0             pLeaderColor = CType(pLineColor, esriDisplay.IColor)             pLeaderLineSymbol.Color = pLeaderColor             pSimpleLineCallout.LineSymbol = pLeaderLineSymbol             pSimpleLineCallout.LeaderTolerance = 0.0             pTextBackground = CType(pSimpleLineCallout, esriDisplay.ITextBackground)             pTextSymbol.Background = pTextBackground             pTextSymbol.Color = pTextColor             pTextElement.Symbol = pTextSymbol             pTextElement.Text = s             pTextElement.ScaleText = True             return pTextElement     ...          def CreateAnnoFeature(pAnnoFC, pElement, featID, annoclass):         """Creates new annotation feature, loads the graphic into it,         and inserts the new anno feature into the anno feature class"""         import comtypes.gen.esriGeoDatabase as esriGeoDatabase         import comtypes.gen.esriCarto as esriCarto         #make Insert cursor and FeatureBuffer for use in InsertFeature method         pFCursor = pAnnoFC.Insert(True)         pFeatBuffer = pAnnoFC.CreateFeatureBuffer()         pFeature = CType(pFeatBuffer, esriGeoDatabase.IFeature)            #set annotation of anno feature         pAnnotationFeature = CType(pFeature, esriCarto.IAnnotationFeature2)         pAnnotationFeature.Annotation = pElement         pAnnotationFeature.Status = esriCarto.esriAnnoStatusPlaced         pAnnotationFeature.AnnotationClassID = annoclass         pFeature = CType(pAnnotationFeature, esriGeoDatabase.IFeature)         #insert the new anno feature         pFeatOID = pFCursor.InsertFeature(CType(pFeature, esriGeoDatabase.IFeatureBuffer))         pFCursor.Flush()         mxDoc.ActiveView.PartialRefresh(esriCarto.esriViewGraphics, None, None)      The BuildTextElement() function contains the code to build either a plain text element or one with a simple line callout format including setting of the anchor point. (See code above for the latter.) The latter results in what looks like a simple line callout, but when the annotation is moved the leader line does not remain anchored on the point feature. The text and leader line are simply combined into a graphic that moves around as a whole with the anno. In the case of the plain text element, I was hoping that a leader line would show, because the simple line callout format is defined in the annotation class symbology. **In this case, how would I set the anchor point?** In fact, in either case the leader line dummy is created--the transparent text box is placed, but there is no leader line. I really don't have a good idea of whether I am going about this in the best way. I can't change the structure of looping through the point features one at a time, but how I go about building the annotation features can certainly change. For instance, using an IFDOGraphicsLayer and realted objects instead of an Insert Cursor might work. I would welcome any suggestions. If anyone can stand to read more ... A related desire on my part is to be able to **populate attributes of each anno feature right after (as?) I create it.** Some of the attribute info will come from the point feature and some will capture the state of some of the properties of the anno feature. I really don't know how to go about this efficiently. **What are some ways I might do this?** Thank you, all, for wading through this tome. I really appreciate your patience and generous help. **EDIT: Followup Question** So, where in my code above can I get an ISymbolCollectionElement and on what? I gather I should be making an empty text element with only a point location geometry assigned, passing this into CreateAnnoFeature(), and setting properties there through ISymbolCollectionElement. Because I create the anno feature as a FeatureBuffer from the anno feature class, the feature _is_ an annotation feature; however, I don't think a feature supports ISymbolCollectionElement, and the TextElement I pass in is just a plain TextElement. It isn't the element of the anno feature until I set the Annotation property. Can I get an ISymbolCollectionElement on the TextElement before I set it as the annotation element? Assuming I can, I guess that all I would have to set is the text, the symbolID, and the anchor point. The leader line, text size, and transparency should be picked up through the symbology defined in the anno feature class, is that correct? On a related note, how do I know the SymbolID to assign? In my existing anno class properties, the symbology tab shows the symbology that is defined for each of the annotation classes. When I create an anno feature and assign it to an annotation class, does it pick up the annotation class' symbology or do I need to assign the SymbolID explicitly (hence the first question above)? (Right now, I set the TextElement properties through ITextSymbol, so I imagine any link to the SymbolCollection that may normally exist is broken.) Thank you, all for the continued help.


title: Problem with the layernode.js, GeoExt Application

text: Attached is the code i have written on the html file. When i run it on the mozilla firefox browser i get the following error from firebug: ![enter image description here](http://i.stack.imgur.com/RN0B3.png) Most of the code has been taken from an existing javascript file from GeoExt (tree.js). The code i have changed/added starts from var mapPanel, tree, map; and ends to map.addLayers(layers); When i actually run it on a browser it is not loading properly but when i minimise it and then maximise the window i get the image that i want. Any ideas why iam getting this error. Thanks                 <script type="text/javascript">     var mapPanel, tree, map;     Ext.onReady( function() {                   // create a map panel with some layers that we will show in our layer tree         // below.         layers = [];              layers.push(new OpenLayers.Layer.OSM());              layers.push(new OpenLayers.Layer.WMS(         "National Parks", "http://localhost:8080/geoserver/wms", {             srs: 'EPSG:4326',             layers: 'National_Parks',             format: 'image/png',             buffer:0         }, {                  'isBaseLayer': false              }         ));              map = new OpenLayers.Map({             allOverlays: false,             projection: new OpenLayers.Projection("EPSG:900913"),             displayProjection: new OpenLayers.Projection("EPSG:4326"),             units: "m",             numZoomLevels: 18,             maxResolution: 156543.0339,             maxExtent: new OpenLayers.Bounds(-20037508, -20037508,             20037508, 20037508.34)         });              mapPanel = new GeoExt.MapPanel({             region: "center",             center: [-7924121.1710935, 6185868.5449234],             zoom: 10,             map: map         });              map.addLayers(layers);                        // create our own layer node UI class, using the TreeNodeUIEventMixin         var LayerNodeUI = Ext.extend(GeoExt.tree.LayerNodeUI, new GeoExt.tree.TreeNodeUIEventMixin());              // using OpenLayers.Format.JSON to create a nice formatted string of the         // configuration for editing it in the UI         var treeConfig = new OpenLayers.Format.JSON().write([{             nodeType: "gx_baselayercontainer"         },{             nodeType: "gx_overlaylayercontainer",             expanded: true,             // render the nodes inside this container with a radio button,             // and assign them the group "foo".             loader: {                 baseAttrs: {                     radioGroup: "foo",                     uiProvider: "layernodeui"                 }             }         },{             nodeType: "gx_layer",             layer: "Tasmania (Group Layer)",             isLeaf: false,             // create subnodes for the layers in the LAYERS param. If we assign             // a loader to a LayerNode and do not provide a loader class, a             // LayerParamLoader will be assumed.             loader: {                 param: "LAYERS"             }         }], true);              // create the tree with the configuration from above         tree = new Ext.tree.TreePanel({             border: true,             region: "west",             title: "Layers",             width: 200,             split: true,             collapsible: true,             collapseMode: "mini",             autoScroll: true,             plugins: [             new GeoExt.plugins.TreeNodeRadioButton({                 listeners: {                     "radiochange": function(node) {                         alert(node.text + " is now the active layer.");                     }                 }             })             ],             loader: new Ext.tree.TreeLoader({                 // applyLoader has to be set to false to not interfer with loaders                 // of nodes further down the tree hierarchy                 applyLoader: false,                 uiProviders: {                     "layernodeui": LayerNodeUI                 }             }),             root: {                 nodeType: "async",                 // the children property of an Ext.tree.AsyncTreeNode is used to                 // provide an initial set of layer nodes. We use the treeConfig                 // from above, that we created with OpenLayers.Format.JSON.write.                 children: Ext.decode(treeConfig)             },             listeners: {                 "radiochange": function(node) {                     alert(node.layer.name + " is now the the active layer.");                 }             },             rootVisible: false,             lines: false,             bbar: [{                 text: "Show/Edit Tree Config",                 handler: function() {                     treeConfigWin.show();                     Ext.getCmp("treeconfig").setValue(treeConfig);                 }             }]         });              // dialog for editing the tree configuration         var treeConfigWin = new Ext.Window({             layout: "fit",             hideBorders: true,             closeAction: "hide",             width: 300,             height: 400,             title: "Tree Configuration",             items: [{                 xtype: "form",                 layout: "fit",                 items: [{                     id: "treeconfig",                     xtype: "textarea"                 }],                 buttons: [{                     text: "Save",                     handler: function() {                         var value = Ext.getCmp("treeconfig").getValue()                         try {                             var root = tree.getRootNode();                             root.attributes.children = Ext.decode(value);                             tree.getLoader().load(root);                         } catch(e) {                             alert("Invalid JSON");                             return;                         }                         treeConfig = value;                         treeConfigWin.hide();                     }                 },{                     text: "Cancel",                     handler: function() {                         treeConfigWin.hide();                     }                 }]             }]         });              new Ext.Viewport({             layout: "fit",             hideBorders: true,             items: {                 layout: "border",                 deferredRender: false,                 items: [mapPanel, tree,{                     contentEl: "desc",                     region: "east",                     bodyStyle: {                         "padding": "5px"                     },                     collapsible: true,                     collapseMode: "mini",                     split: true,                     width: 200,                     title: "Description"                 }]             }         });     });


title: ArcGIS Conflation Tool Recommendation or Custom Script for Comparing Points

text: Can anyone recommend conflation tools for ArcGIS Desktop (10 or 10.1, paid or free) or a scripting outline / procedure (or just a script) to have a technician efficiently process the following rules? We need to compare and update 2 points of interest (POI) point layers, let's call them MasterPOI and ComparePOI. Aprox 30k points in each. The rules for a technician would be the following:   1. Find any ComparePOI points within a ~1000m of MasterPOI.   2. If a ComparePOI point has a better location or a better description (using their human judgement), update MasterPOI with either location or its description field.   3. Separate step maybe -- then any ComparePOI point not used to update MasterPOI, simply add it to the MasterPOI. Most points would fall into this category. (I'm thinking just put a flag on a feature in ComparePOI when #2 occurs.) I could script it myself eventually, but wondering if someone has some experience they could share -- thanks much!


title: How to list all of feature class in SDE?

text: I am getting a problem: my SDE contains some feature classes, but after using the statement:               var namesEnum = workspace.DatasetNames[esriDatasetType.esriDTFeatureClass];     var tempName = namesEnum.Next(); // get value null      The value of tempName is Null, but it is ok if I use esriDatasetType.esriDTFeatureDataset.


title: Extract overlapped parts of the routes - Network Analysis

text: I am on the project to identify the specific roads that are more frequently used than others. With the network shapefiles (OS ITN), origins and destinations (OD) points, route was created for each set of OD (Closest facility tool). What I want to do next is to identify the roads that are used for more than one routes; for instance, assuming that there are 5 people, each of them departs from different point (origin) to get to the point A (destination), but there are some roads that all of them need to use along the way. In other words, I want to extract the lines that "overlapped". As an experiment, I created 3 routes separately and tried to extract overlapped features using overlay tool - intersect - but it didn't work. I tried converting it to Raster and did "Overlay sum" but didn't work. If anyone can suggest the way to solve my problem, that would be really helpful.


title: Interpolating Maps - Statistical Learning Techniques vs Spatial Statistics Techniques

text: I have recently begun experimenting with the interpolation of variales over a whole country. I have good sized training set where I have several dependant variables (continuous and categorical) associated to many independant variables. The independant variables are available for the whole country. I'm not at all an expert in spatial statistics so my first approach was to train machine learning models like random forests, svm, gradient boosting, etc Which are behaving very well. But I have been fiding out that there are default methods for interpolating available in gis packages. Kriging. I played a bit with Kriging was not satisfied. Could co-kriging - regression-kriging get to better perfomances than these before mentioned methods (rf, svm)? Also, I have noticed that there are methods which seem to be tailored for these problems like geographically weighted regression. I am just wondering if my approach is somewhat off if there are methods specifically designed for these tasks. Thank you.


title: Leaflet add and remove legends with layer selection

text: I'm new to Leaflet/Javascript and have been struggling to get legends a map to show only when a specific layer is selected from the layer control. I have three layers, one of which I would like to have no legend and two others that have a corresponding legend. I came across an example, but have not been able to make it work:               // Add and remove legend from layers     map.on('overlayadd', function (eventLayer) {     // Switch to the Permafrost legend...        if (eventLayer.name === 'Permafrost') {            this.removeControl(legend1);            legend2.addTo(this);}       else { // Or switch to the treeline legend...            this.removeControl(legend2);            legend1.addTo(this);       }});      I created a jsfiddle with the specific example: http://jsfiddle.net/gerlis/T8DHb/3/ Any guidance would be greatly appreciated.


title: Renaming a variable input to replace spaces with underscores to be used in an output's name

text: This may be easier than i am making it. Using Model Builder, I have a variable input "Name", which is set as a model parameter, used for a 'Select by Attribute' early in the model. I would like to then use this variable as an input into the final feature class output's name. My issue is that some of these "Names" have spaces in them (E.G. Name = "Watershed 1"). Is there a way, using Model Builder, that i can replace the spaces with underscores/remove the spaces before inserting the variable into the output's name? Resulting in (....spatialjoin_dissolve_Watershed_1) Since this model will be run individually for multiple areas i need the name of the watershed to be included, without having to have the user enter in the watershed name with underscores as a parameter. Thanks for any help!


title: How to raster vector- and shape-files correctly

text: does anybody know how to convert vector- and shape-files correctly? Doesn't work with tab Raster/convert/vector to shape files. The output always contains strange input-data (wrong and strange coordinates).


title: Populate Table from Table Spatialite

text: I am trying to populate a column in a table from another table using Spatialite. My query will not populate the column, and I can't seem to identify what is wrong. I modeled the query from the following post: http://www.surfaces.co.il/wp-content/uploads/2012/05/SL_update3.png What I would like to achieve is to have the corresponding values from lu_grid.gridid to populate lu_geophotos.gridid where lu_geophotos intersects with lu_grid. (A column in a point layer should get the values from a polygon where the points intersect the polygon) Here is my code:               UPDATE lu_geophotos SET gridid = (SELECT GRIDID     FROM lu_grid AS s      WHERE ST_WITHIN (s.Geometry, lu_geophotos.Geometry)      AND s.ROWID IN (SELECT ROWID       FROM SpatialIndex       WHERE f_table_name = 'lu_grid' AND search_frame = lu_geophotos.Geometry)     );      ![enter image description here](http://i.stack.imgur.com/Pp41a.png)


title: ESRI License Initialize & Binding Failure

text: Despite following guidance about how to first bind, then initialize a licence for a standalone WinForm uses some arcobjects, I still get the "80040111 ClassFactory cannot supply requested class" error once I call GxDialogClass(). When debugging, the status object beneath comes back as licence checked out - so it successfully binds AND gains a licence. Yet the 80040111 indicates that I haven't. We are running ArcGIS 10.2.1.               ESRI.ArcGIS.RuntimeManager.Bind(ProductCode.Desktop);     IAoInitialize aoInitialize = new AoInitializeClass();     var status = aoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeAdvanced);     IGxObjectFilterCollection dialog = new GxDialogClass();      Any ideas? Matthew


title: Getting OSM maps in Equirectangular Projection via osm2pgsql

text: I'm trying to import some OSM data into psql as equirectangular projection using osm2pgsql with the following command:               osm2pgsql -c -d osm -S /usr/local/share/osm2pgsql/default.style -l /OPENSTREETMAP/south-america-latest.osm.pbf      However, it fails with this error:               Projection code failed to initialise      I have installed the latest version of the PROJ framework from here. What am I doing wrong? Thanks EDIT 1: Running 'select * from spatial_ref_sys where srid=4326;' on the database produces this:                srid | auth_name | auth_srid |                                                                                srtext                                                                                |              proj4text                    ------+-----------+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------      4326 | EPSG      |      4326 | GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]] | +proj=longlat +datum=WGS84 +no_defs      (1 row)


title: Define transparent color in singleband pseudocolor raster layer style

text: Can I somehow define "transparent" color for values higher than 32000 in raster layer? See the style dialog: ![enter image description here](http://i.stack.imgur.com/FxiXK.png)


title: qgis2 composer - non-rectangular inset map?

text: I'd like to have a near-full-page rectangular map object, then add a non- rectangular inset map object with 6 vertices. Any suggestions on how to accomplish this, other than making two actual maps then brute-force post- processing the images? Thanks!


title: Sum of values within a buffer polygon

text: I need to do the following in QGIS and hope so much anyone could help. I have a vector layer with points. Each point represents a firm with the number of employees in the attribute table. I want to buffer around every point, so that the buffer's attribute table contains the sum of employees within the buffer. It would be so great if the sum to each point could be written to the attribute table. Thanks for your help.


title: Quantifying polyline overlap

text: I have a set of regions and would like to quantify the degree to which the boundary of these regions are situated on/near rivers. I have turned the regions from polygons to polylines in arcgis 10.1 and have the rivers as polylines. Is there any way to quantify what percentage of the boundaries fall on rivers, and therefore statistically show the degree of overlap between these two vector features?


title: What are the pros and cons of each mashup baselayer?

text: I've been making some mashups recently in OpenLayers and find myself naturally favouring OpenStreetMap as a baselayer, I think this is mostly because I like the concept. I realised the other day that I didn't really know why I prefered it, and have played about with googles various base layers, andlong with those of Yahoo and Bing. Are there any discernible benefits of any of the baselayers that I have mentioned (or any others that I havent)? Do you find any problems with any of them or do you find that your users prefer one above the rest?


title: Unable to open old qgis files into the new version ( 1.8.0)

text: I have downloaded QGIS today for my school work also my Qgis version is 1.8.0 and my school's QGIS version is 1.7.0. So My new Version QGIS cannot run the QGIS file they have send me So Please help in thios I want to run that file in my computer.I have a project to do in it.


title: Looking for similar tool (like ArcGIS Diagrammer) in open source for QGIS?

text: Is there any diagrammer tool available (similar to ArcGIS Diagrammer) for QGIS? thanks in advance : )


title: Using a ArcGIS Server Feature Service's addFeature method: Parameters?

text: I am wanting to post data back to a feature service using the addFeatures method on a feature service. Here it says to use a query and an esri rep says to use a query task. But my "Query" object doesn't seem to have a "features" definition as suggested in the linked doc page above where they say the parameters table. Anyone have any ideas on how to do the addFeatures.               QueryTask queryTask =                     new QueryTask("http://server/ArcGIS/rest/services/geoprocessing/featureServiceName/FeatureServer/0/addFeatures");                      ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query();                 query.???


title: How to access all mxd files in a folder?

text: I'm a beginner to Python and am trying to figure out how I can access several mxds in a folder. For example, when I want to use the `AnalyzeforMSD` function in ArcGIS:               import arcpy     mxd = arcpy.mapping.MapDocument(r"C:\Project\ReadyForMSD.mxd")     analysis = arcpy.mapping.AnalyzeForMSD(mxd)      How can I define a folder with mxds as a path, e.g. C:\Projects\data, and analyze all the mxds in it? Best regards, Trashken               import os, arcpy          directory = r"C:\Project"      for root, dirs, files in os.walk(directory):        for myFile in files:             fileExt = os.path.splitext(myFile)[1]             if (fileExt == ".mxd"):                 fullPath = os.path.join(root, myFile)                 print myFile                      myMap = arcpy.mapping.MapDocument(fullPath)                 analysis = arcpy.mapping.AnalyzeForMSD(myMap)           for key in ('messages', 'warnings', 'errors'):      print "----" + key.upper() + "---"      vars = analysis[key]      for ((message, code), layerlist) in vars.iteritems():     print "    ", message, " (CODE %i)" % code     print "       applies to:",     for layer in layerlist:         print layer.name,     print


title: featureId filtering in wfs openlayers

text: I want to define a featureId fiter for wfs layer like below:               wfs = new OpenLayers.Layer.Vector("WFS Vectore", {             strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],             projection: new OpenLayers.Projection("EPSG:4326"),             protocol: new OpenLayers.Protocol.WFS({                 version: "1.1.0",                 srsName: "EPSG:4326",                 url: "http://localhost:8080/geoserver/iran/wms?service=WFS",                 featureType: "population",                 featureNS: "http://iran.kadaster.org",                 geometryName: "the_geom"             }),             filter:                 new OpenLayers.Filter.FeatureId({                     fids: ['population.913', 'population.912']                     //type: ?????                 })              });      I don't know to what set 'type' variable in filtering option?


title: Moving from OpenLayers to Leaflet breaks tilecache

text: My tilecache.cfg is like so (working with MapServer)               [mylayer]     type=WMS     url=http://server/mapserver/app     spherical_mercator=true     layers=mylayer      The following works just fine               var mylayer = new OpenLayers.Layer.WMS(         "My Layer",         "http://server/tilecache/tilecache.cgi",         {layers: "mylayer", transparent: true},         {isBaseLayer: false, opacity: 0.6, visibility: true}     );      However, when I change the above to Leafletjs like below               var mylayer = L.tileLayer.wms("http://server/tilecache/tilecache.cgi", {         layers: 'mylayer',         format: 'image/png',         transparent: true,         attribution: 'Data from blah blah'     });      I get the following error `An error occurred: Current y value -5009377.085697 is too far from tile corner y -10018754.170400` Suggestions? **Update2:** (top-posted). I tried adding `srs` definitions (`srs:"EPSG:4326"` or `srs:"EPSG:900913"`). While the latter didn't help at all, the particular error I reported above went away with 4326, and a couple of tiles were also returned, though most tiles were just blank. This tells me something is goofy with the way Leaflet expects the projection. I'd rather not change anything on the source (MapServer or Tilecache side), if possible, as other applications are depending on that to be working. **Update:** Adding the MapServer map file, in case that might help               MAP         EXTENT -180.150250417362 -90 180.150250417362 90         IMAGECOLOR 255 255 255         IMAGETYPE "png"         NAME "mylayer"         SIZE 1200 600         STATUS ON         UNITS DD         DEBUG 3         CONFIG "MS_ERRORFILE" "/tmp/ms_mylayer_error.log"              OUTPUTFORMAT             NAME "png24"             MIMETYPE "image/png"             DRIVER "AGG/PNG"             EXTENSION "png"             IMAGEMODE RGBA             TRANSPARENT ON         END              SHAPEPATH "/path/to/files"              PROJECTION             "init=epsg:4326"         END              WEB             IMAGEPATH "/tmp/ms_tmp/"             METADATA                 ows_enable_request "*"                 wms_abstract "This WMS mapservice serves a map of mylayer"                 wms_accessconstraints "none"                 wms_title "mylayer"                 wms_onlineresource "http://sever/cgi-bin/mylayer?"                 wms_srs "EPSG:900913 EPSG:4269 EPSG:4326"                 wms_keywordlist "World,mylayer"                 wms_enable_request "*"             END         END              LAYER             NAME "global"             TYPE RASTER             ..                  METADATA                 wms_srs "EPSG:4326"                 wms_name "global"                 wms_server_version "1.1.1"                 wms_format "image/png"                 wms_enable_reques "*"                 wms_extent "-180 -90 180 90"             END         END     END


title: How to find the distance to the nearest coastline from a land-based latitude/longitude point?

text: I'm completely new to GIS and unsure what I need to solve this problem: ![GSHHG shapefile loaded into QGIS](http://i.stack.imgur.com/aCJ40.png) _In the image above turquoise is actually land. Sea is white._ I tried using the NASA Distance to the Nearest Coast data dump by loading it with NumPy and performing a binary search, which worked and was blazingly fast, but the dataset's resolution wasn't high enough. I need a resolution of about 10 metres. I've now downloaded the GSHHG shapefile (shown above loaded in QGIS), but I'm unsure what to do with it. I'm seeing a lot of posts here mentioning PostGIS and SpatiaLite, but I'm not sure if these would be fast enough, or even the right tool. The maximum lookup time needs to be under 100ms as I will be running this against 10,000s of locations during the back-end indexing phase of a travel search engine website. **EDIT:** I'm trying to generate the raster from the shapefile, but I'm not sure what resolution to use for the `-tr` option. According to http://gis.stackexchange.com/a/8655/30920 I need `0.0001`, as 11 metres would be ideal. Below shows the output of `-tr` set to `1`, `0.1` and `0.01` respectively. The file size seems to be growing by 100x for each decimal place. With `0.01` being 4.1gb that would make `0.0001` 41tb (way too big). ![-tr 1 1](http://i.stack.imgur.com/nvKst.png) ![-tr 0.1 0.1](http://i.stack.imgur.com/6vG6p.png) ![-tr 0.01](http://i.stack.imgur.com/HvpLy.png) I'm running: `gdal_rasterize -a level -tr 0.01 0.01 -l GSHHS_f_L1 GSHHS_f_L1.shp 0.01.tif` Is this right?


title: Looking for help identifying projections and reprojecting

text: Hi there at the new forum, I'm still struggling with projections in qgis. The "Vogelschutzgebiete" reprojection worked. But these ones seem to be tougher: www.projektidee.org/images/extern/Gemeinden.zip as well as the same URL with **Aemter.zip** at the end. Are these the same projections? Does anyone here by any chance know how to reproject these to EPSG:32633 (WGS84 UTM33N)? (shapes without projection information are a pain in the a...) Refering also to this thread: http://forum.qgis.org/viewtopic.php?f=2&t=10244&sid=52667e4eb2cfdad92b4f88e160c1b577 best regards desputin


title: Web Map data display/filter/query

text: I have been learning as much web mapping as possible lately. I really enjoy it, as it seems what you need to know to keep up with the geospatial field. I do have a question that is probably easy for most people to answer. What is the best way to query/filter/display/symbolize data based on attributes stored on a spatial database and displayed through something like OpenLayers. I know SQL is great for querying data. But how does this fit into the aspect of a web page?? Is this where PHP comes into play? Or Ajax? I am having a lot of trouble desciphering between where the serverside/clientside work ends and begins. Open layers is great and easy to make maps. But I want to do more with these maps and having trouble what exactly I should learn next in order to actually do something with my data. Can I do all my querying within javascript if something is served through WMS? Can I do basic queries to my GeoJSON files? Or is that where filtering comes in? I saw with CartoDB, they return a url that has the SQL in it. Is this an httpGetRequest? If I have data in MapBox, how can I filter through it and display data based on a attribute, pick from a drop-down box? Sorry if this is a lot of question. Haha. I am just trying to grasp the concept of how to actually manipulate the data I have displayed on OpenLayers. I understand the differences between the database/map server/APIs and their function. But tying them together in a way which can change how/what/where/when my data displays is whats getting to me. For example, if I want data to be displayed based on an an attribute I type into a box. Where is this work done? Or if I want to find the closest bar to a point I place on the map, what is it on the serverside or clientside that goes through my data and finds this? Thanks!


title: ArcGIS for Server Printing - Data Frame Grid

text: We need to print the map from web client (Developed using ArcGIS JavaScript API). I have prepared the Templates and published as Export Web Map (GP Tool). My templates are using Data Frame Grid (Measured grid). I need to customize the grid size based on the printing scale. Is there any possibility of sending the grid size and scale as parameters to Export Web Map tool while generating the print? please suggest if there is any Paid / Free tools available for printing the data frame grid dynamically on ArcGIS server.


title: How to generate heatmaps with QGIS1.9 plugin automatically?

text: I created a few heatmaps with the new plugin in QGIS 1.9, but now I would like to generate a lot of them automatically. How should I do? I created a few of them by hand, but I should first import the data, select the CRS, then select the plugin, select the imported data and the parameters for the heatmap (and pick again the CRS). It takes quite long as soon as you want more than a few heatmaps. I have 300'000 data in one day. I separate them in groups of 15 minutes, and I would like to visualize the heatmap for all groups of 15 minutes (~64), in order to observe the evolution in time. I'm interested in either:   * a way to make it in QGIS automatically, or   * a way to do it in another software, that would be more adapted for this purpose.


title: How to fix "spatial_ref_sys relation does not exist"

text: I am trying to install postgis in my database. I compiled the library successfully. Now when I try to import the sql spatial_ref_sys is shows the error that               spatial_ref_sys relation does not exist      When I looked into the sql, it has no create table at the top. What should I do. Am I supposed to have these two tables geometry_columns and spatial_ref_sys from other sources. I just created a database mydatabase and tried to import the spatial_ref_sys.sql into it. Any suggestions? The version of my postgresql is 9.1.3 and the version of my postgis is 2.0.0


title: Accessing arcpy functions from IronPython

text: I made a few python scripts to automatically optimize and publish my data..   Now i'm thinking about writing a .NET program to manage and run these scripts: the obvious way is invoking them in a different process from the .NET code but this seems downright ugly I was thinking about using IronPython and migrate my scripts into .NET.   Does anyone know if it's possible to invoke arcpy functions from IronPython? Thanks!


title: Arrow labels not rendered correctly

text: Geoserver SLD:                 <sld:LineSymbolizer>         <sld:Stroke>           <sld:CssParameter name="stroke">             <ogc:PropertyName>geo_color</ogc:PropertyName>           </sld:CssParameter>           <sld:CssParameter name="stroke-width">2</sld:CssParameter>         </sld:Stroke>       </sld:LineSymbolizer>       <TextSymbolizer>         <Label>           <ogc:Literal>≻</ogc:Literal>         </Label>         <Font>           <CssParameter name="font-family">Lucida Sans</CssParameter>           <CssParameter name="font-size">20</CssParameter>         </Font>         <LabelPlacement>         <LinePlacement>         <PerpendicularOffset>0</PerpendicularOffset>         </LinePlacement>         </LabelPlacement>         <Fill>           <CssParameter name="fill">             <ogc:PropertyName>geo_color</ogc:PropertyName>           </CssParameter>         </Fill>         <VendorOption name="followLine">true</VendorOption>         <VendorOption name="forceLeftToRight">false</VendorOption>         <VendorOption name="conflictResolution">false</VendorOption>       </TextSymbolizer>      I have the above style set for a WMS layer containing line strings. For most zoom levels the direction arrow aligns properly with its corresponding line. But on zooming out beyond a point, the arrows seem to be displaced away from their respective lines. Shown here: ![Screenshot showing the issue](http://i.stack.imgur.com/BBKF6.png) I am fairly sure that this has to do something with `VendorOption` parameters but unable to put a finger on it. Appreciate any inputs to get this sorted out.


title: Openlayers - Different zoom levels with a WMS layer and only one resolution

text: I am trying to implement a homemade WMS with Openlayers. I only have one "level" of images with one resolution and I would like to add different zoom lvls with those images. Is this possible just with Openlayers ?


title: How to insert values from one table into another?

text: I am trying to write a script that iterates through each row of a table, calculates for this row something. The result of this calculation is finally stored in another table (with just one row). Now I want to add this value to the starting table in the same row. And that is where I am stuck. I tried to work with SearchCursor and UpdateCursor but I am not sure how to make it work between these two tables. (Join is not possible, as there is no field the join could be based on) Sorry, here is the script. The problem is really at the end.               import arcpy     from arcpy import env     from arcpy.sa import *          # Set the workspace     env.workspace = "D:/next/"     env.scratchWorkspace = "D:/next/"          # Set object property to overwrite existing output     arcpy.gp.overwriteOutput = True      # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial")          # Set Raster Variable     inRaster = arcpy.GetParameterAsText(0)     FieldName = arcpy.GetParameterAsText(1)      inputFeature = arcpy.GetParameterAsText(2)              #Add a field to the inputFeature, for results     arcpy.AddField_management(inputFeature, FieldName, "LONG")          #Create the search cursor     rows = arcpy.SearchCursor(inputFeature)          for row in rows:              # Create a Where Clause to select only the current record         whereClause = '"FID" = ' + str(row.FID)         IDField = str(row.FID)         tempData = "row" + IDField + ".shp"         # Create a feature layer from the current row only         arcpy.MakeFeatureLayer_management(inputFeature, tempData, whereClause)              # Extract the cells of a raster that underly the selected feature         maskedRaster = ExtractByMask(inRaster, tempData)         maskedRaster.save ("D:/next/" + "row" + str(IDField))              # Create the table for the new "maskedRaster" (for each value a row and the count of the values)         newRaster = "row" + str(IDField)         arcpy.BuildRasterAttributeTable_management(newRaster, "NONE")              # here would be all the calculations         # I leave them out the skript is long enough, already              # Summarize the values. A dbf-table with only one row is the result         stat = [["Calc", "SUM"]]         arcpy.Statistics_analysis(newRaster, str(newRaster)+".dbf", stat )              # Now create an update Cursor to add the value to the selected row         rows2 = arcpy.UpdateCursor(inputFeature)              # Here comes the problem         for row2 in rows2:              if row2.FID == IDField:                 row2.setValue(FieldName, row2.getValue(arcpy.CalculateField_management(str(newRaster)+".dbf", "SUM_Calc"))                 rows2.updateRow(row2)              del row2, rows2     del row, rows


title: How to merge (append) ArcInfo coverages that are inside folder structure using ArcPy?

text: I'm having a bad time trying to create a script capable of merging a list of arcinfo coverages located inside a folder structure. My goal is to merge the coverages named "car" that are inside each of 500 folders. The field definitions are the same for all the "car" coverages. My unsuccessful approach has been first to create a list with the path of each folder and second apply the arcpy.ListDatasets function to each of the folders and append (or merge) each of the coverages to an initial empty shapefile. I'm new in Python and a simple task like this has become hours of trial and error. I hope someone here can guide me through the best solution. This is the code I have so far (with indentation error on line 21):               import arcpy     from arcpy import env     import os               outlocation = "W:/forestal/1_25k_carreteras"     folderspath = "W:/forestal/cartografia/hojas_1_25k"     emptyshp = "1_25k_car.shp"     folderslst = []               arcpy.CreateFeatureclass_management(outlocation, emptyshp, "POLYLINE")          for dirname, dirnames, filenames in os.walk(folderspath):         for subdirname in dirnames:             folderslst.append(os.path.join(folderspath,dirname))          for folder in folderslst:             arcpy.env.workspace = folder             coverageslst = arcpy.ListDatasets("car", "Coverage")             arcpy.Append_management(coverageslst, outLocation + os.sep + emptyshp)      Thanks!


title: How to create a startup prompt that populates definition queries on multiple feature classes

text: I would like to create an ArcGIS start up prompt or custom button that asks for a user's initials and then populates multiple feature class & layer definition queries. More specifically, I would like to standardize my departments layer organization for new employees and would like to customize the definition queries & symbology of several layers in each employee's MXD. Any tips on where to start would be greatly appreciated!


title: Problem of linear records with zero shape length and no geometry in attribute table

text: I am working with a bicycle and pedestrian facility file geodatabase in ArcMap. I noticed a some of the records in the shapefiles/feature classes have a shape length of zero in the shape length field in the attribute tables. These records have attributes but no geometry that appears when I try to "zoom to selected feature." This makes since because the shape length is zero. Does anyone have an idea of how these records might've come about? How can you have records in an attribute table with no corresponding geometry? I want to say in the past i've been in an editing session adding new features and seen ArcMap created blank features that have no corresponding geometry when I attempt to "zoom to selected feature."


title: Missing libraries when upgrading to PostGIS 2.1 and PostgreSQL 9.3.1 using homebrew

text: In the process of upgrading my PostgreSQL from version 9.2.4 to 9.3.1 (via homebrew on OS X) I came across an odd problem. These are the steps I took so far   * PostgreSQL, PostGIS and required libraries installed (no errors)   * run `initdb` on the new database   * stopped both servers   * running `pg_upgrade` `pg_upgrade` performs the necessary checks, creates dumps of the old cluster, but when importing into the new cluster I get the following error:               > ./pg_upgrade -b /usr/local/Cellar/postgresql/9.2.4/bin/ -B /usr/local/Cellar/postgresql/9.3.1/bin -d /usr/local/var/postgres/ -D /usr/local/var/postgres9.3.1 -u postgres     Performing Consistency Checks     -----------------------------     Checking cluster versions                                   ok     Checking database user is a superuser                       ok     Checking for prepared transactions                          ok     Checking for reg* system OID user data types                ok     Checking for contrib/isn with bigint-passing mismatch       ok     Creating dump of global objects                             ok     Creating dump of database schemas                                                                 ok     Checking for presence of required libraries                 fatal          Your installation references loadable libraries that are missing from the     new installation.  You can add these libraries to the new installation,     or remove the functions using them from the old installation.  A list of     problem libraries is in the file:         loadable_libraries.txt          Failure, exiting      It appears as though PostgreSQL 9.3.1 tries to use PostGIS 2.0, which is not compatible               Could not load library "$libdir/postgis-2.0"     ERROR:  could not access file "$libdir/postgis-2.0": No such file or directory          Could not load library "$libdir/rtpostgis-2.0"     ERROR:  could not access file "$libdir/rtpostgis-2.0": No such file or directory      Has anyone run into the same problem?


title: How do I modify features during runtime, in a GeoJSON feature group on Leaflet?

text: I have added some GeoJSON to my Leaflet powered map as below. (Altered version)               var array_of_layers = L.layerGroup([]);     var styleholder = [];          var belgium_style = {color: "#d3e46f"};     var bosnia_style = {color: "#f3c1d3"};     var (...)          function styling(name, geoname, color){         this.numid = count;         styleholder[count] = this;              this.name = name;         this.geoname = geoname; //the geojson filename, just in case.         this.label = name;         this.color = color;         this.opacity = 1;         this.stroke = false;         this.fillOpacity = 1;         this.fillColor = color;              count++;     }          var belgium_style = new styling("Belgium", "belgium", "#52EB8D");     var bosnia_style = new styling("Bosnia", "bosnia", "#EB9752");     (...)          var everything = L.geoJson(myfile, {         onEachFeature: function(feature){             array_of_layers.addLayer(feature);         },         style: function(feature){                 switch(feature.properties.name){                 case "belgium": return belgium_style; break;                 case "bosnia": return bosnia_style; break;                 case "denmark": return denmark_style; break;                 case "great_britain": return britain_style; break;                 case "greece": return greece_style; break;                 case "italy": return italy_style; break;                 case "serbia": return serbia_style; break;                 case "spain": return spain_style; break;                 }         }          });      So the next thing I need to do is, for instance, make a country become blue and all the others gray, when I mouse over it. And, make that possible as well by a function, that I can call whenever I want, regardless of mouse position. Therefore, during runtime, how do I change the color of any country as I wish? In other words, what is the correct syntax for re-defining the style function for a particular feature? I have tried to iterate over the `styleholder` array with a `for(var x in styleholder)` loop until I get to find the style with the name I want to make blue. By looking at the debugging console, I can tell that I get to find the country, but there's no use changing the color value of a country once it's been created on the map. So the color doesn't change. The code below sums up what I'm talking about:               var change_color_to_blue = function(country){          for(var a in styleholder){        if (a.geoname === country){            a.color = "#0000FF";            a.fillColor = "#0000FF";        }     }          change_color_to_blue("belgium");      You see, although it runs without an error, the color remains the same. The same thing for a mousing-over feature, could be possibly something like this:               everything.on('mouseover', function(e){          var moused_over_country = e.layer;     moused_over_country.color = "#0000FF"; //this is not how it's done          MagicallyMakeAllOtherLayersGray();          refreshgeoJson(); //that does not exist.     refreshMap();     //this neither, most probably.          });      Even this works, and the target country gets blue, how do I make the rest gray? Is there a way to iterate over every feature in geoJson and reset every style function respectively?


title: Integer data type error with layer query and AMF format (ArcGIS Server 10.1)

text: I'm having an issue with ArcGIS Server 10.11 where large integers are coming back wrong when f=amf. When doing a query using f= **json** , the response is:   * Nom = Parc National de la Maiko    * MgC = 310906765 When doing a query using f= **amf** , the response is:   * Nom = Parc National de la Maiko    * MgC = -225964147 Just a hunch, but it feels like amf serialization is using the equivalent of an "int" instead of "bigint" and I'm seeing an overflow error. Has anybody experienced similiar behavior with f=amf and ArcGIS Server 10.1? Is this a known bug? I'm going to try and test with 10.2 and see if its an issue there too. Any help is appreciated.


title: OSM line labels in Tilemill

text: I'm learning to use Tilemill to map Toronto OSM street data. I've added osm2psql data from http://metro.teczno.com/#toronto. When turning on road labels for the line file, I find that I'm getting results much too frequently. Is there a way to control the frequency or distance between labels?


title: Is there a python option to "join attributes by location"?

text: I am trying to perform the function `join attributes by location` as found on the QGIS menu Vector>Data Management Tools. I am seeking an open source python option for this. I know arcpy has a `spatial join` function but I'm trying to perform this outside of the ESRI environment.


title: Real-world QGIS users

text: I am just beginning as a QGIS user, and I have used ArcGIS mostly in the past. I am in the position of having to defend QGIS as a viable solution for many, if not most, GIS needs for Country and City Planning (GIS for Urban and Regional Planning). Is anyone aware of specific communities (small or large) or companies that are using QGIS for commercial-grade Planning GIS? Any in the US? Southeast US is even better... Thanks in advance!


title: Fetch Python Plugins missing

text: I'm running QGis master v1.9.0 on xubuntu and the 'fetch python plugins' option is absent. This guy had this problem with vanilla 1.7.5 but fixed it by upgrading to 1.9.0 master. Nishant had this problem (version unknown); not sure if he fixed it but of the two solutions posted, the first (sudo apt-get install python-qgis) is already installed, and the second (uninstall, reboot, reinstall) changed nothing. Any ideas? Arguably irrelevant but actually not: is there somewhere we can find the estimated landing date for QGis 2.0? If it's due tomorrow, for example, there's little point trying to debug a problem in the 1.9 master only for all such problems to be eradicated with the fresh 2.0 install... :) Thanks!!


title: Length of a degree: where do the terms in this formula come from?

text: Online calculators such as http://www.csgnetwork.com/degreelenllavcalc.html (view page source) use the below formulas to get meters per degree. I understand in general how distance per degree varies depending on latitude location, but I do not understand how that translates to the below. More specifically, where do the constants, the 3 "cos" terms in each formula, and coefficients (2, 4, 6; 3, and 5) for "lat" come from?                   // Set up "Constants"         m1 = 111132.92;     // latitude calculation term 1         m2 = -559.82;       // latitude calculation term 2         m3 = 1.175;         // latitude calculation term 3         m4 = -0.0023;       // latitude calculation term 4         p1 = 111412.84;     // longitude calculation term 1         p2 = -93.5;         // longitude calculation term 2         p3 = 0.118;         // longitude calculation term 3              // Calculate the length of a degree of latitude and longitude in meters         latlen = m1 + (m2 * Math.cos(2 * lat)) + (m3 * Math.cos(4 * lat)) +                 (m4 * Math.cos(6 * lat));         longlen = (p1 * Math.cos(lat)) + (p2 * Math.cos(3 * lat)) +                     (p3 * Math.cos(5 * lat));